unofficial mirror of guix-devel@gnu.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

* [PATCH 02/10] gnu: bootstrap: Add i686-mingw.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-04-29 15:34   ` Manolis Ragkousis
  2016-04-29 15:12 ` [PATCH 03/10] gnu: Add mingw-w64 Jan Nieuwenhuizen
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add i686-mingw.
---
 gnu/packages/bootstrap.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 3f3770d..a3cd185 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -172,6 +172,7 @@ successful, or false to signal an error."
         ;; here just so we can keep going.
         ((string=? system "xtensa-elf") "no-ld.so")
         ((string=? system "avr") "no-ld.so")
+        ((string=? system "i686-mingw") "no-ld.so")
 
         (else (error "dynamic linker name not known for this system"
                      system))))
-- 
2.7.3

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

* [PATCH 03/10] gnu: Add mingw-w64.
  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:12 ` Jan Nieuwenhuizen
  2016-04-29 15:12 ` [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target Jan Nieuwenhuizen
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch,
gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch,
gnu/packages/mingw.scm: New files.
* gnu-system.am: Add them.
---
 gnu/local.mk                                       |  3 +
 gnu/packages/mingw.scm                             | 81 ++++++++++++++++++++++
 .../patches/gcc-4.9.3-mingw-gthr-default.patch     | 11 +++
 .../patches/mingw-w64-5.0rc2-gcc-4.9.3.patch       | 38 ++++++++++
 4 files changed, 133 insertions(+)
 create mode 100644 gnu/packages/mingw.scm
 create mode 100644 gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch
 create mode 100644 gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 9e31ef9..0c2776d 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -229,6 +229,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/mcrypt.scm			\
   gnu/packages/messaging.scm			\
   gnu/packages/mg.scm				\
+  gnu/packages/mingw.scm			\
   gnu/packages/mit-krb5.scm			\
   gnu/packages/moe.scm				\
   gnu/packages/moreutils.scm			\
@@ -485,6 +486,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/gcc-arm-link-spec-fix.patch		\
   gnu/packages/patches/gcc-cross-environment-variables.patch	\
   gnu/packages/patches/gcc-libvtv-runpath.patch			\
+  gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch	\
   gnu/packages/patches/gcc-5.0-libvtv-runpath.patch		\
   gnu/packages/patches/geoclue-config.patch			\
   gnu/packages/patches/ghostscript-CVE-2015-3228.patch		\
@@ -623,6 +625,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/mcron-install.patch			\
   gnu/packages/patches/mdadm-gcc-4.9-fix.patch			\
   gnu/packages/patches/mhash-keygen-test-segfault.patch		\
+  gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch		\
   gnu/packages/patches/mit-krb5-CVE-2015-8629.patch		\
   gnu/packages/patches/mit-krb5-CVE-2015-8630.patch		\
   gnu/packages/patches/mit-krb5-CVE-2015-8631.patch		\
diff --git a/gnu/packages/mingw.scm b/gnu/packages/mingw.scm
new file mode 100644
index 0000000..aa9f53a
--- /dev/null
+++ b/gnu/packages/mingw.scm
@@ -0,0 +1,81 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages mingw)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages cross-base)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages multiprecision)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix utils)
+  #:use-module (ice-9 match))
+
+(define-public mingw-w64
+  (package
+    (name "mingw-w64")
+    (version "5.0-rc2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://sourceforge.net/projects/mingw-w64/files/mingw-w64/"
+                    "mingw-w64-release/mingw-w64-v" version ".tar.bz2"))
+              (sha256
+               (base32 "0imdary8j07if8ih73pfgxiclpf2ax8h3mz8mxln07i8sbbd30c9"))
+              (patches (search-patches "mingw-w64-5.0rc2-gcc-4.9.3.patch"))))
+    (native-inputs `(("xgcc-core" ,xgcc-sans-libc-i686-w64-mingw32)
+                     ("xbinutils" ,xbinutils-i686-w64-mingw32)))
+    (build-system gnu-build-system)
+    (search-paths
+     (list (search-path-specification
+            (variable "CROSS_C_INCLUDE_PATH")
+            (files '("include" "i686-w64-mingw32/include")))
+           (search-path-specification
+            (variable "CROSS_LIBRARY_PATH")
+            (files
+             '("lib" "lib64" "i686-w64-mingw32/lib" "i686-w64-mingw32/lib64")))))
+    (arguments
+     `(#:configure-flags '("--host=i686-w64-mingw32")
+       #:phases (modify-phases %standard-phases
+         (add-before
+             'configure 'setenv
+           (lambda _
+             (let ((xgcc-core (assoc-ref %build-inputs "xgcc-core"))
+                   (mingw-headers (string-append (getcwd) "/mingw-w64-headers")))
+               (setenv "CPP"
+                       (string-append xgcc-core "/bin/i686-w64-mingw32-cpp"))
+               (setenv "CROSS_C_INCLUDE_PATH"
+                       (string-append
+                        mingw-headers
+                        ":" mingw-headers "/include"
+                        ":" mingw-headers "/crt"
+                        ":" mingw-headers "/defaults/include"
+                        ":" mingw-headers "/direct-x/include"))))))
+       #:make-flags (list "DEFS=-DHAVE_CONFIG_H -D__MINGW_HAS_DXSDK=1")
+       #:tests? #f ; compiles and includes glibc headers
+       #:strip-binaries? #f))
+    (home-page "http://mingw.org")
+    (synopsis "Minimalist GNU for Windows")
+    (description "MinGW provides a complete Open Source programming tool set
+which is suitable for the development of native MS-Windows applications, and
+which does not depend on any 3rd-party C-Runtime dlls.")
+    (license license:fdl1.3+)))
diff --git a/gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch b/gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch
new file mode 100644
index 0000000..0ea008a
--- /dev/null
+++ b/gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch
@@ -0,0 +1,11 @@
+--- a/libgcc/config/i386/gthr-win32.h	2016-03-30 07:45:33.388684463 +0200
++++ b/libgcc/config/i386/gthr-win32.h	2016-03-30 15:51:24.123896436 +0200
+@@ -30,7 +30,7 @@
+
+ /* Make sure CONST_CAST2 (origin in system.h) is declared.  */
+ #ifndef CONST_CAST2
+-#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
++#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)X)
+ #endif
+
+ /* Windows32 threads specific definitions. The windows32 threading model
diff --git a/gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch b/gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch
new file mode 100644
index 0000000..6048fb2
--- /dev/null
+++ b/gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch
@@ -0,0 +1,38 @@
+--- mingw-w64-v5.0-rc2/mingw-w64-headers/include/winnt.h.orig	2016-03-30 21:32:21.111586941 +0200
++++ mingw-w64-v5.0-rc2/mingw-w64-headers/include/winnt.h	2016-03-30 21:31:53.607559496 +0200
+@@ -6895,7 +6895,7 @@
+ 	  DWORD Reg : 3;
+ 	  DWORD R : 1;
+ 	  DWORD L : 1;
+-	  DWORD C : 1;
++	  DWORD C_ : 1;
+ 	  DWORD StackAdjust : 10;
+ 	} DUMMYSTRUCTNAME;
+       } DUMMYUNIONNAME;
+--- mingw-w64-v5.0-rc2/mingw-w64-headers/crt/math.h.orig	2016-03-30 21:27:25.375475927 +0200
++++ mingw-w64-v5.0-rc2/mingw-w64-headers/crt/math.h	2016-03-30 21:28:57.871461798 +0200
+@@ -216,6 +216,7 @@
+ #endif
+   }
+
++#if 0
+   __CRT_INLINE long double __cdecl fabsl (long double x)
+   {
+ #ifdef __arm__
+@@ -226,6 +227,7 @@
+     return res;
+ #endif
+   }
++#endif
+
+   __CRT_INLINE double __cdecl fabs (double x)
+   {
+@@ -905,7 +907,7 @@
+ /* 7.12.7.3  */
+   extern double __cdecl hypot (double, double) __MINGW_ATTRIB_DEPRECATED_MSVC2005; /* in libmoldname.a */
+   extern float __cdecl hypotf (float x, float y);
+-#ifndef __CRT__NO_INLINE
++#if 0 //ndef __CRT__NO_INLINE
+   __CRT_INLINE float __cdecl hypotf (float x, float y) { return (float) hypot ((double)x, (double)y);}
+ #endif
+   extern long double __cdecl hypotl (long double, long double);
-- 
2.7.3

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

* [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target.
  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:12 ` [PATCH 03/10] gnu: Add mingw-w64 Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-05-02  8:06   ` Andy Wingo
  2016-04-29 15:12 ` [PATCH 05/10] gnu: gmp: build shared library for mingw Jan Nieuwenhuizen
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* guix/utils.scm (mingw-target?): New function.
* gnu/packages/cross-base.scm (cross-gcc-snippet): New function for mingw.
(cross-gcc): Use it.
(cross-gcc-arguments, cross-gcc-patches, cross-gcc): Support mingw.
(native-libc, cross-newlib?): New functions.
(cross-libc): Use cross-newlib? to support mingw.
(xbinutils-i686-w64-mingw32, xgcc-sans-libc-i686-w64-mingw32,
xgcc-i686-w64-mingw32): New variables.
---
 gnu/packages/cross-base.scm | 148 +++++++++++++++++++++++++++++++++++++++-----
 guix/utils.scm              |   5 ++
 2 files changed, 138 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index ca2cf3b..68d40bd 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -19,12 +19,17 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages cross-base)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
-  #:use-module (gnu packages gcc)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages gawk)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages commencement)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages mingw)
+  #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -35,7 +40,8 @@
   #:use-module (ice-9 match)
   #:export (cross-binutils
             cross-libc
-            cross-gcc))
+            cross-gcc
+            cross-newlib?))
 
 (define %xgcc
   ;; GCC package used as the basis for cross-compilation.  It doesn't have to
@@ -121,7 +127,12 @@ may be either a libc package or #f.)"
                                "--disable-libquadmath"
                                "--disable-decimal-float" ;would need libc
                                "--disable-libcilkrts"
-                               )))
+                                ))
+
+                       ;; For a newlib (non-glibc) target
+                       ,@(if (cross-newlib? target)
+                             '("--with-newlib")
+                             '()))
 
                  ,(if libc
                       flags
@@ -163,7 +174,67 @@ may be either a libc package or #f.)"
                     ;; for cross-compilers.
                     (zero? (system* "make" "install-strip")))
                   ,phases))))
-          (if libc
+           (cond
+            ((mingw-target? target)
+             `(modify-phases ,phases
+                (add-before
+                 'configure 'set-cross-path
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; Add the cross mingw headers to CROSS_C_*_INCLUDE_PATH,
+                   ;; and remove them from C_*INCLUDE_PATH.
+                   (let ((libc (assoc-ref inputs "libc"))
+                         (gcc (assoc-ref inputs "gcc")))
+                     (define (cross? x)
+                       (and libc (string-prefix? libc x)))
+                     (if libc
+                         (let ((cpath (string-append
+                                       libc "/include"
+                                       ":" libc "/i686-w64-mingw32/include")))
+                           (for-each (cut setenv <> cpath)
+                                     '("CROSS_C_INCLUDE_PATH"
+                                       "CROSS_CPLUS_INCLUDE_PATH"
+                                       "CROSS_OBJC_INCLUDE_PATH"
+                                       "CROSS_OBJCPLUS_INCLUDE_PATH")))
+                         (let ((mingw-source (assoc-ref inputs "mingw-source"))
+                               (mingw-headers
+                                (string-append (getcwd) "/mingw-w64-v5.0-rc2/mingw-w64-headers")))
+                           (system* "tar" "xf" mingw-source)
+                           (copy-file (string-append mingw-headers "/crt/_mingw.h.in")
+                                      (string-append mingw-headers "/crt/_mingw.h"))
+                           (substitute* (string-append mingw-headers "/crt/_mingw.h")
+                             (("@MINGW_HAS_SECURE_API@") "#define MINGW_HAS_SECURE_API 1"))
+                           (let ((cpath (string-append
+                                         mingw-headers "/include"
+                                         ":" mingw-headers "/crt"
+                                         ":" mingw-headers "/defaults/include")))
+                             (for-each (cut setenv <> cpath)
+                                       '("CROSS_C_INCLUDE_PATH"
+                                         "CROSS_CPLUS_INCLUDE_PATH"
+                                         "CROSS_OBJC_INCLUDE_PATH"
+                                         "CROSS_OBJCPLUS_INCLUDE_PATH"
+                                         "CROSS_LIBRARY_PATH")))))
+                     (when libc
+                       (setenv "CROSS_LIBRARY_PATH"
+                               (string-append
+                                libc "/lib"
+                                ":" libc "/i686-w64-mingw32/lib")))
+                     (setenv "CPP" (string-append gcc "/bin/cpp"))
+                     (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)))))
+            (libc
               `(alist-cons-before
                 'configure 'set-cross-path
                 (lambda* (#:key inputs #:allow-other-keys)
@@ -200,17 +271,26 @@ may be either a libc package or #f.)"
                                 "LIBRARY_PATH"))
                     #t))
                 ,phases))
-          (else phases)))))))
+          (else phases))))))))
 
 (define (cross-gcc-patches target)
   "Return GCC patches needed for TARGET."
   (cond ((string-prefix? "xtensa-" target)
          ;; Patch by Qualcomm needed to build the ath9k-htc firmware.
          (search-patches "ath9k-htc-firmware-gcc.patch"))
+        ((mingw-target? target)
+         (search-patches "gcc-4.9.3-mingw-gthr-default.patch"))
+        (else '())))
+
+(define (cross-gcc-snippet target)
+  "Return GCC snippet needed for TARGET."
+  (cond ((mingw-target? target)
+         '(copy-recursively "libstdc++-v3/config/os/mingw32-w64"
+                            "libstdc++-v3/config/os/newlib"))
         (else '())))
 
 (define* (cross-gcc target
-                    #:optional (xbinutils (cross-binutils target)) libc)
+                    #:optional (xbinutils (cross-binutils target)) (libc #f))
   "Return a cross-compiler for TARGET, where TARGET is a GNU triplet.  Use
 XBINUTILS as the associated cross-Binutils.  If LIBC is false, then build a
 GCC that does not target a libc; otherwise, target that libc."
@@ -223,7 +303,10 @@ GCC that does not target a libc; otherwise, target that libc."
                (append
                 (origin-patches (package-source %xgcc))
                 (cons (search-patch "gcc-cross-environment-variables.patch")
-                      (cross-gcc-patches target))))))
+                      (cross-gcc-patches target))))
+              (modules '((guix build utils)))
+              (snippet
+               (cross-gcc-snippet target))))
 
     ;; For simplicity, use a single output.  Otherwise libgcc_s & co. are not
     ;; found by default, etc.
@@ -245,6 +328,7 @@ GCC that does not target a libc; otherwise, target that libc."
                              #:target target
                              #:binutils xbinutils))
        ("binutils-cross" ,xbinutils)
+       ("gcc" ,gcc)
 
        ;; Call it differently so that the builder can check whether the "libc"
        ;; input is #f.
@@ -253,13 +337,20 @@ GCC that does not target a libc; otherwise, target that libc."
        ;; Remaining inputs.
        ,@(let ((inputs (append (package-inputs %xgcc)
                                (alist-delete "libc" %final-inputs))))
-           (if libc
+           (cond
+            ((mingw-target? target)
+             (if libc
+                 `(("libc" ,mingw-w64)
+                   ,@inputs)
+                 `(("mingw-source" ,(package-source mingw-w64))
+                   ,@inputs)))
+            (libc
                `(("libc" ,libc)
                  ("xlinux-headers"                ;the target headers
                   ,@(assoc-ref (package-propagated-inputs libc)
                                "linux-headers"))
-                 ,@inputs)
-               inputs))))
+               ,@inputs))
+            (else inputs)))))
 
     (inputs '())
 
@@ -288,7 +379,11 @@ GCC that does not target a libc; otherwise, target that libc."
                      (xbinutils (cross-binutils target)))
   "Return a libc cross-built for TARGET, a GNU triplet.  Use XGCC and
 XBINUTILS and the cross tool chain."
