cf-private: prepend self to system includes

This commit is contained in:
Jude Taylor 2015-10-26 17:12:45 -07:00
parent 0a23e412b4
commit 5ea8770263
3 changed files with 29 additions and 9 deletions

View File

@ -34,7 +34,7 @@ let
cd Library/Frameworks/QuartzCore.framework/Versions/A/Headers
for file in CI*.h; do
rm $file
ln -s ../Frameworks/CoreImage.framework/Versions/A/Headers/$file
ln -s ../Frameworks/CoreImage.framework/Headers/$file
done
'';
@ -151,10 +151,6 @@ in rec {
};
overrides = super: {
CoreText = stdenv.lib.overrideDerivation super.CoreText (drv: {
propagatedNativeBuildInputs = drv.propagatedNativeBuildInputs ++ [ pkgs.darwin.cf-private ];
});
QuartzCore = stdenv.lib.overrideDerivation super.QuartzCore (drv: {
installPhase = drv.installPhase + ''
f="$out/Library/Frameworks/QuartzCore.framework/Headers/CoreImage.h"

View File

@ -3,16 +3,28 @@
let
headers = [
"CFAttributedString.h"
"CFFileDescriptor.h"
"CFFileSecurity.h"
"CFNotificationCenter.h"
"CFStringTokenizer.h"
"CFURLEnumerator.h"
"CoreFoundation.h"
];
in stdenv.mkDerivation {
name = "${CF.name}-private";
unpackPhase = ":";
buildPhase = ":";
phases = [ "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out/include/CoreFoundation
install -m 0644 ${osx_private_sdk}/PrivateSDK10.10.sparse.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/{${stdenv.lib.concatStringsSep "," headers}} $out/include/CoreFoundation
dest=$out/Library/Frameworks/CoreFoundation.framework/Headers
mkdir -p $dest
pushd $dest
for file in ${CF}/Library/Frameworks/CoreFoundation.framework/Headers/*; do
ln -s $file
done
popd
install -m 0644 ${osx_private_sdk}/PrivateSDK10.10.sparse.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/{${stdenv.lib.concatStringsSep "," headers}} $dest
'';
setupHook = ./setup-hook.sh;
}

View File

@ -0,0 +1,12 @@
prependSearchPath() {
NIX_CFLAGS_COMPILE="-F@out@/Library/Frameworks ${NIX_CFLAGS_COMPILE/"-F@out@/Library/Frameworks"/}"
}
linkWithRealCF() {
# gross! many symbols (such as _OBJC_CLASS_$_NSArray) are defined in system CF, but not
# in the opensource release
# if the package needs private headers, we assume they also want to link with system CF
NIX_LDFLAGS+=" /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"
}
preConfigureHooks+=(prependSearchPath linkWithRealCF)