Merge pull request #27598 from LnL7/darwin-cf-rpath

CoreFoundation: use rpath to fix issues when using frameworks
This commit is contained in:
Daiderd Jordan 2017-08-29 22:16:56 +02:00 committed by GitHub
commit adca58c2e7
6 changed files with 18 additions and 4 deletions

View file

@ -145,6 +145,10 @@ if [ "$NIX_@infixSalt@_DONT_SET_RPATH" != 1 ]; then
fi
done
done
if [ -n "${NIX_COREFOUNDATION_RPATH:-}" ]; then
extraAfter+=(-rpath $NIX_COREFOUNDATION_RPATH)
fi
fi

View file

@ -134,7 +134,7 @@ let
propagatedBuildInputs = deps;
# don't use pure CF for dylibs that depend on frameworks
setupHook = ../../../build-support/setup-hooks/fix-darwin-frameworks.sh;
setupHook = ./framework-setup-hook.sh;
# allows building the symlink tree
__impureHostDeps = [ "/System/Library/Frameworks/${name}.framework" ];

View file

@ -29,3 +29,14 @@ fixDarwinFrameworksIn() {
local dir="$1"
fixDarwinFrameworks $(find "$dir" -name "*.dylib")
}
# This configures the stdenv to use /System/Library/Frameworks/CoreFoundation.framework
# instead of the nix version by including the system frameworks path
# as an rpath entry when creating binaries.
useSystemCoreFoundationFramework () {
export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks
}
envHooks+=(useSystemCoreFoundationFramework)

View file

@ -18,7 +18,7 @@ appleDerivation {
--replace "/usr/sbin/" "" \
--replace "/bin/" "" \
--replace "INSTALLNAME=/System" "INSTALLNAME=$out" \
--replace "install_name_tool -id /System" "install_name_tool -id $out" \
--replace "install_name_tool -id /System/Library/Frameworks" "install_name_tool -id @rpath" \
--replace 'chown -RH -f root:wheel $(DSTBASE)/CoreFoundation.framework' "" \
--replace 'chmod -RH' 'chmod -R'

View file

@ -300,6 +300,7 @@ in rec {
targetPlatform = localSystem;
preHook = commonPreHook + ''
export NIX_COREFOUNDATION_RPATH=${pkgs.darwin.CF}/Library/Frameworks
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
'';

View file

@ -328,8 +328,6 @@ with pkgs;
fixDarwinDylibNames = makeSetupHook { } ../build-support/setup-hooks/fix-darwin-dylib-names.sh;
fixDarwinFrameworks = makeSetupHook { } ../build-support/setup-hooks/fix-darwin-frameworks.sh;
keepBuildTree = makeSetupHook { } ../build-support/setup-hooks/keep-build-tree.sh;
enableGCOVInstrumentation = makeSetupHook { } ../build-support/setup-hooks/enable-coverage-instrumentation.sh;