aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/cross-base.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/cross-base.scm')
-rw-r--r--gnu/packages/cross-base.scm43
1 files changed, 17 insertions, 26 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index bb3d6d916a..6a092727c1 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -51,11 +52,8 @@
(define %gcc-include-paths
;; Environment variables for header search paths.
- ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
- '("C_INCLUDE_PATH"
- "CPLUS_INCLUDE_PATH"
- "OBJC_INCLUDE_PATH"
- "OBJCPLUS_INCLUDE_PATH"))
+ ;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
+ '("CPATH"))
(define %gcc-cross-include-paths
;; Search path for target headers when cross-compiling.
@@ -168,7 +166,19 @@ base compiler and using LIBC (which may be either a libc package or #f.)"
,flags))
flags))
((#:phases phases)
- `(cross-gcc-build-phases ,target ,phases))))))
+ `(cross-gcc-build-phases
+ ,target
+ (modify-phases ,phases
+ (add-before 'configure 'treat-glibc-as-system-header
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((libc (assoc-ref inputs "libc")))
+ (when libc
+ ;; For GCC6 and later, make sure Glibc is treated as a "system
+ ;; header" such that #include_next does the right thing.
+ (for-each (lambda (var)
+ (setenv var (string-append libc "/include")))
+ '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH")))
+ #t))))))))))
(define (cross-gcc-patches target)
"Return GCC patches needed for TARGET."
@@ -454,23 +464,6 @@ XBINUTILS and the cross tool chain."
flags)))
((#:phases phases)
`(modify-phases ,phases
- ;; XXX: The hack below allows us to make sure the
- ;; 'apply-hurd-patch' phase gets added in the first
- ;; cross-libc, but does *not* get added twice subsequently
- ;; when cross-building another libc.
- ,@(if (and (hurd-triplet? target)
- (not (hurd-target?)))
- `((add-after 'unpack 'apply-hurd-patch
- (lambda* (#:key inputs native-inputs
- #:allow-other-keys)
- ;; TODO: Move this to 'patches' field.
- (let ((patch (or (assoc-ref native-inputs
- "hurd-magic-pid-patch")
- (assoc-ref inputs
- "hurd-magic-pid-patch"))))
- (invoke "patch" "-p1" "--force" "--input"
- patch)))))
- '())
(add-before 'configure 'set-cross-kernel-headers-path
(lambda* (#:key inputs #:allow-other-keys)
(let* ((kernel (assoc-ref inputs "kernel-headers"))
@@ -494,9 +487,7 @@ XBINUTILS and the cross tool chain."
,@(if (hurd-triplet? target)
`(("cross-mig"
,@(assoc-ref (package-native-inputs xheaders)
- "cross-mig"))
- ("hurd-magic-pid-patch"
- ,(search-patch "glibc-hurd-magic-pid.patch")))
+ "cross-mig")))
'())
,@(package-inputs libc) ;FIXME: static-bash
,@(package-native-inputs libc)))))))