summaryrefslogtreecommitdiff
path: root/gnu/packages/cross-base.scm
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2016-04-29 17:12:22 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-03 17:45:29 +0200
commitefc4eb147512fa7a2c6d74d9b296cfc22b1ef198 (patch)
treeb140807d1a9c8b4c5cb0e3a897424221035517bb /gnu/packages/cross-base.scm
parenta8f3424b25cbbc585126420bcc1434c4a2398588 (diff)
downloadpatches-efc4eb147512fa7a2c6d74d9b296cfc22b1ef198.tar
patches-efc4eb147512fa7a2c6d74d9b296cfc22b1ef198.tar.gz
gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
* gnu/packages/patches/gcc-cross-environment-variables.patch: Also use CROSS_ variants: CROSS_C_INCLUDE_PATH, CROSS_CPLUS_INCLUDE_PATH, CROSS_OBJC_INCLUDE_PATH, CROSS_OBJCPLUS_INCLUDE_PATH to be used for system libraries, see https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00620.html. * gnu/packages/cross-base.scm (cross-gcc, cross-gcc-arguments, cross-libc): Use CROSS_*_INCLUDE_PATH (WAS: CPATH). Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/cross-base.scm')
-rw-r--r--gnu/packages/cross-base.scm71
1 files changed, 45 insertions, 26 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index aa67d21c19..7c76f60a4f 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -166,36 +167,40 @@ may be either a libc package or #f.)"
`(alist-cons-before
'configure 'set-cross-path
(lambda* (#:key inputs #:allow-other-keys)
- ;; Add the cross Linux headers to CROSS_CPATH, and remove them
- ;; from CPATH.
+ ;; Add the cross Linux headers to CROSS_C_*_INCLUDE_PATH,
+ ;; and remove them from C_*INCLUDE_PATH.
(let ((libc (assoc-ref inputs "libc"))
(linux (assoc-ref inputs "xlinux-headers")))
(define (cross? x)
;; Return #t if X is a cross-libc or cross Linux.
(or (string-prefix? libc x)
(string-prefix? linux x)))
-
- (setenv "CROSS_CPATH"
- (string-append libc "/include:"
- linux "/include"))
+ (let ((cpath (string-append
+ libc "/include"
+ ":" linux "/include")))
+ (for-each (cut setenv <> cpath)
+ '("CROSS_C_INCLUDE_PATH"
+ "CROSS_CPLUS_INCLUDE_PATH"
+ "CROSS_OBJC_INCLUDE_PATH"
+ "CROSS_OBJCPLUS_INCLUDE_PATH")))
(setenv "CROSS_LIBRARY_PATH"
(string-append libc "/lib"))
-
- (let ((cpath (search-path-as-string->list
- (getenv "C_INCLUDE_PATH")))
- (libpath (search-path-as-string->list
- (getenv "LIBRARY_PATH"))))
- (setenv "CPATH"
- (list->search-path-as-string
- (remove cross? cpath) ":"))
- (for-each unsetenv
- '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
- (setenv "LIBRARY_PATH"
- (list->search-path-as-string
- (remove cross? libpath) ":"))
- #t)))
- ,phases)
- phases)))))))
+ (for-each
+ (lambda (var)
+ (and=> (getenv var)
+ (lambda (value)
+ (let* ((path (search-path-as-string->list value))
+ (native-path (list->search-path-as-string
+ (remove cross? path) ":")))
+ (setenv var native-path)))))
+ '("C_INCLUDE_PATH"
+ "CPLUS_INCLUDE_PATH"
+ "OBJC_INCLUDE_PATH"
+ "OBJCPLUS_INCLUDE_PATH"
+ "LIBRARY_PATH"))
+ #t))
+ ,phases))
+ (else phases)))))))
(define (cross-gcc-patches target)
"Return GCC patches needed for TARGET."
@@ -259,9 +264,19 @@ GCC that does not target a libc; otherwise, target that libc."
(inputs '())
;; Only search target inputs, not host inputs.
+ ;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
(search-paths
(list (search-path-specification
- (variable "CROSS_CPATH")
+ (variable "CROSS_C_INCLUDE_PATH")
+ (files '("include")))
+ (search-path-specification
+ (variable "CROSS_CPLUS_INCLUDE_PATH")
+ (files '("include")))
+ (search-path-specification
+ (variable "CROSS_OBJC_INCLUDE_PATH")
+ (files '("include")))
+ (search-path-specification
+ (variable "CROSS_OBJCPLUS_INCLUDE_PATH")
(files '("include")))
(search-path-specification
(variable "CROSS_LIBRARY_PATH")
@@ -316,9 +331,13 @@ XBINUTILS and the cross tool chain."
`(alist-cons-before
'configure 'set-cross-linux-headers-path
(lambda* (#:key inputs #:allow-other-keys)
- (let ((linux (assoc-ref inputs "linux-headers")))
- (setenv "CROSS_CPATH"
- (string-append linux "/include"))
+ (let* ((linux (assoc-ref inputs "linux-headers"))
+ (cpath (string-append linux "/include")))
+ (for-each (cut setenv <> cpath)
+ '("CROSS_C_INCLUDE_PATH"
+ "CROSS_CPLUS_INCLUDE_PATH"
+ "CROSS_OBJC_INCLUDE_PATH"
+ "CROSS_OBJCPLUS_INCLUDE_PATH"))
#t))
,phases))))