buildDotnetModule: wrap executables in preFixup
Not doing this used to break wrapGAppsHook as gappsWrapperArgs is set in preFixup, but it was used in installPhase
This commit is contained in:
parent
b0b40f863b
commit
fcbd429742
@ -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.
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user