about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gobject-introspection/setup-hook.sh
blob: 50571a8f914d159c1656cf6d96e59a31bc28444b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 "$targetOffset" 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)