summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvarWithoutBones <ivar.scholten@protonmail.com>2022-01-12 00:03:02 +0100
committerIvarWithoutBones <ivar.scholten@protonmail.com>2022-01-12 00:23:53 +0100
commitfcbd42974214dacba9b283166fe8ead0a04644a2 (patch)
treec06b36170511afd5c4f4fcade99c3de0747e43c2
parentMerge pull request #152770 from aij/hackrf (diff)
downloadnixpkgs-fcbd42974214dacba9b283166fe8ead0a04644a2.tar.gz
buildDotnetModule: wrap executables in preFixup
Not doing this used to break wrapGAppsHook as gappsWrapperArgs is set in preFixup, but it was used in installPhase
-rw-r--r--doc/languages-frameworks/dotnet.section.md2
-rw-r--r--pkgs/build-support/build-dotnet-module/default.nix34
2 files changed, 19 insertions, 17 deletions
diff --git a/doc/languages-frameworks/dotnet.section.md b/doc/languages-frameworks/dotnet.section.md
index 88e1a0b29596..f7af28a16775 100644
--- a/doc/languages-frameworks/dotnet.section.md
+++ b/doc/languages-frameworks/dotnet.section.md
@@ -84,7 +84,7 @@ To package Dotnet applications, you can use `buildDotnetModule`. This has simila
<ProjectReference Include="../foo/bar.fsproj" />
<PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/>
```
-* `executables` is used to specify which executables get wrapped to `$out/bin`, relative to `$out/lib/$pname`. If this is unset, all executables generated will get installed. If you do not want to install any, set this to `[]`.
+* `executables` is used to specify which executables get wrapped to `$out/bin`, relative to `$out/lib/$pname`. If this is unset, all executables generated will get installed. If you do not want to install any, set this to `[]`. This gets done in the `preFixup` phase.
* `runtimeDeps` is used to wrap libraries into `LD_LIBRARY_PATH`. This is how dotnet usually handles runtime dependencies.
* `buildType` is used to change the type of build. Possible values are `Release`, `Debug`, etc. By default, this is set to `Release`.
* `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used.
diff --git a/pkgs/build-support/build-dotnet-module/default.nix b/pkgs/build-support/build-dotnet-module/default.nix
index 0a5b17a4a363..49a61f4e5d6d 100644
--- a/pkgs/build-support/build-dotnet-module/default.nix
+++ b/pkgs/build-support/build-dotnet-module/default.nix
@@ -224,7 +224,7 @@ let
"''${dotnetInstallFlags[@]}" \
"''${dotnetFlags[@]}"
done
- '' + (lib.optionalString packNupkg ''
+ '' + lib.optionalString packNupkg ''
for project in ''${projectFile[@]}; do
dotnet pack "$project" \
-p:ContinuousIntegrationBuild=true \
@@ -235,16 +235,24 @@ let
"''${dotnetPackFlags[@]}" \
"''${dotnetFlags[@]}"
done
- '') + (if executables != null then ''
- for executable in $executables; do
+ '' + ''
+ runHook postInstall
+ '';
+
+ preFixup = ''
+ _wrapDotnetProgram() {
+ makeWrapper "$1" "$out/bin/$(basename "$executable")" \
+ --set DOTNET_ROOT "${dotnet-runtime}" \
+ --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \
+ "''${gappsWrapperArgs[@]}" \
+ "''${makeWrapperArgs[@]}"
+ }
+ '' + (if executables != null then ''
+ for executable in ''${executables[@]}; do
execPath="$out/lib/${args.pname}/$executable"
if [[ -f "$execPath" && -x "$execPath" ]]; then
- makeWrapper "$execPath" "$out/bin/$(basename "$executable")" \
- --set DOTNET_ROOT "${dotnet-runtime}" \
- --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \
- "''${gappsWrapperArgs[@]}" \
- "''${makeWrapperArgs[@]}"
+ _wrapDotnetProgram $execPath
else
echo "Specified binary \"$executable\" is either not an executable, or does not exist!"
exit 1
@@ -253,16 +261,10 @@ let
'' else ''
for executable in $out/lib/${args.pname}/*; do
if [[ -f "$executable" && -x "$executable" && "$executable" != *"dll"* ]]; then
- makeWrapper "$executable" "$out/bin/$(basename "$executable")" \
- --set DOTNET_ROOT "${dotnet-runtime}" \
- --suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \
- "''${gappsWrapperArgs[@]}" \
- "''${makeWrapperArgs[@]}"
+ _wrapDotnetProgram $executable
fi
done
- '') + ''
- runHook postInstall
- '';
+ '');
});
in
package