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 fi
done done
done done
if [ -n "${NIX_COREFOUNDATION_RPATH:-}" ]; then
extraAfter+=(-rpath $NIX_COREFOUNDATION_RPATH)
fi
fi fi

View File

@ -134,7 +134,7 @@ let
propagatedBuildInputs = deps; propagatedBuildInputs = deps;
# don't use pure CF for dylibs that depend on frameworks # 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 # allows building the symlink tree
__impureHostDeps = [ "/System/Library/Frameworks/${name}.framework" ]; __impureHostDeps = [ "/System/Library/Frameworks/${name}.framework" ];

View File

@ -29,3 +29,14 @@ fixDarwinFrameworksIn() {
local dir="$1" local dir="$1"
fixDarwinFrameworks $(find "$dir" -name "*.dylib") 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 "/usr/sbin/" "" \
--replace "/bin/" "" \ --replace "/bin/" "" \
--replace "INSTALLNAME=/System" "INSTALLNAME=$out" \ --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 'chown -RH -f root:wheel $(DSTBASE)/CoreFoundation.framework' "" \
--replace 'chmod -RH' 'chmod -R' --replace 'chmod -RH' 'chmod -R'

View File

@ -300,6 +300,7 @@ in rec {
targetPlatform = localSystem; targetPlatform = localSystem;
preHook = commonPreHook + '' preHook = commonPreHook + ''
export NIX_COREFOUNDATION_RPATH=${pkgs.darwin.CF}/Library/Frameworks
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale 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; 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; keepBuildTree = makeSetupHook { } ../build-support/setup-hooks/keep-build-tree.sh;
enableGCOVInstrumentation = makeSetupHook { } ../build-support/setup-hooks/enable-coverage-instrumentation.sh; enableGCOVInstrumentation = makeSetupHook { } ../build-support/setup-hooks/enable-coverage-instrumentation.sh;