Merge pull request #230710 from wegank/gnatcoll-core-hack

gnatcoll-core: fix build on x86_64-darwin
This commit is contained in:
Weijia Wang
2023-05-09 12:13:18 +03:00
committed by GitHub
2 changed files with 18 additions and 0 deletions
@@ -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.
@@ -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