-  (define xlinux-headers
+  (cond
+   ((cross-newlib? target)
+    (cross-newlib? target))
+   (else
+    (let ((xlinux-headers
     (package (inherit linux-libre-headers)
       (name (string-append (package-name linux-libre-headers)
                            "-cross-" target))
@@ -308,8 +403,7 @@ XBINUTILS and the cross tool chain."
             ,phases))))
       (native-inputs `(("cross-gcc" ,xgcc)
                        ("cross-binutils" ,xbinutils)
-                       ,@(package-native-inputs linux-libre-headers)))))
-
+                       ,@(package-native-inputs linux-libre-headers))))))
   (package (inherit glibc)
     (name (string-append "glibc-cross-" target))
     (arguments
@@ -351,7 +445,16 @@ XBINUTILS and the cross tool chain."
     (native-inputs `(("cross-gcc" ,xgcc)
                      ("cross-binutils" ,xbinutils)
                      ,@(package-inputs glibc)     ;FIXME: static-bash
-                     ,@(package-native-inputs glibc)))))
+                     ,@(package-native-inputs glibc))))))))
+
+(define (native-libc target)
+  (if (mingw-target? target)
+      mingw-w64
+      glibc))
+
+(define (cross-newlib? target)
+  (and (not (eq? (native-libc target) glibc))
+       (native-libc target)))
 
 \f
 ;;;
@@ -393,3 +496,18 @@ XBINUTILS and the cross tool chain."
 ;;     (cross-gcc triplet
 ;;                (cross-binutils triplet)
 ;;                (cross-libc triplet))))
+
+(define-public xgcc-sans-libc-i686-w64-mingw32
+  (let ((triplet "i686-w64-mingw32"))
+    (cross-gcc triplet
+               (cross-binutils triplet))))
+
+(define-public xbinutils-i686-w64-mingw32
+  (let ((triplet "i686-w64-mingw32"))
+    (cross-binutils triplet)))
+
+(define-public xgcc-i686-w64-mingw32
+  (let ((triplet "i686-w64-mingw32"))
+    (cross-gcc triplet
+               (cross-binutils triplet)
+               (cross-newlib? triplet))))
diff --git a/guix/utils.scm b/guix/utils.scm
index 6c01edd..f92367c 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -67,6 +67,7 @@
             gnu-triplet->nix-system
             %current-system
             %current-target-system
+            mingw-target?
             package-name->name+version
             version-compare
             version>?
