diff options
Diffstat (limited to 'gnu/packages/cross-base.scm')
-rw-r--r-- | gnu/packages/cross-base.scm | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 22dfa15674..64d3e1ef67 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. ;;; @@ -174,26 +175,30 @@ may be either a libc package or #f.)" ;; Return #t if X is a cross-libc or cross Linux. (or (string-prefix? libc x) (string-prefix? kernel x))) - - (setenv "CROSS_CPATH" - (string-append libc "/include:" - kernel "/include")) + (let ((cpath (string-append + libc "/include" + ":" kernel "/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))) + (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) phases))))))) @@ -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-kernel-headers-path (lambda* (#:key inputs #:allow-other-keys) - (let ((kernel (assoc-ref inputs "kernel-headers"))) - (setenv "CROSS_CPATH" - (string-append kernel "/include")) + (let* ((kernel (assoc-ref inputs "kernel-headers")) + (cpath (string-append kernel "/include"))) + (for-each (cut setenv <> cpath) + '("CROSS_C_INCLUDE_PATH" + "CROSS_CPLUS_INCLUDE_PATH" + "CROSS_OBJC_INCLUDE_PATH" + "CROSS_OBJCPLUS_INCLUDE_PATH")) #t)) ,phases)))) |