guix-patches
[Top][All Lists]
Advanced

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

[bug#54239] [PATCH v3 07/10] gnu: libcxxabi-6: Allow cross-compilation.


From: Julien Lepiller
Subject: [bug#54239] [PATCH v3 07/10] gnu: libcxxabi-6: Allow cross-compilation.
Date: Sat, 16 Jul 2022 21:48:04 +0200

* gnu/packages/llvm.scm (libcxxabi-6)[native-inputs]: Use
clang-for-target for cross-compilation.  Move llvm and libcxx to...
[inputs]: ...here.
[arguments]<adjust-CPLUS_INCLUDE_PATH>: Also adjust
CROSS_CPLUS_INCLUDE_PATH when necessary.
---
 gnu/packages/llvm.scm | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 96620f1c3c..ba48897c8b 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1711,19 +1711,43 @@ (define-public libcxxabi-6
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
          (add-after 'unpack 'chdir
            (lambda _ (chdir "libcxxabi")))
-         (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((gcc (assoc-ref inputs  "gcc")))
+         (add-after 'unpack 'adjust-CPLUS_INCLUDE_PATH
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (define (delete* what lst)
+               (if (null? what)
+                   lst
+                   (delete* (cdr what) (delete (car what) lst))))
+
+             (let ((gcc (or (assoc-ref inputs  "gcc") (assoc-ref native-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"
                        (string-join
                         (cons (string-append
                                (assoc-ref inputs "libcxx") "/include/c++/v1")
-                              (delete (string-append gcc "/include/c++")
-                                      (string-split (getenv 
"CPLUS_INCLUDE_PATH")
-                                                    #\:)))
+                              (delete*
+                                `(,(string-append gcc "/include/c++")
+                                  ,@(if cross-gcc
+                                        `(,(string-append cross-gcc 
"/include/c++"))
+                                        '()))
+                                (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                              #\:)))
                         ":"))
+               (when cross-gcc
+                 (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                         (string-join
+                          (cons (string-append
+                                  (assoc-ref inputs "libcxx") 
"/include/c++/v1")
+                                (delete*
+                                  (list (string-append cross-gcc 
"/include/c++")
+                                        (string-append gcc "/include/c++"))
+                                  (string-split (getenv 
"CROSS_CPLUS_INCLUDE_PATH")
+                                                #\:)))
+                          ":"))
+                 (format #true
+                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' 
changed to ~a~%"
+                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
                (format #true
                        "environment variable `CPLUS_INCLUDE_PATH' changed to 
~a~%"
                        (getenv "CPLUS_INCLUDE_PATH")))))
@@ -1733,8 +1757,8 @@ (define-public libcxxabi-6
                                  (assoc-ref outputs "out") "/include")))
                (install-file "../libcxxabi/include/__cxxabi_config.h" 
include-dir)
                (install-file "../libcxxabi/include/cxxabi.h" include-dir)))))))
-    (native-inputs
-     (list clang-6 llvm-6 libcxx-6))
+    (inputs (list llvm-6 libcxx-6))
+    (native-inputs (list (clang-for-target clang-6)))
     (home-page "https://libcxxabi.llvm.org";)
     (synopsis "C++ standard library support")
     (description
-- 
2.37.0






reply via email to

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