diff options
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r-- | gnu/packages/llvm.scm | 114 |
1 files changed, 87 insertions, 27 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 617dfb6974..9b2506fe54 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -16,9 +16,11 @@ ;;; Copyright © 2019 Brett Gilio <brettg@gnu.org> ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> -;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> +;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> +;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2021 Julien Lepiller <julien@lepiller.eu> ;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net> +;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,6 +41,7 @@ #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix download) + #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix memoization) #:use-module (guix utils) @@ -64,7 +67,8 @@ #:use-module (gnu packages python) #:use-module (gnu packages swig) #:use-module (gnu packages xml) - #:export (system->llvm-target)) + #:export (make-lld-wrapper + system->llvm-target)) (define* (system->llvm-target #:optional (system (or (and=> (%current-target-system) @@ -492,20 +496,37 @@ output), and Binutils.") (build-system cmake-build-system) (outputs '("out" "opt-viewer")) (native-inputs - `(("python" ,python) + `(("python" ,python-wrapper) ("perl" ,perl))) (inputs `(("libffi" ,libffi))) (propagated-inputs `(("zlib" ,zlib))) ;to use output from llvm-config (arguments - `(#:configure-flags '("-DCMAKE_SKIP_BUILD_RPATH=FALSE" - "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" - "-DBUILD_SHARED_LIBS:BOOL=TRUE" - "-DLLVM_ENABLE_FFI:BOOL=TRUE" - "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities - "-DLLVM_INSTALL_UTILS=ON") ; Needed for rustc. - + ;; TODO(core-updates): Unconditionally use quasiquote + `(#:configure-flags + ,#~(#$(if (%current-target-system) + #~quasiquote + #~quote) + ;; These options are required for cross-compiling LLVM according to + ;; https://llvm.org/docs/HowToCrossCompileLLVM.html. + (#$@(if (%current-target-system) + #~(,(string-append "-DLLVM_TABLEGEN=" + #+(file-append this-package + "/bin/llvm-tblgen")) + #$(string-append "-DLLVM_DEFAULT_TARGET_TRIPLE=" + (%current-target-system)) + #$(string-append "-DLLVM_TARGET_ARCH=" + (system->llvm-target)) + #$(string-append "-DLLVM_TARGETS_TO_BUILD=" + (system->llvm-target))) + #~()) + "-DCMAKE_SKIP_BUILD_RPATH=FALSE" + "-DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE" + "-DBUILD_SHARED_LIBS:BOOL=TRUE" + "-DLLVM_ENABLE_FFI:BOOL=TRUE" + "-DLLVM_REQUIRES_RTTI=1" ; For some third-party utilities + "-DLLVM_INSTALL_UTILS=ON")) ; Needed for rustc. ;; Don't use '-g' during the build, to save space. #:build-type "Release" #:phases @@ -571,11 +592,7 @@ of programming tools as well as libraries with equivalent functionality.") (uri (llvm-uri "llvm" version)) (sha256 (base32 - "0s94lwil98w7zb7cjrbnxli0z7gklb312pkw74xs1d6zk346hgwi")))) - (native-inputs - `(;; TODO: Switch to Python 3 in the next rebuild cycle. - ("python" ,python-2) - ("perl" ,perl))))) + "0s94lwil98w7zb7cjrbnxli0z7gklb312pkw74xs1d6zk346hgwi")))))) (define-public clang-runtime-11 (clang-runtime-from-llvm @@ -601,23 +618,23 @@ of programming tools as well as libraries with equivalent functionality.") (define-public llvm-10 (package (inherit llvm-11) - (version "10.0.0") + (version "10.0.1") (source (origin (method url-fetch) (uri (llvm-uri "llvm" version)) (sha256 (base32 - "1pwgm6cr0xr5a0hrbqs1zvsvvjvy0yq1y47c96804wcs795s90yz")))))) + "1wydhbp9kyjp5y0rc627imxgkgqiv3dfirbqil9dgpnbaw5y7n65")))))) (define-public clang-runtime-10 (clang-runtime-from-llvm llvm-10 - "0x9c531k6ww21s2mkdwqx1vbdjmx6d4wmfb8gdbj0wqa796sczba")) + "1yjqjri753w0fzmxcyz687nvd97sbc9rsqrxzpq720na47hwh3fr")) (define-public clang-10 (clang-from-llvm llvm-10 clang-runtime-10 - "08fbxa2a0kr3ni35ckppj0kyvlcyaywrhpqwcdrdy0z900mhcnw8" + "091bvcny2lh32zy8f3m9viayyhb2zannrndni7325rl85cwgr6pr" #:patches '("clang-10.0-libc-search-path.patch") #:tools-extra (origin @@ -626,7 +643,7 @@ of programming tools as well as libraries with equivalent functionality.") (package-version llvm-10))) (sha256 (base32 - "074ija5s2jsdn0k035r2dzmryjmqxdnyg4xwvaqych2bazv8rpxc"))))) + "06n1yp638rh24xdxv9v2df0qajxbjz4w59b7dd4ky36drwmpi4yh"))))) (define-public clang-toolchain-10 (make-clang-toolchain clang-10)) @@ -825,6 +842,8 @@ of programming tools as well as libraries with equivalent functionality.") (origin (method url-fetch) (uri (llvm-uri "llvm" version)) + (patches + (search-patches "llvm-3.6-fix-build-with-gcc-10.patch")) (sha256 (base32 "153vcvj8gvgwakzr4j0kndc0b7wn91c2g1vy2vg24s6spxcc23gn")))))) @@ -859,14 +878,13 @@ of programming tools as well as libraries with equivalent functionality.") (add-after 'unpack 'find-rpc-includes (lambda* (#:key inputs #:allow-other-keys) (setenv "CPATH" - (string-append (assoc-ref inputs "libtirpc") - "/include/tirpc/:" - (or (getenv "CPATH") ""))) + (string-append + (search-input-directory inputs "/include/tirpc") + ":" (or (getenv "CPATH") ""))) (setenv "CPLUS_INCLUDE_PATH" - (string-append (assoc-ref inputs "libtirpc") - "/include/tirpc/:" - (or (getenv "CPLUS_INCLUDE_PATH") ""))) - #t)))))) + (string-append + (search-input-directory inputs "/include/tirpc") + ":" (or (getenv "CPLUS_INCLUDE_PATH") ""))))))))) (inputs `(("libtirpc" ,libtirpc) ("llvm" ,llvm-3.5)))))) @@ -975,6 +993,48 @@ of programming tools as well as libraries with equivalent functionality.") components which highly leverage existing libraries in the larger LLVM Project.") (license license:asl2.0))) ; With LLVM exception +(define* (make-lld-wrapper lld #:key lld-as-ld?) + "Return a LLD wrapper. When LLD-AS-LD? is true, create a 'ld' symlink that +points to 'lld'." + (package + (name (if lld-as-ld? "lld-as-ld-wrapper" "lld-wrapper")) + (version "0") + (source #f) + (build-system trivial-build-system) + (inputs `(("ld.lld-wrapper" ,(make-ld-wrapper "ld.lld-wrapper" + #:binutils lld + #:linker "ld.lld")) + ("lld-wrapper" ,(make-ld-wrapper "lld-wrapper" + #:binutils lld + #:linker "lld")))) + (arguments + (list #:builder + #~(let ((ld.lld (string-append #$(this-package-input + "ld.lld-wrapper") + "/bin/ld.lld")) + (lld (string-append #$(this-package-input "lld-wrapper") + "/bin/lld"))) + (mkdir #$output) + (mkdir (string-append #$output "/bin")) + (symlink ld.lld (string-append #$output "/bin/ld.lld")) + (symlink lld (string-append #$output "/bin/lld")) + (when #$lld-as-ld? + (symlink ld.lld (string-append #$output "/bin/ld")))))) + (synopsis "LLD linker wrapper") + (description "This is a linker wrapper for LLD; like @code{ld-wrapper}, it +wraps the linker to add any missing @code{-rpath} flags, and to detect any +misuse of libraries outside of the store.") + (home-page "https://www.gnu.org/software/guix/") + (license license:gpl3+))) + +;;; A LLD wrapper suitable to use with -fuse-ld and GCC or with Clang. +(define-public lld-wrapper + (make-lld-wrapper lld)) + +;;; A LLD wrapper that can be used as a (near) drop-in replacement to GNU ld. +(define-public lld-as-ld-wrapper + (make-lld-wrapper lld #:lld-as-ld? #t)) + (define-public lldb (package (name "lldb") |