map apple sdk frameworks CF to darwin.CF to avoid confusion

This commit is contained in:
Jude Taylor 2015-07-08 14:14:27 -07:00
parent cb3e282cda
commit 976d80eb57
7 changed files with 95 additions and 13 deletions

View File

@ -14,6 +14,12 @@ stdenv.mkDerivation rec {
sha256 = "1z0qarf6a2smab28g9dnxklhfayn85wx48bnddmyhb9kqzjgqgjc";
};
# this makes maintainers very sad
# open source CF doesn't have anything NSArray-related, causing linking errors. the
# missing symbol is in system CoreFoundation.
NIX_LDFLAGS = stdenv.lib.optional stdenv.isDarwin
"/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation";
enableParallelBuilding = true;
buildInputs = [ ncurses pkgconfig ]

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, xar, gzip, cpio }:
{ stdenv, fetchurl, xar, gzip, cpio, CF }:
let
# I'd rather not "export" this, since they're somewhat monolithic and encourage bad habits.
@ -146,5 +146,9 @@ in rec {
};
};
frameworks = stdenv.lib.mapAttrs framework (import ./frameworks.nix { inherit frameworks libs; });
frameworks = (stdenv.lib.mapAttrs framework (import ./frameworks.nix { inherit frameworks libs; })) // {
CoreFoundation = CF;
};
inherit sdk;
}

View File

