diff options
author | hacker1024 <hacker1024@users.sourceforge.net> | 2023-10-29 00:46:29 +1100 |
---|---|---|
committer | FlafyDev <flafyarazi@gmail.com> | 2023-12-26 17:08:51 +0200 |
commit | cf55bc7300560f63f4e76521dbd163a00b060769 (patch) | |
tree | fddb536564d7088164dcc330ce4742f6e0222c3f /pkgs/build-support/dart | |
parent | 1ae96d070420e87b8c23ccd60990eb4a061d62f4 (diff) |
buildDartApplication: Generate LD_LIBRARY_PATH at build time
This allows setup hooks to add runtime dependencies.
Diffstat (limited to 'pkgs/build-support/dart')
-rw-r--r-- | pkgs/build-support/dart/build-dart-application/default.nix | 4 | ||||
-rw-r--r-- | pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/pkgs/build-support/dart/build-dart-application/default.nix b/pkgs/build-support/dart/build-dart-application/default.nix index 6ddd4a07d992f..2e99479c9bb04 100644 --- a/pkgs/build-support/dart/build-dart-application/default.nix +++ b/pkgs/build-support/dart/build-dart-application/default.nix @@ -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 diff --git a/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh b/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh index c5a9bedd0665a..60bd74871c92f 100644 --- a/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh +++ b/pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh @@ -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 |