summary refs log tree commit diff
diff options
context:
space:
mode:
authorZhu Zihao <all_but_last@163.com>2022-10-27 16:33:28 +0800
committerLudovic Courtès <ludo@gnu.org>2022-11-06 00:37:06 +0100
commit8501932f36d40ed2f35f6e48979072b3ed796b73 (patch)
treeafc6cdf36556d88046a99802c43cb7990071ad6d
parent86af794215d25350a74faec2d05d0c64fd4922c5 (diff)
downloadguix-8501932f36d40ed2f35f6e48979072b3ed796b73.tar.gz
gnu: libcxx: Update to 14.0.6.
* gnu/packages/llvm.scm(libcxx)[source]: Use "llvm-monorepo".
[arguments]<#:configure-flags>: Use clang & clang++, skip RPATH_CHANGE in CMake.
<#:phases>: Add phase "enter-subdirectory".
[native-inputs]: Add Python 3 for lit.

(libcxx-6)[arguments]: Don't inherit from libcxx.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/packages/llvm.scm49
1 files changed, 35 insertions, 14 deletions
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 00918bfb90..405ff0b0d8 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1531,19 +1531,27 @@ which highly leverage existing libraries in the larger LLVM project.")
 (define-public libcxx
   (package
     (name "libcxx")
-    (version "9.0.1")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (llvm-uri "libcxx" version))
-       (sha256
-        (base32
-         "0d2bj5i6mk4caq7skd5nsdmz8c2m5w5anximl5wz3x32p08zz089"))))
+    (version "14.0.6")
+    (source (llvm-monorepo version))
     (build-system cmake-build-system)
     (arguments
      (list
+      #:tests? #f
+      #:configure-flags
+      #~(list "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi"
+              "-DCMAKE_C_COMPILER=clang"
+              "-DCMAKE_CXX_COMPILER=clang++"
+              ;; libc++.so is actually a GNU ld style linker script, however,
+              ;; CMake still tries to fix the RUNPATH of it during the install
+              ;; step. This argument tells CMake to use the install directory
+              ;; as RUNPATH and don't attempt to patch it.
+              ;; See also: https://gitlab.kitware.com/cmake/cmake/-/issues/22963
+              "-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE")
       #:phases
       #~(modify-phases %standard-phases
+          (add-after 'unpack 'enter-subdirectory
+            (lambda _
+              (chdir "runtimes")))
           (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
             (lambda* (#:key inputs #:allow-other-keys)
               (let ((gcc (assoc-ref inputs  "gcc")))
@@ -1559,7 +1567,7 @@ which highly leverage existing libraries in the larger LLVM project.")
                         (getenv "CPLUS_INCLUDE_PATH"))
                 #t))))))
     (native-inputs
-     (list clang llvm))
+     (list clang llvm python))
     (home-page "https://libcxx.llvm.org")
     (synopsis "C++ standard library")
     (description
@@ -1575,16 +1583,29 @@ use with Clang, targeting C++11, C++14 and above.")
     (version (package-version llvm-6))
     (source
      (origin
-       (inherit (package-source libcxx))
+       (method url-fetch)
        (uri (llvm-uri "libcxx" version))
        (sha256
         (base32
          "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
     (arguments
-     (substitute-keyword-arguments (package-arguments libcxx)
-       ((#:phases p)
-        #~(modify-phases #$p
-            (delete 'enter-subdirectory)))))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((gcc (assoc-ref inputs  "gcc")))
+                ;; Hide GCC's C++ headers so that they do not interfere with
+                ;; the ones we are attempting to build.
+                (setenv "CPLUS_INCLUDE_PATH"
+                        (string-join (delete (string-append gcc "/include/c++")
+                                             (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                                           #\:))
+                                     ":"))
+                (format #t
+                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
+                        (getenv "CPLUS_INCLUDE_PATH"))
+                #t))))))
     (native-inputs
      (list clang-6 llvm-6))))