[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/13: gnu: clang: Move version conditionals out of the builder.
From: |
guix-commits |
Subject: |
07/13: gnu: clang: Move version conditionals out of the builder. |
Date: |
Wed, 26 Feb 2020 15:57:38 -0500 (EST) |
mbakke pushed a commit to branch master
in repository guix.
commit 5041cc28cb33a714ea40c91e14e55706d6dbb9dc
Author: Marius Bakke <address@hidden>
AuthorDate: Wed Feb 26 21:06:01 2020 +0100
gnu: clang: Move version conditionals out of the builder.
* gnu/packages/llvm.scm (clang-from-llvm)[arguments]: Rewrite phase
'set-glibc-file-names' to use VERSION>=? from (guix utils) and splice in the
relevant build code, instead of doing the comparison at build time.
---
gnu/packages/llvm.scm | 107 ++++++++++++++++++++++++--------------------------
1 file changed, 51 insertions(+), 56 deletions(-)
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 4a1a123..41217d1 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -226,64 +226,59 @@ compiler. In LLVM this library is called
\"compiler-rt\".")
(string-append "\"i686-unknown-linux-gnu\", "
all)))
#t))
- (add-after
- 'unpack 'set-glibc-file-names
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((libc (assoc-ref inputs "libc"))
- (compiler-rt (assoc-ref inputs "clang-runtime"))
- (gcc (assoc-ref inputs "gcc"))
- (version
- (string->number
- ,(version-major (package-version
clang-runtime)))))
- (cond
- ((> version 3)
- ;; Link to libclang_rt files from clang-runtime.
- (substitute* "lib/Driver/ToolChain.cpp"
- (("getDriver\\(\\)\\.ResourceDir")
- (string-append "\"" compiler-rt "\"")))
-
- ;; Make "LibDir" refer to <glibc>/lib so that it
- ;; uses the right dynamic linker file name.
- (substitute* "lib/Driver/ToolChains/Linux.cpp"
- (("(^[[:blank:]]+LibDir = ).*" _ declaration)
- (string-append declaration "\"" libc "/lib\";\n"))
-
- ;; Make clang look for libstdc++ in the right
- ;; location.
- (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
- (string-append
- "LibStdCXXIncludePathCandidates[] = { \"" gcc
"/include/c++\","))
-
- ;; Make sure libc's libdir is on the search path,
to
- ;; allow crt1.o & co. to be found.
- (("@GLIBC_LIBDIR@")
- (string-append libc "/lib"))))
- (else
- (substitute* "lib/Driver/Tools.cpp"
- ;; Patch the 'getLinuxDynamicLinker' function so
that
- ;; it uses the right dynamic linker file name.
- (("/lib64/ld-linux-x86-64.so.2")
- (string-append libc
- ,(glibc-dynamic-linker))))
-
- ;; Link to libclang_rt files from clang-runtime.
- ;; This substitution needed slight adjustment in 3.8.
- (if (< 3.8 (string->number ,(version-major+minor
- (package-version
- clang-runtime))))
- (substitute* "lib/Driver/Tools.cpp"
- (("TC\\.getDriver\\(\\)\\.ResourceDir")
- (string-append "\"" compiler-rt "\"")))
+ (add-after 'unpack 'set-glibc-file-names
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((libc (assoc-ref inputs "libc"))
+ (compiler-rt (assoc-ref inputs "clang-runtime"))
+ (gcc (assoc-ref inputs "gcc")))
+ ,@(cond
+ ((version>=? version "6.0")
+ `(;; Link to libclang_rt files from clang-runtime.
(substitute* "lib/Driver/ToolChain.cpp"
(("getDriver\\(\\)\\.ResourceDir")
- (string-append "\"" compiler-rt "\""))))
-
- ;; Make sure libc's libdir is on the search path, to
- ;; allow crt1.o & co. to be found.
- (substitute* "lib/Driver/ToolChains.cpp"
- (("@GLIBC_LIBDIR@")
- (string-append libc "/lib")))))
- #t)))
+ (string-append "\"" compiler-rt "\"")))
+
+ ;; Make "LibDir" refer to <glibc>/lib so that it
+ ;; uses the right dynamic linker file name.
+ (substitute* "lib/Driver/ToolChains/Linux.cpp"
+ (("(^[[:blank:]]+LibDir = ).*" _ declaration)
+ (string-append declaration "\"" libc
"/lib\";\n"))
+
+ ;; Make clang look for libstdc++ in the right
+ ;; location.
+ (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
+ (string-append
+ "LibStdCXXIncludePathCandidates[] = { \"" gcc
+ "/include/c++\","))
+
+ ;; Make sure libc's libdir is on the search
path, to
+ ;; allow crt1.o & co. to be found.
+ (("@GLIBC_LIBDIR@")
+ (string-append libc "/lib")))))
+ (else
+ `((substitute* "lib/Driver/Tools.cpp"
+ ;; Patch the 'getLinuxDynamicLinker' function
so that
+ ;; it uses the right dynamic linker file name.
+ (("/lib64/ld-linux-x86-64.so.2")
+ (string-append libc
+ ,(glibc-dynamic-linker))))
+
+ ;; Link to libclang_rt files from clang-runtime.
+ ;; This substitution needed slight adjustment in
3.8.
+ ,@(if (version>=? version "3.8")
+ '((substitute* "lib/Driver/Tools.cpp"
+ (("TC\\.getDriver\\(\\)\\.ResourceDir")
+ (string-append "\"" compiler-rt
"\""))))
+ '((substitute* "lib/Driver/ToolChain.cpp"
+ (("getDriver\\(\\)\\.ResourceDir")
+ (string-append "\"" compiler-rt
"\"")))))
+
+ ;; Make sure libc's libdir is on the search
path, to
+ ;; allow crt1.o & co. to be found.
+ (substitute* "lib/Driver/ToolChains.cpp"
+ (("@GLIBC_LIBDIR@")
+ (string-append libc "/lib"))))))
+ #t)))
(add-after 'install 'install-clean-up-/share/clang
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
- branch master updated (b68f5a6 -> e524b57), guix-commits, 2020/02/26
- 01/13: gnu: pocl: Build with LLVM@9., guix-commits, 2020/02/26
- 02/13: gnu: LibUV: Add version 1.34.2., guix-commits, 2020/02/26
- 03/13: gnu: nghttp2: Add version 1.40.0., guix-commits, 2020/02/26
- 06/13: gnu: clang: Fix C++ search path handling on non-x86_64., guix-commits, 2020/02/26
- 04/13: gnu: node: Update to 10.19.0., guix-commits, 2020/02/26
- 05/13: gnu: node: Disable failing tests on armhf-linux., guix-commits, 2020/02/26
- 08/13: gnu: emacs-elixir-mode: Fix capitalization in description., guix-commits, 2020/02/26
- 10/13: gnu: benchmark: Add bonnie++., guix-commits, 2020/02/26
- 07/13: gnu: clang: Move version conditionals out of the builder.,
guix-commits <=
- 11/13: gnu: musl: Update to 1.2.0., guix-commits, 2020/02/26
- 12/13: gnu: vim-full: Describe differences from vim., guix-commits, 2020/02/26
- 09/13: gnu: emacs-eacl: Fix typo in description., guix-commits, 2020/02/26
- 13/13: gnu: awscli: Update to 1.18.6., guix-commits, 2020/02/26