about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDrew DeVault <drew@ddevault.org>2025-03-21 10:40:00 +0100
committerAlexey Yerin <yyp@disroot.org>2025-03-21 14:17:46 +0300
commit98fc3cf2108790200aa12635bc46e3cb3cb0139a (patch)
tree593ebb6ba6ff1ca1c30e693f9a3b05f377b57381
parent914e76b6d3c817c942d6584ae51e41529d2a3ec7 (diff)
all: move generated modules into gi:: namespace
Signed-off-by: Drew DeVault <drew@ddevault.org>
-rw-r--r--Makefile43
-rw-r--r--bindings/gi/glib/types.ha (renamed from bindings/glib/types.ha)0
-rw-r--r--bindings/gi/gobject/types.ha (renamed from bindings/gobject/types.ha)0
-rw-r--r--cmd/demo/main.ha8
-rw-r--r--cmd/demo4/main.ha8
-rwxr-xr-xgenerate29
-rwxr-xr-xgenerate437
7 files changed, 75 insertions, 50 deletions
diff --git a/Makefile b/Makefile
index 9b658bb..84d83cc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,7 @@
 .POSIX:
 .SUFFIXES:
 
-BINDINGS_DIR = bindings
-CORE_MODULES = glib gobject gio gmodule atk gdkpixbuf freetype harfbuzz cairo pango xlib types/libc
-MODULES3 = $(CORE_MODULES) gdk gtk
-MODULES4 = $(CORE_MODULES) gdk4 gtk4 pangocairo graphene gsk
+all: hare-gi
 
 DESTDIR =
 PREFIX = /usr/local
@@ -12,31 +9,57 @@ SRCDIR = $(PREFIX)/src
 HARESRCDIR = $(SRCDIR)/hare
 THIRDPARTYDIR = $(HARESRCDIR)/third-party
 
-all:
-	@true
+BINDINGS_DIR = bindings
+MODULES_CORE = \
+	types/libc \
+	gi/glib \
+	gi/gobject \
+	gi/gio \
+	gi/gmodule
+MODULES_GTK_SHARED = \
+	gi/atk \
+	gi/gdkpixbuf \
+	gi/freetype \
+	gi/harfbuzz \
+	gi/cairo \
+	gi/pango \
+	gi/xlib
+MODULES_GTK3 = $(MODULES_CORE) $(MODULES_GTK_SHARED) \
+	gi/gdk \
+	gi/gtk
+MODULES_GTK4 = $(MODULES_CORE) $(MODULES_GTK_SHARED) \
+	gi/gdk4 \
+	gi/gtk4 \
+	gi/pangocairo \
+	gi/graphene \
+	gi/gsk
+
+hare-gi:
+	hare build -o $@ cmd/hare-gi/
+.PHONY: hare-gi
 
 install:
-	@for mod in $(MODULES3); do \
+	@for mod in $(MODULES_GTK3); do \
 		printf "installing %s\n" "$$mod"; \
 		mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 		install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
 
 install4:
-	@for mod in $(MODULES4); do \
+	@for mod in $(MODULES_GTK4); do \
 		printf "installing %s\n" "$$mod"; \
 		mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 		install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
 
 uninstall:
-	@for mod in $(MODULES3); do \
+	@for mod in $(MODULES_GTK3); do \
 		printf "uninstalling %s\n" "$$mod"; \
 		rm -r "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
 
 uninstall4:
-	@for mod in $(MODULES4); do \
+	@for mod in $(MODULES_GTK4); do \
 		printf "uninstalling %s\n" "$$mod"; \
 		rm -r "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
diff --git a/bindings/glib/types.ha b/bindings/gi/glib/types.ha
index 2492c4e..2492c4e 100644
--- a/bindings/glib/types.ha
+++ b/bindings/gi/glib/types.ha
diff --git a/bindings/gobject/types.ha b/bindings/gi/gobject/types.ha
index 570fe30..570fe30 100644
--- a/bindings/gobject/types.ha
+++ b/bindings/gi/gobject/types.ha
diff --git a/cmd/demo/main.ha b/cmd/demo/main.ha
index 8f9151b..a106b5c 100644
--- a/cmd/demo/main.ha
+++ b/cmd/demo/main.ha
@@ -1,7 +1,7 @@
-use gio;
-use glib;
-use gobject;
-use gtk;
+use gi::gio;
+use gi::glib;
+use gi::gobject;
+use gi::gtk;
 use os;
 use rt;
 use types::c;
