Subject: [bug#54239] [PATCH v3 09/10] gnu: Add libcxx-12.

From: Julien Lepiller <[email-masked]>
Date: Sat, 16 Jul 2022 21:48:06 +0200

* gnu/packages/llvm.scm (libcxx): Rename to...
(libcxx-9): ...this.
(libcxx-12): New variable.
---
 gnu/packages/llvm.scm | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 77c3ab73e0..4f0b57a990 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1624,21 +1624,24 @@ (define-public lldb
     (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))
     (license license:asl2.0))) ;with LLVM exceptions
 
-(define-public libcxx
+(define-public libcxx-12
   (package
     (name "libcxx")
-    (version "9.0.1")
+    (version (package-version llvm-12))
     (source
      (origin
        (method url-fetch)
-       (uri (llvm-uri "libcxx" version))
+       (uri (llvm-uri "llvm-project" version))
        (sha256
         (base32
-         "0d2bj5i6mk4caq7skd5nsdmz8c2m5w5anximl5wz3x32p08zz089"))))
+         "03ps7akvbkxxa4xzal49v7lw3bz41zmjsp6fa7cslxrns5fb570j"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
+         (add-after 'unpack 'chdir
+           (lambda _
+             (chdir "libcxx")))
          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (let ((gcc (or (assoc-ref (or native-inputs inputs) "gcc")))
@@ -1662,7 +1665,8 @@ (define-public libcxx
                (format #t
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
                        (getenv "CPLUS_INCLUDE_PATH"))))))))
-    (inputs (list llvm-9))
+    (inputs (list llvm-12))
+    (native-inputs (list python))
     (home-page "https://libcxx.llvm.org")
     (synopsis "C++ standard library")
     (description
@@ -1671,14 +1675,32 @@ (define-public libcxx
     (properties `((release-monitoring-url . ,%llvm-release-monitoring-url)))
     (license license:expat)))
 
+(define-public libcxx-9
+  (package
+    (inherit libcxx-12)
+    (version (package-version llvm-9))
+    (source
+     (origin
+       (method url-fetch)
+       (uri (llvm-uri "libcxx" version))
+       (sha256
+        (base32
+         "0d2bj5i6mk4caq7skd5nsdmz8c2m5w5anximl5wz3x32p08zz089"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments libcxx-12)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (delete 'chdir)))))
+    (inputs (list llvm-9))))
+
 ;; Libcxx files specifically used by PySide2.
 (define-public libcxx-6
   (package
-    (inherit libcxx)
+    (inherit libcxx-9)
     (version (package-version llvm-6))
     (source
      (origin
-       (inherit (package-source libcxx))
+       (inherit (package-source libcxx-9))
        (uri (llvm-uri "libcxx" version))
        (sha256
         (base32
@@ -1757,7 +1779,7 @@ (define (delete* what lst)
                (install-file ,(string-append "../libcxxabi-" version
                                              ".src/include/cxxabi.h")
                              include-dir)))))))
-    (inputs (list llvm-9 libcxx))
+    (inputs (list llvm-9 libcxx-9))
     (native-inputs (list (clang-for-target clang-9)))
     (home-page "https://libcxxabi.llvm.org")
     (synopsis "C++ standard library support")
-- 
2.37.0