buildDartApplication: Generate LD_LIBRARY_PATH at build time
This allows setup hooks to add runtime dependencies.
This commit is contained in:
parent
1ae96d0704
commit
cf55bc7300
2 changed files with 8 additions and 5 deletions
|
@ -89,7 +89,7 @@ let
|
|||
baseDerivation = stdenv.mkDerivation (finalAttrs: (builtins.removeAttrs args [ "gitHashes" "sdkSourceBuilders" "pubspecLock" ]) // {
|
||||
inherit pubspecLockFile packageConfig sdkSetupScript pubGetScript
|
||||
dartCompileCommand dartOutputType dartRuntimeCommand dartCompileFlags
|
||||
dartJitFlags runtimeDependencies;
|
||||
dartJitFlags;
|
||||
|
||||
outputs = args.outputs or [ ] ++ [ "out" "pubcache" ];
|
||||
|
||||
|
@ -98,7 +98,7 @@ let
|
|||
then writeText "entrypoints.json" (builtins.toJSON dartEntryPoints)
|
||||
else null;
|
||||
|
||||
runtimeDependencyLibraryPath = lib.makeLibraryPath finalAttrs.runtimeDependencies;
|
||||
runtimeDependencies = map lib.getLib runtimeDependencies;
|
||||
|
||||
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
|
||||
dart
|
||||
|
|
|
@ -10,9 +10,12 @@ dartFixupHook() {
|
|||
#
|
||||
# This could alternatively be fixed with patchelf --add-needed, but this would cause all the libraries to be opened immediately,
|
||||
# which is not what application authors expect.
|
||||
echo "$runtimeDependencyLibraryPath"
|
||||
if [[ ! -z "$runtimeDependencyLibraryPath" ]]; then
|
||||
wrapProgramArgs+=(--suffix LD_LIBRARY_PATH : \"$runtimeDependencyLibraryPath\")
|
||||
APPLICATION_LD_LIBRARY_PATH=""
|
||||
for runtimeDependency in "${runtimeDependencies[@]}"; do
|
||||
addToSearchPath APPLICATION_LD_LIBRARY_PATH "${runtimeDependency}/lib"
|
||||
done
|
||||
if [[ ! -z "$APPLICATION_LD_LIBRARY_PATH" ]]; then
|
||||
wrapProgramArgs+=(--suffix LD_LIBRARY_PATH : \"$APPLICATION_LD_LIBRARY_PATH\")
|
||||
fi
|
||||
|
||||
if [[ ! -z "$extraWrapProgramArgs" ]]; then
|
||||
|
|
Loading…
Reference in a new issue