Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
useCoreFoundationFramework () {
# Avoid overriding value set by the impure CF
if [ -z "${NIX_COREFOUNDATION_RPATH+x}" ]; then
export NIX_COREFOUNDATION_RPATH=@out@/Library/Frameworks
fi
}

addEnvHooks "$hostOffset" useCoreFoundationFramework
9 changes: 6 additions & 3 deletions pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ lib, stdenv, fetchFromGitHub, fetchurl, ninja, python3, curl, libxml2, objc4, ICU }:
{ lib, stdenv, fetchFromGitHub, fetchurl, ninja, python3, curl, libxml2, objc4, ICU
, withRpathHook ? true }:

let
# 10.12 adds a new sysdir.h that our version of CF in the main derivation depends on, but
Expand All @@ -10,7 +11,7 @@ let
};
in

stdenv.mkDerivation {
stdenv.mkDerivation ({
pname = "swift-corefoundation";
version = "unstable-2018-09-14";

Expand Down Expand Up @@ -104,4 +105,6 @@ stdenv.mkDerivation {
ln -s Versions/Current/$i $base/$i
done
'';
}
} // lib.optionalAttrs withRpathHook {
setupHook = ./corefoundation-setup-hook.sh;
})
15 changes: 8 additions & 7 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ let
"/usr/lib/system/libunc.dylib" # This dependency is "hidden", so our scanning code doesn't pick it up
];

withoutRpathHook = drv: if useAppleSDKLibs then drv else drv.override { withRpathHook = false; };
in
rec {
commonPreHook = ''
Expand Down Expand Up @@ -461,7 +462,8 @@ rec {
darwin = super.darwin.overrideScope (_: _: {
inherit (darwin)
binutils dyld Libsystem xnu configd ICU libdispatch libclosure
launchd CF objc4 darwin-stubs sigtool postLinkSignHook signingUtils;
launchd objc4 darwin-stubs sigtool postLinkSignHook signingUtils;
CF = withoutRpathHook darwin.CF;
});
};
in
Expand All @@ -471,7 +473,7 @@ rec {
'';

extraNativeBuildInputs = [ pkgs.xz ];
extraBuildInputs = [ pkgs.darwin.CF ];
extraBuildInputs = [ (withoutRpathHook pkgs.darwin.CF) ];
libcxx = pkgs."${finalLlvmPackages}".libcxx;

allowedRequisites =
Expand Down Expand Up @@ -541,7 +543,7 @@ rec {
# and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and
# patches our shebangs back to point at bootstrapTools. This makes sure bash comes first.
extraNativeBuildInputs = with pkgs; [ xz ];
extraBuildInputs = [ pkgs.darwin.CF pkgs.bash ];
extraBuildInputs = [ (withoutRpathHook pkgs.darwin.CF) pkgs.bash ];
libcxx = pkgs."${finalLlvmPackages}".libcxx;

extraPreHook = ''
Expand Down Expand Up @@ -617,17 +619,17 @@ rec {

# See useAppleSDKLibs in darwin-packages.nix
CF = if useAppleSDKLibs then super.darwin.CF else
superDarwin.CF.override {
withoutRpathHook (superDarwin.CF.override {
inherit libxml2;
python3 = prevStage.python3;
};
});
});
};
in
with prevStage; stageFun 4 prevStage {
shell = "${pkgs.bash}/bin/bash";
extraNativeBuildInputs = with pkgs; [ xz ];
extraBuildInputs = [ pkgs.darwin.CF pkgs.bash ];
extraBuildInputs = [ (withoutRpathHook pkgs.darwin.CF) pkgs.bash ];
libcxx = pkgs."${finalLlvmPackages}".libcxx;

extraPreHook = ''
Expand Down Expand Up @@ -681,7 +683,6 @@ rec {
targetPlatform = localSystem;

preHook = commonPreHook + ''
export NIX_COREFOUNDATION_RPATH=${pkgs.darwin.CF}/Library/Frameworks
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
'';

Expand Down