nixpkgs/pkgs/os-specific/darwin/swift-corefoundation/default.nix
Dan Peebles 1861744e7c swift-corefoundation: init
This currently only produces a static library, but is a start :) soon we
might be able to incorporate it into our stdenv, but we need to get the
build system to produce a proper .framework first.
2016-08-14 17:35:44 -04:00

39 lines
1 KiB
Nix

{ stdenv, fetchFromGitHub, python, ninja, libpthread, libxml2 }:
stdenv.mkDerivation {
name = "swift-corefoundation";
src = fetchFromGitHub {
owner = "apple";
repo = "swift-corelibs-foundation";
rev = "87d1a97d6af07fec568765c47daddff0aaa0d59c";
sha256 = "05cmqwzqqxb489g9hq7hhj2yva12pi488iblbpnvyk1y4nx077cw";
};
buildInputs = [ ninja python libpthread libxml2 ];
patchPhase = ''
HACK=$PWD/hack
mkdir -p $HACK/CoreFoundation
cp CoreFoundation/Base.subproj/CFAsmMacros.h $HACK/CoreFoundation
substituteInPlace CoreFoundation/build.py \
--replace "','" "'," \
--replace '-I''${SYSROOT}/usr/include/libxml2' '-I${libxml2.dev}/include/libxml2' \
--replace 'cf.ASFLAGS = " ".join([' "cf.ASFLAGS = ' '.join([ '-I$HACK', " \
'';
configureFlags = "--sysroot unused";
buildPhase = ''
cd CoreFoundation
../configure --sysroot foo
ninja
'';
installPhase = ''
mkdir -p $out/lib
cp ../Build/CoreFoundation/libCoreFoundation.a $out/lib
'';
}