···1-{ lib, stdenv, fetchFromGitHub, cmake, python3, ncurses }:
23-stdenv.mkDerivation rec {
4 pname = "libtapi";
5 version = "1100.0.11"; # determined by looking at VERSION.txt
6···1314 sourceRoot = "source/src/llvm";
15000000000016 nativeBuildInputs = [ cmake python3 ];
1718 # ncurses is required here to avoid a reference to bootstrap-tools, which is
19 # not allowed for the stdenv.
20 buildInputs = [ ncurses ];
2122- cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ];
000000000000000000002324 # fixes: fatal error: 'clang/Basic/Diagnostic.h' file not found
25 # adapted from upstream
···34 buildFlags = [ "clangBasic" "libtapi" "tapi" ];
3536 installTargets = [ "install-libtapi" "install-tapi-headers" "install-tapi" ];
37-38- postInstall = lib.optionalString stdenv.isDarwin ''
39- install_name_tool -id $out/lib/libtapi.dylib $out/lib/libtapi.dylib
40- '';
4142 meta = with lib; {
43 description = "Replaces the Mach-O Dynamic Library Stub files in Apple's SDKs to reduce the size";
···1+{ lib, stdenv, fetchFromGitHub, pkgsBuildBuild, cmake, python3, ncurses }:
23+stdenv.mkDerivation {
4 pname = "libtapi";
5 version = "1100.0.11"; # determined by looking at VERSION.txt
6···1314 sourceRoot = "source/src/llvm";
1516+ # Backported from newer llvm, fixes configure error when cross compiling.
17+ # Also means we don't have to manually fix the result with install_name_tool.
18+ patches = [
19+ ./disable-rpath.patch
20+ ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
21+ # TODO: make unconditional and rebuild the world
22+ # TODO: send upstream
23+ ./native-clang-tblgen.patch
24+ ];
25+26 nativeBuildInputs = [ cmake python3 ];
2728 # ncurses is required here to avoid a reference to bootstrap-tools, which is
29 # not allowed for the stdenv.
30 buildInputs = [ ncurses ];
3132+ cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ]
33+ ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) [
34+ "-DCMAKE_CROSSCOMPILING=True"
35+ # This package could probably have a llvm_6 llvm-tblgen and clang-tblgen
36+ # provided to reduce some building. This package seems intended to
37+ # include all of its dependencies, including enough of LLVM to build the
38+ # required tablegens.
39+ (
40+ let
41+ nativeCC = pkgsBuildBuild.stdenv.cc;
42+ nativeBintools = nativeCC.bintools.bintools;
43+ nativeToolchainFlags = [
44+ "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
45+ "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
46+ "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
47+ "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
48+ "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
49+ ];
50+ in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list=${lib.concatStringsSep ";" nativeToolchainFlags}"
51+ )
52+ ];
5354 # fixes: fatal error: 'clang/Basic/Diagnostic.h' file not found
55 # adapted from upstream
···64 buildFlags = [ "clangBasic" "libtapi" "tapi" ];
6566 installTargets = [ "install-libtapi" "install-tapi-headers" "install-tapi" ];
00006768 meta = with lib; {
69 description = "Replaces the Mach-O Dynamic Library Stub files in Apple's SDKs to reduce the size";