sergio/takana
> Una distribución Linux construida con un laboratorio funcional y hermético en el > sótano, y una terminal mutable, clásica y anárquica en el piso de arriba — diseñada > desde el suelo para que una IA programadora entienda, modifique y co…
adwaita-hello, sourceview-hello, hammer-edit: añadir `xz` a [deps]
1# sourceview-hello — VALIDACIÓN del editor: ventana Adwaita con un GtkSourceView (resaltado C, números
2# de línea) editable. Junta libadwaita + gtksourceview + gtk4, link 100% estático. Es, de hecho, el
3# esqueleto de un editor de código real para el distro.
4name = "sourceview-hello"
5version = "5.16.0"
6
7[source]
8tarball = "https://download.gnome.org/sources/gtksourceview/5.16/gtksourceview-5.16.0.tar.xz"
9sha256 = "ab35d420102f3e8b055dd3b8642d3a48209f888189e6254d0ffb4b6a7e8c3566"
10
11[build]
12compiler = "zig-cc"
13target = "x86_64-linux-musl"
14link = "static"
15
16[build.phases]
17configure = "true"
18compile = '''
19cat > sv_hello.c <<'CEOF'
20#include <adwaita.h>
21#include <gtksourceview/gtksource.h>
22static void activate(GtkApplication *app, gpointer user_data) {
23 GtkWidget *win = adw_application_window_new(app);
24 gtk_window_set_title(GTK_WINDOW(win), "Editor hammer");
25 gtk_window_set_default_size(GTK_WINDOW(win), 640, 420);
26 GtkWidget *toolbar = adw_toolbar_view_new();
27 adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar), adw_header_bar_new());
28 GtkSourceBuffer *buf = gtk_source_buffer_new(NULL);
29 GtkSourceLanguageManager *lm = gtk_source_language_manager_get_default();
30 GtkSourceLanguage *lang = gtk_source_language_manager_get_language(lm, "c");
31 if (lang) gtk_source_buffer_set_language(buf, lang);
32 gtk_text_buffer_set_text(GTK_TEXT_BUFFER(buf),
33 "#include <stdio.h>\nint main(void){\n printf(\"hola hammer\\n\");\n return 0;\n}\n", -1);
34 GtkWidget *view = gtk_source_view_new_with_buffer(buf);
35 gtk_source_view_set_show_line_numbers(GTK_SOURCE_VIEW(view), TRUE);
36 gtk_widget_add_css_class(view, "monospace");
37 GtkWidget *scroll = gtk_scrolled_window_new();
38 gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(scroll), view);
39 adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(toolbar), scroll);
40 adw_application_window_set_content(ADW_APPLICATION_WINDOW(win), toolbar);
41 gtk_window_present(GTK_WINDOW(win));
42}
43int main(int argc, char **argv) {
44 AdwApplication *app = adw_application_new("org.hammer.editor", G_APPLICATION_DEFAULT_FLAGS);
45 g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
46 int status = g_application_run(G_APPLICATION(app), argc, argv);
47 g_object_unref(app);
48 return status;
49}
50CEOF
51export PKG_CONFIG_PATH=/usr/lib/pkgconfig
52zig 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)
53'''
54install = "mkdir -p /out/usr/bin && cp sourceview-hello /out/usr/bin/sourceview-hello"
55
56[deps]
57build = ["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"]