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>
This commit is contained in:
parent
a8f3424b25
commit
efc4eb1475
|
@ -1,6 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
|
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
|
||||||
|
;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -166,36 +167,40 @@ may be either a libc package or #f.)"
|
||||||
`(alist-cons-before
|
`(alist-cons-before
|
||||||
'configure 'set-cross-path
|
'configure 'set-cross-path
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
;; Add the cross Linux headers to CROSS_CPATH, and remove them
|
;; Add the cross Linux headers to CROSS_C_*_INCLUDE_PATH,
|
||||||
;; from CPATH.
|
;; and remove them from C_*INCLUDE_PATH.
|
||||||
(let ((libc (assoc-ref inputs "libc"))
|
(let ((libc (assoc-ref inputs "libc"))
|
||||||
(linux (assoc-ref inputs "xlinux-headers")))
|
(linux (assoc-ref inputs "xlinux-headers")))
|
||||||
(define (cross? x)
|
(define (cross? x)
|
||||||
;; Return #t if X is a cross-libc or cross Linux.
|
;; Return #t if X is a cross-libc or cross Linux.
|
||||||
(or (string-prefix? libc x)
|
(or (string-prefix? libc x)
|
||||||
(string-prefix? linux x)))
|
(string-prefix? linux x)))
|
||||||
|
(let ((cpath (string-append
|
||||||
(setenv "CROSS_CPATH"
|
libc "/include"
|
||||||
(string-append libc "/include:"
|
":" linux "/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"
|
(setenv "CROSS_LIBRARY_PATH"
|
||||||
(string-append libc "/lib"))
|
(string-append libc "/lib"))
|
||||||
|
(for-each
|
||||||
(let ((cpath (search-path-as-string->list
|
(lambda (var)
|
||||||
(getenv "C_INCLUDE_PATH")))
|
(and=> (getenv var)
|
||||||
(libpath (search-path-as-string->list
|
(lambda (value)
|
||||||
(getenv "LIBRARY_PATH"))))
|
(let* ((path (search-path-as-string->list value))
|
||||||
(setenv "CPATH"
|
(native-path (list->search-path-as-string
|
||||||
(list->search-path-as-string
|
(remove cross? path) ":")))
|
||||||
(remove cross? cpath) ":"))
|
(setenv var native-path)))))
|
||||||
(for-each unsetenv
|
'("C_INCLUDE_PATH"
|
||||||
'("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"))
|
"CPLUS_INCLUDE_PATH"
|
||||||
(setenv "LIBRARY_PATH"
|
"OBJC_INCLUDE_PATH"
|
||||||
(list->search-path-as-string
|
"OBJCPLUS_INCLUDE_PATH"
|
||||||
(remove cross? libpath) ":"))
|
"LIBRARY_PATH"))
|
||||||
#t)))
|
#t))
|
||||||
,phases)
|
,phases))
|
||||||
phases)))))))
|
(else phases)))))))
|
||||||
|
|
||||||
(define (cross-gcc-patches target)
|
(define (cross-gcc-patches target)
|
||||||
"Return GCC patches needed for TARGET."
|
"Return GCC patches needed for TARGET."
|
||||||
|
@ -259,9 +264,19 @@ GCC that does not target a libc; otherwise, target that libc."
|
||||||
(inputs '())
|
(inputs '())
|
||||||
|
|
||||||
;; Only search target inputs, not host inputs.
|
;; Only search target inputs, not host inputs.
|
||||||
|
;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
|
||||||
(search-paths
|
(search-paths
|
||||||
(list (search-path-specification
|
(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")))
|
(files '("include")))
|
||||||
(search-path-specification
|
(search-path-specification
|
||||||
(variable "CROSS_LIBRARY_PATH")
|
(variable "CROSS_LIBRARY_PATH")
|
||||||
|
@ -316,9 +331,13 @@ XBINUTILS and the cross tool chain."
|
||||||
`(alist-cons-before
|
`(alist-cons-before
|
||||||
'configure 'set-cross-linux-headers-path
|
'configure 'set-cross-linux-headers-path
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
(let ((linux (assoc-ref inputs "linux-headers")))
|
(let* ((linux (assoc-ref inputs "linux-headers"))
|
||||||
(setenv "CROSS_CPATH"
|
(cpath (string-append linux "/include")))
|
||||||
(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))
|
#t))
|
||||||
,phases))))
|
,phases))))
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,23 @@
|
||||||
Search path environment variables for cross-compilers. See the discussion
|
Search path environment variables for cross-compilers. See the discussion
|
||||||
at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
|
at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
|
||||||
|
|
||||||
--- gcc-4.7.2/gcc/incpath.c 2012-01-27 00:34:58.000000000 +0100
|
Note: Touch 'C_INCLUDE_PATH' et al. rather than 'CPATH', as discussed
|
||||||
+++ gcc-4.7.2/gcc/incpath.c 2013-02-12 10:11:27.000000000 +0100
|
at <http://bugs.gnu.org/22186>.
|
||||||
@@ -452,7 +452,7 @@ register_include_chains (cpp_reader *pfi
|
|
||||||
|
--- a/gcc/incpath.c
|
||||||
|
+++ b/gcc/incpath.c
|
||||||
|
@@ -461,8 +461,8 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
|
||||||
|
int stdinc, int cxx_stdinc, int verbose)
|
||||||
|
{
|
||||||
|
static const char *const lang_env_vars[] =
|
||||||
|
- { "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH",
|
||||||
|
- "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH" };
|
||||||
|
+ { "CROSS_C_INCLUDE_PATH", "CROSS_CPLUS_INCLUDE_PATH",
|
||||||
|
+ "CROSS_OBJC_INCLUDE_PATH", "CROSS_OBJCPLUS_INCLUDE_PATH" };
|
||||||
|
cpp_options *cpp_opts = cpp_get_options (pfile);
|
||||||
|
size_t idx = (cpp_opts->objc ? 2: 0);
|
||||||
|
|
||||||
|
@@ -473,7 +473,7 @@ register_include_chains (cpp_reader *pfile, const char *sysroot,
|
||||||
|
|
||||||
/* CPATH and language-dependent environment variables may add to the
|
/* CPATH and language-dependent environment variables may add to the
|
||||||
include chain. */
|
include chain. */
|
||||||
|
@ -12,20 +26,22 @@ at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
|
||||||
add_env_var_paths (lang_env_vars[idx], SYSTEM);
|
add_env_var_paths (lang_env_vars[idx], SYSTEM);
|
||||||
|
|
||||||
target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc);
|
target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc);
|
||||||
|
diff --git a/gcc/system.h b/gcc/system.h
|
||||||
--- gcc-4.7.2/gcc/system.h 2012-02-17 00:16:28.000000000 +0100
|
index 42bc509..af3b9ad 100644
|
||||||
+++ gcc-4.7.2/gcc/system.h 2013-02-12 10:22:17.000000000 +0100
|
--- a/gcc/system.h
|
||||||
@@ -1023,4 +1023,6 @@ helper_const_non_const_cast (const char
|
+++ b/gcc/system.h
|
||||||
#define DEBUG_VARIABLE
|
@@ -1063,4 +1063,6 @@ helper_const_non_const_cast (const char *p)
|
||||||
#endif
|
/* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT. */
|
||||||
|
#include "hwint.h"
|
||||||
|
|
||||||
+#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH"
|
+#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH"
|
||||||
+
|
+
|
||||||
#endif /* ! GCC_SYSTEM_H */
|
#endif /* ! GCC_SYSTEM_H */
|
||||||
|
diff --git a/gcc/tlink.c b/gcc/tlink.c
|
||||||
--- gcc-4.7.2/gcc/tlink.c 2012-02-11 09:50:23.000000000 +0100
|
index bc358b8..ad6242f 100644
|
||||||
+++ gcc-4.7.2/gcc/tlink.c 2013-05-23 22:06:19.000000000 +0200
|
--- a/gcc/tlink.c
|
||||||
@@ -461,7 +461,7 @@ recompile_files (void)
|
+++ b/gcc/tlink.c
|
||||||
|
@@ -458,7 +458,7 @@ recompile_files (void)
|
||||||
file *f;
|
file *f;
|
||||||
|
|
||||||
putenv (xstrdup ("COMPILER_PATH="));
|
putenv (xstrdup ("COMPILER_PATH="));
|
||||||
|
@ -34,10 +50,11 @@ at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
|
||||||
|
|
||||||
while ((f = file_pop ()) != NULL)
|
while ((f = file_pop ()) != NULL)
|
||||||
{
|
{
|
||||||
|
diff --git a/gcc/gcc.c b/gcc/gcc.c
|
||||||
--- gcc-4.7.3/gcc/gcc.c 2013-03-08 08:25:09.000000000 +0100
|
index adbf0c4..70448c6 100644
|
||||||
+++ gcc-4.7.3/gcc/gcc.c 2013-05-24 08:58:16.000000000 +0200
|
--- a/gcc/gcc.c
|
||||||
@@ -3726,7 +3726,7 @@ process_command (unsigned int decoded_op
|
+++ b/gcc/gcc.c
|
||||||
|
@@ -3853,7 +3853,7 @@ process_command (unsigned int decoded_options_count,
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = getenv (LIBRARY_PATH_ENV);
|
temp = getenv (LIBRARY_PATH_ENV);
|
||||||
|
|
Loading…
Reference in New Issue