aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/llvm.scm37
-rw-r--r--gnu/packages/patches/clang-3.8-libc-search-path.patch69
3 files changed, 100 insertions, 7 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index d44a52be95..5e32d872b8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -452,6 +452,7 @@ dist_patch_DATA = \
%D%/packages/patches/cdparanoia-fpic.patch \
%D%/packages/patches/chmlib-inttypes.patch \
%D%/packages/patches/clang-libc-search-path.patch \
+ %D%/packages/patches/clang-3.8-libc-search-path.patch \
%D%/packages/patches/clucene-pkgconfig.patch \
%D%/packages/patches/cmake-fix-tests.patch \
%D%/packages/patches/cpio-gets-undeclared.patch \
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 65b0ef38ca..beb09fa86e 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -38,7 +38,7 @@
(define-public llvm
(package
(name "llvm")
- (version "3.7.1")
+ (version "3.8.1")
(source
(origin
(method url-fetch)
@@ -46,7 +46,7 @@
version "/llvm-" version ".src.tar.xz"))
(sha256
(base32
- "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy"))))
+ "1ybmnid4pw2hxn12ax5qa5kl1ldfns0njg8533y3mzslvd5cx0kf"))))
(build-system cmake-build-system)
(native-inputs
`(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2
@@ -85,8 +85,8 @@ of programming tools as well as libraries with equivalent functionality.")
`(("llvm" ,llvm)))
(arguments
`(;; Don't use '-g' during the build to save space.
- #:build-type "Release"))
-
+ #:build-type "Release"
+ #:tests? #f)) ; Tests require gtest
(home-page "http://compiler-rt.llvm.org")
(synopsis "Runtime library for Clang/LLVM")
(description
@@ -99,7 +99,8 @@ compiler. In LLVM this library is called \"compiler-rt\".")
;; <http://compiler-rt.llvm.org/> doesn't list MIPS as supported.
(supported-systems (delete "mips64el-linux" %supported-systems))))
-(define (clang-from-llvm llvm clang-runtime hash)
+(define* (clang-from-llvm llvm clang-runtime hash
+ #:key (patches '("clang-libc-search-path.patch")))
(package
(name "clang")
(version (package-version llvm))
@@ -109,7 +110,7 @@ compiler. In LLVM this library is called \"compiler-rt\".")
(uri (string-append "http://llvm.org/releases/"
version "/cfe-" version ".src.tar.xz"))
(sha256 (base32 hash))
- (patches (search-patches "clang-libc-search-path.patch"))))
+ (patches (map search-patch patches))))
;; Using cmake allows us to treat llvm as an external library. There
;; doesn't seem to be any way to do this with clang's autotools-based
;; build system.
@@ -182,10 +183,32 @@ code analysis tools.")
(define-public clang-runtime
(clang-runtime-from-llvm
llvm
- "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"))
+ "0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"))
(define-public clang
(clang-from-llvm llvm clang-runtime
+ "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc"
+ #:patches '("clang-3.8-libc-search-path.patch")))
+
+(define-public llvm-3.7
+ (package (inherit llvm)
+ (version "3.7.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://llvm.org/releases/"
+ version "/llvm-" version ".src.tar.xz"))
+ (sha256
+ (base32
+ "1masakdp9g2dan1yrazg7md5am2vacbkb3nahb3dchpc1knr8xxy"))))))
+
+(define-public clang-runtime-3.7
+ (clang-runtime-from-llvm
+ llvm-3.7
+ "10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"))
+
+(define-public clang-3.7
+ (clang-from-llvm llvm-3.7 clang-runtime-3.7
"0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn"))
(define-public llvm-3.6
diff --git a/gnu/packages/patches/clang-3.8-libc-search-path.patch b/gnu/packages/patches/clang-3.8-libc-search-path.patch
new file mode 100644
index 0000000000..0f7d0a4add
--- /dev/null
+++ b/gnu/packages/patches/clang-3.8-libc-search-path.patch
@@ -0,0 +1,69 @@
+Clang attempts to guess file names based on the OS and distro (yes!),
+but unfortunately, that doesn't work for us.
+
+This patch makes it easy to insert libc's $libdir so that Clang passes the
+correct absolute file name of crt1.o etc. to 'ld'. It also disables all
+the distro-specific stuff and removes the hard-coded FHS directory names
+to make sure Clang also works on non-GuixSD systems.
+
+This patch makes slight adjustments over "clang-libc-search-path.patch" for
+changes in clang 3.8.
+
+--- cfe-3.8.0.src/lib/Driver/ToolChains.cpp
++++ cfe-3.8.0.src/lib/Driver/ToolChains.cpp
+@@ -3661,6 +3661,9 @@
+ GCCInstallation.getTriple().str() + "/bin")
+ .str());
+
++ // Comment out the distro-specific tweaks so that they don't bite when
++ // using Guix on a foreign distro.
++#if 0
+ Distro Distro = DetectDistro(D, Arch);
+
+ if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) {
+@@ -3702,6 +3705,7 @@
+
+ if (IsOpenSUSE(Distro))
+ ExtraOpts.push_back("--enable-new-dtags");
++#endif
+
+ // The selection of paths to try here is designed to match the patterns which
+ // the GCC driver itself uses, as this is part of the GCC-compatible driver.
+@@ -3771,14 +3775,12 @@
+ addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
+ }
+
+- addPathIfExists(D, SysRoot + "/lib/" + MultiarchTriple, Paths);
+- addPathIfExists(D, SysRoot + "/lib/../" + OSLibDir, Paths);
+- addPathIfExists(D, SysRoot + "/usr/lib/" + MultiarchTriple, Paths);
+- addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
+-
+ // Try walking via the GCC triple path in case of biarch or multiarch GCC
+ // installations with strange symlinks.
+ if (GCCInstallation.isValid()) {
++ // The following code would end up adding things like
++ // "/usr/lib/x86_64-unknown-linux-gnu/../../lib64" to the search path.
++#if 0
+ addPathIfExists(D,
+ SysRoot + "/usr/lib/" + GCCInstallation.getTriple().str() +
+ "/../../" + OSLibDir,
+@@ -3791,6 +3793,7 @@
+ BiarchSibling.gccSuffix(),
+ Paths);
+ }
++#endif
+
+ // See comments above on the multilib variant for details of why this is
+ // included even from outside the sysroot.
+@@ -3815,8 +3818,9 @@
+ if (StringRef(D.Dir).startswith(SysRoot))
+ addPathIfExists(D, D.Dir + "/../lib", Paths);
+
+- addPathIfExists(D, SysRoot + "/lib", Paths);
+- addPathIfExists(D, SysRoot + "/usr/lib", Paths);
++ // Add libc's lib/ directory to the search path, so that crt1.o, crti.o,
++ // and friends can be found.
++ addPathIfExists(D, "@GLIBC_LIBDIR@", Paths);
+ }
+
+ bool Linux::HasNativeLLVMSupport() const { return true; }