about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorhacker1024 <hacker1024@users.sourceforge.net>2023-10-22 00:14:42 +1100
committerhacker1024 <hacker1024@users.sourceforge.net>2023-10-22 00:14:42 +1100
commitbecdfbe17c5a2104a9e7e024910c6157b1cd10dd (patch)
treeead0338dd0534f10af747e7f5e0f1f54dd7a1431 /pkgs/build-support
parent5391c0204e54b0d1852415108f20ad316f20cdaf (diff)
buildDartApplication: Recognise extraWrapProgramArgs
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/dart/build-dart-application/default.nix1
-rw-r--r--pkgs/build-support/dart/build-dart-application/hooks/dart-fixup-hook.sh25
2 files changed, 19 insertions, 7 deletions
diff --git a/pkgs/build-support/dart/build-dart-application/default.nix b/pkgs/build-support/dart/build-dart-application/default.nix
index 7920a3d61a7a8..76328e5645f6b 100644
--- a/pkgs/build-support/dart/build-dart-application/default.nix
+++ b/pkgs/build-support/dart/build-dart-application/default.nix
@@ -25,6 +25,7 @@
   else null
 
 , runtimeDependencies ? [ ]
+, extraWrapProgramArgs ? ""
 , customPackageOverrides ? { }
 , autoDepsList ? false
 , depsListFile ? null
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 6e1995aebc13c..dd96ab374860b 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
@@ -3,15 +3,26 @@
 dartFixupHook() {
     echo "Executing dartFixupHook"
 
-    echo "Providing runtime dependencies"
+    declare -a wrapProgramArgs
+
+    # Add runtime library dependencies to the LD_LIBRARY_PATH.
+    # For some reason, the RUNPATH of the executable is not used to load dynamic libraries in dart:ffi with DynamicLibrary.open().
+    #
+    # 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
-        # Add runtime library dependencies to the LD_LIBRARY_PATH.
-        # For some reason, the RUNPATH of the executable is not used to load dynamic libraries in dart:ffi with DynamicLibrary.open().
-        #
-        # 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.
+        wrapProgramArgs+=(--suffix LD_LIBRARY_PATH : \"$runtimeDependencyLibraryPath\")
+    fi
+
+    if [[ ! -z "$extraWrapProgramArgs" ]]; then
+        wrapProgramArgs+=("$extraWrapProgramArgs")
+    fi
+
+    if [ ${#wrapProgramArgs[@]} -ne 0 ]; then
         for f in "$out"/bin/*; do
-            wrapProgram "$f" --suffix LD_LIBRARY_PATH : "$runtimeDependencyLibraryPath"
+            echo "Wrapping $f..."
+            eval "wrapProgram \"$f\" ${wrapProgramArgs[@]}"
         done
     fi