summary refs log tree commit diff
path: root/pkgs/development/libraries/gobject-introspection
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2022-09-01 00:45:58 +0300
committerGitHub <noreply@github.com>2022-09-01 00:45:58 +0300
commitacd53be25f02ad118a3df6931d6b66e9764a800e (patch)
tree632a1ce8fb56d12fb25217baa63ce906a303ed91 /pkgs/development/libraries/gobject-introspection
parenta8a3bf5fc061e6c6eb97942445db368abf77b7dc (diff)
parent267ef1f2dee1baee4d5da59a1c669e1e4e08065f (diff)
Merge pull request #185097 from Artturin/gobjectfunfixes
Diffstat (limited to 'pkgs/development/libraries/gobject-introspection')
-rw-r--r--pkgs/development/libraries/gobject-introspection/wrapper.nix6
-rw-r--r--pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh2
-rw-r--r--pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-qemuwrapper.sh23
-rw-r--r--pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh2
4 files changed, 28 insertions, 5 deletions
diff --git a/pkgs/development/libraries/gobject-introspection/wrapper.nix b/pkgs/development/libraries/gobject-introspection/wrapper.nix
index 4b3fa1a198199..917debf98264d 100644
--- a/pkgs/development/libraries/gobject-introspection/wrapper.nix
+++ b/pkgs/development/libraries/gobject-introspection/wrapper.nix
@@ -25,6 +25,7 @@ in
     (
       export bash="${buildPackages.bash}"
       export emulator=${lib.escapeShellArg (stdenv.targetPlatform.emulator buildPackages)}
+      export emulatorwrapper="$dev/bin/g-ir-scanner-qemuwrapper"
       export buildobjdump="${buildPackages.stdenv.cc.bintools}/bin/objdump"
 
       export targetgir="${lib.getDev (targetPackages.gobject-introspection-unwrapped.override argsForTarget)}"
@@ -32,9 +33,8 @@ in
       substituteAll "${./wrappers/g-ir-compiler.sh}" "$dev/bin/g-ir-compiler"
       substituteAll "${./wrappers/g-ir-scanner.sh}" "$dev/bin/g-ir-scanner"
       substituteAll "${./wrappers/g-ir-scanner-lddwrapper.sh}" "$dev/bin/g-ir-scanner-lddwrapper"
-      chmod +x "$dev/bin/g-ir-compiler"
-      chmod +x "$dev/bin/g-ir-scanner"
-      chmod +x "$dev/bin/g-ir-scanner-lddwrapper"
+      substituteAll "${./wrappers/g-ir-scanner-qemuwrapper.sh}" "$dev/bin/g-ir-scanner-qemuwrapper"
+      chmod +x $dev/bin/g-ir-*
     )
   ''
   # when cross-compiling and using the wrapper then when a package looks up the g_ir_X
diff --git a/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh b/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh
index 69642831c8a0f..e82de18cae3dd 100644
--- a/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh
+++ b/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-compiler.sh
@@ -1,4 +1,4 @@
 #! @bash@/bin/bash
 # shellcheck shell=bash
 
-exec @emulator@ @targetgir@/bin/g-ir-compiler "$@"
+exec @emulatorwrapper@ @targetgir@/bin/g-ir-compiler "$@"
diff --git a/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-qemuwrapper.sh b/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-qemuwrapper.sh
new file mode 100644
index 0000000000000..9b407bc4144af
--- /dev/null
+++ b/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner-qemuwrapper.sh
@@ -0,0 +1,23 @@
+#! @bash@/bin/bash
+# shellcheck shell=bash
+
+# fixes issues like
+# libdbusmenu-gtk3-aarch64-unknown-linux-gnu> /build/libdbusmenu-16.04.0/libdbusmenu-gtk/tmp-introspect2jhtiwwn/.libs/DbusmenuGtk3-0.4:
+# error while loading shared libraries: libdbusmenu-glib.so.4: cannot open shared object file: No such file or directory
+# in non-meson builds
+
+# see: https://github.com/void-linux/void-packages/blob/master/srcpkgs/gobject-introspection/files/g-ir-scanner-qemuwrapper
+# https://github.com/openembedded/openembedded-core/blob/c5a14f39a6717a99b510cb97aa2fb403d4b98d99/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.72.0.bb#L74
+while read -r d; do \
+    # some meson projects may have subprojects which use makefiles for docs(e.g. gi-docgen), ignore those as they will never be needed
+    if [[ -f "$d/Makefile" && "$d" != *"subproject"* ]]; then
+        GIR_EXTRA_LIBS_PATH="$(readlink -f "$d/.libs"):$GIR_EXTRA_LIBS_PATH"
+        export GIR_EXTRA_LIBS_PATH
+    fi
+done < <(find "$NIX_BUILD_TOP" -type d)
+
+# quoting broke the build of atk
+# shellcheck disable=2086
+exec @emulator@ ${GIR_EXTRA_OPTIONS:-} \
+    ${GIR_EXTRA_LIBS_PATH:+-E LD_LIBRARY_PATH="${GIR_EXTRA_LIBS_PATH}"} \
+    "$@"
diff --git a/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh b/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh
index 6a222191c7b20..7843bb91db970 100644
--- a/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh
+++ b/pkgs/development/libraries/gobject-introspection/wrappers/g-ir-scanner.sh
@@ -2,6 +2,6 @@
 # shellcheck shell=bash
 
 exec @dev@/bin/.g-ir-scanner-wrapped \
-    --use-binary-wrapper=@emulator@ \
+    --use-binary-wrapper=@emulatorwrapper@ \
     --use-ldd-wrapper=@dev@/bin/g-ir-scanner-lddwrapper \
     "$@"