gprbuild: fix rpath only when targeting darwin
This commit is contained in:
parent
a8eea70935
commit
6034ebb9ff
|
@ -53,7 +53,14 @@ stdenv.mkDerivation {
|
|||
# introducing a wrapper for it in the future remains TODO.
|
||||
# For the moment this doesn't matter since we have no situation
|
||||
# were gprbuild is used to build something used at build time.
|
||||
setupHook = ./gpr-project-path-hook.sh;
|
||||
setupHooks = [
|
||||
./gpr-project-path-hook.sh
|
||||
] ++ lib.optionals stdenv.targetPlatform.isDarwin [
|
||||
# This setupHook replaces the paths of shared libraries starting
|
||||
# with @rpath with the absolute paths on Darwin, so that the
|
||||
# binaries can be run without additional setup.
|
||||
./gpr-project-darwin-rpath-hook.sh
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
|
|
@ -17,7 +17,7 @@ stdenv.mkDerivation {
|
|||
inherit (gprbuild-boot)
|
||||
version
|
||||
src
|
||||
setupHook
|
||||
setupHooks
|
||||
meta
|
||||
;
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
fixGprProjectDarwinRpath() {
|
||||
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 ${!outputLib}/lib/$(basename $rpath) $f || true
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
preFixupPhases+=" fixGprProjectDarwinRpath"
|
|
@ -6,16 +6,3 @@ 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
|
||||
|
|
Loading…
Reference in a new issue