diff --git a/pkgs/development/libraries/ada/gnatcoll/bindings.nix b/pkgs/development/libraries/ada/gnatcoll/bindings.nix index 9d22551b32a9..146bf1091a70 100644 --- a/pkgs/development/libraries/ada/gnatcoll/bindings.nix +++ b/pkgs/development/libraries/ada/gnatcoll/bindings.nix @@ -14,6 +14,7 @@ , zlib , python3 , ncurses +, darwin }: let @@ -48,6 +49,10 @@ stdenv.mkDerivation rec { python3 ]; + buildInputs = lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.CoreFoundation + ]; + # propagate since gprbuild needs to find referenced .gpr files # and all dependency C libraries when statically linking a # downstream executable. diff --git a/pkgs/development/tools/build-managers/gprbuild/gpr-project-path-hook.sh b/pkgs/development/tools/build-managers/gprbuild/gpr-project-path-hook.sh index f98b2ab9e58d..bd562b925e22 100644 --- a/pkgs/development/tools/build-managers/gprbuild/gpr-project-path-hook.sh +++ b/pkgs/development/tools/build-managers/gprbuild/gpr-project-path-hook.sh @@ -6,3 +6,16 @@ addAdaObjectsPath() { } addEnvHooks "$targetOffset" addAdaObjectsPath + +fixDarwinRpath() { + for f in $(find $out -type f -executable); do + install_name_tool -id $f $f || true + for rpath in $(otool -L $f | grep rpath | awk '{print $1}'); do + install_name_tool -change $rpath $out/lib/$(basename $rpath) $f || true + done + done +} + +if [ "$(uname)" = "Darwin" ]; then + preFixupPhases+=" fixDarwinRpath" +fi