mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
gnu: cross-base: Switch back to 'CROSS_C_INCLUDE_PATH' & co.
This is a followup to 2073b55e6b
.
* gnu/build/cross-toolchain.scm (%gcc-include-paths): Switch back to
'C_INCLUDE_PATH' & co.
* gnu/packages/cross-base.scm (%gcc-include-paths): Likewise.
(cross-gcc-arguments): Remove 'treat-glibc-as-system-header' phase.
(cross-gcc)[native-inputs]: Reorder so that libc comes last.
[search-paths]: Add "include/c++" for 'CROSS_CPLUS_INCLUDE_PATH'.
* guix/build-system/gnu.scm (standard-cross-packages): Have "cross-gcc"
appear both for 'host and 'target.
This commit is contained in:
parent
fd1fde6041
commit
89da127035
3 changed files with 46 additions and 34 deletions
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2013, 2014, 2015, 2016, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
|
||||
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||
;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
|
||||
|
@ -38,8 +38,11 @@ (define-module (gnu build cross-toolchain)
|
|||
|
||||
(define %gcc-include-paths
|
||||
;; Environment variables for header search paths.
|
||||
;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
|
||||
'("CPATH"))
|
||||
;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
|
||||
'("C_INCLUDE_PATH"
|
||||
"CPLUS_INCLUDE_PATH"
|
||||
"OBJC_INCLUDE_PATH"
|
||||
"OBJCPLUS_INCLUDE_PATH"))
|
||||
|
||||
(define %gcc-cross-include-paths
|
||||
;; Search path for target headers when cross-compiling.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
|
||||
;;; Copyright © 2016, 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
|
||||
|
@ -54,8 +54,11 @@ (define-syntax %xgcc
|
|||
|
||||
(define %gcc-include-paths
|
||||
;; Environment variables for header search paths.
|
||||
;; Note: See <http://bugs.gnu.org/30756> for why not 'C_INCLUDE_PATH' & co.
|
||||
'("CPATH"))
|
||||
;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
|
||||
'("C_INCLUDE_PATH"
|
||||
"CPLUS_INCLUDE_PATH"
|
||||
"OBJC_INCLUDE_PATH"
|
||||
"OBJCPLUS_INCLUDE_PATH"))
|
||||
|
||||
(define %gcc-cross-include-paths
|
||||
;; Search path for target headers when cross-compiling.
|
||||
|
@ -177,19 +180,7 @@ (define (cross-gcc-arguments target xgcc libc)
|
|||
,flags))
|
||||
flags))
|
||||
((#:phases 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))))))))))
|
||||
`(cross-gcc-build-phases ,target ,phases))))))
|
||||
|
||||
(define (cross-gcc-patches xgcc target)
|
||||
"Return GCC patches needed for XGCC and TARGET."
|
||||
|
@ -262,27 +253,31 @@ (define* (cross-gcc target
|
|||
#:binutils xbinutils))
|
||||
("binutils-cross" ,xbinutils)
|
||||
|
||||
;; Call it differently so that the builder can check whether the "libc"
|
||||
;; input is #f.
|
||||
("libc-native" ,@(assoc-ref (%final-inputs) "libc"))
|
||||
|
||||
;; Remaining inputs.
|
||||
,@(let ((inputs (append (package-inputs xgcc)
|
||||
(alist-delete "libc" (%final-inputs)))))
|
||||
(fold alist-delete (%final-inputs)
|
||||
'("libc" "libc:static"))
|
||||
|
||||
;; Call it differently so that the builder can
|
||||
;; check whether the "libc" input is #f.
|
||||
`(("libc-native"
|
||||
,@(assoc-ref (%final-inputs) "libc"))
|
||||
("libc-native:static"
|
||||
,@(assoc-ref (%final-inputs)
|
||||
"libc:static"))))))
|
||||
(cond
|
||||
((target-mingw? target)
|
||||
(if libc
|
||||
`(("libc" ,libc)
|
||||
,@inputs)
|
||||
`(("mingw-source" ,(package-source mingw-w64))
|
||||
,@inputs)))
|
||||
`(,@inputs
|
||||
("libc" ,libc))
|
||||
`(,@inputs
|
||||
("mingw-source" ,(package-source mingw-w64)))))
|
||||
(libc
|
||||
`(("libc" ,libc)
|
||||
`(,@inputs
|
||||
("libc" ,libc)
|
||||
("libc:static" ,libc "static")
|
||||
("xkernel-headers" ;the target headers
|
||||
,@(assoc-ref (package-propagated-inputs libc)
|
||||
"kernel-headers"))
|
||||
,@inputs))
|
||||
"kernel-headers"))))
|
||||
(else inputs)))))
|
||||
|
||||
(inputs '())
|
||||
|
@ -294,7 +289,15 @@ (define* (cross-gcc target
|
|||
(map (lambda (variable)
|
||||
(search-path-specification
|
||||
(variable variable)
|
||||
(files '("include"))))
|
||||
|
||||
;; Add 'include/c++' here so that <cstdlib>'s
|
||||
;; "#include_next <stdlib.h>" finds GCC's
|
||||
;; <stdlib.h>, not libc's.
|
||||
(files (match variable
|
||||
("CROSS_CPLUS_INCLUDE_PATH"
|
||||
'("include/c++" "include"))
|
||||
(_
|
||||
'("include"))))))
|
||||
%gcc-cross-include-paths)))
|
||||
(native-search-paths '())))
|
||||
|
||||
|
|
|
@ -460,13 +460,19 @@ (define standard-cross-packages
|
|||
(libc (module-ref cross 'cross-libc)))
|
||||
(case kind
|
||||
((host)
|
||||
;; Cross-GCC appears once here, so that it's in $PATH...
|
||||
`(("cross-gcc" ,(gcc target
|
||||
#:xbinutils (binutils target)
|
||||
#:libc (libc target)))
|
||||
("cross-binutils" ,(binutils target))))
|
||||
((target)
|
||||
(let ((libc (libc target)))
|
||||
`(("cross-libc" ,libc)
|
||||
;; ... and once here, so that libstdc++ & co. are in
|
||||
;; CROSS_CPLUS_INCLUDE_PATH, etc.
|
||||
`(("cross-gcc" ,(gcc target
|
||||
#:xbinutils (binutils target)
|
||||
#:libc libc))
|
||||
("cross-libc" ,libc)
|
||||
|
||||
;; MinGW's libc doesn't have a "static" output.
|
||||
,@(if (member "static" (package-outputs libc))
|
||||
|
|
Loading…
Reference in a new issue