@@ -585,6 +586,10 @@ returned by `config.guess'."
   ;; cross-building to.
   (make-parameter #f))
 
+(define* (mingw-target? #:optional (target (%current-target-system)))
+  (and target
+       (string-suffix? "-mingw32" target)))
+
 (define (package-name->name+version spec)
   "Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"
 and \"0.9.1b\".  When the version part is unavailable, SPEC and #f are
-- 
2.7.3

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

* [PATCH 05/10] gnu: gmp: build shared library for mingw.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (2 preceding siblings ...)
  2016-04-29 15:12 ` [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-04-29 15:12 ` [PATCH 06/10] gnu: Add libiconv Jan Nieuwenhuizen
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/multiprecision.scm (gmp)[MINGW]: Use --enable-shared.
---
 gnu/packages/multiprecision.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index 9924323..8c1a9b7 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -49,7 +50,13 @@
                 '(;; Build a "fat binary", with routines for several
                   ;; sub-architectures.
                   "--enable-fat"
-                  "--enable-cxx")))
+                  "--enable-cxx"
+                  ,@(cond ((mingw-target?)
+                           ;; Static and shared cannot be built in one go:
+                           ;; they produce different headers.  We need shared.
+                           `("--disable-static"
+                             "--enable-shared"))
+                          (else '())))))
    (synopsis "Multiple-precision arithmetic library")
    (description
     "GMP is a library for arbitrary precision arithmetic, operating on
-- 
2.7.3

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

* [PATCH 06/10] gnu: Add libiconv.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (3 preceding siblings ...)
  2016-04-29 15:12 ` [PATCH 05/10] gnu: gmp: build shared library for mingw Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-05-01 17:07   ` Manolis Ragkousis
  2016-04-29 15:12 ` [PATCH 07/10] gnu: ncurses: support mingw Jan Nieuwenhuizen
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/base.scm (libiconv): New variable.
(libiconv-if-needed): New function.
---
 gnu/packages/base.scm | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 1c4ebbf..8137918 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +25,7 @@
 
 (define-module (gnu packages base)
   #:use-module ((guix licenses)
-                #:select (gpl3+ lgpl2.0+ public-domain))
+                #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages bash)
@@ -43,7 +44,9 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system trivial))
+  #:use-module (guix build-system trivial)
+  #:export (glibc
+            libiconv-if-needed))
 
 ;;; Commentary:
 ;;;
@@ -936,6 +939,32 @@ reflect changes made by political bodies to time zone boundaries, UTC offsets,
 and daylight-saving rules.")
     (license public-domain)))
 
+(define-public libiconv
+  (package
+   (name "libiconv")
+   (version "1.14")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append
+                  "mirror://gnu/libiconv/libiconv-"
+                  version ".tar.gz"))
+            (sha256
+             (base32
+              "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))))
+   (build-system gnu-build-system)
+   (synopsis "Character set conversion library")
+   (description
+     "libiconv provides an implementation of the iconv function for systems
+that lack it.  iconv is used to convert between character encodings in a
+program.  It supports a wide variety of different encodings.")
+   (home-page "http://www.gnu.org/software/libiconv/")
+   (license lgpl3+)))
+
+(define* (libiconv-if-needed #:optional (target (%current-target-system)))
+  (if (mingw-target? target)
+      `(("libiconv" ,libiconv))
+      '()))
+
 (define-public (canonical-package package)
   ;; Avoid circular dependency by lazily resolving 'commencement'.
   (let* ((iface (resolve-interface '(gnu packages commencement)))
-- 
2.7.3

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

* [PATCH 07/10] gnu: ncurses: support mingw.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (4 preceding siblings ...)
  2016-04-29 15:12 ` [PATCH 06/10] gnu: Add libiconv Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-05-02  8:09   ` Andy Wingo
  2016-04-29 15:12 ` [PATCH 08/10] gnu: readline: " Jan Nieuwenhuizen
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/patches/ncurses-mingw.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/ncurses.scm (ncurses): Support mingw.
---
 gnu/local.mk                             |  1 +
 gnu/packages/ncurses.scm                 | 88 +++++++++++++++++++++++---------
 gnu/packages/patches/ncurses-mingw.patch | 24 +++++++++
 3 files changed, 89 insertions(+), 24 deletions(-)
 create mode 100644 gnu/packages/patches/ncurses-mingw.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 0c2776d..eb59fea 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -636,6 +636,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/mumps-build-parallelism.patch		\
   gnu/packages/patches/mupen64plus-ui-console-notice.patch	\
   gnu/packages/patches/mutt-store-references.patch		\
+  gnu/packages/patches/ncurses-mingw.patch			\
   gnu/packages/patches/net-tools-bitrot.patch			\
   gnu/packages/patches/ngircd-handle-zombies.patch		\
   gnu/packages/patches/ngircd-no-dns-in-tests.patch		\
diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index 147033a..840dcf2 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,9 +20,11 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages ncurses)
+  #:use-module (gnu packages)
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix utils)
   #:use-module (guix build-system gnu))
 
 (define-public ncurses
@@ -36,6 +39,7 @@
                     #:allow-other-keys)
             (let ((out (assoc-ref outputs "out"))
                   (doc (assoc-ref outputs "doc")))
+              (format #t "configure flags: ~s~%" configure-flags)
               (zero? (apply system* "./configure"
                             (string-append "SHELL=" (which "sh"))
                             (string-append "--build=" build)
@@ -60,33 +64,66 @@
                "mandir=share/man"))
             #t))
         (post-install-phase
-         '(lambda* (#:key outputs #:allow-other-keys)
-            (let ((out (assoc-ref outputs "out")))
+         `(lambda* (#:key outputs target #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out"))
+                  (mingw-target? (lambda* (#:optional (target target))
+                                   (and target
+                                        (string-suffix? "-mingw32" target))))
+                  (libraries '("curses" "ncurses" "form" "panel" "menu")))
               ;; When building a wide-character (Unicode) build, create backward
               ;; compatibility links from the the "normal" libraries to the
               ;; wide-character libraries (e.g. libncurses.so to libncursesw.so).
-              (with-directory-excursion (string-append out "/lib")
-                (for-each (lambda (lib)
-                            (define libw.a
-                              (string-append "lib" lib "w.a"))
-                            (define lib.a
-                              (string-append "lib" lib ".a"))
-                            (define libw.so.x
-                              (string-append "lib" lib "w.so.6"))
-                            (define lib.so.x
-                              (string-append "lib" lib ".so.6"))
-                            (define lib.so
-                              (string-append "lib" lib ".so"))
+              (cond
+               ((mingw-target? target)
+                (with-directory-excursion (string-append out "/bin")
+                  (for-each
+                   (lambda (lib)
+                     (define lib.dll
+                       (string-append "lib" lib ".dll"))
+                     (define libw6.dll
+                       (string-append "lib" lib "w6.dll"))
+
+                     (when (file-exists? libw6.dll)
+                       (format #t "creating symlinks for `lib~a'~%" lib)
+                       (symlink libw6.dll lib.dll)))
+                   libraries))
+                ;; TODO: create .la files to link to the .dll?
+                (with-directory-excursion (string-append out "/lib")
+                  (for-each
+                   (lambda (lib)
+                     (define libw.a
+                       (string-append "lib" lib "w.a"))
+                     (define lib.a
+                       (string-append "lib" lib ".a"))
+
+                     (when (file-exists? libw.a)
+                       (format #t "creating symlinks for `lib~a'~%" lib)
+                       (symlink libw.a lib.a)))
+                   libraries)))
+               (else
+                (with-directory-excursion (string-append out "/lib")
+                  (for-each
+                   (lambda (lib)
+                     (define libw.a
+                       (string-append "lib" lib "w.a"))
+                     (define lib.a
+                       (string-append "lib" lib ".a"))
+                     (define libw.so.x
+                       (string-append "lib" lib "w.so.6"))
+                     (define lib.so.x
+                       (string-append "lib" lib ".so.6"))
+                     (define lib.so
+                       (string-append "lib" lib ".so"))
 
-                            (when (file-exists? libw.a)
-                              (format #t "creating symlinks for `lib~a'~%" lib)
-                              (symlink libw.a lib.a)
-                              (symlink libw.so.x lib.so.x)
-                              (false-if-exception (delete-file lib.so))
-                              (call-with-output-file lib.so
-                                (lambda (p)
-                                  (format p "INPUT (-l~aw)~%" lib)))))
-                          '("curses" "ncurses" "form" "panel" "menu")))))))
+                     (when (file-exists? libw.a)
+                       (format #t "creating symlinks for `lib~a'~%" lib)
+                       (symlink libw.a lib.a)
+                       (symlink libw.so.x lib.so.x)
+                       (false-if-exception (delete-file lib.so))
+                       (call-with-output-file lib.so
+                         (lambda (p)
+                           (format p "INPUT (-l~aw)~%" lib)))))
+                   libraries))))))))
     (package
      (name "ncurses")
      (version "6.0")
@@ -94,6 +131,7 @@
               (method url-fetch)
               (uri (string-append "mirror://gnu/ncurses/ncurses-"
                                   version ".tar.gz"))
+              (patches (search-patches "ncurses-mingw.patch"))
               (sha256
                (base32
                 "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm"))))
@@ -113,7 +151,9 @@
           ;; Make sure programs like 'tic', 'reset', and 'clear' have a
           ;; correct RUNPATH.
           ,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out")
-                          "/lib"))
+                          "/lib")
+          ;; MinGW: Provide termcap api, created for the MinGW port.
+          ,@(if ,(mingw-target?) '("--enable-term-driver") '()))
         #:tests? #f                               ; no "check" target
         #:phases (modify-phases %standard-phases
                    (replace 'configure ,configure-phase)
diff --git a/gnu/packages/patches/ncurses-mingw.patch b/gnu/packages/patches/ncurses-mingw.patch
new file mode 100644
index 0000000..0f6a313
--- /dev/null
+++ b/gnu/packages/patches/ncurses-mingw.patch
@@ -0,0 +1,24 @@
+Taken from Eli Zaretskii's gdb bug report
+
+    https://sourceware.org/ml/gdb-patches/2012-04/msg01052.html
+
+Upstream status: Not presented to upstream.
+
+--- ncurses-6.0.orig/include/curses.h.in	2014-08-09 22:39:44.000000000 +0200
++++ ncurses-6.0/include/curses.h.in	2016-04-09 20:47:14.266679000 +0200
+@@ -1420,3 +1420,15 @@
+ #define KEY_BREAK	0401		/* Break key (unreliable) */
+ #define KEY_SRESET	0530		/* Soft (partial) reset (unreliable) */
+ #define KEY_RESET	0531		/* Reset or hard reset (unreliable) */
++
++#ifdef __MINGW32__
++/* Windows API headers, included e.g. by serial.h, define MOUSE_MOVED,
++   and so does PDCurses's curses.h, but for an entirely different
++   purpose.  Since we don't use the Windows semantics of MOUSE_MOVED
++   anywhere, avoid compiler warnings by undefining MOUSE_MOVED before
++   including curses.h.  */
++#undef MOUSE_MOVED
++/* Likewise, KEY_EVENT is defined by ncurses.h, but also by Windows
++   API headers.  */
++#undef KEY_EVENT
++#endif
-- 
2.7.3

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

* [PATCH 08/10] gnu: readline: support mingw.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (5 preceding siblings ...)
  2016-04-29 15:12 ` [PATCH 07/10] gnu: ncurses: support mingw Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-05-02  8:12   ` Andy Wingo
  2016-04-29 15:12 ` [PATCH 09/10] gnu: libunistring: support mingw: propagate libiconv if needed Jan Nieuwenhuizen
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/patches/readline-6.3-mingw.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/readline.scm (readline): Support mingw.
---
 gnu/local.mk                                  |   1 +
 gnu/packages/patches/readline-6.3-mingw.patch | 128 ++++++++++++++++++++++++++
 gnu/packages/readline.scm                     |  17 +++-
 3 files changed, 143 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/readline-6.3-mingw.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index eb59fea..26685e2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -724,6 +724,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/qt4-ldflags.patch			\
   gnu/packages/patches/ratpoison-shell.patch			\
   gnu/packages/patches/readline-link-ncurses.patch		\
+  gnu/packages/patches/readline-6.3-mingw.patch			\
   gnu/packages/patches/ripperx-missing-file.patch		\
   gnu/packages/patches/rsem-makefile.patch			\
   gnu/packages/patches/sed-hurd-path-max.patch			\
diff --git a/gnu/packages/patches/readline-6.3-mingw.patch b/gnu/packages/patches/readline-6.3-mingw.patch
new file mode 100644
index 0000000..28064bb
--- /dev/null
+++ b/gnu/packages/patches/readline-6.3-mingw.patch
@@ -0,0 +1,128 @@
+Mingw lacks some SIG*.  Taken from
+
+    wget https://raw.githubusercontent.com/Alexpux/MINGW-packages/master/mingw-w64-readline/readline-6.3-mingw.patch
+
+some updates to make it apply.
+
+Upstream status: Not presented to upstream.
+
+--- colors.c~	2013-03-20 11:19:08.000000000 -0400
++++ colors.c	2015-07-20 12:44:31.821014500 -0400
+@@ -37,6 +37,10 @@
+ #include "posixstat.h" // stat related macros (S_ISREG, ...)
+ #include <fcntl.h> // S_ISUID
+ 
++#ifndef S_ISDIR
++#define	S_ISDIR(m)	(((m) & S_IFMT) == S_IFDIR)
++#endif
++
+ // strlen()
+ #if defined (HAVE_STRING_H)
+ #  include <string.h>
+@@ -151,12 +155,17 @@
+       if (S_ISREG (mode))
+         {
+           colored_filetype = C_FILE;
+-
++#ifdef S_ISUID
+           if ((mode & S_ISUID) != 0 && is_colored (C_SETUID))
+             colored_filetype = C_SETUID;
+-          else if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
++		else
++#endif
++#ifdef S_ISGID
++          if ((mode & S_ISGID) != 0 && is_colored (C_SETGID))
+             colored_filetype = C_SETGID;
+-          else if (is_colored (C_CAP) && 0) //f->has_capability)
++          else
++#endif
++		  if (is_colored (C_CAP) && 0) //f->has_capability)
+             colored_filetype = C_CAP;
+           else if ((mode & S_IXUGO) != 0 && is_colored (C_EXEC))
+             colored_filetype = C_EXEC;
+@@ -180,15 +189,19 @@
+             colored_filetype = C_STICKY;
+ #endif
+         }
++	#ifdef S_ISLNK
+       else if (S_ISLNK (mode))
+         colored_filetype = ((linkok == 0
+                  && (!strncmp (_rl_color_indicator[C_LINK].string, "target", 6)
+                      || _rl_color_indicator[C_ORPHAN].string))
+                 ? C_ORPHAN : C_LINK);
++	#endif
+       else if (S_ISFIFO (mode))
+         colored_filetype = C_FIFO;
++	#ifdef S_ISSOCK
+       else if (S_ISSOCK (mode))
+         colored_filetype = C_SOCK;
++#endif
+       else if (S_ISBLK (mode))
+         colored_filetype = C_BLK;
+       else if (S_ISCHR (mode))
+--- signals.c~	2014-01-10 15:06:48.000000000 -0500
++++ signals.c	2015-07-20 12:33:07.437472100 -0400
+@@ -216,7 +216,9 @@
+       /* FALLTHROUGH */
+ 
+     case SIGTERM:
++#if defined (SIGHUP)
+     case SIGHUP:
++#endif
+ #if defined (SIGTSTP)
+     case SIGTSTP:
+     case SIGTTOU:
+@@ -397,7 +399,9 @@
+ 
+       sigaddset (&bset, SIGINT);
+       sigaddset (&bset, SIGTERM);
++#ifdef SIGHUP
+       sigaddset (&bset, SIGHUP);
++#endif
+ #if defined (SIGQUIT)
+       sigaddset (&bset, SIGQUIT);
+ #endif
+@@ -426,7 +430,9 @@
+ 
+       rl_maybe_set_sighandler (SIGINT, rl_signal_handler, &old_int);
+       rl_maybe_set_sighandler (SIGTERM, rl_signal_handler, &old_term);
++#ifdef SIGHUP
+       rl_maybe_set_sighandler (SIGHUP, rl_signal_handler, &old_hup);
++#endif
+ #if defined (SIGQUIT)
+       rl_maybe_set_sighandler (SIGQUIT, rl_signal_handler, &old_quit);
+ #endif
+@@ -491,7 +497,9 @@
+ 	 overhead */
+       rl_maybe_restore_sighandler (SIGINT, &old_int);
+       rl_maybe_restore_sighandler (SIGTERM, &old_term);
++#ifdef SIGHUP
+       rl_maybe_restore_sighandler (SIGHUP, &old_hup);
++#endif
+ #if defined (SIGQUIT)
+       rl_maybe_restore_sighandler (SIGQUIT, &old_quit);
+ #endif
+--- input.c~	1970-01-01 01:00:00.000000000 +0100
++++ input.c	2016-04-01 20:13:24.293063372 +0200
+@@ -532,11 +532,18 @@
+ 	 Otherwise (not EINTR), some error occurred, also signifying EOF. */
+       if (errno != EINTR)
+ 	return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
+-      else if (_rl_caught_signal == SIGHUP || _rl_caught_signal == SIGTERM)
++      else if (
++#ifdef SIGHUP
++	  _rl_caught_signal == SIGHUP ||
++#endif
++	  _rl_caught_signal == SIGTERM)
+ 	return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
+-      else if (_rl_caught_signal == SIGINT || _rl_caught_signal == SIGQUIT)
++      else if (_rl_caught_signal == SIGINT
++#ifdef SIGQUIT
++	  || _rl_caught_signal == SIGQUIT
++#endif
++	  )
+         RL_CHECK_SIGNALS ();
+-
+       if (rl_signal_event_hook)
+ 	(*rl_signal_event_hook) ();
+     }
diff --git a/gnu/packages/readline.scm b/gnu/packages/readline.scm
index db469db..eaf84e1 100644
--- a/gnu/packages/readline.scm
+++ b/gnu/packages/readline.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,7 +23,8 @@
   #:use-module (gnu packages ncurses)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (guix utils))
 
 (define-public readline
   (let ((post-install-phase
@@ -46,21 +48,30 @@
                (sha256
                 (base32
                  "0hzxr9jxqqx5sxsv9vmlxdnvlr9vi4ih1avjb869hbs6p5qn1fjn"))
-               (patches (search-patches "readline-link-ncurses.patch"))
+               (patches (search-patches "readline-link-ncurses.patch"
+                                        "readline-6.3-mingw.patch"))
                (patch-flags '("-p0"))))
       (build-system gnu-build-system)
       (propagated-inputs `(("ncurses" ,ncurses)))
       (arguments `(#:configure-flags
                    (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
                                         (assoc-ref %build-inputs "ncurses")
-                                        "/lib")
+                                        ,(if (mingw-target?) "/bin" "/lib"))
 
                          ;; This test does an 'AC_TRY_RUN', which aborts when
                          ;; cross-compiling, so provide the correct answer.
                          ,@(if (%current-target-system)
                                '("bash_cv_wcwidth_broken=no")
+                               '())
+                         ;; MinGW: ncurses provides the termcap api.
+                         ,@(if (mingw-target?)
+                               '("bash_cv_termcap_lib=ncurses")
                                '()))
 
+                   #:make-flags (list ,@(if (mingw-target?)
+                                            ;; MinGW: termcap in ncurses
+                                            '("TERMCAP_LIB=-lncurses")
+                                            '()))
                    #:phases (alist-cons-after
                              'install 'post-install
                              ,post-install-phase
-- 
2.7.3

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

* [PATCH 09/10] gnu: libunistring: support mingw: propagate libiconv if needed.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (6 preceding siblings ...)
  2016-04-29 15:12 ` [PATCH 08/10] gnu: readline: " Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-04-29 15:12 ` [PATCH 10/10] gnu: guile-2.0: support mingw Jan Nieuwenhuizen
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/libunistring (libunistring): propagated-inputs: add
libiconv-if-needed.  Fixes unicode translation in mingw.
---
 gnu/packages/libunistring.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/libunistring.scm b/gnu/packages/libunistring.scm
index f29b742..d2feac2 100644
--- a/gnu/packages/libunistring.scm
+++ b/gnu/packages/libunistring.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,7 +22,8 @@
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages base))
 
 (define-public libunistring
   (package
@@ -35,7 +37,7 @@
             (sha256
              (base32
               "0ixxmgpgh2v8ifm6hbwsjxl023myk3dfnj7wnvmqjivza31fw9cn"))))
-   (propagated-inputs '())                  ; FIXME: add libiconv when !glibc
+   (propagated-inputs `(,@(libiconv-if-needed)))
    (build-system gnu-build-system)
    (arguments
     ;; Work around parallel build issue whereby C files may be compiled before
-- 
2.7.3

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

* [PATCH 10/10] gnu: guile-2.0: support mingw.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (7 preceding siblings ...)
  2016-04-29 15:12 ` [PATCH 09/10] gnu: libunistring: support mingw: propagate libiconv if needed Jan Nieuwenhuizen
@ 2016-04-29 15:12 ` Jan Nieuwenhuizen
  2016-05-02  8:04 ` [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Andy Wingo
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 15:12 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/guile.scm (guile-2.0): Support mingw.
---
 gnu/packages/guile.scm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 53ea3e5..3fd9ded 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -135,11 +135,12 @@ without requiring the source code to be rewritten.")
               "1qh3j7308qvsjgwf7h94yqgckpbgz2k3yqdkzsyhqcafvfka9l5f"))
             (patches (search-patches "guile-arm-fixes.patch"))))
    (build-system gnu-build-system)
-   (native-inputs `(("pkgconfig" ,pkg-config)))
+   (native-inputs `(("pkgconfig" ,pkg-config)
+                    ,@(if (mingw-target?) `(("bash" ,bash)) '())))
    (inputs `(("libffi" ,libffi)
              ("readline" ,readline)
-             ("bash" ,bash)))
-
+             ,@(libiconv-if-needed)
+             ,@(if (mingw-target?) '() `(("bash" ,bash)))))
    (propagated-inputs
     `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
        ;; reads `-lltdl -lunistring', adding them here will add the needed
@@ -168,7 +169,9 @@ without requiring the source code to be rewritten.")
                   (let ((bash (assoc-ref inputs "bash")))
                     (substitute* "module/ice-9/popen.scm"
                       (("/bin/sh")
-                       (string-append bash "/bin/bash")))))
+                       (if bash
+                           (string-append bash "/bin/bash")
+                           "bash")))))
                 %standard-phases)))
 
    (native-search-paths
-- 
2.7.3

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

* Re: [PATCH 02/10] gnu: bootstrap: Add i686-mingw.
  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
  0 siblings, 1 reply; 41+ messages in thread
From: Manolis Ragkousis @ 2016-04-29 15:34 UTC (permalink / raw)
  To: Jan Nieuwenhuizen, guix-devel

Hey Jan,


On 04/29/16 18:12, Jan Nieuwenhuizen wrote:
> * gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add i686-mingw.
>
Could you change the message to
"* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add case for
i686-mingw."
to be more consistent with other similar commits?

Other than that OK for master.

Thank you,
Manolis

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

* Re: [PATCH 02/10] gnu: bootstrap: Add i686-mingw.
  2016-04-29 15:34   ` Manolis Ragkousis
@ 2016-04-29 18:28     ` Jan Nieuwenhuizen
  2016-05-01 11:02       ` Manolis Ragkousis
  0 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-04-29 18:28 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

Manolis Ragkousis writes:

Hi Manolis,

> Could you change the message to
> "* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add case for
> i686-mingw."
> to be more consistent with other similar commits?
>
> Other than that OK for master.

Like so?
Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-bootstrap-Add-case-for-i686-mingw.patch --]
[-- Type: text/x-diff, Size: 904 bytes --]

From be2bcbab4b19c26f7425e9aa09b08b93dbbfa68e Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Thu, 14 Apr 2016 07:31:35 +0200
Subject: [PATCH 02/10] gnu: bootstrap: Add case for i686-mingw.

* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Add case for i686-mingw.
---
 gnu/packages/bootstrap.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 3f3770d..a3cd185 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -172,6 +172,7 @@ successful, or false to signal an error."
         ;; here just so we can keep going.
         ((string=? system "xtensa-elf") "no-ld.so")
         ((string=? system "avr") "no-ld.so")
+        ((string=? system "i686-mingw") "no-ld.so")
 
         (else (error "dynamic linker name not known for this system"
                      system))))
-- 
2.7.3


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 02/10] gnu: bootstrap: Add i686-mingw.
  2016-04-29 18:28     ` Jan Nieuwenhuizen
@ 2016-05-01 11:02       ` Manolis Ragkousis
  0 siblings, 0 replies; 41+ messages in thread
From: Manolis Ragkousis @ 2016-05-01 11:02 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

Pushed to master.

Thanks :-)

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

* Re: [PATCH 06/10] gnu: Add libiconv.
  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
                       ` (2 more replies)
  0 siblings, 3 replies; 41+ messages in thread
From: Manolis Ragkousis @ 2016-05-01 17:07 UTC (permalink / raw)
  To: Jan Nieuwenhuizen, guix-devel

Καλησπέρα Jan,

On 04/29/2016 06:12 PM, Jan Nieuwenhuizen wrote:
> +  #:use-module (guix build-system trivial)
> +  #:export (glibc
> +            libiconv-if-needed))

The #:export (glibc...) part only exists in wip-hurd so we need to
remove this in order for your patch to apply on master.

> +(define-public libiconv
> +  (package
> +   (name "libiconv")
> +   (version "1.14")
> +   (source (origin
> +            (method url-fetch)
> +            (uri (string-append
> +                  "mirror://gnu/libiconv/libiconv-"
> +                  version ".tar.gz"))
> +            (sha256
> +             (base32
> +              "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))))
> +   (build-system gnu-build-system)
> +   (synopsis "Character set conversion library")
> +   (description
> +     "libiconv provides an implementation of the iconv function for systems
> +that lack it.  iconv is used to convert between character encodings in a
> +program.  It supports a wide variety of different encodings.")
> +   (home-page "http://www.gnu.org/software/libiconv/")
> +   (license lgpl3+)))

Maybe we should break this patch into two different ones, one for the
libiconv package description and one for the libiconv-if-needed. The
first will go to master and the second to core-updates. WDYT?

> +
> +(define* (libiconv-if-needed #:optional (target (%current-target-system)))
> +  (if (mingw-target? target)
> +      `(("libiconv" ,libiconv))
> +      '()))
> +

I am sorry for my ignorance but why is libiconv needed when targeting mingw?

Thanks,
Manolis

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

* Re: [PATCH 06/10] gnu: Add libiconv.
  2016-05-01 17:07   ` Manolis Ragkousis
@ 2016-05-01 17:43     ` John Darrington
  2016-05-01 18:58       ` Jan Nieuwenhuizen
  2016-05-01 18:27     ` Jan Nieuwenhuizen
  2016-05-03 12:20     ` Ludovic Courtès
  2 siblings, 1 reply; 41+ messages in thread
From: John Darrington @ 2016-05-01 17:43 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2214 bytes --]

On Sun, May 01, 2016 at 08:07:56PM +0300, Manolis Ragkousis wrote:
     ?????????????????? Jan,
     
     On 04/29/2016 06:12 PM, Jan Nieuwenhuizen wrote:
     > +  #:use-module (guix build-system trivial)
     > +  #:export (glibc
     > +            libiconv-if-needed))
     
     The #:export (glibc...) part only exists in wip-hurd so we need to
     remove this in order for your patch to apply on master.
     
     > +(define-public libiconv
     > +  (package
     > +   (name "libiconv")
     > +   (version "1.14")
     > +   (source (origin
     > +            (method url-fetch)
     > +            (uri (string-append
     > +                  "mirror://gnu/libiconv/libiconv-"
     > +                  version ".tar.gz"))
     > +            (sha256
     > +             (base32
     > +              "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))))
     > +   (build-system gnu-build-system)
     > +   (synopsis "Character set conversion library")
     > +   (description
     > +     "libiconv provides an implementation of the iconv function for systems
     > +that lack it.  iconv is used to convert between character encodings in a
     > +program.  It supports a wide variety of different encodings.")
     > +   (home-page "http://www.gnu.org/software/libiconv/")
     > +   (license lgpl3+)))
     
     Maybe we should break this patch into two different ones, one for the
     libiconv package description and one for the libiconv-if-needed. The
     first will go to master and the second to core-updates. WDYT?
     
     > +
     > +(define* (libiconv-if-needed #:optional (target (%current-target-system)))
     > +  (if (mingw-target? target)
     > +      `(("libiconv" ,libiconv))
     > +      '()))
     > +
     
     I am sorry for my ignorance but why is libiconv needed when targeting mingw?
     
Because Microsoft does not implement iconv, and presumably this package needs it.

J'

-- 
Avoid eavesdropping.  Send strong encryted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH 06/10] gnu: Add libiconv.
  2016-05-01 17:07   ` Manolis Ragkousis
  2016-05-01 17:43     ` John Darrington
@ 2016-05-01 18:27     ` Jan Nieuwenhuizen
  2016-05-03 12:20     ` Ludovic Courtès
  2 siblings, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-01 18:27 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1626 bytes --]

Manolis Ragkousis writes:

> Καλησπέρα Jan,

Goedeavond Manolis,

>> +  #:export (glibc
>> +            libiconv-if-needed))
>
> The #:export (glibc...) part only exists in wip-hurd so we need to
> remove this in order for your patch to apply on master.

Ok, changed to

    #:export (libiconv-if-needed))

>> +(define-public libiconv

> Maybe we should break this patch into two different ones, one for the
> libiconv package description and one for the libiconv-if-needed. The
> first will go to master and the second to core-updates. WDYT?

I don't think that's necessary.  This patch itself does not change any
package.  The only thing this patch does is add libiconv, and the
convenience function:

>> +(define* (libiconv-if-needed #:optional (target (%current-target-system)))
>> +  (if (mingw-target? target)
>> +      `(("libiconv" ,libiconv))
>> +      '()))

that can be used by other packages, such as libunistring.  See below.
As we get more platforms that have libc without iconv, they can be
added to the if condition above.

> I am sorry for my ignorance but why is libiconv needed when targeting
> mingw?

Libiconv is character-set translation functionality that's also present
in glibc.  MinGW is one of those platforms that has a libc without
iconv.  Some packages, e.g. libunistring, need iconv functionality.

Have a look at the 09/10 libunistring patch, it says

-   (propagated-inputs '())                  ; FIXME: add libiconv when !glibc
+   (propagated-inputs `(,@(libiconv-if-needed)))

as libunistring depends on iconv.

Greetings,
Jan


[-- Attachment #2: 0006-gnu-Add-libiconv.patch --]
[-- Type: text/x-diff, Size: 2804 bytes --]

From c04fb3f9ae21c49a5925d7cc767dd558273c4082 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Tue, 12 Apr 2016 15:46:58 +0200
Subject: [PATCH 06/10] gnu: Add libiconv.

* gnu/packages/base.scm (libiconv): New variable.
(libiconv-if-needed): New function.
---
 gnu/packages/base.scm | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 1c4ebbf..34dac61 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +25,7 @@
 
 (define-module (gnu packages base)
   #:use-module ((guix licenses)
-                #:select (gpl3+ lgpl2.0+ public-domain))
+                #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages bash)
@@ -43,7 +44,8 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system trivial))
+  #:use-module (guix build-system trivial)
+  #:export (libiconv-if-needed))
 
 ;;; Commentary:
 ;;;
@@ -936,6 +938,32 @@ reflect changes made by political bodies to time zone boundaries, UTC offsets,
 and daylight-saving rules.")
     (license public-domain)))
 
+(define-public libiconv
+  (package
+   (name "libiconv")
+   (version "1.14")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append
+                  "mirror://gnu/libiconv/libiconv-"
+                  version ".tar.gz"))
+            (sha256
+             (base32
+              "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))))
+   (build-system gnu-build-system)
+   (synopsis "Character set conversion library")
+   (description
+     "libiconv provides an implementation of the iconv function for systems
+that lack it.  iconv is used to convert between character encodings in a
+program.  It supports a wide variety of different encodings.")
+   (home-page "http://www.gnu.org/software/libiconv/")
+   (license lgpl3+)))
+
+(define* (libiconv-if-needed #:optional (target (%current-target-system)))
+  (if (mingw-target? target)
+      `(("libiconv" ,libiconv))
+      '()))
+
 (define-public (canonical-package package)
   ;; Avoid circular dependency by lazily resolving 'commencement'.
   (let* ((iface (resolve-interface '(gnu packages commencement)))
-- 
2.7.3


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 06/10] gnu: Add libiconv.
  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
  0 siblings, 2 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-01 18:58 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington writes:

>      I am sorry for my ignorance but why is libiconv needed when
>      targeting mingw?
>      
> Because Microsoft does not implement iconv, and presumably this package needs it.

As this is about the mingw port, it would be because the mingw c library
does not bundle iconv.

It's a good question, it puzzles me too why GNU libc decides to bundle
or duplicate the GNU iconv functionality.  In general (webkit, qt), such
practice is frowned upon?

Greetings,
Jan

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 06/10] gnu: Add libiconv.
  2016-05-01 18:58       ` Jan Nieuwenhuizen
@ 2016-05-01 19:07         ` John Darrington
  2016-05-03 12:19         ` Ludovic Courtès
  1 sibling, 0 replies; 41+ messages in thread
From: John Darrington @ 2016-05-01 19:07 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

On Sun, May 01, 2016 at 08:58:12PM +0200, Jan Nieuwenhuizen wrote:
     John Darrington writes:
     
     >      I am sorry for my ignorance but why is libiconv needed when
     >      targeting mingw?
     >      
     > Because Microsoft does not implement iconv, and presumably this package needs it.
     
     It's a good question, it puzzles me too why GNU libc decides to bundle
     or duplicate the GNU iconv functionality.  In general (webkit, qt), such
     practice is frowned upon?

I think the reason is historical.  Libc implemented iconv before libiconv became
available.  I suppose they could drop it, but then a lot of people will be suprised
when their programs no longer link.

But yes it's not a nice sitation ... especially as the api of the iconv function
is gratuitously different between the implementations.

J'

-- 
Avoid eavesdropping.  Send strong encryted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (8 preceding siblings ...)
  2016-04-29 15:12 ` [PATCH 10/10] gnu: guile-2.0: support mingw Jan Nieuwenhuizen
@ 2016-05-02  8:04 ` Andy Wingo
  2016-05-02 17:59   ` Jan Nieuwenhuizen
  2016-05-03 12:06   ` Ludovic Courtès
  2016-05-03 12:16 ` Ludovic Courtès
  2016-05-14  5:29 ` Mark H Weaver
  11 siblings, 2 replies; 41+ messages in thread
From: Andy Wingo @ 2016-05-02  8:04 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

On Fri 29 Apr 2016 17:12, Jan Nieuwenhuizen <janneke@gnu.org> writes:

> * 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).
> ---

LGTM, for what it's worth.  I get lost in the patches-to-patches part of
the mail but it does not seem to be incorrect.

One final ignorant question: there really is no way to do this without
patching GCC?  And why just one CROSS_C_INCLUDE_PATH -- would it not be
necessary in theory to have such a CROSS_ARCH_... for each ARCH that we
might be interested in?  I am not suggesting that you make the change
now but I want to know what the right thing is :)

Andy

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

* Re: [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target.
  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
  0 siblings, 1 reply; 41+ messages in thread
From: Andy Wingo @ 2016-05-02  8:06 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

On Fri 29 Apr 2016 17:12, Jan Nieuwenhuizen <janneke@gnu.org> writes:

> @@ -288,7 +379,11 @@ GCC that does not target a libc; otherwise, target that libc."
>                       (xbinutils (cross-binutils target)))
>    "Return a libc cross-built for TARGET, a GNU triplet.  Use XGCC and
>  XBINUTILS and the cross tool chain."
> -  (define xlinux-headers
> +  (cond
> +   ((cross-newlib? target)
> +    (cross-newlib? target))
> +   (else
> +    (let ((xlinux-headers
>      (package (inherit linux-libre-headers)
>        (name (string-append (package-name linux-libre-headers)
>                             "-cross-" target))

This hunk looks borked.  Resend please :)

A

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

* Re: [PATCH 07/10] gnu: ncurses: support mingw.
  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
  0 siblings, 1 reply; 41+ messages in thread
From: Andy Wingo @ 2016-05-02  8:09 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

On Fri 29 Apr 2016 17:12, Jan Nieuwenhuizen <janneke@gnu.org> writes:

> @@ -36,6 +39,7 @@
>                      #:allow-other-keys)
>              (let ((out (assoc-ref outputs "out"))
>                    (doc (assoc-ref outputs "doc")))
> +              (format #t "configure flags: ~s~%" configure-flags)
>                (zero? (apply system* "./configure"
>                              (string-append "SHELL=" (which "sh"))
>                              (string-append "--build=" build)

Please remove :)

Otherwise LGTM.

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

* Re: [PATCH 08/10] gnu: readline: support mingw.
  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
  0 siblings, 2 replies; 41+ messages in thread
From: Andy Wingo @ 2016-05-02  8:12 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

On Fri 29 Apr 2016 17:12, Jan Nieuwenhuizen <janneke@gnu.org> writes:

> * gnu/packages/patches/readline-6.3-mingw.patch: New file.
> * gnu-system.am (dist_patch_DATA): Add it.
> * gnu/packages/readline.scm (readline): Support mingw.

Can you clarify the licensing on the patch, and note its original
author?  Ideally we should send the patch upstream, too.

>        (arguments `(#:configure-flags
>                     (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
>                                          (assoc-ref %build-inputs "ncurses")
> -                                        "/lib")
> +                                        ,(if (mingw-target?) "/bin" "/lib"))

Is there a reason for MinGW ncurses to put its library in /bin on a
MinGW system?  Better if it put it in /lib like everything else...

Andy

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

* Re: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  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
  1 sibling, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-02 17:59 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo writes:

[cc: Ludovic]

> On Fri 29 Apr 2016 17:12, Jan Nieuwenhuizen <janneke@gnu.org> writes:
>
>> * 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).
>> ---
>
> LGTM, for what it's worth.  I get lost in the patches-to-patches part of
> the mail but it does not seem to be incorrect.

Ok, thanks!

> One final ignorant question: there really is no way to do this without
> patching GCC?  And why just one CROSS_C_INCLUDE_PATH -- would it not be
> necessary in theory to have such a CROSS_ARCH_... for each ARCH that we
> might be interested in?  I am not suggesting that you make the change
> now but I want to know what the right thing is :)

I really like your questions!  (again :-)

The traditional way of supporting multiple (cross) compilers is to
configure gcc using --with-sysroot and possibly --with-build-sysroot.
Extra libraries with their headers are installed there and you never
specify any environment include paths.

Happy as I am that the MinGW cross build starts to look real nice, I'm
not to happy with the environment vars and patching gcc.  A sysroot
approach could be nicer, but I'm not sure how to do that in Guix.

Would it be possible to create sysroot profiles, similar to user
profiles that are linked from ~/.guix-profile, where each gcc/target
has a named, versioned profile that is used as sysroot, eg

   /var/guix/profiles/per-arch/mingw-32/guix-profile-0-link -> /gnu/store/..

and version that something like

  0: binutils
  1: binutils + gcc-sans-libc
  2: binutils + gcc-sans-libc + libc
  3: binutils + libc + gcc

or maybe cross packages could use a sysroot off profile like

   ~/.guix-profile/bin/gcc
   ~/.guix-profile/bin/i686-w64-mingw32-gcc
   ~/.guix-profile/sysroot/i686-mingw-w32/include
   ~/.guix-profile/sysroot/i686-mingw-w32/lib
   ~/.guix-profile/sysroot/i686-mingw-w32/bin/gcc

Then, invoke gcc using

   i686-w64-mingw32-gcc --sysroot = ~/.guix-profile/sysroot/i686-mingw-w32/
   
or create a wrapper adding this...

Sadly this is just dreaming way beyond my Guix/nix knowledge.  For
example, why aren't we using/creating profile in our build root and set
just one directory like

    PATH=/gnu/store/...-profile/bin
    FOO=/gnu/store/...-profile/foo
    
etc, populated with symlinks, but use environment-variables and long
PATHs...

Greetings, Jan

-- 
jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target.
  2016-05-02  8:06   ` Andy Wingo
@ 2016-05-02 18:34     ` Jan Nieuwenhuizen
  0 siblings, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-02 18:34 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1430 bytes --]

Andy Wingo writes:

> On Fri 29 Apr 2016 17:12, Jan Nieuwenhuizen <janneke@gnu.org> writes:
>
>> @@ -288,7 +379,11 @@ GCC that does not target a libc; otherwise, target that libc."
>>                       (xbinutils (cross-binutils target)))
>>    "Return a libc cross-built for TARGET, a GNU triplet.  Use XGCC and
>>  XBINUTILS and the cross tool chain."
>> -  (define xlinux-headers
>> +  (cond
>> +   ((cross-newlib? target)
>> +    (cross-newlib? target))
>> +   (else
>> +    (let ((xlinux-headers
>>      (package (inherit linux-libre-headers)
>>        (name (string-append (package-name linux-libre-headers)
>>                             "-cross-" target))
>
> This hunk looks borked.  Resend please :)

Hah!  Sorry; yes, it sure looks like that...however "only" the
indentation is borked.  Note how the toplevel `(define' is changed to a
`(let ((' for xlinux-headers, because it's been moved into a cond
clause.  The extra parentheses get closed in subsequent chunks:

-                       ,@(package-native-inputs linux-libre-headers)))))
-
+                       ,@(package-native-inputs linux-libre-headers))))))

close let bindings for xlinux-headers

-                     ,@(package-native-inputs glibc)))))
+                     ,@(package-native-inputs glibc))))))))

close (let, (cond and (else

Attached a properly re-indented version.  I changed some line breaks to
not exeed 80 chars.

Greetings,
Jan


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0004-gnu-cross-build-i686-w64-mingw32-new-cross-target.patch --]
[-- Type: text/x-diff, Size: 17239 bytes --]

From 4ef0e89a5e8b8878db4717b901d226c7133b8deb Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Sun, 17 Apr 2016 18:42:43 +0200
Subject: [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target.

* guix/utils.scm (mingw-target?): New function.
* gnu/packages/cross-base.scm (cross-gcc-snippet): New function for mingw.
(cross-gcc): Use it.
(cross-gcc-arguments, cross-gcc-patches, cross-gcc): Support mingw.
(native-libc, cross-newlib?): New functions.
(cross-libc): Use cross-newlib? to support mingw.
(xbinutils-i686-w64-mingw32, xgcc-sans-libc-i686-w64-mingw32,
xgcc-i686-w64-mingw32): New variables.
---
 gnu/packages/cross-base.scm | 269 ++++++++++++++++++++++++++++++++------------
 guix/utils.scm              |   5 +
 2 files changed, 199 insertions(+), 75 deletions(-)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index ca2cf3b..30b6c05 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -19,12 +19,17 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages cross-base)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
-  #:use-module (gnu packages gcc)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages gawk)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages commencement)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages mingw)
+  #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -35,7 +40,8 @@
   #:use-module (ice-9 match)
   #:export (cross-binutils
             cross-libc
-            cross-gcc))
+            cross-gcc
+            cross-newlib?))
 
 (define %xgcc
   ;; GCC package used as the basis for cross-compilation.  It doesn't have to
@@ -121,7 +127,12 @@ may be either a libc package or #f.)"
                                "--disable-libquadmath"
                                "--disable-decimal-float" ;would need libc
                                "--disable-libcilkrts"
-                               )))
+                                ))
+
+                       ;; For a newlib (non-glibc) target
+                       ,@(if (cross-newlib? target)
+                             '("--with-newlib")
+                             '()))
 
                  ,(if libc
                       flags
@@ -163,7 +174,67 @@ may be either a libc package or #f.)"
                     ;; for cross-compilers.
                     (zero? (system* "make" "install-strip")))
                   ,phases))))
