ansible-later: 2.0.22 -> 2.0.23
[NixPkgs.git] / pkgs / build-support / dotnet / build-dotnet-module / hooks / dotnet-fixup-hook.sh
blob59df9b319afba13f80eadd99c8a00eea263881f5
1 # Inherit arguments from the derivation
2 makeWrapperArgs=( ${makeWrapperArgs-} )
4 # First argument is the executable you want to wrap,
5 # the second is the destination for the wrapper.
6 wrapDotnetProgram() {
7 if [ ! "${selfContainedBuild-}" ]; then
8 local -r dotnetRootFlag=("--set" "DOTNET_ROOT" "@dotnetRuntime@")
9 fi
11 makeWrapper "$1" "$2" \
12 --suffix "LD_LIBRARY_PATH" : "@runtimeDeps@" \
13 "${dotnetRootFlag[@]}" \
14 "${gappsWrapperArgs[@]}" \
15 "${makeWrapperArgs[@]}"
17 echo "installed wrapper to "$2""
20 dotnetFixupHook() {
21 echo "Executing dotnetFixupPhase"
23 if [ "${executables-}" ]; then
24 for executable in ${executables[@]}; do
25 path="$out/lib/$pname/$executable"
27 if test -x "$path"; then
28 wrapDotnetProgram "$path" "$out/bin/$(basename "$executable")"
29 else
30 echo "Specified binary \"$executable\" is either not an executable or does not exist!"
31 echo "Looked in $path"
32 exit 1
34 done
35 else
36 while IFS= read -d '' executable; do
37 wrapDotnetProgram "$executable" "$out/bin/$(basename "$executable")" \;
38 done < <(find "$out/lib/$pname" ! -name "*.dll" -executable -type f -print0)
41 echo "Finished dotnetFixupPhase"
44 if [[ -z "${dontDotnetFixup-}" ]]; then
45 preFixupPhases+=" dotnetFixupHook"