guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#54239] [PATCH v2 3/5] gnu: libcxx: Allow cross-compilation.


From: Julien Lepiller
Subject: [bug#54239] [PATCH v2 3/5] gnu: libcxx: Allow cross-compilation.
Date: Fri, 4 Mar 2022 10:59:51 +0100

* gnu/packages/llvm.scm (libcxx)[native-inputs]: Move llvm to...
[inputs]: ...here.
[arguments]: adjust CROSS_INCLUDE_PATH when cross-compiling.
(libcxx-6)[native-inputs]: Move llvm to...
[inputs]: ...here.
---
 gnu/packages/llvm.scm | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index c277e2ac35..137bc99f35 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1362,8 +1362,9 @@ (define-public libcxx
      `(#:phases
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((gcc (assoc-ref inputs  "gcc")))
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (let ((gcc (or (assoc-ref (or native-inputs inputs) "gcc")))
+                   (cross-gcc (assoc-ref native-inputs "cross-gcc")))
                ;; Hide GCC's C++ headers so that they do not interfere with
                ;; the ones we are attempting to build.
                (setenv "CPLUS_INCLUDE_PATH"
@@ -1371,12 +1372,19 @@ (define-public libcxx
                                             (string-split (getenv 
"CPLUS_INCLUDE_PATH")
                                                           #\:))
                                     ":"))
+               (when cross-gcc
+                 (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                         (string-join (delete (string-append cross-gcc 
"/include/c++")
+                                              (string-split (getenv 
"CPLUS_INCLUDE_PATH")
+                                                            #\:))
+                                      ":"))
+                 (format #t
+                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' 
changed to ~a~%"
+                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
                (format #t
                        "environment variable `CPLUS_INCLUDE_PATH' changed to 
~a~%"
-                       (getenv "CPLUS_INCLUDE_PATH"))
-               #t))))))
-    (native-inputs
-     (list clang llvm))
+                       (getenv "CPLUS_INCLUDE_PATH"))))))))
+    (inputs (list llvm-9))
     (home-page "https://libcxx.llvm.org";)
     (synopsis "C++ standard library")
     (description
@@ -1397,8 +1405,7 @@ (define-public libcxx-6
        (sha256
         (base32
          "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
-    (native-inputs
-     (list clang-6 llvm-6))))
+    (inputs (list llvm-6))))
 
 (define-public libcxxabi-6
   (package
-- 
2.34.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]