1 if [[ -z "${__nix_wrapGNUstepAppsHook-}" ]]; then
2 __nix_wrapGNUstepAppsHook
=1 # Don't run this hook more than once.
4 # Inherit arguments given in mkDerivation
5 gnustepWrapperArgs
=(${gnustepWrapperArgs-})
9 NIX_GNUSTEP_SYSTEM_APPS
10 NIX_GNUSTEP_SYSTEM_ADMIN_APPS
11 NIX_GNUSTEP_SYSTEM_WEB_APPS
12 NIX_GNUSTEP_SYSTEM_TOOLS
13 NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS
14 NIX_GNUSTEP_SYSTEM_LIBRARY
15 NIX_GNUSTEP_SYSTEM_HEADERS
16 NIX_GNUSTEP_SYSTEM_LIBRARIES
17 NIX_GNUSTEP_SYSTEM_DOC
18 NIX_GNUSTEP_SYSTEM_DOC_MAN
19 NIX_GNUSTEP_SYSTEM_DOC_INFO
24 --set GNUSTEP_CONFIG_FILE
"$out/GNUstep.conf" \
25 "${gnustepWrapperArgs[@]}"
28 ensureGNUstepConfig
() (
29 if [[ -f "$out/GNUstep.conf" ]]; then
33 echo "writing GNUstep config file"
36 if [[ -d "$2" && "${!1-}" != *"$2"* ]]; then
37 addToSearchPath
"$1" "$2"
41 gsAddToIncludeSearchPath
() {
44 if [[ -d "$2" && "${ref-}" != *"$2"* ]]; then
45 if [[ "${ref-}" != "" ]]; then
53 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_APPS
"$out/lib/GNUstep/Applications"
54 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS
"$out/lib/GNUstep/Applications"
55 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS
"$out/lib/GNUstep/WebApplications"
56 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS
"$out/bin"
57 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS
"$out/sbin"
58 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY
"$out/lib/GNUstep"
59 gsAddToIncludeSearchPath NIX_GNUSTEP_SYSTEM_HEADERS
"$out/include"
60 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES
"$out/lib"
61 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC
"$out/share/GNUstep/Documentation"
62 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN
"$out/share/man"
63 gsAddToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO
"$out/share/info"
65 for var
in "${gnustepConfigVars[@]}"; do
66 if [[ -n "${!var-}" ]]; then
67 printf '%s="%s"\n' "$var" "${!var}"
69 done > "$out/GNUstep.conf"
72 # Note: $gnustepWrapperArgs still gets defined even if ${dontWrapGNUstepApps-} is set.
73 wrapGNUstepAppsHook
() {
74 # skip this hook when requested
75 [[ -z "${dontWrapGNUstepApps-}" ]] ||
return 0
77 # guard against running multiple times (e.g. due to propagation)
78 [[ -z "$wrapGNUstepAppsHookHasRun" ]] ||
return 0
79 wrapGNUstepAppsHookHasRun
=1
81 local targetDirs
=("$prefix/bin")
82 echo "wrapping GNUstep applications in ${targetDirs[@]}"
84 for targetDir
in "${targetDirs[@]}"; do
85 [[ -d "$targetDir" ]] ||
continue
87 while IFS
= read -r -d '' file; do
90 wrapGNUstepApp
"$file"
91 done < <(find "$targetDir" ! -type d
-executable -print0)
95 fixupOutputHooks
+=(wrapGNUstepAppsHook
)