mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
darwin.apple_sdk.frameworks: remove NIX_COREFOUNDATION_RPATH hook
Darwin no longer supports switching between CoreFoundation implementations as of https://github.com/NixOS/nixpkgs/pull/265102. The setup hook is vestigial and was mostly harmless until https://github.com/NixOS/nixpkgs/pull/329526 was necessitated to fix build failures on staging-next https://github.com/NixOS/nixpkgs/pull/328673. The correct fix is to remove the hook. It’s not used by the 11.0 or 12.3 SDKs. This makes the 10.12 SDK a bit more like the other SDKs.
This commit is contained in:
parent
e88f0cf2f2
commit
2c54952847
@ -226,12 +226,6 @@ if [[ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 && "$linkType" != static-pie ]]; t
|
||||
|
||||
fi
|
||||
|
||||
# This is outside the DONT_SET_RPATH branch because it's more targeted and we
|
||||
# usually want it (on Darwin) even if DONT_SET_RPATH is set.
|
||||
if [ -n "${NIX_COREFOUNDATION_RPATH:-}" ]; then
|
||||
extraAfter+=(-rpath $NIX_COREFOUNDATION_RPATH)
|
||||
fi
|
||||
|
||||
# Only add --build-id if this is a final link. FIXME: should build gcc
|
||||
# with --enable-linker-build-id instead?
|
||||
#
|
||||
|
@ -41,9 +41,6 @@ in
|
||||
|
||||
# Apparently --bindir is not respected.
|
||||
makeFlagsArray+=("bindir=$bin/bin" "sbindir=$bin/sbin" "rootsbindir=$bin/sbin")
|
||||
'' + lib.optionalString stdenv.buildPlatform.isDarwin ''
|
||||
# ld-wrapper will otherwise attempt to inject CoreFoundation into ld-linux's RUNPATH
|
||||
export NIX_COREFOUNDATION_RPATH=
|
||||
'';
|
||||
|
||||
# The pie, stackprotector and fortify hardening flags are autodetected by
|
||||
|
@ -163,17 +163,6 @@ let
|
||||
|
||||
propagatedBuildInputs = builtins.attrValues deps;
|
||||
|
||||
# don't use pure CF for dylibs that depend on frameworks
|
||||
setupHook = ./framework-setup-hook.sh;
|
||||
|
||||
# Not going to be more specific than this for now
|
||||
__propagatedImpureHostDeps = lib.optionals (name != "Kernel") [
|
||||
# The setup-hook ensures that everyone uses the impure CoreFoundation who uses these SDK frameworks, so let's expose it
|
||||
"/System/Library/Frameworks/CoreFoundation.framework"
|
||||
"/System/Library/Frameworks/${name}.framework"
|
||||
"/System/Library/Frameworks/${name}.framework/${name}"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Apple SDK framework ${name}";
|
||||
maintainers = with maintainers; [ copumpkin ];
|
||||
|
@ -1,42 +0,0 @@
|
||||
# On macOS, frameworks are linked to the system CoreFoundation but
|
||||
# dynamic libraries built with nix use a pure version of CF this
|
||||
# causes segfaults for binaries that depend on it at runtime. This
|
||||
# can be solved in two ways.
|
||||
# 1. Rewrite references to the pure CF using this setup hook, this
|
||||
# works for the simple case but this can still cause problems if other
|
||||
# dependencies (eg. python) use the pure CF.
|
||||
# 2. Create a wrapper for the binary that sets DYLD_FRAMEWORK_PATH to
|
||||
# /System/Library/Frameworks. This will make everything load the
|
||||
# system's CoreFoundation framework while still keeping the
|
||||
# dependencies pure for other packages.
|
||||
|
||||
fixupOutputHooks+=('fixDarwinFrameworksIn $prefix')
|
||||
|
||||
fixDarwinFrameworks() {
|
||||
local systemPrefix='/System/Library/Frameworks'
|
||||
|
||||
for fn in "$@"; do
|
||||
if [ -L "$fn" ]; then continue; fi
|
||||
echo "$fn: fixing dylib"
|
||||
|
||||
for framework in $(otool -L "$fn" | awk '/CoreFoundation\.framework/ {print $1}'); do
|
||||
install_name_tool -change "$framework" "$systemPrefix/CoreFoundation.framework/Versions/A/CoreFoundation" "$fn" >&2
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
addEnvHooks "$hostOffset" useSystemCoreFoundationFramework
|
@ -86,6 +86,5 @@ stdenv.mkDerivation {
|
||||
"$out/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation"
|
||||
|
||||
mkdir -p "$out/nix-support"
|
||||
substituteAll ${./pure-corefoundation-hook.sh} "$out/nix-support/setup-hook"
|
||||
'';
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
usePureCoreFoundation() {
|
||||
# Avoid overriding value set by the impure CF
|
||||
if [ -z "${NIX_COREFOUNDATION_RPATH:-}" ]; then
|
||||
export NIX_COREFOUNDATION_RPATH=@out@/Library/Frameworks
|
||||
fi
|
||||
}
|
||||
addEnvHooks "$hostOffset" usePureCoreFoundation
|
Loading…
Reference in New Issue
Block a user