From 1e85675b652b4e133a98841d75bb7fe7e00058d5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 21 Mar 2025 10:40:01 +0100 Subject: Add consistent "3" suffix to gtk3 bits Signed-off-by: Drew DeVault --- .gitignore | 2 +- Makefile | 16 ++++++++++------ cmd/demo/main.ha | 57 ------------------------------------------------------- cmd/demo3/main.ha | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ generate | 36 ----------------------------------- generate3 | 36 +++++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 100 deletions(-) delete mode 100644 cmd/demo/main.ha create mode 100644 cmd/demo3/main.ha delete mode 100755 generate create mode 100755 generate3 diff --git a/.gitignore b/.gitignore index 4d33af7..28c2fe4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /xmltree /hare-gi -/demo +/demo3 /demo4 _generated.ha diff --git a/Makefile b/Makefile index 84d83cc..9e73e1c 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,9 @@ hare-gi: hare build -o $@ cmd/hare-gi/ .PHONY: hare-gi -install: +install: install3 install4 + +install3: @for mod in $(MODULES_GTK3); do \ printf "installing %s\n" "$$mod"; \ mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \ @@ -52,7 +54,9 @@ install4: install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \ done -uninstall: +uninstall: uninstall3 uninstall4 + +uninstall3: @for mod in $(MODULES_GTK3); do \ printf "uninstalling %s\n" "$$mod"; \ rm -r "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \ @@ -73,15 +77,15 @@ HAREPATH_ENV_CMD = hare version -vv | grep '^HAREPATH' # the unquoted value, which makes it easy to add the bindings directory to the # path -demo: +demo3: eval "$$($(HAREPATH_ENV_CMD))" && env HAREPATH="$(BINDINGS_DIR):$$HAREPATH" \ - hare build $$(pkg-config --libs-only-l gtk+-3.0) -o demo cmd/demo + hare build $$(pkg-config --libs-only-l gtk+-3.0) -o demo3 cmd/demo3 demo4: eval "$$($(HAREPATH_ENV_CMD))" && env HAREPATH="$(BINDINGS_DIR):$$HAREPATH" \ hare build $$(pkg-config --libs-only-l gtk4) -o demo4 cmd/demo4 clean: - rm -f hare-gi xmltree demo demo4 + rm -f hare-gi xmltree demo3 demo4 bindings/gi/*/_generate.ha -.PHONY: all install install4 uninstall uninstall4 demo demo4 clean +.PHONY: all install3 install4 uninstall3 uninstall4 demo3 demo4 clean diff --git a/cmd/demo/main.ha b/cmd/demo/main.ha deleted file mode 100644 index a106b5c..0000000 --- a/cmd/demo/main.ha +++ /dev/null @@ -1,57 +0,0 @@ -use gi::gio; -use gi::glib; -use gi::gobject; -use gi::gtk; -use os; -use rt; -use types::c; - -fn about_clicked(btn: *gtk::Button, data: *opaque) void = { - let dialog = gtk::about_dialog_new(): *gtk::AboutDialog; - const authors: []*c::char = [ - c::nulstr("Harriet?\0"), - null: *c::char, - ]; - gtk::about_dialog_set_license_type( - dialog, - gtk::License::MPL_2_0, - ); - gtk::about_dialog_set_authors( - dialog, - authors: *[*]*c::char: **c::char, - ); - gtk::about_dialog_set_website( - dialog, - c::nulstr("https://git.sr.ht/~yerinalexey/hare-gi\0"), - ); - gtk::widget_show_all(dialog); -}; - -fn activate(app: *gio::Application, data: *opaque) void = { - const app = app: *gtk::Application; - - let button = gtk::button_new_with_label(c::nulstr("About\0")): *gtk::Button; - gtk::button_connect_clicked(button, &about_clicked, null); - - let headerbar = gtk::header_bar_new(): *gtk::HeaderBar; - gtk::header_bar_set_title(headerbar, c::nulstr("hare-gi demo\0")); - gtk::header_bar_set_show_close_button(headerbar, glib::TRUE); - gtk::header_bar_pack_end(headerbar, button); - - let window = gtk::application_window_new(app): *gtk::ApplicationWindow; - gtk::window_set_titlebar(window, headerbar); - gtk::widget_show_all(window); -}; - -export fn main() void = { - let app = gtk::application_new( - c::nulstr("hare_gi.example\0"), - gio::ApplicationFlags::FLAGS_NONE, - ): *gtk::Application; - gio::application_connect_activate(app, &activate, null); - const status = gio::application_run( - app, rt::argc: int, rt::argv: **c::char, - ); - gobject::object_unref(app); - os::exit(status); -}; diff --git a/cmd/demo3/main.ha b/cmd/demo3/main.ha new file mode 100644 index 0000000..a106b5c --- /dev/null +++ b/cmd/demo3/main.ha @@ -0,0 +1,57 @@ +use gi::gio; +use gi::glib; +use gi::gobject; +use gi::gtk; +use os; +use rt; +use types::c; + +fn about_clicked(btn: *gtk::Button, data: *opaque) void = { + let dialog = gtk::about_dialog_new(): *gtk::AboutDialog; + const authors: []*c::char = [ + c::nulstr("Harriet?\0"), + null: *c::char, + ]; + gtk::about_dialog_set_license_type( + dialog, + gtk::License::MPL_2_0, + ); + gtk::about_dialog_set_authors( + dialog, + authors: *[*]*c::char: **c::char, + ); + gtk::about_dialog_set_website( + dialog, + c::nulstr("https://git.sr.ht/~yerinalexey/hare-gi\0"), + ); + gtk::widget_show_all(dialog); +}; + +fn activate(app: *gio::Application, data: *opaque) void = { + const app = app: *gtk::Application; + + let button = gtk::button_new_with_label(c::nulstr("About\0")): *gtk::Button; + gtk::button_connect_clicked(button, &about_clicked, null); + + let headerbar = gtk::header_bar_new(): *gtk::HeaderBar; + gtk::header_bar_set_title(headerbar, c::nulstr("hare-gi demo\0")); + gtk::header_bar_set_show_close_button(headerbar, glib::TRUE); + gtk::header_bar_pack_end(headerbar, button); + + let window = gtk::application_window_new(app): *gtk::ApplicationWindow; + gtk::window_set_titlebar(window, headerbar); + gtk::widget_show_all(window); +}; + +export fn main() void = { + let app = gtk::application_new( + c::nulstr("hare_gi.example\0"), + gio::ApplicationFlags::FLAGS_NONE, + ): *gtk::Application; + gio::application_connect_activate(app, &activate, null); + const status = gio::application_run( + app, rt::argc: int, rt::argv: **c::char, + ); + gobject::object_unref(app); + os::exit(status); +}; diff --git a/generate b/generate deleted file mode 100755 index 3b17734..0000000 --- a/generate +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -BIND=./bindings/gi -NS=gi:: - -mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \ - "$BIND"/gdkpixbuf "$BIND"/freetype "$BIND"/harfbuzz "$BIND"/cairo \ - "$BIND"/pango "$BIND"/gdk "$BIND"/xlib "$BIND"/gtk - -hare build cmd/hare-gi && exec ./hare-gi -B \ - -m GLib,${NS}glib,"$BIND"/glib/_generated.ha \ - -m GObject,${NS}gobject,"$BIND"/gobject/_generated.ha \ - -m Gio,${NS}gio,"$BIND"/gio/_generated.ha \ - -m GModule,${NS}gmodule,"$BIND"/gmodule/_generated.ha \ - -m Atk,${NS}atk,"$BIND"/atk/_generated.ha \ - -m GdkPixbuf,${NS}gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \ - -m freetype2,${NS}freetype,"$BIND"/freetype/_generated.ha \ - -m HarfBuzz,${NS}harfbuzz,"$BIND"/harfbuzz/_generated.ha \ - -m cairo,${NS}cairo,"$BIND"/cairo/_generated.ha \ - -m Pango,${NS}pango,"$BIND"/pango/_generated.ha \ - -m Gdk,${NS}gdk,"$BIND"/gdk/_generated.ha \ - -m xlib,${NS}xlib,"$BIND"/xlib/_generated.ha \ - -m Gtk,${NS}gtk,"$BIND"/gtk/_generated.ha \ - /usr/share/gir-1.0/GLib-2.0.gir \ - /usr/share/gir-1.0/GObject-2.0.gir \ - /usr/share/gir-1.0/Gio-2.0.gir \ - /usr/share/gir-1.0/GModule-2.0.gir \ - /usr/share/gir-1.0/Atk-1.0.gir \ - /usr/share/gir-1.0/GdkPixbuf-2.0.gir \ - /usr/share/gir-1.0/freetype2-2.0.gir \ - /usr/share/gir-1.0/HarfBuzz-0.0.gir \ - /usr/share/gir-1.0/cairo-1.0.gir \ - /usr/share/gir-1.0/Pango-1.0.gir \ - /usr/share/gir-1.0/Gdk-3.0.gir \ - /usr/share/gir-1.0/xlib-2.0.gir \ - /usr/share/gir-1.0/Gtk-3.0.gir diff --git a/generate3 b/generate3 new file mode 100755 index 0000000..3b17734 --- /dev/null +++ b/generate3 @@ -0,0 +1,36 @@ +#!/bin/sh + +BIND=./bindings/gi +NS=gi:: + +mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \ + "$BIND"/gdkpixbuf "$BIND"/freetype "$BIND"/harfbuzz "$BIND"/cairo \ + "$BIND"/pango "$BIND"/gdk "$BIND"/xlib "$BIND"/gtk + +hare build cmd/hare-gi && exec ./hare-gi -B \ + -m GLib,${NS}glib,"$BIND"/glib/_generated.ha \ + -m GObject,${NS}gobject,"$BIND"/gobject/_generated.ha \ + -m Gio,${NS}gio,"$BIND"/gio/_generated.ha \ + -m GModule,${NS}gmodule,"$BIND"/gmodule/_generated.ha \ + -m Atk,${NS}atk,"$BIND"/atk/_generated.ha \ + -m GdkPixbuf,${NS}gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \ + -m freetype2,${NS}freetype,"$BIND"/freetype/_generated.ha \ + -m HarfBuzz,${NS}harfbuzz,"$BIND"/harfbuzz/_generated.ha \ + -m cairo,${NS}cairo,"$BIND"/cairo/_generated.ha \ + -m Pango,${NS}pango,"$BIND"/pango/_generated.ha \ + -m Gdk,${NS}gdk,"$BIND"/gdk/_generated.ha \ + -m xlib,${NS}xlib,"$BIND"/xlib/_generated.ha \ + -m Gtk,${NS}gtk,"$BIND"/gtk/_generated.ha \ + /usr/share/gir-1.0/GLib-2.0.gir \ + /usr/share/gir-1.0/GObject-2.0.gir \ + /usr/share/gir-1.0/Gio-2.0.gir \ + /usr/share/gir-1.0/GModule-2.0.gir \ + /usr/share/gir-1.0/Atk-1.0.gir \ + /usr/share/gir-1.0/GdkPixbuf-2.0.gir \ + /usr/share/gir-1.0/freetype2-2.0.gir \ + /usr/share/gir-1.0/HarfBuzz-0.0.gir \ + /usr/share/gir-1.0/cairo-1.0.gir \ + /usr/share/gir-1.0/Pango-1.0.gir \ + /usr/share/gir-1.0/Gdk-3.0.gir \ + /usr/share/gir-1.0/xlib-2.0.gir \ + /usr/share/gir-1.0/Gtk-3.0.gir -- cgit 1.3.0-6-gf8a5