-          (if libc
+           (cond
+            ((mingw-target? target)
+             `(modify-phases ,phases
+                (add-before
+                 'configure 'set-cross-path
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; Add the cross mingw headers to CROSS_C_*_INCLUDE_PATH,
+                   ;; and remove them from C_*INCLUDE_PATH.
+                   (let ((libc (assoc-ref inputs "libc"))
+                         (gcc (assoc-ref inputs "gcc")))
+                     (define (cross? x)
+                       (and libc (string-prefix? libc x)))
+                     (if libc
+                         (let ((cpath (string-append
+                                       libc "/include"
+                                       ":" libc "/i686-w64-mingw32/include")))
+                           (for-each (cut setenv <> cpath)
+                                     '("CROSS_C_INCLUDE_PATH"
+                                       "CROSS_CPLUS_INCLUDE_PATH"
+                                       "CROSS_OBJC_INCLUDE_PATH"
+                                       "CROSS_OBJCPLUS_INCLUDE_PATH")))
+                         (let ((mingw-source (assoc-ref inputs "mingw-source"))
+                               (mingw-headers
+                                (string-append (getcwd) "/mingw-w64-v5.0-rc2/mingw-w64-headers")))
+                           (system* "tar" "xf" mingw-source)
+                           (copy-file (string-append mingw-headers "/crt/_mingw.h.in")
+                                      (string-append mingw-headers "/crt/_mingw.h"))
+                           (substitute* (string-append mingw-headers "/crt/_mingw.h")
+                             (("@MINGW_HAS_SECURE_API@") "#define MINGW_HAS_SECURE_API 1"))
+                           (let ((cpath (string-append
+                                         mingw-headers "/include"
+                                         ":" mingw-headers "/crt"
+                                         ":" mingw-headers "/defaults/include")))
+                             (for-each (cut setenv <> cpath)
+                                       '("CROSS_C_INCLUDE_PATH"
+                                         "CROSS_CPLUS_INCLUDE_PATH"
+                                         "CROSS_OBJC_INCLUDE_PATH"
+                                         "CROSS_OBJCPLUS_INCLUDE_PATH"
+                                         "CROSS_LIBRARY_PATH")))))
+                     (when libc
+                       (setenv "CROSS_LIBRARY_PATH"
+                               (string-append
+                                libc "/lib"
+                                ":" libc "/i686-w64-mingw32/lib")))
+                     (setenv "CPP" (string-append gcc "/bin/cpp"))
+                     (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)))))
+            (libc
               `(alist-cons-before
                 'configure 'set-cross-path
                 (lambda* (#:key inputs #:allow-other-keys)
@@ -200,17 +271,26 @@ may be either a libc package or #f.)"
                                 "LIBRARY_PATH"))
                     #t))
                 ,phases))
-          (else phases)))))))
+          (else phases))))))))
 
 (define (cross-gcc-patches target)
   "Return GCC patches needed for TARGET."
   (cond ((string-prefix? "xtensa-" target)
          ;; Patch by Qualcomm needed to build the ath9k-htc firmware.
          (search-patches "ath9k-htc-firmware-gcc.patch"))
+        ((mingw-target? target)
+         (search-patches "gcc-4.9.3-mingw-gthr-default.patch"))
+        (else '())))
+
+(define (cross-gcc-snippet target)
+  "Return GCC snippet needed for TARGET."
+  (cond ((mingw-target? target)
+         '(copy-recursively "libstdc++-v3/config/os/mingw32-w64"
+                            "libstdc++-v3/config/os/newlib"))
         (else '())))
 
 (define* (cross-gcc target
-                    #:optional (xbinutils (cross-binutils target)) libc)
+                    #:optional (xbinutils (cross-binutils target)) (libc #f))
   "Return a cross-compiler for TARGET, where TARGET is a GNU triplet.  Use
 XBINUTILS as the associated cross-Binutils.  If LIBC is false, then build a
 GCC that does not target a libc; otherwise, target that libc."
@@ -223,7 +303,10 @@ GCC that does not target a libc; otherwise, target that libc."
                (append
                 (origin-patches (package-source %xgcc))
                 (cons (search-patch "gcc-cross-environment-variables.patch")
-                      (cross-gcc-patches target))))))
+                      (cross-gcc-patches target))))
+              (modules '((guix build utils)))
+              (snippet
+               (cross-gcc-snippet target))))
 
     ;; For simplicity, use a single output.  Otherwise libgcc_s & co. are not
     ;; found by default, etc.
