about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh')
-rw-r--r--nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh b/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh
new file mode 100644
index 000000000000..6bee47aeb096
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh
@@ -0,0 +1,34 @@
+make_gobject_introspection_find_gir_files() {
+    # required for .typelib files, eg mypaint git version
+    if [ -d "$1/lib/girepository-1.0" ]; then
+      addToSearchPath GI_TYPELIB_PATH $1/lib/girepository-1.0
+    fi
+
+    # XDG_DATA_DIRS: required for finding .gir files
+    if [ -d "$1/share/gir-1.0" ]; then
+      addToSearchPath XDG_DATA_DIRS $1/share
+    fi
+}
+
+addEnvHooks "$hostOffset" make_gobject_introspection_find_gir_files
+
+giDiscoverSelf() {
+    if [ -d "$prefix/lib/girepository-1.0" ]; then
+      addToSearchPath GI_TYPELIB_PATH $prefix/lib/girepository-1.0
+    fi
+}
+
+# gappsWrapperArgsHook expects GI_TYPELIB_PATH variable to be set by this.
+# Until we have dependency mechanism in generic builder, we need to use this ugly hack.
+if [[ " ${preFixupPhases:-} " =~ " gappsWrapperArgsHook " ]]; then
+    preFixupPhases+=" "
+    preFixupPhases="${preFixupPhases/ gappsWrapperArgsHook / giDiscoverSelf gappsWrapperArgsHook }"
+else
+    preFixupPhases+=" giDiscoverSelf"
+fi
+
+_multioutMoveGlibGir() {
+  moveToOutput share/gir-1.0 "${!outputDev}"
+}
+
+preFixupHooks+=(_multioutMoveGlibGir)