all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
@ 2016-04-29 15:12 Jan Nieuwenhuizen
  2016-04-29 15:12 ` [PATCH 02/10] gnu: bootstrap: Add i686-mingw Jan Nieuwenhuizen
                   ` (11 more replies)
  0 siblings, 12 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* 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).
---
 gnu/packages/cross-base.scm                        | 70 +++++++++++-------
 .../patches/gcc-cross-environment-variables.patch  | 82 +++++++++++++++++-----
 2 files changed, 107 insertions(+), 45 deletions(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index aa67d21..ca2cf3b 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."
@@ -261,7 +266,16 @@ GCC that does not target a libc; otherwise, target that libc."
     ;; Only search target inputs, not host inputs.
     (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 +330,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))))
 
diff --git a/gnu/packages/patches/gcc-cross-environment-variables.patch b/gnu/packages/patches/gcc-cross-environment-variables.patch
index 0bd0be5..38f3456 100644
--- a/gnu/packages/patches/gcc-cross-environment-variables.patch
+++ b/gnu/packages/patches/gcc-cross-environment-variables.patch
@@ -1,9 +1,50 @@
-Search path environment variables for cross-compilers.  See the discussion
-at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
+From a1d8c3d926cb43e51a2b4838ad5cca9c2510fbbb Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke@gnu.org>
+Date: Sat, 16 Apr 2016 10:08:16 +0200
+Subject: [PATCH] Search path environment variables for cross-compilers.
 
---- gcc-4.7.2/gcc/incpath.c	2012-01-27 00:34:58.000000000 +0100
-+++ gcc-4.7.2/gcc/incpath.c	2013-02-12 10:11:27.000000000 +0100
-@@ -452,7 +452,7 @@ register_include_chains (cpp_reader *pfi
+See the discussion at
+
+    <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>
+
+which lead to the previous iteration of this patch, introducing CROSS_CPATH,
+CROSS_LIBRARY_PATH and advocated the use of CPATH/CROSS_CPATH.
+
+As a concequence of the bug report
+
+    http://bugs.gnu.org/22186
+
+usage of C_INCLUDE_PATH was re-introduced.  As noted in he discussion at
+
+    <https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00533.html>
+
+this introduces native headers in the search path and it was decided to keep
+using C_INCLUDE_PATH for system headers and introduce CROSS_C_INCLUDE_PATH et
+al., next to CROSS_CPATH to support cross compiling.
+
+---
+ gcc/gcc.c     | 2 +-
+ gcc/incpath.c | 6 +++---
+ gcc/system.h  | 2 ++
+ gcc/tlink.c   | 2 +-
+ 4 files changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/gcc/incpath.c b/gcc/incpath.c
+index f495c0a..ba12249 100644
+--- 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
       include chain.  */
@@ -12,20 +53,22 @@ at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
    add_env_var_paths (lang_env_vars[idx], SYSTEM);
  
    target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc);
-
---- gcc-4.7.2/gcc/system.h	2012-02-17 00:16:28.000000000 +0100
-+++ gcc-4.7.2/gcc/system.h	2013-02-12 10:22:17.000000000 +0100
-@@ -1023,4 +1023,6 @@ helper_const_non_const_cast (const char
- #define DEBUG_VARIABLE
- #endif
+diff --git a/gcc/system.h b/gcc/system.h
+index 42bc509..af3b9ad 100644
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -1063,4 +1063,6 @@ helper_const_non_const_cast (const char *p)
+ /* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT.  */
+ #include "hwint.h"
  
 +#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH"
 +
  #endif /* ! GCC_SYSTEM_H */
-
---- gcc-4.7.2/gcc/tlink.c	2012-02-11 09:50:23.000000000 +0100
-+++ gcc-4.7.2/gcc/tlink.c	2013-05-23 22:06:19.000000000 +0200
-@@ -461,7 +461,7 @@ recompile_files (void)
+diff --git a/gcc/tlink.c b/gcc/tlink.c
+index bc358b8..ad6242f 100644
+--- a/gcc/tlink.c
++++ b/gcc/tlink.c
+@@ -458,7 +458,7 @@ recompile_files (void)
    file *f;
  
    putenv (xstrdup ("COMPILER_PATH="));
@@ -34,10 +77,11 @@ at <http://gcc.gnu.org/ml/gcc/2013-02/msg00124.html>.
  
    while ((f = file_pop ()) != NULL)
      {
-
---- gcc-4.7.3/gcc/gcc.c	2013-03-08 08:25:09.000000000 +0100
-+++ gcc-4.7.3/gcc/gcc.c	2013-05-24 08:58:16.000000000 +0200
-@@ -3726,7 +3726,7 @@ process_command (unsigned int decoded_op
+diff --git a/gcc/gcc.c b/gcc/gcc.c
+index adbf0c4..70448c6 100644
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -3853,7 +3853,7 @@ process_command (unsigned int decoded_options_count,
      }
  
    temp = getenv (LIBRARY_PATH_ENV);
-- 
2.7.3

^ permalink raw reply related	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2016-05-16 21:03 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 02/10] gnu: bootstrap: Add i686-mingw Jan Nieuwenhuizen
2016-04-29 15:34   ` Manolis Ragkousis
2016-04-29 18:28     ` Jan Nieuwenhuizen
2016-05-01 11:02       ` Manolis Ragkousis
2016-04-29 15:12 ` [PATCH 03/10] gnu: Add mingw-w64 Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target Jan Nieuwenhuizen
2016-05-02  8:06   ` Andy Wingo
2016-05-02 18:34     ` Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 05/10] gnu: gmp: build shared library for mingw Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 06/10] gnu: Add libiconv Jan Nieuwenhuizen
2016-05-01 17:07   ` Manolis Ragkousis
2016-05-01 17:43     ` John Darrington
2016-05-01 18:58       ` Jan Nieuwenhuizen
2016-05-01 19:07         ` John Darrington
2016-05-03 12:19         ` Ludovic Courtès
2016-05-01 18:27     ` Jan Nieuwenhuizen
2016-05-03 12:20     ` Ludovic Courtès
2016-05-03 16:55       ` [PATCH 06a/10] " Jan Nieuwenhuizen
2016-05-05 14:56         ` Ludovic Courtès
2016-05-03 16:56       ` [PATCH 06b/10] gnu: Add function libiconv-if-needed Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 07/10] gnu: ncurses: support mingw Jan Nieuwenhuizen
2016-05-02  8:09   ` Andy Wingo
2016-05-02 18:41     ` Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 08/10] gnu: readline: " Jan Nieuwenhuizen
2016-05-02  8:12   ` Andy Wingo
2016-05-02 18:52     ` Jan Nieuwenhuizen
2016-05-02 19:25     ` Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 09/10] gnu: libunistring: support mingw: propagate libiconv if needed Jan Nieuwenhuizen
2016-04-29 15:12 ` [PATCH 10/10] gnu: guile-2.0: support mingw Jan Nieuwenhuizen
2016-05-02  8:04 ` [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Andy Wingo
2016-05-02 17:59   ` Jan Nieuwenhuizen
2016-05-03 12:06   ` Ludovic Courtès
2016-05-03 13:27     ` Andy Wingo
2016-05-03 12:16 ` Ludovic Courtès
2016-05-14  5:29 ` Mark H Weaver
2016-05-14  6:37   ` Jan Nieuwenhuizen
2016-05-14  8:25     ` FIXUP: " Jan Nieuwenhuizen
2016-05-14 20:05       ` Ludovic Courtès
2016-05-14 20:50         ` Jan Nieuwenhuizen
2016-05-16 21:02           ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.