libtapi: fix build, install phase and install name

installTarget looks like a typo for installTargets. This causes a lot
of llvm and clang to be built and installed.

Clang is not intended to be an external dependency. The source bundle
includes llvm and clang. Adding include paths and building clangBasic
first is sufficient to use the internal clang components.
This commit is contained in:
Andrew Childs 2020-07-26 17:27:15 +09:00
parent 1e6079d819
commit b418d4c6a4

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, cmake, python3, clang_6 }:
{ lib, stdenv, fetchFromGitHub, cmake, python3 }:
stdenv.mkDerivation {
name = "libtapi-1000.10.8";
@ -9,22 +9,32 @@ stdenv.mkDerivation {
sha256 = "1a19h39a48agvnmal99n9j1fjadiqwib7hfzmn342wmgh9z3vk0g";
};
nativeBuildInputs = [ cmake python3 ];
buildInputs = [ clang_6.cc ];
sourceRoot = "source/src/llvm";
preConfigure = ''
cd src/llvm
'';
nativeBuildInputs = [ cmake python3 ];
cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ];
buildFlags = [ "libtapi" ];
# 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
preConfigure = ''
INCLUDE_FIX="-I $PWD/projects/clang/include"
INCLUDE_FIX+=" -I $PWD/build/projects/clang/include"
installTarget = "install-libtapi";
cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="$INCLUDE_FIX")
'';
buildFlags = [ "clangBasic" "libtapi" ];
installTargets = [ "install-libtapi" "install-tapi-headers" ];
postInstall = ''
install_name_tool -id $out/lib/libtapi.dylib $out/lib/libtapi.dylib
'';
meta = with lib; {
license = licenses.apsl20;
maintainers = with maintainers; [ matthewbauer ];
};
}