summary refs log tree commit diff
path: root/gnu/packages/llvm.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/llvm.scm')
-rw-r--r--gnu/packages/llvm.scm67
1 files changed, 42 insertions, 25 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index a79998e5ac..6403176306 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -17,8 +17,10 @@
 ;;; 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 © 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)
@@ -491,20 +494,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
@@ -570,11 +590,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
@@ -600,23 +616,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
@@ -625,7 +641,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))
@@ -824,6 +840,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"))))))
@@ -858,14 +876,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))))))