@@ -245,6 +328,7 @@ GCC that does not target a libc; otherwise, target that libc."
                              #:target target
                              #:binutils xbinutils))
        ("binutils-cross" ,xbinutils)
+       ("gcc" ,gcc)
 
        ;; Call it differently so that the builder can check whether the "libc"
        ;; input is #f.
@@ -253,13 +337,20 @@ GCC that does not target a libc; otherwise, target that libc."
        ;; Remaining inputs.
        ,@(let ((inputs (append (package-inputs %xgcc)
                                (alist-delete "libc" %final-inputs))))
-           (if libc
+           (cond
+            ((mingw-target? target)
+             (if libc
+                 `(("libc" ,mingw-w64)
+                   ,@inputs)
+                 `(("mingw-source" ,(package-source mingw-w64))
+                   ,@inputs)))
+            (libc
                `(("libc" ,libc)
                  ("xlinux-headers"                ;the target headers
                   ,@(assoc-ref (package-propagated-inputs libc)
                                "linux-headers"))
-                 ,@inputs)
-               inputs))))
+               ,@inputs))
+            (else inputs)))))
 
     (inputs '())
 
@@ -288,70 +379,83 @@ GCC that does not target a libc; otherwise, target that libc."
                      (xbinutils (cross-binutils target)))
   "Return a libc cross-built for TARGET, a GNU triplet.  Use XGCC and
 XBINUTILS and the cross tool chain."
-  (define xlinux-headers
-    (package (inherit linux-libre-headers)
-      (name (string-append (package-name linux-libre-headers)
-                           "-cross-" target))
-      (arguments
-       (substitute-keyword-arguments
-           `(#:implicit-cross-inputs? #f
-             ,@(package-arguments linux-libre-headers))
-         ((#:phases phases)
-          `(alist-replace
-            'build
-            (lambda _
-              (setenv "ARCH" ,(system->linux-architecture target))
-              (format #t "`ARCH' set to `~a' (cross compiling)~%" (getenv "ARCH"))
-
-              (and (zero? (system* "make" "defconfig"))
-                   (zero? (system* "make" "mrproper" "headers_check"))))
-            ,phases))))
-      (native-inputs `(("cross-gcc" ,xgcc)
-                       ("cross-binutils" ,xbinutils)
-                       ,@(package-native-inputs linux-libre-headers)))))
-
-  (package (inherit glibc)
-    (name (string-append "glibc-cross-" target))
-    (arguments
-     (substitute-keyword-arguments
-         `(;; Disable stripping (see above.)
-           #:strip-binaries? #f
-
-           ;; This package is used as a target input, but it should not have
-           ;; the usual cross-compilation inputs since that would include
-           ;; itself.
-           #:implicit-cross-inputs? #f
-
-           ,@(package-arguments glibc))
-       ((#:configure-flags flags)
-        `(cons ,(string-append "--host=" target)
-               ,flags))
-       ((#:phases phases)
-        `(alist-cons-before
-          'configure 'set-cross-linux-headers-path
-          (lambda* (#:key inputs #:allow-other-keys)
-            (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))))
-
-    ;; Shadow the native "linux-headers" because glibc's recipe expects the
-    ;; "linux-headers" input to point to the right thing.
-    (propagated-inputs `(("linux-headers" ,xlinux-headers)))
-
-    ;; FIXME: 'static-bash' should really be an input, not a native input, but
-    ;; to do that will require building an intermediate cross libc.
-    (inputs '())
-
-    (native-inputs `(("cross-gcc" ,xgcc)
-                     ("cross-binutils" ,xbinutils)
-                     ,@(package-inputs glibc)     ;FIXME: static-bash
-                     ,@(package-native-inputs glibc)))))
+  (cond
+   ((cross-newlib? target)
+    (cross-newlib? target))
+   (else
+    (let ((xlinux-headers
+           (package (inherit linux-libre-headers)
+             (name (string-append (package-name linux-libre-headers)
+                                  "-cross-" target))
+             (arguments
+              (substitute-keyword-arguments
+                  `(#:implicit-cross-inputs? #f
+                    ,@(package-arguments linux-libre-headers))
+                ((#:phases phases)
+                 `(alist-replace
+                   'build
+                   (lambda _
+                     (setenv "ARCH" ,(system->linux-architecture target))
+                     (format #t "`ARCH' set to `~a' (cross compiling)~%"
+                             (getenv "ARCH"))
+
+                     (and (zero? (system* "make" "defconfig"))
+                          (zero? (system* "make" "mrproper" "headers_check"))))
+                   ,phases))))
+             (native-inputs `(("cross-gcc" ,xgcc)
+                              ("cross-binutils" ,xbinutils)
+                              ,@(package-native-inputs linux-libre-headers))))))
+      (package (inherit glibc)
+        (name (string-append "glibc-cross-" target))
+        (arguments
+         (substitute-keyword-arguments
+             `(;; Disable stripping (see above.)
+               #:strip-binaries? #f
+
+               ;; This package is used as a target input, but it should not have
+               ;; the usual cross-compilation inputs since that would include
+               ;; itself.
+               #:implicit-cross-inputs? #f
+
+               ,@(package-arguments glibc))
+           ((#:configure-flags flags)
+            `(cons ,(string-append "--host=" target)
+                   ,flags))
+           ((#:phases phases)
+            `(alist-cons-before
+              'configure 'set-cross-linux-headers-path
+              (lambda* (#:key inputs #:allow-other-keys)
+                (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))))
+
+        ;; Shadow the native "linux-headers" because glibc's recipe expects the
+        ;; "linux-headers" input to point to the right thing.
+        (propagated-inputs `(("linux-headers" ,xlinux-headers)))
+
+        ;; FIXME: 'static-bash' should really be an input, not a native input,
+        ;; but to do that will require building an intermediate cross libc.
+        (inputs '())
+
+        (native-inputs `(("cross-gcc" ,xgcc)
+                         ("cross-binutils" ,xbinutils)
+                         ,@(package-inputs glibc)     ;FIXME: static-bash
+                         ,@(package-native-inputs glibc))))))))
+
+(define (native-libc target)
+  (if (mingw-target? target)
+      mingw-w64
+      glibc))
+
+(define (cross-newlib? target)
+  (and (not (eq? (native-libc target) glibc))
+       (native-libc target)))
 
 \f
 ;;;
@@ -393,3 +497,18 @@ XBINUTILS and the cross tool chain."
 ;;     (cross-gcc triplet
 ;;                (cross-binutils triplet)
 ;;                (cross-libc triplet))))
+
+(define-public xgcc-sans-libc-i686-w64-mingw32
+  (let ((triplet "i686-w64-mingw32"))
+    (cross-gcc triplet
+               (cross-binutils triplet))))
+
+(define-public xbinutils-i686-w64-mingw32
+  (let ((triplet "i686-w64-mingw32"))
+    (cross-binutils triplet)))
+
+(define-public xgcc-i686-w64-mingw32
+  (let ((triplet "i686-w64-mingw32"))
+    (cross-gcc triplet
+               (cross-binutils triplet)
+               (cross-newlib? triplet))))
diff --git a/guix/utils.scm b/guix/utils.scm
index 6c01edd..f92367c 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -67,6 +67,7 @@
             gnu-triplet->nix-system
             %current-system
             %current-target-system
+            mingw-target?
             package-name->name+version
             version-compare
             version>?
@@ -585,6 +586,10 @@ returned by `config.guess'."
   ;; cross-building to.
   (make-parameter #f))
 
+(define* (mingw-target? #:optional (target (%current-target-system)))
+  (and target
+       (string-suffix? "-mingw32" target)))
+
 (define (package-name->name+version spec)
   "Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"
 and \"0.9.1b\".  When the version part is unavailable, SPEC and #f are
-- 
2.7.3


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 07/10] gnu: ncurses: support mingw.
  2016-05-02  8:09   ` Andy Wingo
@ 2016-05-02 18:41     ` Jan Nieuwenhuizen
  0 siblings, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-02 18:41 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo writes:

> On Fri 29 Apr 2016 17:12, Jan Nieuwenhuizen <janneke@gnu.org> writes:
>
>> @@ -36,6 +39,7 @@
>>                      #:allow-other-keys)
>>              (let ((out (assoc-ref outputs "out"))
>>                    (doc (assoc-ref outputs "doc")))
>> +              (format #t "configure flags: ~s~%" configure-flags)
>>                (zero? (apply system* "./configure"
>>                              (string-append "SHELL=" (which "sh"))
>>                              (string-append "--build=" build)
>
> Please remove :)

Hmm.  Yes.  I should maybe at least have put this in the commit
message?

It started out as a debug message...it confused me that the log file did
not mention my extra configure flags until I found

guix/build/gnu-build-system.scm (configure):

    (format #t "source directory: ~s (relative from build: ~s)~%"
            abs-srcdir srcdir)
    (if out-of-source?
        (begin
          (mkdir "../build")
          (chdir "../build")))
    (format #t "build directory: ~s~%" (getcwd))
    (format #t "configure flags: ~s~%" flags)

and I thought that at least printing the configure flags in ncurses'
custom configure stage would be nice.  WDYT?

> Otherwise LGTM.

Otherwise I'd gladly remove it.

Greetings,
Jan

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 08/10] gnu: readline: support mingw.
  2016-05-02  8:12   ` Andy Wingo
@ 2016-05-02 18:52     ` Jan Nieuwenhuizen
  2016-05-02 19:25     ` Jan Nieuwenhuizen
  1 sibling, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-02 18:52 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo writes:

>>        (arguments `(#:configure-flags
>>                     (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
>>                                          (assoc-ref %build-inputs "ncurses")
>> -                                        "/lib")
>> +                                        ,(if (mingw-target?) "/bin" "/lib"))
>
> Is there a reason for MinGW ncurses to put its library in /bin on a
> MinGW system?  Better if it put it in /lib like everything else...

Yes...ncurses does not create any .la-files; only .dll-files.  Sadly
those must go in bin.  Maybe we could add a workaround in ncurses,
adding symlinks of those dlls in lib...

This bothered me too and the real solution here is to (cross) build
ncurses using libtool.

The good news is that ncurses can optionally be built with libtool.  The
bad news is that because the ncurses build system takes an installed
version of libtool instead of generating one during configuring as
usual, cross building ncurses with libtool needs an installed pre-build
cross version of libtool.  WDYT?

Greetings,
Jan

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 08/10] gnu: readline: support mingw.
  2016-05-02  8:12   ` Andy Wingo
  2016-05-02 18:52     ` Jan Nieuwenhuizen
@ 2016-05-02 19:25     ` Jan Nieuwenhuizen
  1 sibling, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-02 19:25 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo writes:

>> * gnu/packages/patches/readline-6.3-mingw.patch: New file.
>> * gnu-system.am (dist_patch_DATA): Add it.
>> * gnu/packages/readline.scm (readline): Support mingw.
>
> Can you clarify the licensing on the patch, and note its original
> author?  Ideally we should send the patch upstream, too.

Oops, didn't mean to snip this.  I mailed Alexey Pavlov and didn't get a
response yet.  I found an earlier patch that this seems to add a bit
too.

As you can see, it's #ifdef'ing out macros that are missing on mingw:
S_ISUID, S_ISGID, S_ISLNK, S_ISSOCK.

And now that I look into it, also some that were missing but are now
present: SIGHUP, SIGQUIT.  And defining S_ISDIR which is a straight copy
from stat.h, but is now present in mingw too.

Another possibility would be to just patch those macros into mingw's
stat.h and drop this patch.  WDYT?

Jan

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  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
  1 sibling, 1 reply; 41+ messages in thread
From: Ludovic Courtès @ 2016-05-03 12:06 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo <wingo@igalia.com> skribis:

> One final ignorant question: there really is no way to do this without
> patching GCC?

Unfortunately no.  Currently, both a native compiler and a cross
compiler honor CPATH, LIBRARY_PATH, etc., meaning that they cannot be
used at all in a cross-compilation environment.

I think we should push some more for inclusion of this functionality
upstream.

> And why just one CROSS_C_INCLUDE_PATH -- would it not be necessary in
> theory to have such a CROSS_ARCH_... for each ARCH that we might be
> interested in?  I am not suggesting that you make the change now but I
> want to know what the right thing is :)

In theory, you’re right.  That’s one of the concerns that was raised:

  http://gcc.gnu.org/ml/gcc/2013-02/msg00125.html

I don’t think it’s a common use case though.

Thanks for taking the time to review, BTW!

Ludo’.

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

* Re: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (9 preceding siblings ...)
  2016-05-02  8:04 ` [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Andy Wingo
@ 2016-05-03 12:16 ` Ludovic Courtès
  2016-05-14  5:29 ` Mark H Weaver
  11 siblings, 0 replies; 41+ messages in thread
From: Ludovic Courtès @ 2016-05-03 12:16 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> * 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).

LGTM!  Applied to master with minor cosmetic changes (I’ll push in a
moment.)

Thank you!

Ludo’.

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

* Re: [PATCH 06/10] gnu: Add libiconv.
  2016-05-01 18:58       ` Jan Nieuwenhuizen
  2016-05-01 19:07         ` John Darrington
@ 2016-05-03 12:19         ` Ludovic Courtès
  1 sibling, 0 replies; 41+ messages in thread
From: Ludovic Courtès @ 2016-05-03 12:19 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

Hello,

Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> It's a good question, it puzzles me too why GNU libc decides to bundle
> or duplicate the GNU iconv functionality.

POSIX C libraries provide iconv:

  http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html

libiconv exists only for incomplete or super-old C libraries.

Ludo’.

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

* Re: [PATCH 06/10] gnu: Add libiconv.
  2016-05-01 17:07   ` Manolis Ragkousis
  2016-05-01 17:43     ` John Darrington
  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-03 16:56       ` [PATCH 06b/10] gnu: Add function libiconv-if-needed Jan Nieuwenhuizen
  2 siblings, 2 replies; 41+ messages in thread
From: Ludovic Courtès @ 2016-05-03 12:20 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> On 04/29/2016 06:12 PM, Jan Nieuwenhuizen wrote:
>> +  #:use-module (guix build-system trivial)
>> +  #:export (glibc
>> +            libiconv-if-needed))
>
> The #:export (glibc...) part only exists in wip-hurd so we need to
> remove this in order for your patch to apply on master.

Yes.

>> +(define-public libiconv
>> +  (package
>> +   (name "libiconv")
>> +   (version "1.14")
>> +   (source (origin
>> +            (method url-fetch)
>> +            (uri (string-append
>> +                  "mirror://gnu/libiconv/libiconv-"
>> +                  version ".tar.gz"))
>> +            (sha256
>> +             (base32
>> +              "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))))
>> +   (build-system gnu-build-system)
>> +   (synopsis "Character set conversion library")
>> +   (description
>> +     "libiconv provides an implementation of the iconv function for systems
>> +that lack it.  iconv is used to convert between character encodings in a
>> +program.  It supports a wide variety of different encodings.")
>> +   (home-page "http://www.gnu.org/software/libiconv/")
>> +   (license lgpl3+)))
>
> Maybe we should break this patch into two different ones, one for the
> libiconv package description and one for the libiconv-if-needed. The
> first will go to master and the second to core-updates. WDYT?

Seconded: the patch that adds libiconv (and only that) can go directly
in master; the patch that adds ‘libiconv-if-needed’ must be separate
since it depends on the MinGW stuff.

Thanks,
Ludo’.

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

* Re: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-05-03 12:06   ` Ludovic Courtès
@ 2016-05-03 13:27     ` Andy Wingo
  0 siblings, 0 replies; 41+ messages in thread
From: Andy Wingo @ 2016-05-03 13:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Tue 03 May 2016 14:06, ludo@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo@igalia.com> skribis:
>
>> And why just one CROSS_C_INCLUDE_PATH -- would it not be necessary in
>> theory to have such a CROSS_ARCH_... for each ARCH that we might be
>> interested in?  I am not suggesting that you make the change now but I
>> want to know what the right thing is :)
>
> In theory, you’re right.  That’s one of the concerns that was raised:
>
>   http://gcc.gnu.org/ml/gcc/2013-02/msg00125.html
>
> I don’t think it’s a common use case though.

I dunno.  You could certainly manage to install a mingw toolchain and an
AVR toolchain into a profile by mistake.  It's a bad idea of course, and
we wouldn't warn about it, and the failure would be weird.  The
mitigating factors are that you rarely need to actually have a
cross-compiler in a profile because cross-builds can just include them
automatically, and also you can use environments -- but it's something
that people need to add to their mental model, and something we should
document in the pending "cross-compiling from guix" section of the
manual :)

Andy

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

* Re: [PATCH 06a/10] gnu: Add libiconv.
  2016-05-03 12:20     ` Ludovic Courtès
@ 2016-05-03 16:55       ` 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
  1 sibling, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-03 16:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1091 bytes --]

Ludovic Courtès writes:

> Manolis Ragkousis <manolis837@gmail.com> skribis:
>
>> On 04/29/2016 06:12 PM, Jan Nieuwenhuizen wrote:
>>> +  #:use-module (guix build-system trivial)
>>> +  #:export (glibc
>>> +            libiconv-if-needed))
>>
>> The #:export (glibc...) part only exists in wip-hurd so we need to
>> remove this in order for your patch to apply on master.
>
> Yes.

(already) done.

>> Maybe we should break this patch into two different ones, one for the
>> libiconv package description and one for the libiconv-if-needed. The
>> first will go to master and the second to core-updates. WDYT?
>
> Seconded: the patch that adds libiconv (and only that) can go directly
> in master; the patch that adds ‘libiconv-if-needed’ must be separate
> since it depends on the MinGW stuff.

Split up-now into 6a/10 and 6b/10.

Ah, Sorry!!  libiconv-if-needed depends on mingw-target? which sits in
guix/utils.scm.  I had that in patch 0004, and so I assumed that would
go in first and be OK.  IIUC, 0004 may go into core-updates...

Greetings,
Jan


[-- Attachment #2: 0006a-gnu-Add-libiconv.patch --]
[-- Type: text/x-diff, Size: 2602 bytes --]

From e3d01e6075ece0269131fb35cd560c05d37a586e Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Tue, 3 May 2016 18:48:40 +0200
Subject: [PATCH 6a/10] gnu: Add libiconv.

* gnu/packages/base.scm (libiconv): New variable.
---
 gnu/packages/base.scm | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 1c4ebbf..3819ecc 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2014, 2015 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,7 +25,7 @@
 
 (define-module (gnu packages base)
   #:use-module ((guix licenses)
-                #:select (gpl3+ lgpl2.0+ public-domain))
+                #:select (gpl3+ lgpl2.0+ lgpl3+ public-domain))
   #:use-module (gnu packages)
   #:use-module (gnu packages acl)
   #:use-module (gnu packages bash)
@@ -43,7 +44,8 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
-  #:use-module (guix build-system trivial))
+  #:use-module (guix build-system trivial)
+  #:export (libiconv-if-needed))
 
 ;;; Commentary:
 ;;;
@@ -936,6 +938,27 @@ reflect changes made by political bodies to time zone boundaries, UTC offsets,
 and daylight-saving rules.")
     (license public-domain)))
 
+(define-public libiconv
+  (package
+   (name "libiconv")
+   (version "1.14")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append
+                  "mirror://gnu/libiconv/libiconv-"
+                  version ".tar.gz"))
+            (sha256
+             (base32
+              "04q6lgl3kglmmhw59igq1n7v3rp1rpkypl366cy1k1yn2znlvckj"))))
+   (build-system gnu-build-system)
+   (synopsis "Character set conversion library")
+   (description
+     "libiconv provides an implementation of the iconv function for systems
+that lack it.  iconv is used to convert between character encodings in a
+program.  It supports a wide variety of different encodings.")
+   (home-page "http://www.gnu.org/software/libiconv/")
+   (license lgpl3+)))
+
 (define-public (canonical-package package)
   ;; Avoid circular dependency by lazily resolving 'commencement'.
   (let* ((iface (resolve-interface '(gnu packages commencement)))
-- 
2.7.3


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 06b/10] gnu: Add function libiconv-if-needed.
  2016-05-03 12:20     ` Ludovic Courtès
  2016-05-03 16:55       ` [PATCH 06a/10] " Jan Nieuwenhuizen
@ 2016-05-03 16:56       ` Jan Nieuwenhuizen
  1 sibling, 0 replies; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-03 16:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 68 bytes --]

Ludovic Courtès writes:

And the second part
Greetings,
Jan


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0006b-gnu-Add-function-libiconv-if-needed.patch --]
[-- Type: text/x-diff, Size: 997 bytes --]

From 9c00010dede03a2b59c5c18c25749bf14e6c9c10 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Tue, 3 May 2016 18:49:33 +0200
Subject: [PATCH 6b/10] gnu: Add function libiconv-if-needed.

* gnu/packages/base.scm (libiconv-if-needed): New function.
---
 gnu/packages/base.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 3819ecc..34dac61 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -959,6 +959,11 @@ program.  It supports a wide variety of different encodings.")
    (home-page "http://www.gnu.org/software/libiconv/")
    (license lgpl3+)))
 
