llvm 7: Allow for specifying an arbitrary list of backends to build
This commit is contained in:
parent
2ca39fe86b
commit
4b7a615899
@ -13,7 +13,8 @@
|
|||||||
, debugVersion ? false
|
, debugVersion ? false
|
||||||
, enableManpages ? false
|
, enableManpages ? false
|
||||||
, enableSharedLibraries ? true
|
, enableSharedLibraries ? true
|
||||||
, enableWasm ? true
|
, targets ? [ stdenv.hostPlatform stdenv.targetPlatform ]
|
||||||
|
, enableWasm ? true # TODO fold this into `targets` somehow
|
||||||
, enablePFM ? !stdenv.isDarwin
|
, enablePFM ? !stdenv.isDarwin
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -24,17 +25,9 @@ let
|
|||||||
shortVersion = with stdenv.lib;
|
shortVersion = with stdenv.lib;
|
||||||
concatStringsSep "." (take 1 (splitString "." release_version));
|
concatStringsSep "." (take 1 (splitString "." release_version));
|
||||||
|
|
||||||
llvmTarget = platform:
|
inherit
|
||||||
if platform.parsed.cpu.family == "x86" then
|
(import ../common.nix { inherit (stdenv) lib; })
|
||||||
"X86"
|
llvmBackendList;
|
||||||
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 {
|
in stdenv.mkDerivation (rec {
|
||||||
name = "llvm-${version}";
|
name = "llvm-${version}";
|
||||||
|
|
||||||
@ -92,7 +85,7 @@ in stdenv.mkDerivation (rec {
|
|||||||
"-DLLVM_ENABLE_RTTI=ON"
|
"-DLLVM_ENABLE_RTTI=ON"
|
||||||
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
|
||||||
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.targetPlatform.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"
|
"-DLLVM_ENABLE_DUMP=ON"
|
||||||
]
|
]
|
||||||
|
18
pkgs/development/compilers/llvm/common.nix
Normal file
18
pkgs/development/compilers/llvm/common.nix
Normal file
@ -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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user