about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDrew DeVault <drew@ddevault.org>2025-03-21 10:40:06 +0100
committerAlexey Yerin <yyp@disroot.org>2025-03-21 14:40:42 +0300
commit100753a060bebb9ad33a2b56722a4e83faba3fea (patch)
tree236780e4181ccb3e8f5899765101c51c9909d7c3
parentea84d7a04d5f2eb51c06a5cafbfd877228ab8c4a (diff)
Move bindings from bindings/gi => gi
Signed-off-by: Drew DeVault <drew@ddevault.org>
-rw-r--r--Makefile28
-rw-r--r--cmd/hare-gi/emit.ha2
-rw-r--r--gi/glib/types.ha (renamed from bindings/gi/glib/types.ha)0
-rw-r--r--gi/gobject/types.ha (renamed from bindings/gi/gobject/types.ha)0
-rw-r--r--gi/libc/types.ha (renamed from bindings/types/libc/types.ha)0
-rwxr-xr-xscripts/generate32
-rwxr-xr-xscripts/generate42
7 files changed, 11 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 1250439..1456f25 100644
--- a/Makefile
+++ b/Makefile
@@ -10,9 +10,8 @@ SRCDIR = $(PREFIX)/src
 HARESRCDIR = $(SRCDIR)/hare
 THIRDPARTYDIR = $(HARESRCDIR)/third-party
 
-BINDINGS_DIR = bindings
 MODULES_CORE = \
-	types/libc \
+	gi/libc \
 	gi/glib \
 	gi/gobject \
 	gi/gio \
@@ -57,14 +56,14 @@ install-gtk3: .gen
 	@for mod in $(MODULES_GTK3); do \
 		printf "installing %s\n" "$$mod"; \
 		mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
-		install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
+		install -m644 "$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
 
 install-gtk4: .gen
 	@for mod in $(MODULES_GTK4); do \
 		printf "installing %s\n" "$$mod"; \
 		mkdir -p "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
-		install -m644 "$(BINDINGS_DIR)/$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
+		install -m644 "$$mod"/* "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
 
 uninstall: uninstall3 uninstall4
@@ -81,25 +80,14 @@ uninstall4:
 		rm -r "$(DESTDIR)$(THIRDPARTYDIR)/$$mod"; \
 	done
 
-HAREPATH_ENV_CMD = hare version -vv | grep '^HAREPATH'
+demo3: .gen
+	hare build $(LIBS_3) -o demo3 cmd/demo3
 
-# hare version -vv returns the value of HAREPATH in form
-# HAREPATH=<possibly shell-quoted string>
-#
-# Using eval on that line will set the HAREPATH variable in the environment to
-# the unquoted value, which makes it easy to add the bindings directory to the
-# path
-
-demo3:
-	eval "$$($(HAREPATH_ENV_CMD))" && env HAREPATH="$(BINDINGS_DIR):$$HAREPATH" \
-		hare build $(LIBS_3) -o demo3 cmd/demo3
-
-demo4:
-	eval "$$($(HAREPATH_ENV_CMD))" && env HAREPATH="$(BINDINGS_DIR):$$HAREPATH" \
-		hare build $(LIBS_4) -o demo4 cmd/demo4
+demo4: .gen
+	hare build $(LIBS_4) -o demo4 cmd/demo4
 
 clean:
-	rm -f hare-gi xmltree demo3 demo4 bindings/gi/*/_generate.ha
+	rm -f hare-gi xmltree demo3 demo4 gi/*/_generate.ha
 
 .PHONY: all clean
 .PHONY: install install-gtk3 install-gtk4
diff --git a/cmd/hare-gi/emit.ha b/cmd/hare-gi/emit.ha
index bec5b4a..5f137ed 100644
--- a/cmd/hare-gi/emit.ha
+++ b/cmd/hare-gi/emit.ha
@@ -672,7 +672,7 @@ fn emit_c_type(ctx: *context, type_: ctype, flags: ctype_flag...) (void | io::er
 		const (mod, id) = special;
 		switch (mod) {
 		case cmodule::LIBC =>
-			add_import(ctx.current, ["types", "libc"]);
+			add_import(ctx.current, ["gi", "libc"]);
 			fmt::fprintf(ctx.current.output, "libc::{}", id)?;
 		case cmodule::GLIB =>
 			emit_object(ctx, ctx.glib, id)?;
diff --git a/bindings/gi/glib/types.ha b/gi/glib/types.ha
index 2492c4e..2492c4e 100644
--- a/bindings/gi/glib/types.ha
+++ b/gi/glib/types.ha
diff --git a/bindings/gi/gobject/types.ha b/gi/gobject/types.ha
index 570fe30..570fe30 100644
--- a/bindings/gi/gobject/types.ha
+++ b/gi/gobject/types.ha
diff --git a/bindings/types/libc/types.ha b/gi/libc/types.ha
index 94959b7..94959b7 100644
--- a/bindings/types/libc/types.ha
+++ b/gi/libc/types.ha
diff --git a/scripts/generate3 b/scripts/generate3
index 18a834b..bf57ff5 100755
--- a/scripts/generate3
+++ b/scripts/generate3
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-BIND=./bindings/gi
+BIND=./gi
 NS=gi::
 
 mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \
diff --git a/scripts/generate4 b/scripts/generate4
index 0c75b61..c285a4e 100755
--- a/scripts/generate4
+++ b/scripts/generate4
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-BIND=./bindings/gi
+BIND=./gi
 NS=gi::
 
 mkdir -p "$BIND"/glib "$BIND"/gobject "$BIND"/gio "$BIND"/gmodule "$BIND"/atk \