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" />
|
<ProjectReference Include="../foo/bar.fsproj" />
|
||||||
<PackageReference Include="bar" Version="*" Condition=" '$(ContinuousIntegrationBuild)'=='true' "/>
|
<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.
|
* `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`.
|
* `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.
|
* `dotnet-sdk` is useful in cases where you need to change what dotnet SDK is being used.
|
||||||
|
|
|
@ -224,7 +224,7 @@ let
|
||||||
"''${dotnetInstallFlags[@]}" \
|
"''${dotnetInstallFlags[@]}" \
|
||||||
"''${dotnetFlags[@]}"
|
"''${dotnetFlags[@]}"
|
||||||
done
|
done
|
||||||
'' + (lib.optionalString packNupkg ''
|
'' + lib.optionalString packNupkg ''
|
||||||
for project in ''${projectFile[@]}; do
|
for project in ''${projectFile[@]}; do
|
||||||
dotnet pack "$project" \
|
dotnet pack "$project" \
|
||||||
-p:ContinuousIntegrationBuild=true \
|
-p:ContinuousIntegrationBuild=true \
|
||||||
|
@ -235,16 +235,24 @@ let
|
||||||
"''${dotnetPackFlags[@]}" \
|
"''${dotnetPackFlags[@]}" \
|
||||||
"''${dotnetFlags[@]}"
|
"''${dotnetFlags[@]}"
|
||||||
done
|
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"
|
execPath="$out/lib/${args.pname}/$executable"
|
||||||
|
|
||||||
if [[ -f "$execPath" && -x "$execPath" ]]; then
|
if [[ -f "$execPath" && -x "$execPath" ]]; then
|
||||||
makeWrapper "$execPath" "$out/bin/$(basename "$executable")" \
|
_wrapDotnetProgram $execPath
|
||||||
--set DOTNET_ROOT "${dotnet-runtime}" \
|
|
||||||
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \
|
|
||||||
"''${gappsWrapperArgs[@]}" \
|
|
||||||
"''${makeWrapperArgs[@]}"
|
|
||||||
else
|
else
|
||||||
echo "Specified binary \"$executable\" is either not an executable, or does not exist!"
|
echo "Specified binary \"$executable\" is either not an executable, or does not exist!"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -253,16 +261,10 @@ let
|
||||||
'' else ''
|
'' else ''
|
||||||
for executable in $out/lib/${args.pname}/*; do
|
for executable in $out/lib/${args.pname}/*; do
|
||||||
if [[ -f "$executable" && -x "$executable" && "$executable" != *"dll"* ]]; then
|
if [[ -f "$executable" && -x "$executable" && "$executable" != *"dll"* ]]; then
|
||||||
makeWrapper "$executable" "$out/bin/$(basename "$executable")" \
|
_wrapDotnetProgram $executable
|
||||||
--set DOTNET_ROOT "${dotnet-runtime}" \
|
|
||||||
--suffix LD_LIBRARY_PATH : "${lib.makeLibraryPath runtimeDeps}" \
|
|
||||||
"''${gappsWrapperArgs[@]}" \
|
|
||||||
"''${makeWrapperArgs[@]}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
'') + ''
|
'');
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
package
|
package
|
||||||
|
|
Loading…
Reference in a new issue