1 # shellcheck shell=bash
5 if [ -d "$1/lib/gio/modules" ] && [ -n "$(ls -A "$1/lib
/gio
/modules
")" ] ; then
6 gappsWrapperArgs
+=(--prefix GIO_EXTRA_MODULES
: "$1/lib/gio/modules")
10 addEnvHooks
"${targetOffset:?}" find_gio_modules
12 gappsWrapperArgsHook
() {
13 if [ -n "$GDK_PIXBUF_MODULE_FILE" ]; then
14 gappsWrapperArgs
+=(--set GDK_PIXBUF_MODULE_FILE
"$GDK_PIXBUF_MODULE_FILE")
17 if [ -n "$GSETTINGS_SCHEMAS_PATH" ]; then
18 gappsWrapperArgs
+=(--prefix XDG_DATA_DIRS
: "$GSETTINGS_SCHEMAS_PATH")
21 # Check for prefix as well
22 if [ -d "${prefix:?}/share" ]; then
23 gappsWrapperArgs
+=(--prefix XDG_DATA_DIRS
: "$prefix/share")
26 if [ -d "$prefix/lib/gio/modules" ] && [ -n "$(ls -A "$prefix/lib
/gio
/modules
")" ]; then
27 gappsWrapperArgs
+=(--prefix GIO_EXTRA_MODULES
: "$prefix/lib/gio/modules")
30 for v
in ${wrapPrefixVariables:-} GST_PLUGIN_SYSTEM_PATH_1_0 GI_TYPELIB_PATH GRL_PLUGIN_PATH
; do
31 if [ -n "${!v}" ]; then
32 gappsWrapperArgs
+=(--prefix "$v" : "${!v}")
37 preFixupPhases
+=" gappsWrapperArgsHook"
42 wrapProgram
"$program" "${gappsWrapperArgs[@]}" "$@"
45 # Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set.
47 # guard against running multiple times (e.g. due to propagation)
48 [ -z "$wrapGAppsHookHasRun" ] ||
return 0
51 if [[ -z "${dontWrapGApps:-}" ]]; then
52 targetDirsThatExist
=()
56 targetDirs
=("${prefix}/bin" "${prefix}/libexec")
57 for targetDir
in "${targetDirs[@]}"; do
58 if [[ -d "${targetDir}" ]]; then
59 targetDirsThatExist
+=("${targetDir}")
60 targetDirsRealPath
+=("$(realpath "${targetDir}")/")
61 find "${targetDir}" -type f
-executable -print0 |
62 while IFS
= read -r -d '' file; do
63 echo "Wrapping program '${file}'"
69 # wrap links to binaries that point outside targetDirs
70 # Note: links to binaries within targetDirs do not need
71 # to be wrapped as the binaries have already been wrapped
72 if [[ ${#targetDirsThatExist[@]} -ne 0 ]]; then
73 find "${targetDirsThatExist[@]}" -type l
-xtype f
-executable -print0 |
74 while IFS
= read -r -d '' linkPath
; do
75 linkPathReal
=$
(realpath
"${linkPath}")
76 for targetPath
in "${targetDirsRealPath[@]}"; do
77 if [[ "$linkPathReal" == "$targetPath"* ]]; then
78 echo "Not wrapping link: '$linkPath' (already wrapped)"
82 echo "Wrapping link: '$linkPath'"
83 wrapGApp
"${linkPath}"
89 fixupOutputHooks
+=(wrapGAppsHook
)