summaryrefslogtreecommitdiff
path: root/gnu/packages/gcc.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-03-09 13:08:53 +0100
committerLudovic Courtès <ludo@gnu.org>2023-03-09 13:08:53 +0100
commit0ad86e94f518c70690641c1d6f3a04037974a25b (patch)
tree4fdb725874a24b4b3aaee59b136956a1f751ee0e /gnu/packages/gcc.scm
parentb0f1728187fd512d8e71730a67cb1df65c04ccca (diff)
gnu: libstdc++: Fix cross-compilation.
* gnu/packages/gcc.scm (make-libstdc++): Adjust 'hide-gcc-headers' for cross-compiled libstdc++.
Diffstat (limited to 'gnu/packages/gcc.scm')
-rw-r--r--gnu/packages/gcc.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index d002545f8f..ce6e3e7a83 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
@@ -849,9 +849,12 @@ using compilers other than GCC."
#:phases
(modify-phases %standard-phases
,@(if (version>=? (package-version gcc) "11")
- '((add-after 'unpack 'hide-gcc-headers
+ `((add-after 'unpack 'hide-gcc-headers
(lambda* (#:key native-inputs inputs #:allow-other-keys)
- (let ((gcc (assoc-ref (or native-inputs inputs) "gcc")))
+ (let ((gcc (assoc-ref (or native-inputs inputs)
+ ,(if (%current-target-system)
+ "cross-gcc"
+ "gcc"))))
;; Fix a regression in GCC 11 where the GCC headers
;; shadows glibc headers when building libstdc++. An
;; upstream fix was added in GCC 11.3.0, but it only
@@ -861,11 +864,16 @@ using compilers other than GCC."
;; and the similar adjustment in GCC-FINAL.
(substitute* "libstdc++-v3/src/c++17/Makefile.in"
(("AM_CXXFLAGS = ")
- (string-append "CPLUS_INCLUDE_PATH = "
+ (string-append ,(if (%current-target-system)
+ "CROSS_CPLUS_INCLUDE_PATH = "
+ "CPLUS_INCLUDE_PATH = ")
(string-join
(remove (cut string-prefix? gcc <>)
(string-split
- (getenv "CPLUS_INCLUDE_PATH")
+ (getenv
+ ,(if (%current-target-system)
+ "CROSS_CPLUS_INCLUDE_PATH"
+ "CPLUS_INCLUDE_PATH"))
#\:))
":")
"\nAM_CXXFLAGS = ")))))))