diff --git a/pkgs/development/compilers/llvm/clang.nix b/pkgs/development/compilers/llvm/clang.nix index ca3b72ffc519..ca205022adb3 100644 --- a/pkgs/development/compilers/llvm/clang.nix +++ b/pkgs/development/compilers/llvm/clang.nix @@ -12,15 +12,16 @@ in stdenv.mkDerivation { name = "clang-${version}"; - CC = if stdenv.gcc ? clang then "clang" else "gcc"; - - CXX = if stdenv.gcc ? clang then "clang++" else "g++"; - src = llvm.src; buildInputs = [ perl llvm groff ]; - configureFlags = [ "--enable-optimized" "--enable-shared" "--disable-static" ]; + configureFlags = [ "--enable-optimized" "--enable-shared" "--disable-static" ] + ++ stdenv.lib.optionals (stdenv.gcc ? clang) [ + "--with-built-clang=yes" + "CXX=clang++" + ]; + srcClang = fetchurl { url = "http://llvm.org/releases/${version}/clang-${version}.tgz"; sha256 = "1pq9g7qxw761dp6gx3amx39kl9p4zhlymmn8gfmcnw9ag0zizi3h"; diff --git a/pkgs/development/compilers/llvm/default.nix b/pkgs/development/compilers/llvm/default.nix index 62e71d4a1b23..7b38db8a646f 100644 --- a/pkgs/development/compilers/llvm/default.nix +++ b/pkgs/development/compilers/llvm/default.nix @@ -5,10 +5,6 @@ let version = "2.9"; in stdenv.mkDerivation { name = "llvm-${version}"; - CC = if stdenv.gcc ? clang then "clang" else "gcc"; - - CXX = if stdenv.gcc ? clang then "clang++" else "g++"; - src = fetchurl { url = "http://llvm.org/releases/${version}/llvm-${version}.tgz"; sha256 = "0y9pgdakn3n0vf8zs6fjxjw6972nyw4rkfwwza6b8a3ll77kc4k6"; @@ -16,7 +12,11 @@ stdenv.mkDerivation { buildInputs = [ perl groff ]; - configureFlags = [ "--enable-optimized" "--enable-shared" "--disable-static" ]; + configureFlags = [ "--enable-optimized" "--enable-shared" "--disable-static" ] + ++ stdenv.lib.optionals (stdenv.gcc ? clang) [ + "--with-built-clang=yes" + "CXX=clang++" + ]; meta = { homepage = http://llvm.org/;