Files
takana/recipes/sourceview-hello.toml
T
Sergio 5f6c062cd9 adwaita-hello, sourceview-hello, hammer-edit: añadir xz a [deps]
Con gtk4 ya sin objetivos compartidos, estas tres dejaron de fallar por PIC
(0 errores) y pasaron a morir en el link con `unable to find static system
library 'lzma'`.

Misma causa que appstream: declaran `appstream` y `libxmlb` pero no `xz`, y
`libxmlb.pc` trae `Requires: gio-2.0, liblzma, libzstd`. Al enlazar appstream
estática necesitan la liblzma igual. Patrón `.pc Requires`→[deps]; `xz` va
junto a `zstd`, que viene del mismo .pc.

Con esto cierra la clausura ENTERA de gtk4 en el grafo del corpus, las 6 que
colgaban de él: gtk4-hello, libadwaita, gtksourceview, adwaita-hello,
sourceview-hello y hammer-edit — todas SELLADAS y con binario real.
2026-08-27 14:50:10 +00:00

58 lines
2.9 KiB
TOML

# sourceview-hello — VALIDACIÓN del editor: ventana Adwaita con un GtkSourceView (resaltado C, números
# de línea) editable. Junta libadwaita + gtksourceview + gtk4, link 100% estático. Es, de hecho, el
# esqueleto de un editor de código real para el distro.
name = "sourceview-hello"
version = "5.16.0"
[source]
tarball = "https://download.gnome.org/sources/gtksourceview/5.16/gtksourceview-5.16.0.tar.xz"
sha256 = "ab35d420102f3e8b055dd3b8642d3a48209f888189e6254d0ffb4b6a7e8c3566"
[build]
compiler = "zig-cc"
target = "x86_64-linux-musl"
link = "static"
[build.phases]
configure = "true"
compile = '''
cat > sv_hello.c <<'CEOF'
#include <adwaita.h>
#include <gtksourceview/gtksource.h>
static void activate(GtkApplication *app, gpointer user_data) {
GtkWidget *win = adw_application_window_new(app);
gtk_window_set_title(GTK_WINDOW(win), "Editor hammer");
gtk_window_set_default_size(GTK_WINDOW(win), 640, 420);
GtkWidget *toolbar = adw_toolbar_view_new();
adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar), adw_header_bar_new());
GtkSourceBuffer *buf = gtk_source_buffer_new(NULL);
GtkSourceLanguageManager *lm = gtk_source_language_manager_get_default();
GtkSourceLanguage *lang = gtk_source_language_manager_get_language(lm, "c");
if (lang) gtk_source_buffer_set_language(buf, lang);
gtk_text_buffer_set_text(GTK_TEXT_BUFFER(buf),
"#include <stdio.h>\nint main(void){\n printf(\"hola hammer\\n\");\n return 0;\n}\n", -1);
GtkWidget *view = gtk_source_view_new_with_buffer(buf);
gtk_source_view_set_show_line_numbers(GTK_SOURCE_VIEW(view), TRUE);
gtk_widget_add_css_class(view, "monospace");
GtkWidget *scroll = gtk_scrolled_window_new();
gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(scroll), view);
adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(toolbar), scroll);
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.editor", 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 sv_hello.c -o sourceview-hello $(pkg-config --cflags --libs --static gtksourceview-5 libadwaita-1 harfbuzz-subset epoxy xkbcommon wayland-client wayland-egl libtiff-4 libjpeg cairo-script-interpreter)
'''
install = "mkdir -p /out/usr/bin && cp sourceview-hello /out/usr/bin/sourceview-hello"
[deps]
build = ["pkgconf", "gtksourceview", "libadwaita", "appstream", "libyaml", "curl", "openssl", "libxmlb", "libxml2", "xz", "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"]