@ -26,8 +26,7 @@ with frameworks; with libs; {
CoreAudio = [ CoreFoundation IOKit ];
CoreAudioKit = [ AudioUnit ];
CoreData = [];
CoreFoundation = [];
CoreGraphics = [ Accelerate CoreFoundation IOKit IOSurface ];
CoreGraphics = [ Accelerate CoreFoundation IOKit IOSurface SystemConfiguration ];
CoreLocation = [];
CoreMIDI = [ CoreFoundation ];
CoreMIDIServer = [];
@ -110,7 +109,7 @@ with frameworks; with libs; {
Accelerate = [ CoreWLAN IOBluetooth ];
ApplicationServices = [ CoreFoundation CoreServices CoreText ImageIO ];
Carbon = [ ApplicationServices CoreFoundation CoreServices IOKit Security ];
CoreServices = [ CFNetwork CoreFoundation DiskArbitration Security NetFS OpenDirectory ServiceManagement ];
CoreServices = [ CFNetwork CoreAudio CoreData CoreFoundation DiskArbitration Security NetFS OpenDirectory ServiceManagement ];
IOBluetooth = [ IOKit ];
JavaVM = [];
OpenDirectory = [];

View File

@ -1,9 +1,8 @@
{
CoreFoundation = [
"/System/Library/Frameworks/CoreFoundation.framework"
];
rec {
CFNetwork = [
"/System/Library/Frameworks/CFNetwork.framework"
"/usr/lib/libsqlite3.dylib"
"/usr/lib/libxml2.2.dylib"
];
IOKit = [
"/System/Library/Frameworks/IOKit.framework"
@ -13,15 +12,28 @@
];
Security = [
"/System/Library/Frameworks/Security.framework"
"/usr/lib/libbz2.1.0.dylib"
"/usr/lib/libpam.2.dylib"
"/usr/lib/libxar.1.dylib"
];
CoreServices = [
"/System/Library/Frameworks/CoreServices.framework"
];
"/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/DataDetectorsCore"
"/System/Library/PrivateFrameworks/TCC.framework/Versions/A/TCC"
"/System/Library/PrivateFrameworks/LanguageModeling.framework/Versions/A/LanguageModeling"
"/usr/lib/libmecabra.dylib"
"/usr/lib/libcmph.dylib"
"/usr/lib/libiconv.2.dylib"
"/usr/lib/libxslt.1.dylib"
] ++ Foundation;
IOSurface = [
"/System/Library/Frameworks/IOSurface.framework"
];
CoreGraphics = [
"/System/Library/Frameworks/CoreGraphics.framework"
"/System/Library/PrivateFrameworks/MultitouchSupport.framework/Versions/A/MultitouchSupport"
"/usr/lib/libbsm.0.dylib"
"/usr/lib/libz.1.dylib"
];
CoreText = [
"/System/Library/Frameworks/CoreText.framework"
@ -31,7 +43,9 @@
];
ApplicationServices = [
"/System/Library/Frameworks/ApplicationServices.framework"
];
"/usr/lib/libcups.2.dylib"
"/usr/lib/libresolv.9.dylib"
] ++ AudioToolbox;
OpenGL = [
"/System/Library/Frameworks/OpenGL.framework"
];
@ -102,6 +116,10 @@
Foundation = [
"/System/Library/Frameworks/Foundation.framework"
"/usr/lib/libextension.dylib"
"/usr/lib/libarchive.2.dylib"
"/usr/lib/liblzma.5.dylib"
"/usr/lib/liblangid.dylib"
"/usr/lib/libCRFSuite.dylib"
];
CoreData = [
"/System/Library/Frameworks/CoreData.framework"
@ -131,6 +149,8 @@
];
NetFS = [
"/System/Library/Frameworks/NetFS.framework"
"/System/Library/PrivateFrameworks/NetAuth.framework/Versions/A/NetAuth"
"/System/Library/PrivateFrameworks/login.framework/Versions/A/Frameworks/loginsupport.framework/Versions/A/loginsupport"
];
Accelerate = [
"/System/Library/Frameworks/Accelerate.framework"

View File

@ -0,0 +1,39 @@
diff --git a/CFBase.h b/CFBase.h
index ffddd2b..e5a926b 100644
--- a/CFBase.h
+++ b/CFBase.h
@@ -249,6 +249,33 @@ CF_EXTERN_C_BEGIN
#endif
#endif
+#if __has_attribute(objc_bridge) && __has_feature(objc_bridge_id) && __has_feature(objc_bridge_id_on_typedefs)
+
+#ifdef __OBJC__
+@class NSArray;
+@class NSAttributedString;
+@class NSString;
+@class NSNull;
+@class NSCharacterSet;
+@class NSData;
+@class NSDate;
+@class NSTimeZone;
+@class NSDictionary;
+@class NSError;
+@class NSLocale;
+@class NSNumber;
+@class NSSet;
+@class NSURL;
+#endif
+
+#define CF_BRIDGED_TYPE(T) __attribute__((objc_bridge(T)))
+#define CF_BRIDGED_MUTABLE_TYPE(T) __attribute__((objc_bridge_mutable(T)))
+#define CF_RELATED_TYPE(T,C,I) __attribute__((objc_bridge_related(T,C,I)))
+#else
+#define CF_BRIDGED_TYPE(T)
+#define CF_BRIDGED_MUTABLE_TYPE(T)
+#define CF_RELATED_TYPE(T,C,I)
+#endif
CF_EXPORT double kCFCoreFoundationVersionNumber;

View File

@ -3,7 +3,16 @@
appleDerivation {
buildInputs = [ dyld icu libdispatch launchd libclosure ];
patches = [ ./add-cf-initialize.patch ./add-cfmachport.patch ];
patches = [ ./add-cf-initialize.patch ./add-cfmachport.patch ./cf-bridging.patch ];
# CFAttributedString.h is in the SDK only, not on opensource.apple.com or github
__propagatedImpureHostDeps = [
"/System/Library/Frameworks/CoreFoundation.framework"
"/usr/lib/libc++.1.dylib"
"/usr/lib/libc++abi.dylib"
"/usr/lib/libicucore.A.dylib"
"/usr/lib/libz.1.dylib"
];
preBuild = ''
substituteInPlace Makefile \
@ -35,6 +44,9 @@ appleDerivation {
'';
postInstall = ''
# gross! convince apple to release this as part of CF
cp /System/Library/Frameworks/CoreFoundation.framework/Headers/CFAttributedString.h "$out/System/Library/Frameworks/CoreFoundation.framework/Headers"
mv $out/System/* $out
rmdir $out/System
'';

View File

@ -9343,7 +9343,9 @@ let
cmdline_sdk = cmdline.sdk;
cmdline_tools = cmdline.tools;
apple_sdk = callPackage ../os-specific/darwin/apple-sdk {};
apple_sdk = callPackage ../os-specific/darwin/apple-sdk {
inherit (darwin) CF;
};
libobjc = apple-source-releases.objc4;
};