tawasuyu

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…

TOML 604Rust 56Shell 36Markdown 281227 Definitions

⎇ ba1fb2d3a8ada748984dceeb0f58e6b3e67772b8 recipes/sourceview-hello.toml TOML · 58 lines · 3.0 KB History raw

licencias: 95% (1114/1164) — la evidencia sale del tarball pineado, offline ba1fb2d3a · Sergio ·

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"
6license = "LGPL-2.1-or-later"
7
8[source]
9tarball = "https://download.gnome.org/sources/gtksourceview/5.16/gtksourceview-5.16.0.tar.xz"
10sha256  = "ab35d420102f3e8b055dd3b8642d3a48209f888189e6254d0ffb4b6a7e8c3566"
11
12[build]
13compiler = "zig-cc"
14target   = "x86_64-linux-musl"
15link     = "static"
16
17[build.phases]
18configure = "true"
19compile = '''
20cat > sv_hello.c <<'CEOF'
21#include <adwaita.h>
22#include <gtksourceview/gtksource.h>
23static void activate(GtkApplication *app, gpointer user_data) {
24  GtkWidget *win = adw_application_window_new(app);
25  gtk_window_set_title(GTK_WINDOW(win), "Editor hammer");
26  gtk_window_set_default_size(GTK_WINDOW(win), 640, 420);
27  GtkWidget *toolbar = adw_toolbar_view_new();
28  adw_toolbar_view_add_top_bar(ADW_TOOLBAR_VIEW(toolbar), adw_header_bar_new());
29  GtkSourceBuffer *buf = gtk_source_buffer_new(NULL);
30  GtkSourceLanguageManager *lm = gtk_source_language_manager_get_default();
31  GtkSourceLanguage *lang = gtk_source_language_manager_get_language(lm, "c");
32  if (lang) gtk_source_buffer_set_language(buf, lang);
33  gtk_text_buffer_set_text(GTK_TEXT_BUFFER(buf),
34    "#include <stdio.h>\nint main(void){\n  printf(\"hola hammer\\n\");\n  return 0;\n}\n", -1);
35  GtkWidget *view = gtk_source_view_new_with_buffer(buf);
36  gtk_source_view_set_show_line_numbers(GTK_SOURCE_VIEW(view), TRUE);
37  gtk_widget_add_css_class(view, "monospace");
38  GtkWidget *scroll = gtk_scrolled_window_new();
39  gtk_scrolled_window_set_child(GTK_SCROLLED_WINDOW(scroll), view);
40  adw_toolbar_view_set_content(ADW_TOOLBAR_VIEW(toolbar), scroll);
41  adw_application_window_set_content(ADW_APPLICATION_WINDOW(win), toolbar);
42  gtk_window_present(GTK_WINDOW(win));
43}
44int main(int argc, char **argv) {
45  AdwApplication *app = adw_application_new("org.hammer.editor", G_APPLICATION_DEFAULT_FLAGS);
46  g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
47  int status = g_application_run(G_APPLICATION(app), argc, argv);
48  g_object_unref(app);
49  return status;
50}
51CEOF
52export PKG_CONFIG_PATH=/usr/lib/pkgconfig
53zig 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)
54'''
55install = "mkdir -p /out/usr/bin && cp sourceview-hello /out/usr/bin/sourceview-hello"
56
57[deps]
58build = ["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"]