From 0855015e51a74b0de56f5557eada7f1a11c35188 Mon Sep 17 00:00:00 2001 From: sergio Date: Tue, 30 Jun 2026 14:59:57 -0400 Subject: [PATCH] =?UTF-8?q?Etapa=20G=20(GUI):=20sourceview-hello=20?= =?UTF-8?q?=E2=80=94=20editor=20de=20c=C3=B3digo=20(Adwaita=20+=20GtkSourc?= =?UTF-8?q?eView,=20resaltado=20C=20+=20nums=20de=20l=C3=ADnea)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Link 100% estático: gtk4+libadwaita+gtksourceview → 154MB ELF estático, corre. Esqueleto de un editor real para el distro; valida los 3 stacks juntos. Co-Authored-By: Claude Opus 4.8 --- recipes/incoming-clib/sourceview-hello.toml | 57 +++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 recipes/incoming-clib/sourceview-hello.toml diff --git a/recipes/incoming-clib/sourceview-hello.toml b/recipes/incoming-clib/sourceview-hello.toml new file mode 100644 index 00000000..44d78da5 --- /dev/null +++ b/recipes/incoming-clib/sourceview-hello.toml @@ -0,0 +1,57 @@ +# 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 +#include +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 \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", "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"]