diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-02-27 12:01:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-27 12:01:09 +0000 |
commit | 6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903 (patch) | |
tree | 095234b88078fb8675b7c48585c5440a980a08fe /pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh | |
parent | d8e40250665ef073afc1d208f9f911c2fd4ab397 (diff) | |
parent | 6896623f630ce8703e2201625eabd9f01dfcc5e0 (diff) | |
download | nixpkgs-6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903.tar nixpkgs-6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903.tar.gz nixpkgs-6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903.tar.bz2 nixpkgs-6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903.tar.lz nixpkgs-6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903.tar.xz nixpkgs-6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903.tar.zst nixpkgs-6fab7a16fa3e2a9328cf2c11bfed50ff3c3f7903.zip |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh')
-rw-r--r-- | pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh new file mode 100644 index 00000000000..f8bbb7b1805 --- /dev/null +++ b/pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-fixup-hook.sh @@ -0,0 +1,42 @@ +declare -a makeWrapperArgs gappsWrapperArgs + +# First argument is the executable you want to wrap, +# the second is the destination for the wrapper. +wrapDotnetProgram() { + makeWrapper "$1" "$2" \ + --set "DOTNET_ROOT" "@dotnetRuntime@" \ + --suffix "LD_LIBRARY_PATH" : "@runtimeDeps@" \ + "${gappsWrapperArgs[@]}" \ + "${makeWrapperArgs[@]}" + + echo "Installed wrapper to: "$2"" +} + +dotnetFixupHook() { + echo "Executing dotnetFixupPhase" + + if [ "${executables-}" ]; then + for executable in ${executables[@]}; do + execPath="$out/lib/${pname-}/$executable" + + if [[ -f "$execPath" && -x "$execPath" ]]; then + wrapDotnetProgram "$execPath" "$out/bin/$(basename "$executable")" + else + echo "Specified binary \"$executable\" is either not an executable, or does not exist!" + exit 1 + fi + done + else + for executable in $out/lib/${pname-}/*; do + if [[ -f "$executable" && -x "$executable" && "$executable" != *"dll"* ]]; then + wrapDotnetProgram "$executable" "$out/bin/$(basename "$executable")" + fi + done + fi + + echo "Finished dotnetFixupPhase" +} + +if [[ -z "${dontDotnetFixup-}" ]]; then + preFixupPhases+=" dotnetFixupHook" +fi |