+(define* (libiconv-if-needed #:optional (target (%current-target-system)))
+  (if (mingw-target? target)
+      `(("libiconv" ,libiconv))
+      '()))
+
 (define-public (canonical-package package)
   ;; Avoid circular dependency by lazily resolving 'commencement'.
   (let* ((iface (resolve-interface '(gnu packages commencement)))
-- 
2.7.3


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: [PATCH 06a/10] gnu: Add libiconv.
  2016-05-03 16:55       ` [PATCH 06a/10] " Jan Nieuwenhuizen
@ 2016-05-05 14:56         ` Ludovic Courtès
  0 siblings, 0 replies; 41+ messages in thread
From: Ludovic Courtès @ 2016-05-05 14:56 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> From e3d01e6075ece0269131fb35cd560c05d37a586e Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <janneke@gnu.org>
> Date: Tue, 3 May 2016 18:48:40 +0200
> Subject: [PATCH 6a/10] gnu: Add libiconv.
>
> * gnu/packages/base.scm (libiconv): New variable.

Pushed with minor changes, notably a fix for the ‘undeclared gets’ issue
that Manolis mentioned yesterday on IRC.

Thanks!

Ludo’.

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

* Re: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-04-29 15:12 [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers Jan Nieuwenhuizen
                   ` (10 preceding siblings ...)
  2016-05-03 12:16 ` Ludovic Courtès
@ 2016-05-14  5:29 ` Mark H Weaver
  2016-05-14  6:37   ` Jan Nieuwenhuizen
  11 siblings, 1 reply; 41+ messages in thread
From: Mark H Weaver @ 2016-05-14  5:29 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

Hi Jan,

Jan Nieuwenhuizen <janneke@gnu.org> writes:

> * 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).

This patch, pushed to master about two weeks ago as commit
efc4eb147512fa7a2c6d74d9b296cfc22b1ef198, broke 79 cross-compiled builds
on hydra:

  http://hydra.gnu.org/eval/108933#tabs-now-fail

The problem is that 'cross-libc' creates build-side code that uses 'cut'
from srfi-26, although (srfi srfi-26) is not loaded on the build side:

> @@ -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))))

Leading to "ERROR: Unbound variable: cut".

  http://hydra.gnu.org/build/1185432/nixlog/3/tail-reload

In contrast, 'cross-gcc', which also uses 'cut' in its build-side code,
arranges to have (srfi srfi-26) loaded via the '#:modules' argument
(lines 232-240 of cross-base.scm):

    (arguments
     `(#:implicit-inputs? #f
       #:modules ((guix build gnu-build-system)
                  (guix build utils)
                  (ice-9 regex)
                  (srfi srfi-1)
                  (srfi srfi-26))

       ,@(cross-gcc-arguments target libc)))

In addition to this problem with 'cut', there was also a syntax error
corrected by Ludovic in commit 0a0884c9916d2d4632c6b86a917ce1fa038cf7a7:

  commit 0a0884c9916d2d4632c6b86a917ce1fa038cf7a7
  Author: Ludovic Courtès <ludo@gnu.org>
  Date:   Tue May 3 23:43:49 2016 +0200

  gnu: cross: Fix typo.

  * gnu/packages/cross-base.scm (cross-gcc-arguments): Remove erroneous
  'else' introduced in efc4eb147512fa7a2c6d74d9b296cfc22b1ef198.

  diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
  index 7c76f60..73ac76a 100644
  --- a/gnu/packages/cross-base.scm
  +++ b/gnu/packages/cross-base.scm
  @@ -199,8 +199,8 @@ may be either a libc package or #f.)"
                                   "OBJCPLUS_INCLUDE_PATH"
                                   "LIBRARY_PATH"))
                       #t))
  -                ,phases))
  -          (else phases)))))))
  +                ,phases)
  +              phases)))))))
   
   (define (cross-gcc-patches target)
     "Return GCC patches needed for TARGET."

Given the non-trivial nature of these changes, I assume that you tested
your patch set before submitting it, which leads me to conclude that you
accidentally sent us a different, untested version of this patch.  Can
you try to find the version that you tested?

Anyway, thanks for your efforts on this important work!

     Mark

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

* Re: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-05-14  5:29 ` Mark H Weaver
@ 2016-05-14  6:37   ` Jan Nieuwenhuizen
  2016-05-14  8:25     ` FIXUP: " Jan Nieuwenhuizen
  0 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-14  6:37 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver writes:

Hi Mark,

TL;DR: Apparently I tested only the full mingw stack.  I'm working on a
       fix for cut now and will extend my test set.  Sorry.

> This patch, pushed to master about two weeks ago as commit
> efc4eb147512fa7a2c6d74d9b296cfc22b1ef198, broke 79 cross-compiled builds
> on hydra:
>
>   http://hydra.gnu.org/eval/108933#tabs-now-fail

Oops 2.  Noted as an `interesting' url to look at after buildsystem
patches are merged, thanks.

> The problem is that 'cross-libc' creates build-side code that uses 'cut'
> from srfi-26, although (srfi srfi-26) is not loaded on the build side:
>> +              (for-each (cut setenv <> cpath)
>> +                        '("CROSS_C_INCLUDE_PATH"
>> +                          "CROSS_CPLUS_INCLUDE_PATH"
>> +                          "CROSS_OBJC_INCLUDE_PATH"
>> +                          "CROSS_OBJCPLUS_INCLUDE_PATH"))              
>>                #t))
>>            ,phases))))
>
> Leading to "ERROR: Unbound variable: cut".
>
>   http://hydra.gnu.org/build/1185432/nixlog/3/tail-reload
>
> In contrast, 'cross-gcc', which also uses 'cut' in its build-side code,
> arranges to have (srfi srfi-26) loaded via the '#:modules' argument
> (lines 232-240 of cross-base.scm):

