summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorVladimir Still <xstill@fi.muni.cz>2014-01-26 19:16:50 +0100
committerVladimir Still <xstill@fi.muni.cz>2014-01-26 19:16:50 +0100
commit11a752092870bcf18aa883032d5d06dac4728461 (patch)
treeb237f0749b3c6b74ba4e9b5ac7fea51d72baa321 /pkgs/development
parent8bc7c9f66d6a3b23b0a7a69fbd33882ca5f54bfc (diff)
downloadnixpkgs-11a752092870bcf18aa883032d5d06dac4728461.tar
nixpkgs-11a752092870bcf18aa883032d5d06dac4728461.tar.gz
nixpkgs-11a752092870bcf18aa883032d5d06dac4728461.tar.bz2
nixpkgs-11a752092870bcf18aa883032d5d06dac4728461.tar.lz
nixpkgs-11a752092870bcf18aa883032d5d06dac4728461.tar.xz
nixpkgs-11a752092870bcf18aa883032d5d06dac4728461.tar.zst
nixpkgs-11a752092870bcf18aa883032d5d06dac4728461.zip
llvm: Bring back old expressions for llvm & clang 3.[123].
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/llvm/3.1/clang-include-paths.patch21
-rw-r--r--pkgs/development/compilers/llvm/3.1/clang-ld-flags.patch57
-rw-r--r--pkgs/development/compilers/llvm/3.1/clang.nix38
-rw-r--r--pkgs/development/compilers/llvm/3.1/default.nix27
-rw-r--r--pkgs/development/compilers/llvm/3.2/clang-purity.patch137
-rw-r--r--pkgs/development/compilers/llvm/3.2/clang.nix40
-rw-r--r--pkgs/development/compilers/llvm/3.2/default.nix36
-rw-r--r--pkgs/development/compilers/llvm/3.2/set_soname.patch12
-rw-r--r--pkgs/development/compilers/llvm/3.3/clang-purity.patch162
-rw-r--r--pkgs/development/compilers/llvm/3.3/clang-tablegen-dir.patch9
-rw-r--r--pkgs/development/compilers/llvm/3.3/clang.nix41
11 files changed, 580 insertions, 0 deletions
diff --git a/pkgs/development/compilers/llvm/3.1/clang-include-paths.patch b/pkgs/development/compilers/llvm/3.1/clang-include-paths.patch
new file mode 100644
index 00000000000..5e7370718ab
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.1/clang-include-paths.patch
@@ -0,0 +1,21 @@
+diff -Naur clang-3.1.src-orig/lib/Driver/ToolChains.cpp clang-3.1.src/lib/Driver/ToolChains.cpp
+--- clang-3.1.src-orig/lib/Driver/ToolChains.cpp	2012-05-11 20:16:02.000000000 -0400
++++ clang-3.1.src/lib/Driver/ToolChains.cpp	2012-10-08 01:13:01.044083509 -0400
+@@ -2146,9 +2146,6 @@
+   if (DriverArgs.hasArg(options::OPT_nostdinc))
+     return;
+ 
+-  if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
+-    addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/include");
+-
+   if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+     llvm::sys::Path P(D.ResourceDir);
+     P.appendComponent("include");
+@@ -2264,6 +2261,7 @@
+     return;
+ 
+   // Check if libc++ has been enabled and provide its include paths if so.
++  // !!! Will need to modify this if/when nixpkgs uses libc++
+   if (GetCXXStdlibType(DriverArgs) == ToolChain::CST_Libcxx) {
+     // libc++ is always installed at a fixed path on Linux currently.
+     addSystemInclude(DriverArgs, CC1Args,
diff --git a/pkgs/development/compilers/llvm/3.1/clang-ld-flags.patch b/pkgs/development/compilers/llvm/3.1/clang-ld-flags.patch
new file mode 100644
index 00000000000..ffa67b464ec
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.1/clang-ld-flags.patch
@@ -0,0 +1,57 @@
+diff -Naur clang-3.1.src-orig/lib/Driver/ToolChains.cpp clang-3.1.src/lib/Driver/ToolChains.cpp
+--- clang-3.1.src-orig/lib/Driver/ToolChains.cpp	2012-05-11 20:16:02.000000000 -0400
++++ clang-3.1.src/lib/Driver/ToolChains.cpp	2012-10-08 01:22:53.458850737 -0400
+@@ -2077,16 +2077,6 @@
+       addPathIfExists(LibPath + "/../" + Multilib, Paths);
+     }
+   }
+-  addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths);
+-  addPathIfExists(SysRoot + "/lib/../" + Multilib, Paths);
+-  addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
+-  addPathIfExists(SysRoot + "/usr/lib/../" + Multilib, Paths);
+-
+-  // Try walking via the GCC triple path in case of multiarch GCC
+-  // installations with strange symlinks.
+-  if (GCCInstallation.isValid())
+-    addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
+-                    "/../../" + Multilib, Paths);
+ 
+   // Add the non-multilib suffixed paths (if potentially different).
+   if (GCCInstallation.isValid()) {
+@@ -2100,8 +2090,6 @@
+       addPathIfExists(LibPath, Paths);
+     }
+   }
+-  addPathIfExists(SysRoot + "/lib", Paths);
+-  addPathIfExists(SysRoot + "/usr/lib", Paths);
+ }
+ 
+ bool Linux::HasNativeLLVMSupport() const {
+diff -Naur clang-3.1.src-orig/lib/Driver/Tools.cpp clang-3.1.src/lib/Driver/Tools.cpp
+--- clang-3.1.src-orig/lib/Driver/Tools.cpp	2012-04-18 17:32:25.000000000 -0400
++++ clang-3.1.src/lib/Driver/Tools.cpp	2012-10-08 01:25:23.913501995 -0400
+@@ -5210,24 +5210,6 @@
+       ToolChain.getArch() == llvm::Triple::thumb ||
+       (!Args.hasArg(options::OPT_static) &&
+        !Args.hasArg(options::OPT_shared))) {
+-    CmdArgs.push_back("-dynamic-linker");
+-    if (ToolChain.getArch() == llvm::Triple::x86)
+-      CmdArgs.push_back("/lib/ld-linux.so.2");
+-    else if (ToolChain.getArch() == llvm::Triple::arm ||
+-             ToolChain.getArch() == llvm::Triple::thumb)
+-      CmdArgs.push_back("/lib/ld-linux.so.3");
+-    else if (ToolChain.getArch() == llvm::Triple::mips ||
+-             ToolChain.getArch() == llvm::Triple::mipsel)
+-      CmdArgs.push_back("/lib/ld.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::mips64 ||
+-             ToolChain.getArch() == llvm::Triple::mips64el)
+-      CmdArgs.push_back("/lib64/ld.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::ppc)
+-      CmdArgs.push_back("/lib/ld.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::ppc64)
+-      CmdArgs.push_back("/lib64/ld64.so.1");
+-    else
+-      CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2");
+   }
+ 
+   CmdArgs.push_back("-o");
diff --git a/pkgs/development/compilers/llvm/3.1/clang.nix b/pkgs/development/compilers/llvm/3.1/clang.nix
new file mode 100644
index 00000000000..48e4c4946f3
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.1/clang.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, perl, groff, llvm, cmake }:
+
+let version = "3.1"; in
+
+stdenv.mkDerivation {
+  name = "clang-${version}";
+
+  buildInputs = [ perl llvm groff cmake ];
+
+  patches = stdenv.lib.optionals (stdenv.gcc.libc != null) 
+    [ ./clang-include-paths.patch ./clang-ld-flags.patch ];
+
+  cmakeFlags = [
+    "-DCLANG_PATH_TO_LLVM_BUILD=${llvm}"
+    "-DCMAKE_BUILD_TYPE=Release"
+    "-DLLVM_TARGETS_TO_BUILD=all"
+  ] ++ stdenv.lib.optionals (stdenv.gcc.libc != null) [
+    "-DC_INCLUDE_DIRS=${stdenv.gcc.libc}/include/"
+  ];
+
+  enableParallelBuilding = true;
+
+  src = fetchurl {
+      url = "http://llvm.org/releases/${version}/clang-${version}.src.tar.gz";
+      sha256 = "11m7sm9f8qcrayckfg3z91zb3fimilpm0f7azn7q7qnkvhay4qzz";
+  };
+
+  passthru = { gcc = stdenv.gcc.gcc; };
+
+  meta = {
+    homepage = http://clang.llvm.org/;
+    description = "A C language family frontend for LLVM";
+    license = "BSD";
+    maintainers = with stdenv.lib.maintainers; [viric shlevy];
+    platforms = with stdenv.lib.platforms; all;
+  };
+}
+
diff --git a/pkgs/development/compilers/llvm/3.1/default.nix b/pkgs/development/compilers/llvm/3.1/default.nix
new file mode 100644
index 00000000000..204c080b871
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.1/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, perl, groff, cmake, python }:
+
+let version = "3.1"; in
+
+stdenv.mkDerivation {
+  name = "llvm-${version}";
+
+  src = fetchurl {
+    url    = "http://llvm.org/releases/${version}/llvm-${version}.src.tar.gz";
+    sha256 = "1ea05135197b5400c1f88d00ff280d775ce778f8f9ea042e25a1e1e734a4b9ab";
+  };
+
+  buildInputs = [ perl groff cmake python ];
+
+  cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://llvm.org/;
+    description = "Collection of modular and reusable compiler and toolchain technologies";
+    license = "BSD";
+    maintainers = with stdenv.lib.maintainers; [viric shlevy raskin];
+    platforms = with stdenv.lib.platforms; all;
+  };
+}
+
diff --git a/pkgs/development/compilers/llvm/3.2/clang-purity.patch b/pkgs/development/compilers/llvm/3.2/clang-purity.patch
new file mode 100644
index 00000000000..18c70b56c54
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.2/clang-purity.patch
@@ -0,0 +1,137 @@
+diff -Naur clang-3.2.src-orig/lib/Driver/ToolChains.cpp clang-3.2.src/lib/Driver/ToolChains.cpp
+--- clang-3.2.src-orig/lib/Driver/ToolChains.cpp	2012-12-16 10:59:27.000000000 -0500
++++ clang-3.2.src/lib/Driver/ToolChains.cpp	2013-01-22 14:16:55.787547681 -0500
+@@ -2153,16 +2153,6 @@
+       addPathIfExists(LibPath + "/../" + GCCTriple.str() + "/lib", Paths);
+     }
+   }
+-  addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths);
+-  addPathIfExists(SysRoot + "/lib/../" + Multilib, Paths);
+-  addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
+-  addPathIfExists(SysRoot + "/usr/lib/../" + Multilib, Paths);
+-
+-  // Try walking via the GCC triple path in case of multiarch GCC
+-  // installations with strange symlinks.
+-  if (GCCInstallation.isValid())
+-    addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
+-                    "/../../" + Multilib, Paths);
+ 
+   // Add the non-multilib suffixed paths (if potentially different).
+   if (GCCInstallation.isValid()) {
+@@ -2176,8 +2166,6 @@
+       addPathIfExists(LibPath, Paths);
+     }
+   }
+-  addPathIfExists(SysRoot + "/lib", Paths);
+-  addPathIfExists(SysRoot + "/usr/lib", Paths);
+ }
+ 
+ bool Linux::HasNativeLLVMSupport() const {
+@@ -2228,9 +2216,6 @@
+   if (DriverArgs.hasArg(options::OPT_nostdinc))
+     return;
+ 
+-  if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
+-    addSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/local/include");
+-
+   if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+     llvm::sys::Path P(D.ResourceDir);
+     P.appendComponent("include");
+@@ -2295,24 +2280,6 @@
+     "/usr/include/powerpc64-linux-gnu"
+   };
+   ArrayRef<StringRef> MultiarchIncludeDirs;
+-  if (getTriple().getArch() == llvm::Triple::x86_64) {
+-    MultiarchIncludeDirs = X86_64MultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::x86) {
+-    MultiarchIncludeDirs = X86MultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::arm) {
+-    if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+-      MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs;
+-    else
+-      MultiarchIncludeDirs = ARMMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::mips) {
+-    MultiarchIncludeDirs = MIPSMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::mipsel) {
+-    MultiarchIncludeDirs = MIPSELMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::ppc) {
+-    MultiarchIncludeDirs = PPCMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::ppc64) {
+-    MultiarchIncludeDirs = PPC64MultiarchIncludeDirs;
+-  }
+   for (ArrayRef<StringRef>::iterator I = MultiarchIncludeDirs.begin(),
+                                      E = MultiarchIncludeDirs.end();
+        I != E; ++I) {
+@@ -2324,13 +2291,6 @@
+ 
+   if (getTriple().getOS() == llvm::Triple::RTEMS)
+     return;
+-
+-  // Add an include of '/include' directly. This isn't provided by default by
+-  // system GCCs, but is often used with cross-compiling GCCs, and harmless to
+-  // add even when Clang is acting as-if it were a system compiler.
+-  addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/include");
+-
+-  addExternCSystemInclude(DriverArgs, CC1Args, D.SysRoot + "/usr/include");
+ }
+ 
+ /// \brief Helper to add the thre variant paths for a libstdc++ installation.
+diff -Naur clang-3.2.src-orig/lib/Driver/Tools.cpp clang-3.2.src/lib/Driver/Tools.cpp
+--- clang-3.2.src-orig/lib/Driver/Tools.cpp	2012-11-21 02:56:23.000000000 -0500
++++ clang-3.2.src/lib/Driver/Tools.cpp	2013-01-22 14:24:37.167212186 -0500
+@@ -5972,34 +5972,6 @@
+       ToolChain.getArch() == llvm::Triple::thumb ||
+       (!Args.hasArg(options::OPT_static) &&
+        !Args.hasArg(options::OPT_shared))) {
+-    CmdArgs.push_back("-dynamic-linker");
+-    if (isAndroid)
+-      CmdArgs.push_back("/system/bin/linker");
+-    else if (ToolChain.getArch() == llvm::Triple::x86)
+-      CmdArgs.push_back("/lib/ld-linux.so.2");
+-    else if (ToolChain.getArch() == llvm::Triple::arm ||
+-             ToolChain.getArch() == llvm::Triple::thumb) {
+-      if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+-        CmdArgs.push_back("/lib/ld-linux-armhf.so.3");
+-      else
+-        CmdArgs.push_back("/lib/ld-linux.so.3");
+-    }
+-    else if (ToolChain.getArch() == llvm::Triple::mips ||
+-             ToolChain.getArch() == llvm::Triple::mipsel)
+-      CmdArgs.push_back("/lib/ld.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::mips64 ||
+-             ToolChain.getArch() == llvm::Triple::mips64el) {
+-      if (hasMipsN32ABIArg(Args))
+-        CmdArgs.push_back("/lib32/ld.so.1");
+-      else
+-        CmdArgs.push_back("/lib64/ld.so.1");
+-    }
+-    else if (ToolChain.getArch() == llvm::Triple::ppc)
+-      CmdArgs.push_back("/lib/ld.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::ppc64)
+-      CmdArgs.push_back("/lib64/ld64.so.1");
+-    else
+-      CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2");
+   }
+ 
+   CmdArgs.push_back("-o");
+diff -Naur clang-3.2.src-orig/lib/Frontend/InitHeaderSearch.cpp clang-3.2.src/lib/Frontend/InitHeaderSearch.cpp
+--- clang-3.2.src-orig/lib/Frontend/InitHeaderSearch.cpp	2012-10-24 12:19:39.000000000 -0400
++++ clang-3.2.src/lib/Frontend/InitHeaderSearch.cpp	2013-01-22 14:20:32.803925775 -0500
+@@ -221,8 +221,6 @@
+     case llvm::Triple::Bitrig:
+       break;
+     default:
+-      // FIXME: temporary hack: hard-coded paths.
+-      AddPath("/usr/local/include", System, true, false, false);
+       break;
+     }
+   }
+@@ -330,8 +328,6 @@
+     break;
+   }
+ 
+-  if ( os != llvm::Triple::RTEMS )
+-    AddPath("/usr/include", System, false, false, false);
+ }
+ 
+ void InitHeaderSearch::
diff --git a/pkgs/development/compilers/llvm/3.2/clang.nix b/pkgs/development/compilers/llvm/3.2/clang.nix
new file mode 100644
index 00000000000..c2117798666
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.2/clang.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, perl, groff, llvm, cmake, libxml2 }:
+
+let
+  version = "3.2";
+  gccReal = if (stdenv.gcc.gcc or null) == null then stdenv.gcc else stdenv.gcc.gcc;
+in
+
+stdenv.mkDerivation {
+  name = "clang-${version}";
+
+  buildInputs = [ perl llvm groff cmake libxml2 ];
+
+  patches = stdenv.lib.optional (stdenv.gcc.libc != null) ./clang-purity.patch;
+
+  cmakeFlags = [
+    "-DCLANG_PATH_TO_LLVM_BUILD=${llvm}"
+    "-DCMAKE_BUILD_TYPE=Release"
+    "-DLLVM_TARGETS_TO_BUILD=all"
+    "-DGCC_INSTALL_PREFIX=${gccReal}"
+  ] ++ stdenv.lib.optionals (stdenv.gcc.libc != null) [
+    "-DC_INCLUDE_DIRS=${stdenv.gcc.libc}/include/"
+  ];
+
+  enableParallelBuilding = true;
+
+  src = fetchurl {
+      url = "http://llvm.org/releases/${version}/clang-${version}.src.tar.gz";
+      sha256 = "0n2nzw3pw2v7fk67f2k2qyzd9wibvi3i5j7cjzz1csqgghzz1aia";
+  };
+
+  passthru = { gcc = stdenv.gcc.gcc; };
+
+  meta = {
+    homepage = http://clang.llvm.org/;
+    description = "A C language family frontend for LLVM";
+    license = "BSD";
+    maintainers = with stdenv.lib.maintainers; [viric shlevy];
+    platforms = with stdenv.lib.platforms; all;
+  };
+}
diff --git a/pkgs/development/compilers/llvm/3.2/default.nix b/pkgs/development/compilers/llvm/3.2/default.nix
new file mode 100644
index 00000000000..59e2bdc5509
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.2/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, perl, groff, cmake, python, libffi }:
+
+let version = "3.2"; in
+
+stdenv.mkDerivation {
+  name = "llvm-${version}";
+
+  src = fetchurl {
+    url    = "http://llvm.org/releases/${version}/llvm-${version}.src.tar.gz";
+    sha256 = "0hv30v5l4fkgyijs56sr1pbrlzgd674pg143x7az2h37sb290l0j";
+  };
+
+  patches = [ ./set_soname.patch ]; # http://llvm.org/bugs/show_bug.cgi?id=12334
+  patchFlags = "-p0";
+
+  preConfigure = "patchShebangs .";
+
+  propagatedBuildInputs = [ libffi ];
+  buildInputs = [ perl groff cmake python ]; # ToDo: polly, libc++; enable cxx11?
+
+  # created binaries need to be run before installation... I coudn't find a better way
+  preBuild = ''export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:"`pwd`/lib'';
+
+  cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" "-DBUILD_SHARED_LIBS=ON" ];
+
+  enableParallelBuilding = true;
+  #doCheck = true; # tests are broken, don't know why
+
+  meta = {
+    homepage = http://llvm.org/;
+    description = "Collection of modular and reusable compiler and toolchain technologies";
+    license = "BSD";
+    maintainers = with stdenv.lib.maintainers; [viric shlevy raskin];
+    platforms = with stdenv.lib.platforms; all;
+  };
+}
diff --git a/pkgs/development/compilers/llvm/3.2/set_soname.patch b/pkgs/development/compilers/llvm/3.2/set_soname.patch
new file mode 100644
index 00000000000..69ba74dddad
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.2/set_soname.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/show_bug.cgi?id=409267
+http://llvm.org/bugs/show_bug.cgi?id=12334
+--- tools/llvm-shlib/Makefile.orig	2012-03-26 18:14:13.071797115 +0200
++++ tools/llvm-shlib/Makefile	2012-03-26 17:31:12.491196254 +0200
+@@ -67,6 +67,7 @@
+     # Include everything from the .a's into the shared library.
+     LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \
+                        -Wl,--no-whole-archive
++    LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT)
+ endif
+ 
+ ifeq ($(HOST_OS),Linux)
diff --git a/pkgs/development/compilers/llvm/3.3/clang-purity.patch b/pkgs/development/compilers/llvm/3.3/clang-purity.patch
new file mode 100644
index 00000000000..e82305189e8
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.3/clang-purity.patch
@@ -0,0 +1,162 @@
+diff -Naur cfe-3.3.src-orig/lib/Driver/ToolChains.cpp cfe-3.3.src/lib/Driver/ToolChains.cpp
+--- cfe-3.3.src-orig/lib/Driver/ToolChains.cpp	2013-05-06 12:26:41.000000000 -0400
++++ cfe-3.3.src/lib/Driver/ToolChains.cpp	2013-06-21 19:28:12.120364372 -0400
+@@ -2318,17 +2318,6 @@
+                       Paths);
+     }
+   }
+-  addPathIfExists(SysRoot + "/lib/" + MultiarchTriple, Paths);
+-  addPathIfExists(SysRoot + "/lib/../" + Multilib, Paths);
+-  addPathIfExists(SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
+-  addPathIfExists(SysRoot + "/usr/lib/../" + Multilib, Paths);
+-
+-  // Try walking via the GCC triple path in case of multiarch GCC
+-  // installations with strange symlinks.
+-  if (GCCInstallation.isValid())
+-    addPathIfExists(SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
+-                    "/../../" + Multilib, Paths);
+-
+   // Add the non-multilib suffixed paths (if potentially different).
+   if (GCCInstallation.isValid()) {
+     const std::string &LibPath = GCCInstallation.getParentLibPath();
+@@ -2341,8 +2330,6 @@
+       addPathIfExists(LibPath, Paths);
+     }
+   }
+-  addPathIfExists(SysRoot + "/lib", Paths);
+-  addPathIfExists(SysRoot + "/usr/lib", Paths);
+ 
+   IsPIEDefault = SanitizerArgs(*this, Args).hasZeroBaseShadow();
+ }
+@@ -2395,9 +2382,6 @@
+   if (DriverArgs.hasArg(options::OPT_nostdinc))
+     return;
+ 
+-  if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
+-    addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include");
+-
+   if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+     llvm::sys::Path P(D.ResourceDir);
+     P.appendComponent("include");
+@@ -2479,26 +2463,6 @@
+     "/usr/include/powerpc64-linux-gnu"
+   };
+   ArrayRef<StringRef> MultiarchIncludeDirs;
+-  if (getTriple().getArch() == llvm::Triple::x86_64) {
+-    MultiarchIncludeDirs = X86_64MultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::x86) {
+-    MultiarchIncludeDirs = X86MultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::aarch64) {
+-    MultiarchIncludeDirs = AArch64MultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::arm) {
+-    if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+-      MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs;
+-    else
+-      MultiarchIncludeDirs = ARMMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::mips) {
+-    MultiarchIncludeDirs = MIPSMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::mipsel) {
+-    MultiarchIncludeDirs = MIPSELMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::ppc) {
+-    MultiarchIncludeDirs = PPCMultiarchIncludeDirs;
+-  } else if (getTriple().getArch() == llvm::Triple::ppc64) {
+-    MultiarchIncludeDirs = PPC64MultiarchIncludeDirs;
+-  }
+   for (ArrayRef<StringRef>::iterator I = MultiarchIncludeDirs.begin(),
+                                      E = MultiarchIncludeDirs.end();
+        I != E; ++I) {
+@@ -2510,13 +2474,6 @@
+ 
+   if (getTriple().getOS() == llvm::Triple::RTEMS)
+     return;
+-
+-  // Add an include of '/include' directly. This isn't provided by default by
+-  // system GCCs, but is often used with cross-compiling GCCs, and harmless to
+-  // add even when Clang is acting as-if it were a system compiler.
+-  addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include");
+-
+-  addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
+ }
+ 
+ /// \brief Helper to add the three variant paths for a libstdc++ installation.
+diff -Naur cfe-3.3.src-orig/lib/Driver/Tools.cpp cfe-3.3.src/lib/Driver/Tools.cpp
+--- cfe-3.3.src-orig/lib/Driver/Tools.cpp	2013-05-30 14:01:30.000000000 -0400
++++ cfe-3.3.src/lib/Driver/Tools.cpp	2013-06-21 19:30:51.604726574 -0400
+@@ -5976,43 +5976,6 @@
+     }
+   }
+ 
+-  if (ToolChain.getArch() == llvm::Triple::arm ||
+-      ToolChain.getArch() == llvm::Triple::thumb ||
+-      (!Args.hasArg(options::OPT_static) &&
+-       !Args.hasArg(options::OPT_shared))) {
+-    CmdArgs.push_back("-dynamic-linker");
+-    if (isAndroid)
+-      CmdArgs.push_back("/system/bin/linker");
+-    else if (ToolChain.getArch() == llvm::Triple::x86)
+-      CmdArgs.push_back("/lib/ld-linux.so.2");
+-    else if (ToolChain.getArch() == llvm::Triple::aarch64)
+-      CmdArgs.push_back("/lib/ld-linux-aarch64.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::arm ||
+-             ToolChain.getArch() == llvm::Triple::thumb) {
+-      if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+-        CmdArgs.push_back("/lib/ld-linux-armhf.so.3");
+-      else
+-        CmdArgs.push_back("/lib/ld-linux.so.3");
+-    }
+-    else if (ToolChain.getArch() == llvm::Triple::mips ||
+-             ToolChain.getArch() == llvm::Triple::mipsel)
+-      CmdArgs.push_back("/lib/ld.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::mips64 ||
+-             ToolChain.getArch() == llvm::Triple::mips64el) {
+-      if (hasMipsN32ABIArg(Args))
+-        CmdArgs.push_back("/lib32/ld.so.1");
+-      else
+-        CmdArgs.push_back("/lib64/ld.so.1");
+-    }
+-    else if (ToolChain.getArch() == llvm::Triple::ppc)
+-      CmdArgs.push_back("/lib/ld.so.1");
+-    else if (ToolChain.getArch() == llvm::Triple::ppc64 ||
+-	     ToolChain.getArch() == llvm::Triple::systemz)
+-      CmdArgs.push_back("/lib64/ld64.so.1");
+-    else
+-      CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2");
+-  }
+-
+   CmdArgs.push_back("-o");
+   CmdArgs.push_back(Output.getFilename());
+ 
+diff -Naur cfe-3.3.src-orig/lib/Frontend/InitHeaderSearch.cpp cfe-3.3.src/lib/Frontend/InitHeaderSearch.cpp
+--- cfe-3.3.src-orig/lib/Frontend/InitHeaderSearch.cpp	2013-04-29 21:21:43.000000000 -0400
++++ cfe-3.3.src/lib/Frontend/InitHeaderSearch.cpp	2013-06-21 19:32:47.627016565 -0400
+@@ -225,20 +225,6 @@
+                                             const HeaderSearchOptions &HSOpts) {
+   llvm::Triple::OSType os = triple.getOS();
+ 
+-  if (HSOpts.UseStandardSystemIncludes) {
+-    switch (os) {
+-    case llvm::Triple::FreeBSD:
+-    case llvm::Triple::NetBSD:
+-    case llvm::Triple::OpenBSD:
+-    case llvm::Triple::Bitrig:
+-      break;
+-    default:
+-      // FIXME: temporary hack: hard-coded paths.
+-      AddPath("/usr/local/include", System, false);
+-      break;
+-    }
+-  }
+-
+   // Builtin includes use #include_next directives and should be positioned
+   // just prior C include dirs.
+   if (HSOpts.UseBuiltinIncludes) {
+@@ -332,9 +318,6 @@
+   default:
+     break;
+   }
+-
+-  if ( os != llvm::Triple::RTEMS )
+-    AddPath("/usr/include", ExternCSystem, false);
+ }
+ 
+ void InitHeaderSearch::
diff --git a/pkgs/development/compilers/llvm/3.3/clang-tablegen-dir.patch b/pkgs/development/compilers/llvm/3.3/clang-tablegen-dir.patch
new file mode 100644
index 00000000000..de6a468b239
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.3/clang-tablegen-dir.patch
@@ -0,0 +1,9 @@
+--- a/utils/TableGen/CMakeLists.txt       (revision 190146)
++++ b/utils/TableGen/CMakeLists.txt       (working copy)
+@@ -1,4 +1,5 @@
+ set(LLVM_LINK_COMPONENTS Support)
++set(LLVM_TOOLS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+ 
+ add_tablegen(clang-tblgen CLANG
+   ClangASTNodesEmitter.cpp
+
diff --git a/pkgs/development/compilers/llvm/3.3/clang.nix b/pkgs/development/compilers/llvm/3.3/clang.nix
new file mode 100644
index 00000000000..8c178c9ce03
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.3/clang.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, perl, groff, llvm, cmake, libxml2, python }:
+
+let
+  version = "3.3";
+  gccReal = if (stdenv.gcc.gcc or null) == null then stdenv.gcc else stdenv.gcc.gcc;
+in
+
+stdenv.mkDerivation {
+  name = "clang-${version}";
+
+  buildInputs = [ perl llvm groff cmake libxml2 python ];
+
+  patches = [ ./clang-tablegen-dir.patch ] ++
+            stdenv.lib.optional (stdenv.gcc.libc != null) ./clang-purity.patch;
+
+  cmakeFlags = [
+    "-DCLANG_PATH_TO_LLVM_BUILD=${llvm}"
+    "-DCMAKE_BUILD_TYPE=Release"
+    "-DLLVM_TARGETS_TO_BUILD=all"
+    "-DGCC_INSTALL_PREFIX=${gccReal}"
+  ] ++ stdenv.lib.optionals (stdenv.gcc.libc != null) [
+    "-DC_INCLUDE_DIRS=${stdenv.gcc.libc}/include/"
+  ];
+
+  enableParallelBuilding = true;
+
+  src = fetchurl {
+      url = "http://llvm.org/releases/${version}/cfe-${version}.src.tar.gz";
+      sha256 = "15mrvw43s4frk1j49qr4v5viq68h8qlf10qs6ghd6mrsmgj5vddi";
+  };
+
+  passthru = { gcc = stdenv.gcc.gcc; };
+
+  meta = {
+    homepage = http://clang.llvm.org/;
+    description = "A C language family frontend for LLVM";
+    license = "BSD";
+    maintainers = with stdenv.lib.maintainers; [viric shlevy];
+    platforms = with stdenv.lib.platforms; all;
+  };
+}