lol
at 23.11-beta 74 lines 2.4 kB view raw
1{ lib, stdenv, cmake, fetchFromGitHub, zlib, libxml2, libpng 2, CoreServices, CoreGraphics, ImageIO, ninja }: 3 4let 5 googletest = fetchFromGitHub { 6 owner = "google"; 7 repo = "googletest"; 8 rev = "43359642a1c16ad3f4fc575c7edd0cb935810815"; 9 sha256 = "0y4xaah62fjr3isaryc3vfz3mn9xflr00vchdimj8785milxga4q"; 10 }; 11 12 linenoise = fetchFromGitHub { 13 owner = "antirez"; 14 repo = "linenoise"; 15 rev = "c894b9e59f02203dbe4e2be657572cf88c4230c3"; 16 sha256 = "0wasql7ph5g473zxhc2z47z3pjp42q0dsn4gpijwzbxawid71b4w"; 17 }; 18in stdenv.mkDerivation { 19 pname = "xcbuild"; 20 21 # Once a version is released that includes 22 # https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710, 23 # we can stop doing this -pre thing. 24 version = "0.1.2-pre"; 25 26 src = fetchFromGitHub { 27 owner = "facebook"; 28 repo = "xcbuild"; 29 rev = "32b9fbeb69bfa2682bd0351ec2f14548aaedd554"; 30 sha256 = "1xxwg2849jizxv0g1hy0b1m3i7iivp9bmc4f5pi76swsn423d41m"; 31 }; 32 33 patches = [ ./includes.patch ]; 34 35 prePatch = '' 36 rmdir ThirdParty/* 37 cp -r --no-preserve=all ${googletest} ThirdParty/googletest 38 cp -r --no-preserve=all ${linenoise} ThirdParty/linenoise 39 ''; 40 41 postPatch = lib.optionalString (!stdenv.isDarwin) '' 42 # Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror. 43 sed 1i'#include <sys/sysmacros.h>' \ 44 -i Libraries/xcassets/Headers/xcassets/Slot/SystemVersion.h 45 '' + lib.optionalString stdenv.isDarwin '' 46 # Apple Open Sourced LZFSE, but not libcompression, and it isn't 47 # part of an impure framework we can add 48 substituteInPlace Libraries/libcar/Sources/Rendition.cpp \ 49 --replace "#if HAVE_LIBCOMPRESSION" "#if 0" 50 ''; 51 52 # TODO: instruct cmake not to put it in /usr, rather than cleaning up 53 postInstall = '' 54 mv $out/usr/* $out 55 rmdir $out/usr 56 cp liblinenoise.* $out/lib/ 57 ''; 58 59 env.NIX_CFLAGS_COMPILE = "-Wno-error"; 60 61 cmakeFlags = [ "-GNinja" ]; 62 63 nativeBuildInputs = [ cmake ninja ]; 64 buildInputs = [ zlib libxml2 libpng ] 65 ++ lib.optionals stdenv.isDarwin [ CoreServices CoreGraphics ImageIO ]; 66 67 meta = with lib; { 68 description = "Xcode-compatible build tool"; 69 homepage = "https://github.com/facebook/xcbuild"; 70 platforms = platforms.unix; 71 maintainers = with maintainers; [ copumpkin matthewbauer ]; 72 license = with licenses; [ bsd2 bsd3 ]; 73 }; 74}