about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-02-14 01:17:10 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2019-02-26 19:45:35 -0500
commitb86e62d30d4635ef3294d9c1c308f9c8b0061045 (patch)
treef1a687409945a48f6ae42d41dc2af41886186501 /pkgs/stdenv
parent77d7d60d8c6b4f2a163f1f9575dce1860cbb293b (diff)
llvm: support cross compilation with useLLVM flag
You can build (partially) with LLVM toolchain using the useLLVM flag.
This works like so:

  nix-build -A hello --arg crossSystem '{ system =
    "aarch64-unknown-linux-musl"; useLLVM = true }'

also don’t separate debug info in lldClang

It doesn’t work currently with that setup hook. Missing build-id?
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/cross/default.nix2
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix2
2 files changed, 3 insertions, 1 deletions
diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix
index aafc0855dbe31..7b4f8adc82f39 100644
--- a/pkgs/stdenv/cross/default.nix
+++ b/pkgs/stdenv/cross/default.nix
@@ -54,6 +54,8 @@ in lib.init bootStages ++ [
              then buildPackages.darwin.iosSdkPkgs.clang
            else if crossSystem.useAndroidPrebuilt or false
              then buildPackages."androidndkPkgs_${crossSystem.ndkVer}".gcc
+           else if crossSystem.useLLVM or false
+             then buildPackages.llvmPackages_7.lldClang
            else buildPackages.gcc;
 
       extraNativeBuildInputs = old.extraNativeBuildInputs
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index cafd1031ab8b9..39b84179ae079 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -86,7 +86,7 @@ rec {
       doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform;
       doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform;
 
-      separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux;
+      separateDebugInfo' = separateDebugInfo && stdenv.hostPlatform.isLinux && !(stdenv.hostPlatform.useLLVM or false);
       outputs' = outputs ++ lib.optional separateDebugInfo' "debug";
 
       fixedOutputDrv = attrs ? outputHash;