core/pkgs/by-name/xc/xcbuild/default.nix

113 lines
2.7 KiB
Nix
Raw Normal View History

2024-06-30 08:12:46 +00:00
{
lib,
stdenv,
cmake,
fetchFromGitHub,
zlib,
libxml2,
libpng,
CoreServices,
CoreGraphics,
ImageIO,
ninja,
}:
2024-05-02 00:46:19 +00:00
let
googletest = fetchFromGitHub {
2024-06-30 08:12:46 +00:00
owner = "google";
repo = "googletest";
rev = "43359642a1c16ad3f4fc575c7edd0cb935810815";
2024-05-02 00:46:19 +00:00
sha256 = "0y4xaah62fjr3isaryc3vfz3mn9xflr00vchdimj8785milxga4q";
};
linenoise = fetchFromGitHub {
2024-06-30 08:12:46 +00:00
owner = "antirez";
repo = "linenoise";
rev = "c894b9e59f02203dbe4e2be657572cf88c4230c3";
2024-05-02 00:46:19 +00:00
sha256 = "0wasql7ph5g473zxhc2z47z3pjp42q0dsn4gpijwzbxawid71b4w";
};
2024-06-30 08:12:46 +00:00
in
stdenv.mkDerivation {
2024-05-02 00:46:19 +00:00
pname = "xcbuild";
# Once a version is released that includes
# https://github.com/facebook/xcbuild/commit/183c087a6484ceaae860c6f7300caf50aea0d710,
# we can stop doing this -pre thing.
version = "0.1.2-pre";
src = fetchFromGitHub {
2024-06-30 08:12:46 +00:00
owner = "facebook";
repo = "xcbuild";
rev = "32b9fbeb69bfa2682bd0351ec2f14548aaedd554";
2024-05-02 00:46:19 +00:00
sha256 = "1xxwg2849jizxv0g1hy0b1m3i7iivp9bmc4f5pi76swsn423d41m";
};
patches = [ ./includes.patch ];
prePatch = ''
rmdir ThirdParty/*
cp -r --no-preserve=all ${googletest} ThirdParty/googletest
cp -r --no-preserve=all ${linenoise} ThirdParty/linenoise
'';
2024-06-30 08:12:46 +00:00
postPatch =
lib.optionalString (!stdenv.isDarwin) ''
# Fix build on gcc-13 due to missing includes
sed -e '1i #include <cstdint>' -i \
Libraries/libutil/Headers/libutil/Permissions.h \
Libraries/pbxbuild/Headers/pbxbuild/Tool/AuxiliaryFile.h \
Libraries/pbxbuild/Headers/pbxbuild/Tool/Invocation.h
2024-05-02 00:46:19 +00:00
2024-06-30 08:12:46 +00:00
# Avoid a glibc >= 2.25 deprecation warning that gets fatal via -Werror.
sed 1i'#include <sys/sysmacros.h>' \
-i Libraries/xcassets/Headers/xcassets/Slot/SystemVersion.h
''
+ lib.optionalString stdenv.isDarwin ''
# Apple Open Sourced LZFSE, but not libcompression, and it isn't
# part of an impure framework we can add
substituteInPlace Libraries/libcar/Sources/Rendition.cpp \
--replace "#if HAVE_LIBCOMPRESSION" "#if 0"
'';
2024-05-02 00:46:19 +00:00
# TODO: instruct cmake not to put it in /usr, rather than cleaning up
postInstall = ''
mv $out/usr/* $out
rmdir $out/usr
cp liblinenoise.* $out/lib/
'';
env.NIX_CFLAGS_COMPILE = "-Wno-error";
cmakeFlags = [ "-GNinja" ];
2024-06-30 08:12:46 +00:00
nativeBuildInputs = [
cmake
ninja
];
buildInputs =
[
zlib
libxml2
libpng
]
++ lib.optionals stdenv.isDarwin [
CoreServices
CoreGraphics
ImageIO
];
2024-05-02 00:46:19 +00:00
meta = with lib; {
description = "Xcode-compatible build tool";
homepage = "https://github.com/facebook/xcbuild";
platforms = platforms.unix;
2024-06-30 08:12:46 +00:00
maintainers = with maintainers; [
copumpkin
matthewbauer
];
license = with licenses; [
bsd2
bsd3
];
2024-05-02 00:46:19 +00:00
};
}