summaryrefslogtreecommitdiff
path: root/gnu/packages/llvm.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r--gnu/packages/llvm.scm82
1 files changed, 64 insertions, 18 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 41217d14f0..1286fe521b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -96,6 +96,7 @@ as \"x86_64-linux\"."
(base32
"16hwp3qa54c3a3v7h8nlw0fh5criqh0hlr1skybyk0cz70gyx880"))))
(build-system cmake-build-system)
+ (outputs '("out" "opt-viewer"))
(native-inputs
`(("python" ,python-2) ;bytes->str conversion in clang>=3.7 needs python-2
("perl" ,perl)))
@@ -113,16 +114,27 @@ as \"x86_64-linux\"."
;; Don't use '-g' during the build, to save space.
#:build-type "Release"
- #:phases (modify-phases %standard-phases
- (add-before 'build 'shared-lib-workaround
- ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
- ;; doesn't seem to get the correct rpath to be able to run
- ;; from the build directory. Set LD_LIBRARY_PATH as a
- ;; workaround.
- (lambda _
- (setenv "LD_LIBRARY_PATH"
- (string-append (getcwd) "/lib"))
- #t)))))
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'build 'shared-lib-workaround
+ ;; Even with CMAKE_SKIP_BUILD_RPATH=FALSE, llvm-tblgen
+ ;; doesn't seem to get the correct rpath to be able to run
+ ;; from the build directory. Set LD_LIBRARY_PATH as a
+ ;; workaround.
+ (lambda _
+ (setenv "LD_LIBRARY_PATH"
+ (string-append (getcwd) "/lib"))
+ #t))
+ (add-after 'install 'install-opt-viewer
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (opt-viewer-out (assoc-ref outputs "opt-viewer"))
+ (opt-viewer-share-dir (string-append opt-viewer-out "/share"))
+ (opt-viewer-dir (string-append opt-viewer-share-dir "/opt-viewer")))
+ (mkdir-p opt-viewer-share-dir)
+ (rename-file (string-append out "/share/opt-viewer")
+ opt-viewer-dir))
+ #t)))))
(home-page "https://www.llvm.org")
(synopsis "Optimizing compiler infrastructure")
(description
@@ -152,7 +164,28 @@ of programming tools as well as libraries with equivalent functionality.")
(arguments
`(;; Don't use '-g' during the build to save space.
#:build-type "Release"
- #:tests? #f)) ; Tests require gtest
+ #:tests? #f ; Tests require gtest
+ #:modules ((srfi srfi-1)
+ (ice-9 match)
+ ,@%cmake-build-system-modules)
+ #:phases (modify-phases (@ (guix build cmake-build-system) %standard-phases)
+ (add-after 'set-paths 'hide-glibc
+ ;; Work around https://issues.guix.info/issue/36882. We need to
+ ;; remove glibc from CPLUS_INCLUDE_PATH so that the one hardcoded
+ ;; in GCC, at the bottom of GCC include search-path is used.
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((filters '("libc"))
+ (input-directories
+ (filter-map (lambda (input)
+ (match input
+ ((name . dir)
+ (and (not (member name filters))
+ dir))))
+ inputs)))
+ (set-path-environment-variable "CPLUS_INCLUDE_PATH"
+ '("include")
+ input-directories)
+ #t))))))
(home-page "https://compiler-rt.llvm.org")
(synopsis "Runtime library for Clang/LLVM")
(description
@@ -371,7 +404,8 @@ output), and Binutils.")
(define-public clang-runtime
(clang-runtime-from-llvm
llvm
- "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2"))
+ "0xwh79g3zggdabxgnd0bphry75asm1qz7mv3hcqihqwqr6aspgy2"
+ '("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang
(clang-from-llvm llvm clang-runtime
@@ -401,7 +435,8 @@ output), and Binutils.")
(define-public clang-runtime-8
(clang-runtime-from-llvm
llvm-8
- "1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl"))
+ "1c919wsm17xnv7lr8bhpq2wkq8113lzlw6hzhfr737j59x3wfddl"
+ '("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang-8
(clang-from-llvm llvm-8 clang-runtime-8
@@ -425,7 +460,8 @@ output), and Binutils.")
(define-public clang-runtime-7
(clang-runtime-from-llvm
llvm-7
- "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"))
+ "065ybd8fsc4h2hikbdyricj6pyv4r7r7kpcikhb2y5zf370xybkq"
+ '("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang-7
(clang-from-llvm llvm-7 clang-runtime-7
@@ -449,7 +485,8 @@ output), and Binutils.")
(define-public clang-runtime-6
(clang-runtime-from-llvm
llvm-6
- "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"))
+ "1fcr3jn24yr8lh36nc0c4ikli4744i2q9m1ik67p1jymwwaixkgl"
+ '("clang-runtime-9-libsanitizer-mode-field.patch")))
(define-public clang-6
(clang-from-llvm llvm-6 clang-runtime-6
@@ -469,13 +506,20 @@ output), and Binutils.")
(uri (llvm-download-uri "llvm" version))
(sha256
(base32
- "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z"))))))
+ "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z"))))
+ (outputs '("out"))
+ (arguments
+ (substitute-keyword-arguments (package-arguments llvm)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'install-opt-viewer)))))))
(define-public clang-runtime-3.9.1
(clang-runtime-from-llvm
llvm-3.9.1
"16gc2gdmp5c800qvydrdhsp0bzb97s8wrakl6i8a4lgslnqnf2fk"
- '("clang-runtime-asan-build-fixes.patch"
+ '("clang-runtime-3.9-libsanitizer-mode-field.patch"
+ "clang-runtime-asan-build-fixes.patch"
"clang-runtime-esan-build-fixes.patch"
"clang-3.5-libsanitizer-ustat-fix.patch")))
@@ -501,6 +545,7 @@ output), and Binutils.")
llvm-3.8
"0p0y85c7izndbpg2l816z7z7558axq11d5pwkm4h11sdw7d13w0d"
'("clang-runtime-asan-build-fixes.patch"
+ "clang-runtime-3.8-libsanitizer-mode-field.patch"
"clang-3.5-libsanitizer-ustat-fix.patch")))
(define-public clang-3.8
@@ -524,6 +569,7 @@ output), and Binutils.")
llvm-3.7
"10c1mz2q4bdq9bqfgr3dirc6hz1h3sq8573srd5q5lr7m7j6jiwx"
'("clang-runtime-asan-build-fixes.patch"
+ "clang-runtime-3.8-libsanitizer-mode-field.patch"
"clang-3.5-libsanitizer-ustat-fix.patch")))
(define-public clang-3.7
@@ -546,7 +592,7 @@ output), and Binutils.")
(clang-runtime-from-llvm
llvm-3.6
"11qx8d3pbfqjaj2x207pvlvzihbs1z2xbw4crpz7aid6h1yz6bqg"
- '("clang-runtime-asan-build-fixes.patch")))
+ '("clang-runtime-asan-build-fixes.patch")))
(define-public clang-3.6
(clang-from-llvm llvm-3.6 clang-runtime-3.6