diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2018-12-08 19:27:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-08 19:27:07 +0000 |
commit | 7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07 (patch) | |
tree | 000fca8921ff6efc5ad926edd5e5e20c5cc3268c /pkgs/development | |
parent | b4a2ed8e48b6208bc6a0923fd3590bc7d0b7dae8 (diff) | |
parent | 2ca39fe86b4c5581e4a3aa9d716df05db895d582 (diff) | |
download | nixlib-7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07.tar nixlib-7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07.tar.gz nixlib-7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07.tar.bz2 nixlib-7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07.tar.lz nixlib-7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07.tar.xz nixlib-7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07.tar.zst nixlib-7a4c81dfc8e58dcb7d66a2f01b0e379d3e54bf07.zip |
Merge pull request #51226 from Mic92/llvm-cross-targets
llvm: fix cross-compilation
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/compilers/llvm/7/llvm.nix | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index 67bde813feed..06024856356f 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -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" ] |