Etapa G (GUI): validación libadwaita — adwaita-hello (AdwApplicationWindow+ToolbarView+StatusPage)
Linkeado 100% estático contra libadwaita-1.a: binario 152MB, ELF 'not a dynamic executable', corre. Prueba que el stack Adwaita del lab es usable por apps reales. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# adwaita-hello — app Adwaita mínima de VALIDACIÓN: prueba que libadwaita-1.a es linkeable de verdad.
|
||||
# AdwApplication + AdwApplicationWindow + AdwToolbarView. Link 100% estático vía pkg-config --static
|
||||
# libadwaita-1 + las privadas de gdk/gsk/appstream que el .pc no declara. Mismo patrón que gtk4-hello.
|
||||
name = "adwaita-hello"
|
||||
version = "1.7.6"
|
||||
|
||||
[source]
|
||||
tarball = "https://download.gnome.org/sources/libadwaita/1.7/libadwaita-1.7.6.tar.xz"
|
||||
sha256 = "5eacc5550f0bdbba6a1568aebf25a3d88f5ee07d6b558becc6fd9487579c9a29"
|
||||
|
||||
[build]
|
||||
compiler = "zig-cc"
|
||||
target = "x86_64-linux-musl"
|
||||
link = "static"
|
||||
|
||||
[build.phases]
|
||||
configure = "true"
|
||||
compile = '''
|
||||
cat > adw_hello.c <<'CEOF'
|
||||
#include <adwaita.h>
|
||||
static void activate(GtkApplication *app, gpointer user_data) {
|
||||
GtkWidget *win = adw_application_window_new(app);
|
||||
gtk_window_set_title(GTK_WINDOW(win), "Adwaita en hammer");
|
||||
gtk_window_set_default_size(GTK_WINDOW(win), 400, 260);
|
||||
GtkWidget *toolbar = adw_toolbar_view_new();
|
||||
adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar), adw_header_bar_new());
|
||||
GtkWidget *status = adw_status_page_new();
|
||||
adw_status_page_set_title(ADW_STATUS_PAGE(status), "libadwaita static-musl ✓");
|
||||
adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(toolbar), status);
|
||||
adw_application_window_set_content(ADW_APPLICATION_WINDOW(win), toolbar);
|
||||
gtk_window_present(GTK_WINDOW(win));
|
||||
}
|
||||
int main(int argc, char **argv) {
|
||||
AdwApplication *app = adw_application_new("org.hammer.adw", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
|
||||
int status = g_application_run(G_APPLICATION(app), argc, argv);
|
||||
g_object_unref(app);
|
||||
return status;
|
||||
}
|
||||
CEOF
|
||||
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
|
||||
zig cc -mcpu=baseline -static adw_hello.c -o adwaita-hello $(pkg-config --cflags --libs --static libadwaita-1 harfbuzz-subset epoxy xkbcommon wayland-client wayland-egl libtiff-4 libjpeg cairo-script-interpreter)
|
||||
'''
|
||||
install = "mkdir -p /out/usr/bin && cp adwaita-hello /out/usr/bin/adwaita-hello"
|
||||
|
||||
[deps]
|
||||
build = ["pkgconf", "libadwaita", "appstream", "libyaml", "curl", "libxmlb", "libxml2", "zstd", "gtk4", "pango", "gdk-pixbuf", "cairo", "graphene", "glib", "harfbuzz", "fribidi", "fontconfig", "freetype", "pixman", "libpng", "expat", "libjpeg-turbo", "libtiff", "libepoxy", "wayland", "libxkbcommon", "libdrm", "pcre2", "libffi", "zlib", "mesa"]
|
||||
Reference in New Issue
Block a user