>     (arguments
>      `(#:implicit-inputs? #f
>        #:modules ((guix build gnu-build-system)
>                   (guix build utils)
>                   (ice-9 regex)
>                   (srfi srfi-1)
>                   (srfi srfi-26))
>
>        ,@(cross-gcc-arguments target libc)))

Yes, apparently that's what I tested.

> In addition to this problem with 'cut', there was also a syntax error
> corrected by Ludovic in commit 0a0884c9916d2d4632c6b86a917ce1fa038cf7a7:
>   -                ,phases))
>   -          (else phases)))))))
>   +                ,phases)
>   +              phases)))))))


I was very unhappy with that, sorry.

> Given the non-trivial nature of these changes, I assume that you tested
> your patch set before submitting it, which leads me to conclude that you
> accidentally sent us a different, untested version of this patch.  Can
> you try to find the version that you tested?

Apparently I made some changes that I, unintentionally, did not test.

The typo above is a snippet that belonged in the subsequent

    [PATCH 04/10] gnu: cross-build: i686-w64-mingw32: new cross target.

which thus shadowed/fixed what I actually tested, it's easy to spot
when you know wat to look for

    https://lists.gnu.org/archive/html/guix-devel/2016-04/msg01189.html

    -          (if libc
    +           (cond
    +            ((mingw-target? target)
    ...
    -          (else phases)))))))
    +          (else phases))))))))

I developed the mingw cross build as one fat patch and then split that
out into 10 separate patches, and I only tested the combination of
patches.  The 04/10 did not get in, thus triggering the typo.

As for the cross-compile missing cut-bug: I had a wrong understanding of
the build system.  I was convinced that cross-gcc was used during
bootstrapping and that I thus was implicitly testing that.  Last week
Manolis showed me this is not the case.

What I did do, was rebase my the mingw patch set to Manolis' wip-hurd
branch and make hurd bootstrap tarballs.  With that, I thought I had
other cross builds covered.  However, the changes that needed had to be
manually transplanted back.  I'm not sure if I missed the cut problem
there or if that's yet another code location; I'm looking into that.

> Anyway, thanks for your efforts on this important work!

:-) Thanks for your patience and understanding!

Meanwhile, I can "happily" confirm that

    ./pre-inst-env guix build --target=mips64el-linux-gnuabi64 hello

currently fails for me; so I've got a failing test to repair.  I add
this to my test set.

Greetings,
Jan

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* FIXUP: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-05-14  6:37   ` Jan Nieuwenhuizen
@ 2016-05-14  8:25     ` Jan Nieuwenhuizen
  2016-05-14 20:05       ` Ludovic Courtès
  0 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-14  8:25 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]

