diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-11-15 22:05:17 -0500 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-11-16 14:08:03 -0500 |
commit | ac99ead663b7797b6b320d3ed11d18496ba62209 (patch) | |
tree | c8d62636d0257b0be87e1b0a8d053c39a868cc88 /gnu/packages/llvm.scm | |
parent | 52c1f5c8253f1ee59bb75c09900c3dbcb970c232 (diff) | |
download | guix-ac99ead663b7797b6b320d3ed11d18496ba62209.tar.gz guix-ac99ead663b7797b6b320d3ed11d18496ba62209.zip |
gnu: Add clang-15.
* gnu/packages/llvm.scm (clang-from-llvm): Add LEGACY-BUILD-SHARED-LIBS?
argument and update doc.
[configure-flags]: Conditionally add -DCLANG_LINK_CLANG_DYLIB=ON.
[phases]{change-directory}: Conditionally add phase.
{add-tools-extra}: Conditionally patch AddClang.cmake file.
(clang-15): New variable.
(clang-14): Streamline.
(clang-13, clang-12, clang-11, clang-10, clang-9, clang-8, clang-7, clang-6)
(clang-3.9.1, clang-3.8, clang-3.7, clang-3.5): Set LEGACY-BUILD-SHARED-LIBS?
argument to #t.
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r-- | gnu/packages/llvm.scm | 96 |
1 files changed, 65 insertions, 31 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 9f4f64e0d0..2b958b060e 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -176,11 +176,14 @@ compiler. In LLVM this library is called \"compiler-rt\".") (properties (append `((release-monitoring-url . ,%llvm-release-monitoring-url)) - (clang-properties (package-version llvm))))) + (clang-properties (package-version llvm)))) + (legacy-build-shared-libs? #f)) "Produce Clang with dependencies on LLVM and CLANG-RUNTIME, and applying the given PATCHES. When TOOLS-EXTRA is given, it must point to the 'clang-tools-extra' tarball, which contains code for 'clang-tidy', 'pp-trace', -'modularize', and other tools." +'modularize', and other tools. LEGACY-BUILD-SHARED-LIBS? is used to configure +the package to use the legacy BUILD_SHARED_LIBS CMake option, which was used +until LLVM/Clang 14." (package (name "clang") (version (package-version llvm)) @@ -221,14 +224,17 @@ given PATCHES. When TOOLS-EXTRA is given, it must point to the (string-append "-DC_INCLUDE_DIRS=" (assoc-ref %build-inputs "libc") "/include") - ,@(if (target-riscv64?) - (list "-DLIBOMP_LIBFLAGS=-latomic" - "-DCMAKE_SHARED_LINKER_FLAGS=-latomic") - `())) + ,@(if (target-riscv64?) + (list "-DLIBOMP_LIBFLAGS=-latomic" + "-DCMAKE_SHARED_LINKER_FLAGS=-latomic") + `()) + ,@(if legacy-build-shared-libs? + '() + (list "-DCLANG_LINK_CLANG_DYLIB=ON"))) ,@(if (target-riscv64?) - `(#:make-flags '("LDFLAGS=-latomic")) - '()) + `(#:make-flags '("LDFLAGS=-latomic")) + '()) ;; Don't use '-g' during the build to save space. #:build-type "Release" @@ -247,9 +253,11 @@ given PATCHES. When TOOLS-EXTRA is given, it must point to the (string-delete #\- (package-version llvm)) ".src") "tools/extra") - ;; Build and link to shared libraries. - (substitute* "cmake/modules/AddClang.cmake" - (("BUILD_SHARED_LIBS") "True")) + ,@(if legacy-build-shared-libs? + ;; Build and link to shared libraries. + '((substitute* "cmake/modules/AddClang.cmake" + (("BUILD_SHARED_LIBS") "True"))) + '()) #t)))) '()) (add-after 'unpack 'add-missing-triplets @@ -323,6 +331,15 @@ given PATCHES. When TOOLS-EXTRA is given, it must point to the (("@GLIBC_LIBDIR@") (string-append libc "/lib")))))) #t))) + ;; Awkwardly, multiple phases added after the same phase, + ;; e.g. unpack, get applied in the reverse order. In other + ;; words, adding 'change-directory last means it occurs + ;; first after the unpack phase. + ,@(if (version>=? version "14") + '((add-after 'unpack 'change-directory + (lambda _ + (chdir "clang")))) + '()) ,@(if (version>=? version "10") `((add-after 'install 'adjust-cmake-file (lambda* (#:key outputs #:allow-other-keys) @@ -713,26 +730,31 @@ of programming tools as well as libraries with equivalent functionality.") ("gcc" ,gcc-11) ,@(package-native-inputs template)))))) +(define-public clang-15 + (clang-from-llvm + llvm-15 clang-runtime-15 + #:tools-extra + (origin + (method url-fetch) + (uri (llvm-uri "clang-tools-extra" + (package-version llvm-15))) + (sha256 + (base32 + "03adxlh84if9p53m6izjsql500rjza9rng8akab2pdqibgrg73rh"))))) + (define-public clang-14 - (let ((template - (clang-from-llvm llvm-14 clang-runtime-14 - #:tools-extra - (origin - (method url-fetch) - (uri (llvm-uri "clang-tools-extra" - (package-version llvm-14))) - (sha256 - (base32 - "0rhq4wkmvr369nkk059skzzw7jx6qhzqhmiwmqg4sp66avzviwvw")))))) - (package - (inherit template) - (arguments - (substitute-keyword-arguments (package-arguments template) - ((#:phases phases '(@ (guix build cmake-build-system) %standard-phases)) - #~(modify-phases #$phases - (add-after 'unpack 'change-directory - (lambda _ - (chdir "clang")))))))))) + (clang-from-llvm + llvm-14 clang-runtime-14 + #:legacy-build-shared-libs? #t + #:tools-extra + (origin + (method url-fetch) + (uri (llvm-uri "clang-tools-extra" + (package-version llvm-14))) + (sha256 + (base32 + "0rhq4wkmvr369nkk059skzzw7jx6qhzqhmiwmqg4sp66avzviwvw"))))) + (define-public libomp-14 (package @@ -805,6 +827,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-13 (clang-from-llvm llvm-13 clang-runtime-13 "1j8pr5kk8iqyb4jds3yl7c6x672617h4ngkpl4575j7mk4nrwykq" + #:legacy-build-shared-libs? #t #:patches '("clang-13.0-libc-search-path.patch") #:tools-extra (origin @@ -919,6 +942,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-12 (clang-from-llvm llvm-12 clang-runtime-12 "0px4gl27az6cdz6adds89qzdwb1cqpjsfvrldbz9qvpmphrj34bf" + #:legacy-build-shared-libs? #t #:patches '("clang-12.0-libc-search-path.patch") #:tools-extra (origin @@ -973,6 +997,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-11 (clang-from-llvm llvm-11 clang-runtime-11 "02ajkij85966vd150iy246mv16dsaph1kfi0y8wnncp8w6nar5hg" + #:legacy-build-shared-libs? #t #:patches '("clang-11.0-libc-search-path.patch") #:tools-extra (origin @@ -1029,12 +1054,13 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-10 (clang-from-llvm llvm-10 clang-runtime-10 "091bvcny2lh32zy8f3m9viayyhb2zannrndni7325rl85cwgr6pr" + #:legacy-build-shared-libs? #t #:patches '("clang-10.0-libc-search-path.patch") #:tools-extra (origin (method url-fetch) (uri (llvm-uri "clang-tools-extra" - (package-version llvm-10))) + (package-version llvm-10))) (sha256 (base32 "06n1yp638rh24xdxv9v2df0qajxbjz4w59b7dd4ky36drwmpi4yh"))))) @@ -1098,6 +1124,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-9 (clang-from-llvm llvm-9 clang-runtime-9 "0ls2h3iv4finqyflyhry21qhc9cm9ga7g1zq21020p065qmm2y2p" + #:legacy-build-shared-libs? #t #:patches '("clang-9.0-libc-search-path.patch"))) (define-public libomp-9 @@ -1141,6 +1168,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-8 (clang-from-llvm llvm-8 clang-runtime-8 "0ihnbdl058gvl2wdy45p5am55bq8ifx8m9mhcsgj9ax8yxlzvvvh" + #:legacy-build-shared-libs? #t #:patches '("clang-8.0-libc-search-path.patch"))) (define-public libomp-8 @@ -1183,6 +1211,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-7 (clang-from-llvm llvm-7 clang-runtime-7 "0vc4i87qwxnw9lci4ayws9spakg0z6w5w670snj9f8g5m9rc8zg9" + #:legacy-build-shared-libs? #t #:patches '("clang-7.0-libc-search-path.patch"))) (define-public libomp-7 @@ -1224,6 +1253,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-6 (clang-from-llvm llvm-6 clang-runtime-6 "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w" + #:legacy-build-shared-libs? #t #:patches '("clang-6.0-libc-search-path.patch"))) (define-public libomp-6 @@ -1285,6 +1315,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-3.9.1 (clang-from-llvm llvm-3.9.1 clang-runtime-3.9.1 "0qsyyb40iwifhhlx9a3drf8z6ni6zwyk3bvh0kx2gs6yjsxwxi76" + #:legacy-build-shared-libs? #t #:patches '("clang-3.8-libc-search-path.patch"))) (define-public llvm-3.8 @@ -1311,6 +1342,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-3.8 (clang-from-llvm llvm-3.8 clang-runtime-3.8 "1prc72xmkgx8wrzmrr337776676nhsp1qd3mw2bvb22bzdnq7lsc" + #:legacy-build-shared-libs? #t #:patches '("clang-3.8-libc-search-path.patch"))) (define-public llvm-3.7 @@ -1337,6 +1369,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-3.7 (clang-from-llvm llvm-3.7 clang-runtime-3.7 "0x065d0w9b51xvdjxwfzjxng0gzpbx45fgiaxpap45ragi61dqjn" + #:legacy-build-shared-libs? #t #:patches '("clang-3.5-libc-search-path.patch"))) (define-public llvm-3.6 @@ -1396,6 +1429,7 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.") (define-public clang-3.5 (clang-from-llvm llvm-3.5 clang-runtime-3.5 "0846h8vn3zlc00jkmvrmy88gc6ql6014c02l4jv78fpvfigmgssg" + #:legacy-build-shared-libs? #t #:patches '("clang-3.5-libc-search-path.patch"))) ;; Default LLVM and Clang version. |