diff --git a/cmd/demo4/main.ha b/cmd/demo4/main.ha
index 97693eb..39ca4ca 100644
--- a/cmd/demo4/main.ha
+++ b/cmd/demo4/main.ha
@@ -1,7 +1,7 @@
-use gio;
-use glib;
-use gobject;
-use gtk4;
+use gi::gio;
+use gi::glib;
+use gi::gobject;
+use gi::gtk4;
 use os;
 use rt;
 use types::c;
diff --git a/generate b/generate
index 0e7911b..3b17734 100755
--- a/generate
+++ b/generate
@@ -1,25 +1,26 @@
 #!/bin/sh
 
-BIND=./bindings
+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,glib,"$BIND"/glib/_generated.ha \
-	-m GObject,gobject,"$BIND"/gobject/_generated.ha \
-	-m Gio,gio,"$BIND"/gio/_generated.ha \
-	-m GModule,gmodule,"$BIND"/gmodule/_generated.ha \
-	-m Atk,atk,"$BIND"/atk/_generated.ha \
-	-m GdkPixbuf,gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \
-	-m freetype2,freetype,"$BIND"/freetype/_generated.ha \
-	-m HarfBuzz,harfbuzz,"$BIND"/harfbuzz/_generated.ha \
-	-m cairo,cairo,"$BIND"/cairo/_generated.ha \
-	-m Pango,pango,"$BIND"/pango/_generated.ha \
-	-m Gdk,gdk,"$BIND"/gdk/_generated.ha \
-	-m xlib,xlib,"$BIND"/xlib/_generated.ha \
-	-m Gtk,gtk,"$BIND"/gtk/_generated.ha \
+	-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 \
diff --git a/generate4 b/generate4
index de2eb6f..26a15d4 100755
--- a/generate4
+++ b/generate4
@@ -1,29 +1,30 @@
 #!/bin/sh
 
-BIND=./bindings
+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"/pangocairo "$BIND"/gdk4 "$BIND"/xlib "$BIND"/graphene \
 	"$BIND"/gsk "$BIND"/gtk4
 
-hare build cmd/hare-gi && exec ./hare-gi -B \
-	-m GLib,glib,"$BIND"/glib/_generated.ha \
-	-m GObject,gobject,"$BIND"/gobject/_generated.ha \
-	-m Gio,gio,"$BIND"/gio/_generated.ha \
-	-m GModule,gmodule,"$BIND"/gmodule/_generated.ha \
-	-m Atk,atk,"$BIND"/atk/_generated.ha \
-	-m GdkPixbuf,gdkpixbuf,"$BIND"/gdkpixbuf/_generated.ha \
-	-m freetype2,freetype,"$BIND"/freetype/_generated.ha \
-	-m HarfBuzz,harfbuzz,"$BIND"/harfbuzz/_generated.ha \
-	-m cairo,cairo,"$BIND"/cairo/_generated.ha \
-	-m Pango,pango,"$BIND"/pango/_generated.ha \
-	-m PangoCairo,pangocairo,"$BIND"/pangocairo/_generated.ha \
-	-m Gdk,gdk4,"$BIND"/gdk4/_generated.ha \
-	-m xlib,xlib,"$BIND"/xlib/_generated.ha \
-	-m Graphene,graphene,"$BIND"/graphene/_generated.ha \
-	-m Gsk,gsk,"$BIND"/gsk/_generated.ha \
-	-m Gtk,gtk4,"$BIND"/gtk4/_generated.ha \
+hare build cmd/hare-gi && exec ./hare-gi \
+	-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 PangoCairo,${NS}pangocairo,"$BIND"/pangocairo/_generated.ha \
+	-m Gdk,${NS}gdk4,"$BIND"/gdk4/_generated.ha \
+	-m xlib,${NS}xlib,"$BIND"/xlib/_generated.ha \
+	-m Graphene,${NS}graphene,"$BIND"/graphene/_generated.ha \
+	-m Gsk,${NS}gsk,"$BIND"/gsk/_generated.ha \
+	-m Gtk,${NS}gtk4,"$BIND"/gtk4/_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 \