3
0
Fork 0
forked from mirrors/nixpkgs

Bootstrap clang with itself

svn path=/nixpkgs/trunk/; revision=29901
This commit is contained in:
Shea Levy 2011-10-19 17:11:26 +00:00
parent bfc36e2f8a
commit 94dbab27a3
3 changed files with 16 additions and 7 deletions

View file

@ -1,17 +1,20 @@
{ stdenv, fetchurl, gcc, flex, perl, libtool, groff
, buildClang ? false }:
{ stdenv, fetchurl, perl, groff, buildClang ? false }:
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";
};
buildInputs = [ gcc flex perl groff ];
buildInputs = [ perl groff ];
configureFlags = [ "--enable-optimized" "--enable-shared" "--disable-static" ];
@ -51,13 +54,13 @@ stdenv.mkDerivation ({
# Set up the header file paths
preConfigure = ''
sed -i -e 's,C_INCLUDE_PATH,"${gcc.libc}/include/",' \
sed -i -e 's,C_INCLUDE_PATH,"${stdenv.gcc.libc}/include/",' \
-e 's,CPP_HOST,"${triplet}",' \
-e 's,CPP_INCLUDE_PATH,"${gcc.gcc}/include/c++/${gcc.gcc.version}",' \
-e 's,CPP_INCLUDE_PATH,"${stdenv.gcc.gcc}/include/c++/${stdenv.gcc.gcc.version}",' \
tools/clang/lib/Frontend/InitHeaderSearch.cpp
'';
passthru = { gcc = gcc.gcc; };
passthru = { gcc = stdenv.gcc.gcc; };
meta = {
homepage = http://clang.llvm.org/;

View file

@ -11,6 +11,7 @@ rec {
# Override the compiler in stdenv for specific packages.
overrideGCC = stdenv: gcc: stdenv //
{ mkDerivation = args: stdenv.mkDerivation (args // { NIX_GCC = gcc; });
inherit gcc;
};

View file

@ -1640,7 +1640,12 @@ let
ccl = builderDefsPackage ../development/compilers/ccl {};
clang = wrapClang (llvm.override { buildClang = true; });
clangBoot = wrapClang (llvm.override { buildClang = true; });
clang = wrapClang (llvm.override { buildClang = true; stdenv = stdenvAdapters.overrideGCC stdenv clangBoot; });
#Use this instead of stdenv to build with clang
clangStdenv = stdenvAdapters.overrideGCC stdenv clang;
clangSVN = llvmSVN.override {
buildClang = true;