2017-05-24 00:26:43 +01:00
|
|
|
{ stdenv, appleDerivation, ICU, dyld, libdispatch, libplatform, launchd, libclosure }:
|
2015-02-08 06:53:52 +00:00
|
|
|
|
2015-08-04 17:55:29 +01:00
|
|
|
# this project uses blocks, a clang-only extension
|
|
|
|
assert stdenv.cc.isClang;
|
|
|
|
|
2015-02-08 06:53:52 +00:00
|
|
|
appleDerivation {
|
2017-05-24 00:26:43 +01:00
|
|
|
buildInputs = [ dyld ICU libdispatch libplatform launchd libclosure ];
|
2015-02-08 06:53:52 +00:00
|
|
|
|
2017-05-24 00:26:43 +01:00
|
|
|
patches = [ ./add-cfmachport.patch ./cf-bridging.patch ./remove-xpc.patch ];
|
2015-07-08 22:14:27 +01:00
|
|
|
|
2015-11-21 23:51:48 +00:00
|
|
|
__propagatedImpureHostDeps = [ "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation" ];
|
2015-02-08 06:53:52 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "/usr/bin/clang" "clang" \
|
|
|
|
--replace "-arch i386 " "" \
|
|
|
|
--replace "/usr/bin/" "" \
|
|
|
|
--replace "/usr/sbin/" "" \
|
|
|
|
--replace "/bin/" "" \
|
|
|
|
--replace "INSTALLNAME=/System" "INSTALLNAME=$out" \
|
2017-07-21 19:29:18 +01:00
|
|
|
--replace "install_name_tool -id /System/Library/Frameworks" "install_name_tool -id @rpath" \
|
2015-02-08 06:53:52 +00:00
|
|
|
--replace 'chown -RH -f root:wheel $(DSTBASE)/CoreFoundation.framework' "" \
|
|
|
|
--replace 'chmod -RH' 'chmod -R'
|
|
|
|
|
2015-11-03 10:12:46 +00:00
|
|
|
# with this file present, CoreFoundation gets a _main symbol defined, which can
|
|
|
|
# interfere with linking other programs
|
|
|
|
rm plconvert.c
|
|
|
|
|
2015-02-08 06:53:52 +00:00
|
|
|
replacement=''$'#define __PTK_FRAMEWORK_COREFOUNDATION_KEY5 55\n#define _pthread_getspecific_direct(key) pthread_getspecific((key))\n#define _pthread_setspecific_direct(key, val) pthread_setspecific((key), (val))'
|
|
|
|
|
|
|
|
substituteInPlace CFPlatform.c --replace "#include <pthread/tsd_private.h>" "$replacement"
|
|
|
|
|
|
|
|
substituteInPlace CFRunLoop.c --replace "#include <pthread/private.h>" ""
|
|
|
|
|
|
|
|
substituteInPlace CFURLPriv.h \
|
|
|
|
--replace "#include <CoreFoundation/CFFileSecurity.h>" "" \
|
|
|
|
--replace "#include <CoreFoundation/CFURLEnumerator.h>" "" \
|
|
|
|
--replace "CFFileSecurityRef" "void *" \
|
|
|
|
--replace "CFURLEnumeratorResult" "void *" \
|
|
|
|
--replace "CFURLEnumeratorRef" "void *"
|
|
|
|
|
|
|
|
export DSTROOT=$out
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mv $out/System/* $out
|
|
|
|
rmdir $out/System
|
2015-11-13 02:59:17 +00:00
|
|
|
mv $out/Library/Frameworks/CoreFoundation.framework/Versions/A/PrivateHeaders/* \
|
|
|
|
$out/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers
|
2015-02-08 06:53:52 +00:00
|
|
|
'';
|
|
|
|
}
|