2020-07-25 07:26:54 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, python3, ncurses }:
|
2019-01-25 23:04:50 +00:00
|
|
|
|
2020-10-21 16:23:10 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "libtapi";
|
|
|
|
version = "1000.10.8"; # determined by looking at VERSION.txt
|
|
|
|
|
2019-01-25 23:04:50 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tpoechtrager";
|
|
|
|
repo = "apple-libtapi";
|
2020-07-21 16:30:19 +01:00
|
|
|
rev = "3cb307764cc5f1856c8a23bbdf3eb49dfc6bea48";
|
|
|
|
sha256 = "1zb10p6xkls8x7wsdwgy9c0v16z97rfkgidii9ffq5rfczgvrhjh";
|
2019-01-25 23:04:50 +00:00
|
|
|
};
|
|
|
|
|
2020-07-26 09:27:15 +01:00
|
|
|
sourceRoot = "source/src/llvm";
|
|
|
|
|
2020-01-13 09:45:16 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
2019-01-25 23:04:50 +00:00
|
|
|
|
2020-07-25 07:26:54 +01:00
|
|
|
# ncurses is required here to avoid a reference to bootstrap-tools, which is
|
|
|
|
# not allowed for the stdenv.
|
|
|
|
buildInputs = [ ncurses ];
|
|
|
|
|
2020-07-26 09:27:15 +01:00
|
|
|
cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ];
|
|
|
|
|
|
|
|
# fixes: fatal error: 'clang/Basic/Diagnostic.h' file not found
|
|
|
|
# adapted from upstream
|
|
|
|
# https://github.com/tpoechtrager/apple-libtapi/blob/3cb307764cc5f1856c8a23bbdf3eb49dfc6bea48/build.sh#L58-L60
|
2019-01-25 23:04:50 +00:00
|
|
|
preConfigure = ''
|
2020-07-26 09:27:15 +01:00
|
|
|
INCLUDE_FIX="-I $PWD/projects/clang/include"
|
|
|
|
INCLUDE_FIX+=" -I $PWD/build/projects/clang/include"
|
|
|
|
|
|
|
|
cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="$INCLUDE_FIX")
|
2019-01-25 23:04:50 +00:00
|
|
|
'';
|
|
|
|
|
2020-07-26 09:27:15 +01:00
|
|
|
buildFlags = [ "clangBasic" "libtapi" ];
|
2019-01-25 23:04:50 +00:00
|
|
|
|
2020-07-26 09:27:15 +01:00
|
|
|
installTargets = [ "install-libtapi" "install-tapi-headers" ];
|
2019-01-25 23:04:50 +00:00
|
|
|
|
2020-10-21 16:23:10 +01:00
|
|
|
postInstall = lib.optionalString stdenv.isDarwin ''
|
2020-07-26 09:27:15 +01:00
|
|
|
install_name_tool -id $out/lib/libtapi.dylib $out/lib/libtapi.dylib
|
|
|
|
'';
|
2019-01-25 23:04:50 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2020-10-21 16:23:10 +01:00
|
|
|
description = "Replaces the Mach-O Dynamic Library Stub files in Apple's SDKs to reduce the size";
|
|
|
|
homepage = "https://github.com/tpoechtrager/apple-libtapi";
|
2019-01-25 23:04:50 +00:00
|
|
|
license = licenses.apsl20;
|
|
|
|
maintainers = with maintainers; [ matthewbauer ];
|
|
|
|
};
|
|
|
|
}
|