llvm_7: fix cross-compiling

This commit is contained in:
Jörg Thalheim 2018-12-08 19:25:43 +00:00
parent b3ae7d1c8c
commit 2ca39fe86b

View file

@ -23,6 +23,18 @@ let
# Used when creating a version-suffixed symlink of libLLVM.dylib
shortVersion = with stdenv.lib;
concatStringsSep "." (take 1 (splitString "." release_version));
llvmTarget = platform:
if platform.parsed.cpu.family == "x86" then
"X86"
else if platform.parsed.cpu.name == "aarch64" then
"AArch64"
else if platform.parsed.cpu.family == "arm" then
"ARM"
else if platform.parsed.cpu.family == "mips" then
"Mips"
else
throw "Unsupported system";
in stdenv.mkDerivation (rec {
name = "llvm-${version}";
@ -78,10 +90,9 @@ in stdenv.mkDerivation (rec {
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_ENABLE_FFI=ON"
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}"
"-DLLVM_TARGETS_TO_BUILD=${llvmTarget stdenv.hostPlatform};${llvmTarget stdenv.targetPlatform}"
"-DLLVM_ENABLE_DUMP=ON"
]