diff options
author | John Ericson <git@JohnEricson.me> | 2018-12-13 01:13:30 -0500 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2018-12-13 01:14:24 -0500 |
commit | 4b7a6158998bb3f8a62896be22ad597b7cceba9d (patch) | |
tree | c58a03dd9b8359a3e7d0065ecefa0acab8b4af37 /pkgs/development/compilers/llvm | |
parent | 2ca39fe86b4c5581e4a3aa9d716df05db895d582 (diff) | |
download | nixlib-4b7a6158998bb3f8a62896be22ad597b7cceba9d.tar nixlib-4b7a6158998bb3f8a62896be22ad597b7cceba9d.tar.gz nixlib-4b7a6158998bb3f8a62896be22ad597b7cceba9d.tar.bz2 nixlib-4b7a6158998bb3f8a62896be22ad597b7cceba9d.tar.lz nixlib-4b7a6158998bb3f8a62896be22ad597b7cceba9d.tar.xz nixlib-4b7a6158998bb3f8a62896be22ad597b7cceba9d.tar.zst nixlib-4b7a6158998bb3f8a62896be22ad597b7cceba9d.zip |
llvm 7: Allow for specifying an arbitrary list of backends to build
Diffstat (limited to 'pkgs/development/compilers/llvm')
-rw-r--r-- | pkgs/development/compilers/llvm/7/llvm.nix | 19 | ||||
-rw-r--r-- | pkgs/development/compilers/llvm/common.nix | 18 |
2 files changed, 24 insertions, 13 deletions
diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix index 06024856356f..6fcdc394bed4 100644 --- a/pkgs/development/compilers/llvm/7/llvm.nix +++ b/pkgs/development/compilers/llvm/7/llvm.nix @@ -13,7 +13,8 @@ , debugVersion ? false , enableManpages ? false , enableSharedLibraries ? true -, enableWasm ? true +, targets ? [ stdenv.hostPlatform stdenv.targetPlatform ] +, enableWasm ? true # TODO fold this into `targets` somehow , enablePFM ? !stdenv.isDarwin }: @@ -24,17 +25,9 @@ let 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"; + inherit + (import ../common.nix { inherit (stdenv) lib; }) + llvmBackendList; in stdenv.mkDerivation (rec { name = "llvm-${version}"; @@ -92,7 +85,7 @@ in stdenv.mkDerivation (rec { "-DLLVM_ENABLE_RTTI=ON" "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}" "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.config}" - "-DLLVM_TARGETS_TO_BUILD=${llvmTarget stdenv.hostPlatform};${llvmTarget stdenv.targetPlatform}" + "-DLLVM_TARGETS_TO_BUILD=${llvmBackendList targets}" "-DLLVM_ENABLE_DUMP=ON" ] diff --git a/pkgs/development/compilers/llvm/common.nix b/pkgs/development/compilers/llvm/common.nix new file mode 100644 index 000000000000..e4f55963a6fb --- /dev/null +++ b/pkgs/development/compilers/llvm/common.nix @@ -0,0 +1,18 @@ +{ lib }: + +rec { + llvmBackend = 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"; + + llvmBackendList = platforms: + lib.concatStringsSep ";" (map llvmBackend platforms); +} |