1{ stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng, CoreServices, CoreGraphics, ImageIO, ninja }:
2
3let
4 googletest = fetchFromGitHub {
5 owner = "google";
6 repo = "googletest";
7 rev = "43359642a1c16ad3f4fc575c7edd0cb935810815";
8 sha256 = "0y4xaah62fjr3isaryc3vfz3mn9xflr00vchdimj8785milxga4q";
9 };
10
11 linenoise = fetchFromGitHub {
12 owner = "antirez";
13 repo = "linenoise";
14 rev = "c894b9e59f02203dbe4e2be657572cf88c4230c3";
15 sha256 = "0wasql7ph5g473zxhc2z47z3pjp42q0dsn4gpijwzbxawid71b4w";
16 };
17in stdenv.mkDerivation rec {
18 name = "xcbuild-${version}";
19
20 # Once a version is released that includes https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710,
21 # we can stop doing this -pre thing.
22 version = "0.1.2-pre";
23
24 src = fetchFromGitHub {
25 owner = "facebook";
26 repo = "xcbuild";
27 rev = "32b9fbeb69bfa2682bd0351ec2f14548aaedd554";
28 sha256 = "1xxwg2849jizxv0g1hy0b1m3i7iivp9bmc4f5pi76swsn423d41m";
29 };
30
31 prePatch = ''
32 rmdir ThirdParty/*
33 cp -r --no-preserve=all ${googletest} ThirdParty/googletest
34 cp -r --no-preserve=all ${linenoise} ThirdParty/linenoise
35 '';
36
37 # Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror.
38 postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
39 sed 1i'#include <sys/sysmacros.h>' \
40 -i Libraries/xcassets/Headers/xcassets/Slot/SystemVersion.h
41 '';
42
43 enableParallelBuilding = true;
44
45 # TODO: instruct cmake not to put it in /usr, rather than cleaning up
46 postInstall = ''
47 mv $out/usr/* $out
48 rmdir $out/usr
49 '';
50
51 NIX_CFLAGS_COMPILE = "-Wno-error=strict-aliasing";
52
53 cmakeFlags = [ "-GNinja" ];
54
55 buildInputs = [ cmake zlib libxml2 libpng ninja ]
56 ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices CoreGraphics ImageIO ];
57
58 meta = with stdenv.lib; {
59 description = "Xcode-compatible build tool";
60 homepage = https://github.com/facebook/xcbuild;
61 platforms = platforms.unix;
62 maintainers = with maintainers; [ copumpkin matthewbauer ];
63 };
64}