Jan Nieuwenhuizen writes:

Fix for

    ./pre-inst-env guix build --target=mips64el-linux-gnuabi64 hello

attached.  Adds srfi-26 to glibc for cut.

As Andy suggested I will be factoring-out the for-each (setenv) CROSS_*
stanzas but I'm still experimenting with that, with cross-libtool and
the whole lilypond stack.

Greetings,
Jan


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-cross-base-Add-srfi-26-for-glibc.-Fixes-glibc-ba.patch --]
[-- Type: text/x-diff, Size: 997 bytes --]

From 0361374c4469b1e9b573668a6020b19e7abfbfe2 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Sat, 14 May 2016 10:13:21 +0200
Subject: [PATCH] gnu: cross-base: Add srfi-26 for glibc.  Fixes glibc-based
 cross builds.

* gnu/packages/cross-base.scm (glibc): Add (srfi srfi-26) to (arguments
---
 gnu/packages/cross-base.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 73ac76a..7ed4ae4 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -323,6 +323,11 @@ XBINUTILS and the cross tool chain."
            ;; itself.
            #:implicit-cross-inputs? #f
 
+           ;; We need cut from srfi-26
+           #:modules ((guix build gnu-build-system)
+                      (guix build utils)
+                      (srfi srfi-26))
+
            ,@(package-arguments glibc))
        ((#:configure-flags flags)
         `(cons ,(string-append "--host=" target)
-- 
2.7.3


[-- Attachment #3: Type: text/plain, Size: 154 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: FIXUP: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-05-14  8:25     ` FIXUP: " Jan Nieuwenhuizen
@ 2016-05-14 20:05       ` Ludovic Courtès
  2016-05-14 20:50         ` Jan Nieuwenhuizen
  0 siblings, 1 reply; 41+ messages in thread
From: Ludovic Courtès @ 2016-05-14 20:05 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> From 0361374c4469b1e9b573668a6020b19e7abfbfe2 Mon Sep 17 00:00:00 2001
> From: Jan Nieuwenhuizen <janneke@gnu.org>
> Date: Sat, 14 May 2016 10:13:21 +0200
> Subject: [PATCH] gnu: cross-base: Add srfi-26 for glibc.  Fixes glibc-based
>  cross builds.
>
> * gnu/packages/cross-base.scm (glibc): Add (srfi srfi-26) to (arguments

Thanks for your quick response, applied with an adjusted commit log.

I concur with Mark: this is a very sensitive area that takes time to
test and adjust, which is the main reason why it takes me so much time
to review and such ;-), so we want to make sure we don’t break it.

In the future, please make sure to test individual patches with the
known-good *-linux-gnu targets.

Thanks!

Ludo’.

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

* Re: FIXUP: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-05-14 20:05       ` Ludovic Courtès
@ 2016-05-14 20:50         ` Jan Nieuwenhuizen
  2016-05-16 21:02           ` Ludovic Courtès
  0 siblings, 1 reply; 41+ messages in thread
From: Jan Nieuwenhuizen @ 2016-05-14 20:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès writes:

> Thanks for your quick response, applied with an adjusted commit log.

Thanks.

> I concur with Mark: this is a very sensitive area that takes time to
> test and adjust, which is the main reason why it takes me so much time
> to review and such ;-), so we want to make sure we don’t break it.

Sure, I agree.  These two real silly problems I introduced only makes me
appreciate more that it takes some time to get the patches in ;-)

> In the future, please make sure to test individual patches with the
> known-good *-linux-gnu targets.

Yes.  I wrongly assumed (though that I knew and saw happen) that
cross-gcc and cross-libc were used in the bootstrap process that I was
thus testing them...I've seen a lot of my build host compilers and libc
getting built and rebuilt.  Now I know that's not the case and need to
test for that when touching this area.  That's still no excuse for
not testing the cross-base.scm patches individually :-/

I would still like to explore getting rid of the patched gcc and all
the environment variables and use a --sysroot instead; but I would
need some help/inspiration to get that experiment going.

Greetings, Jan

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

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

* Re: FIXUP: [PATCH 01/10] gnu: cross: Use CROSS_*_INCLUDE_PATH for system headers.
  2016-05-14 20:50         ` Jan Nieuwenhuizen
@ 2016-05-16 21:02           ` Ludovic Courtès
  0 siblings, 0 replies; 41+ messages in thread
From: Ludovic Courtès @ 2016-05-16 21:02 UTC (permalink / raw)
  To: Jan Nieuwenhuizen; +Cc: guix-devel

Jan Nieuwenhuizen <janneke@gnu.org> skribis:

> I would still like to explore getting rid of the patched gcc and all
> the environment variables and use a --sysroot instead; but I would
> need some help/inspiration to get that experiment going.

I’m not sure this is doable or desirable.  AIUI --sysroot is pretty much
biased towards FHS.

My 2¢,
Ludo’.

^ permalink raw reply	[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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).