* [PATCH 01/12] gnu: Add gcc-cross-x86_64 packages for testing.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 02/12] gnu: Add mingw-w64 Jan Nieuwenhuizen
` (10 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 UTC (permalink / raw)
To: guix-devel
* gnu/packages/cross-base.scm: (xgcc-sans-libc-x86_64-linux-gnu,
xgcc-x86_64-linux-gnu): New variables.
---
gnu/packages/cross-base.scm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 3bd30fd..cb53668 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -402,3 +402,14 @@ XBINUTILS and the cross tool chain."
;; (cross-gcc triplet
;; (cross-binutils triplet)
;; (cross-libc triplet))))
+
+(define-public xgcc-sans-libc-x86_64-linux-gnu
+ (let ((triplet "x86_64-linux-gnu"))
+ (cross-gcc triplet
+ (cross-binutils triplet))))
+
+(define-public xgcc-x86_64-linux-gnu
+ (let ((triplet "x86_64-linux-gnu"))
+ (cross-gcc triplet
+ (cross-binutils triplet)
+ (cross-libc triplet))))
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/12] gnu: Add mingw-w64.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 01/12] gnu: Add gcc-cross-x86_64 packages for testing Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 7:42 ` Alex Kost
2016-08-18 6:08 ` [PATCH 03/12] gnu: cross-build: i686-w64-mingw32: new cross target Jan Nieuwenhuizen
` (9 subsequent siblings)
11 siblings, 1 reply; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 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/local.mk (dist_patch_DATA): Add them.
---
gnu/local.mk | 3 +
gnu/packages/mingw.scm | 82 ++++++++
.../patches/gcc-4.9.3-mingw-gthr-default.patch | 11 ++
.../patches/mingw-w64-5.0rc2-gcc-4.9.3.patch | 218 +++++++++++++++++++++
4 files changed, 314 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 53621d8..e5aed2b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -235,6 +235,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/mc.scm \
%D%/packages/mcrypt.scm \
%D%/packages/messaging.scm \
+ %D%/packages/mingw.scm \
%D%/packages/mg.scm \
%D%/packages/mit-krb5.scm \
%D%/packages/moe.scm \
@@ -516,6 +517,7 @@ dist_patch_DATA = \
%D%/packages/patches/gcc-arm-link-spec-fix.patch \
%D%/packages/patches/gcc-cross-environment-variables.patch \
%D%/packages/patches/gcc-libvtv-runpath.patch \
+ %D%/packages/patches/gcc-4.9.3-mingw-gthr-default.patch \
%D%/packages/patches/gcc-5.0-libvtv-runpath.patch \
%D%/packages/patches/gd-fix-gd2-read-test.patch \
%D%/packages/patches/gd-fix-tests-on-i686.patch \
@@ -664,6 +666,7 @@ dist_patch_DATA = \
%D%/packages/patches/mcrypt-CVE-2012-4426.patch \
%D%/packages/patches/mcrypt-CVE-2012-4527.patch \
%D%/packages/patches/mhash-keygen-test-segfault.patch \
+ %D%/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch \
%D%/packages/patches/mpc123-initialize-ao.patch \
%D%/packages/patches/mplayer2-theora-fix.patch \
%D%/packages/patches/module-init-tools-moduledir.patch \
diff --git a/gnu/packages/mingw.scm b/gnu/packages/mingw.scm
new file mode 100644
index 0000000..61f0bd3
--- /dev/null
+++ b/gnu/packages/mingw.scm
@@ -0,0 +1,82 @@
+;;; 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* (#:key inputs #:allow-other-keys)
+ (let ((xgcc-core (assoc-ref 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..e8f841c
--- /dev/null
+++ b/gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch
@@ -0,0 +1,218 @@
+This patch includes
+
+ * mingw-w64-headers/include/winnt.h: compile fixes for1 gcc-4.9.3
+ * mingw-w64-headers/crt/math.h: Likewise
+ * mingw-w64-headers/crt/float.h (FLT_EPSILON,DBL_EPSILON,LDBL_EPSILON): Add
+ symbols.
+ * mingw-w64-headers/crt/stat.h (S_ISLNK,S_ISSOCK,S_ISUID,S_ISGID,S_ISLINK):
+ Add symbols.
+ (lstat): Add function.
+ * mingw-w64-headers/crt/_mingw_stat64.h: Likewise
+ * mingw-w64-headers/crt/stdlib.h (realpath): Add function.
+
+Needed for building with gcc-4.9.3 and using with cross-libtool-2.4.6.
+
+Upstream status: not yet presented upstream.
+
+index 9c5cf87..74a8541 100644
+--- a/mingw-w64-crt/misc/dirname.c
++++ b/mingw-w64-crt/misc/dirname.c
+@@ -29,6 +29,12 @@
+ #define __cdecl /* this may not be defined. */
+ #endif
+
++char *__cdecl
++realpath(const char *name, char *resolved)
++{
++ return resolved ? strcpy (resolved, name) : strdup (name);
++}
++
+ char * __cdecl
+ dirname(char *path)
+ {
+diff --git a/mingw-w64-headers/crt/_mingw_stat64.h b/mingw-w64-headers/crt/_mingw_stat64.h
+index 17e754c..7d2339b 100644
+--- a/mingw-w64-headers/crt/_mingw_stat64.h
++++ b/mingw-w64-headers/crt/_mingw_stat64.h
+@@ -2,13 +2,17 @@
+
+ #ifdef _USE_32BIT_TIME_T
+ #define _fstat32 _fstat
++#define _lstat32 _lstat
+ #define _stat32 _stat
+ #define _wstat32 _wstat
+ #define _fstat32i64 _fstati64
++#define _lstat32i64 _lstati64
+ #define _stat32i64 _stati64
+ #define _wstat32i64 _wstati64
+ #else
+ #define _fstat _fstat64i32
++#define _lstat _lstat64i32
++#define _lstati64 _lstat64
+ #define _fstati64 _fstat64
+ #define _stat _stat64i32
+ #define _stati64 _stat64
+diff --git a/mingw-w64-headers/crt/float.h b/mingw-w64-headers/crt/float.h
+index 5874f4e..bdf4ead 100644
+--- a/mingw-w64-headers/crt/float.h
++++ b/mingw-w64-headers/crt/float.h
+@@ -22,6 +22,15 @@
+ #if (__GNUC__ < 4)
+ #error Corrupt install of gcc-s internal headers, or search order was changed.
+ #else
++
++ /* From gcc-4.9.3 float.h. */
++ #undef FLT_EPSILON
++ #undef DBL_EPSILON
++ #undef LDBL_EPSILON
++ #define FLT_EPSILON __FLT_EPSILON__
++ #define DBL_EPSILON __DBL_EPSILON__
++ #define LDBL_EPSILON __LDBL_EPSILON__
++
+ /* #include_next <float_ginclude.h> */
+
+ /* Number of decimal digits, q, such that any floating-point number with q
+diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h
+index 1e970f4..99a332f 100644
+--- a/mingw-w64-headers/crt/math.h
++++ b/mingw-w64-headers/crt/math.h
+@@ -216,6 +216,7 @@ extern "C" {
+ #endif
+ }
+
++#if 0
+ __CRT_INLINE long double __cdecl fabsl (long double x)
+ {
+ #ifdef __arm__
+@@ -226,6 +227,7 @@ extern "C" {
+ return res;
+ #endif
+ }
++#endif
+
+ __CRT_INLINE double __cdecl fabs (double x)
+ {
+@@ -905,7 +907,7 @@ __mingw_choose_expr ( \
+ /* 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);
+diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
+index dfc5ae4..6f0fee3 100644
+--- a/mingw-w64-headers/crt/stdlib.h
++++ b/mingw-w64-headers/crt/stdlib.h
+@@ -8,6 +8,7 @@
+
+ #include <crtdefs.h>
+ #include <limits.h>
++#include <string.h>
+
+ #if defined (__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) && !defined (__USE_MINGW_STRTOX)
+ #define __USE_MINGW_STRTOX 1
+@@ -676,6 +677,8 @@ unsigned long __cdecl _lrotr(unsigned long,int);
+
+ #endif /* !__NO_ISOCEXT */
+
++char *__cdecl realpath (const char *name, char *resolved);
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff --git a/mingw-w64-headers/crt/sys/stat.h b/mingw-w64-headers/crt/sys/stat.h
+index ed60219..d88b4f1 100644
+--- a/mingw-w64-headers/crt/sys/stat.h
++++ b/mingw-w64-headers/crt/sys/stat.h
+@@ -58,16 +58,21 @@ extern "C" {
+ #include <_mingw_stat64.h>
+
+ #define _S_IFMT 0xF000
++#define _S_IFLNK 0xA000
++#define _S_IFSOCK 0xC000
+ #define _S_IFDIR 0x4000
+ #define _S_IFCHR 0x2000
+ #define _S_IFIFO 0x1000
+ #define _S_IFREG 0x8000
++#define _S_ISUID 0x0400
++#define _S_ISGID 0x0200
+ #define _S_IREAD 0x0100
+ #define _S_IWRITE 0x0080
+ #define _S_IEXEC 0x0040
+
+ _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat);
+ _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat);
++ static inline int __cdecl _lstat32(const char *_Name,struct _stat32 *_Stat) {return _stat32(_Name, _Stat);}
+ _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat);
+ _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat);
+ int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat);
+@@ -97,6 +102,9 @@ extern "C" {
+ _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat);
+ _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat);
+ int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
++ static inline int __cdecl _lstat64(const char *_Name,struct _stat64 *_Stat) {return _stat64(_Name, _Stat);}
++ static inline int __cdecl _lstat32i64(const char *_Name,struct _stat32i64 *_Stat) {return _stat32i64(_Name, _Stat);}
++ static inline int __cdecl _lstat64i32(const char *_Name,struct _stat64i32 *_Stat) {return _stat64i32(_Name, _Stat);}
+ #ifndef __CRT__NO_INLINE
+ __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat)
+ {
+@@ -132,6 +140,8 @@ extern "C" {
+ #ifndef NO_OLDNAMES
+ #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
+
++#define S_IFLNK _S_IFLNK
++#define S_IFSOCK _S_IFSOCK
+ #define S_IFMT _S_IFMT
+ #define S_IFDIR _S_IFDIR
+ #define S_IFCHR _S_IFCHR
+@@ -162,6 +172,11 @@ extern "C" {
+ #define S_IXOTH (S_IXGRP >> 3)
+ #define S_IRWXO (S_IRWXG >> 3)
+
++#define S_ISUID _S_ISUID
++#define S_ISGID _S_ISGID
++
++#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
++#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+ #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+ #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+@@ -174,6 +189,7 @@ extern "C" {
+ int __cdecl stat(const char *_Filename,struct stat *_Stat);
+ int __cdecl fstat(int _Desc,struct stat *_Stat);
+ int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
++static inline int __cdecl lstat(const char *_Filename,struct stat *_Stat){return stat(_Filename, _Stat);}
+
+ #ifndef __CRT__NO_INLINE
+ #ifdef _USE_32BIT_TIME_T
+@@ -262,9 +278,11 @@ __CRT_INLINE int __cdecl
+
+ #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
+ #ifdef _USE_32BIT_TIME_T
++#define lstat _lstat32i64
+ #define stat _stat32i64
+ #define fstat _fstat32i64
+ #else
++#define lstat _lstat64
+ #define stat _stat64
+ #define fstat _fstat64
+ #endif
+diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
+index 52af29b..8626396 100644
+--- a/mingw-w64-headers/include/winnt.h
++++ b/mingw-w64-headers/include/winnt.h
+@@ -6895,7 +6895,12 @@ __buildmemorybarrier()
+ DWORD Reg : 3;
+ DWORD R : 1;
+ DWORD L : 1;
++/* C is used as a const specifier */
++#define save_C C
++#undef C
+ DWORD C : 1;
++#define C save_C
++#undef save_C
+ DWORD StackAdjust : 10;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 02/12] gnu: Add mingw-w64.
2016-08-18 6:08 ` [PATCH 02/12] gnu: Add mingw-w64 Jan Nieuwenhuizen
@ 2016-08-18 7:42 ` Alex Kost
2016-08-18 9:48 ` Jan Nieuwenhuizen
0 siblings, 1 reply; 21+ messages in thread
From: Alex Kost @ 2016-08-18 7:42 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: guix-devel
Jan Nieuwenhuizen (2016-08-18 09:08 +0300) wrote:
[...]
> + (arguments
> + `(#:configure-flags '("--host=i686-w64-mingw32")
> + #:phases
> + (modify-phases %standard-phases
> + (add-before
> + 'configure 'setenv
it's more good-looking if this line is moved to the previous one :-)
(add-before 'configure 'setenv
> + (lambda* (#:key inputs #:allow-other-keys)
> + (let ((xgcc-core (assoc-ref 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"))))))
--
Alex
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 02/12] gnu: Add mingw-w64.
2016-08-18 7:42 ` Alex Kost
@ 2016-08-18 9:48 ` Jan Nieuwenhuizen
0 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 9:48 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 224 bytes --]
Alex Kost writes:
>> + (add-before
>> + 'configure 'setenv
>
> it's more good-looking if this line is moved to the previous one :-)
>
> (add-before 'configure 'setenv
Done.
Greetings,
Jan
[-- Attachment #2: 0002-gnu-Add-mingw-w64.patch --]
[-- Type: text/x-patch, Size: 14969 bytes --]
From fe679f99f0cd75051015c4513a77780d0ec36109 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Thu, 14 Apr 2016 07:35:40 +0200
Subject: [PATCH 02/12] gnu: Add mingw-w64.
* 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/local.mk (dist_patch_DATA): 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 | 218 +++++++++++++++++++++
4 files changed, 313 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 53621d8..e5aed2b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -235,6 +235,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/mc.scm \
%D%/packages/mcrypt.scm \
%D%/packages/messaging.scm \
+ %D%/packages/mingw.scm \
%D%/packages/mg.scm \
%D%/packages/mit-krb5.scm \
%D%/packages/moe.scm \
@@ -516,6 +517,7 @@ dist_patch_DATA = \
%D%/packages/patches/gcc-arm-link-spec-fix.patch \
%D%/packages/patches/gcc-cross-environment-variables.patch \
%D%/packages/patches/gcc-libvtv-runpath.patch \
+ %D%/packages/patches/gcc-4.9.3-mingw-gthr-default.patch \
%D%/packages/patches/gcc-5.0-libvtv-runpath.patch \
%D%/packages/patches/gd-fix-gd2-read-test.patch \
%D%/packages/patches/gd-fix-tests-on-i686.patch \
@@ -664,6 +666,7 @@ dist_patch_DATA = \
%D%/packages/patches/mcrypt-CVE-2012-4426.patch \
%D%/packages/patches/mcrypt-CVE-2012-4527.patch \
%D%/packages/patches/mhash-keygen-test-segfault.patch \
+ %D%/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch \
%D%/packages/patches/mpc123-initialize-ao.patch \
%D%/packages/patches/mplayer2-theora-fix.patch \
%D%/packages/patches/module-init-tools-moduledir.patch \
diff --git a/gnu/packages/mingw.scm b/gnu/packages/mingw.scm
new file mode 100644
index 0000000..4eb2c8f
--- /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* (#:key inputs #:allow-other-keys)
+ (let ((xgcc-core (assoc-ref 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..e8f841c
--- /dev/null
+++ b/gnu/packages/patches/mingw-w64-5.0rc2-gcc-4.9.3.patch
@@ -0,0 +1,218 @@
+This patch includes
+
+ * mingw-w64-headers/include/winnt.h: compile fixes for1 gcc-4.9.3
+ * mingw-w64-headers/crt/math.h: Likewise
+ * mingw-w64-headers/crt/float.h (FLT_EPSILON,DBL_EPSILON,LDBL_EPSILON): Add
+ symbols.
+ * mingw-w64-headers/crt/stat.h (S_ISLNK,S_ISSOCK,S_ISUID,S_ISGID,S_ISLINK):
+ Add symbols.
+ (lstat): Add function.
+ * mingw-w64-headers/crt/_mingw_stat64.h: Likewise
+ * mingw-w64-headers/crt/stdlib.h (realpath): Add function.
+
+Needed for building with gcc-4.9.3 and using with cross-libtool-2.4.6.
+
+Upstream status: not yet presented upstream.
+
+index 9c5cf87..74a8541 100644
+--- a/mingw-w64-crt/misc/dirname.c
++++ b/mingw-w64-crt/misc/dirname.c
+@@ -29,6 +29,12 @@
+ #define __cdecl /* this may not be defined. */
+ #endif
+
++char *__cdecl
++realpath(const char *name, char *resolved)
++{
++ return resolved ? strcpy (resolved, name) : strdup (name);
++}
++
+ char * __cdecl
+ dirname(char *path)
+ {
+diff --git a/mingw-w64-headers/crt/_mingw_stat64.h b/mingw-w64-headers/crt/_mingw_stat64.h
+index 17e754c..7d2339b 100644
+--- a/mingw-w64-headers/crt/_mingw_stat64.h
++++ b/mingw-w64-headers/crt/_mingw_stat64.h
+@@ -2,13 +2,17 @@
+
+ #ifdef _USE_32BIT_TIME_T
+ #define _fstat32 _fstat
++#define _lstat32 _lstat
+ #define _stat32 _stat
+ #define _wstat32 _wstat
+ #define _fstat32i64 _fstati64
++#define _lstat32i64 _lstati64
+ #define _stat32i64 _stati64
+ #define _wstat32i64 _wstati64
+ #else
+ #define _fstat _fstat64i32
++#define _lstat _lstat64i32
++#define _lstati64 _lstat64
+ #define _fstati64 _fstat64
+ #define _stat _stat64i32
+ #define _stati64 _stat64
+diff --git a/mingw-w64-headers/crt/float.h b/mingw-w64-headers/crt/float.h
+index 5874f4e..bdf4ead 100644
+--- a/mingw-w64-headers/crt/float.h
++++ b/mingw-w64-headers/crt/float.h
+@@ -22,6 +22,15 @@
+ #if (__GNUC__ < 4)
+ #error Corrupt install of gcc-s internal headers, or search order was changed.
+ #else
++
++ /* From gcc-4.9.3 float.h. */
++ #undef FLT_EPSILON
++ #undef DBL_EPSILON
++ #undef LDBL_EPSILON
++ #define FLT_EPSILON __FLT_EPSILON__
++ #define DBL_EPSILON __DBL_EPSILON__
++ #define LDBL_EPSILON __LDBL_EPSILON__
++
+ /* #include_next <float_ginclude.h> */
+
+ /* Number of decimal digits, q, such that any floating-point number with q
+diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h
+index 1e970f4..99a332f 100644
+--- a/mingw-w64-headers/crt/math.h
++++ b/mingw-w64-headers/crt/math.h
+@@ -216,6 +216,7 @@ extern "C" {
+ #endif
+ }
+
++#if 0
+ __CRT_INLINE long double __cdecl fabsl (long double x)
+ {
+ #ifdef __arm__
+@@ -226,6 +227,7 @@ extern "C" {
+ return res;
+ #endif
+ }
++#endif
+
+ __CRT_INLINE double __cdecl fabs (double x)
+ {
+@@ -905,7 +907,7 @@ __mingw_choose_expr ( \
+ /* 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);
+diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
+index dfc5ae4..6f0fee3 100644
+--- a/mingw-w64-headers/crt/stdlib.h
++++ b/mingw-w64-headers/crt/stdlib.h
+@@ -8,6 +8,7 @@
+
+ #include <crtdefs.h>
+ #include <limits.h>
++#include <string.h>
+
+ #if defined (__USE_MINGW_ANSI_STDIO) && ((__USE_MINGW_ANSI_STDIO + 0) != 0) && !defined (__USE_MINGW_STRTOX)
+ #define __USE_MINGW_STRTOX 1
+@@ -676,6 +677,8 @@ unsigned long __cdecl _lrotr(unsigned long,int);
+
+ #endif /* !__NO_ISOCEXT */
+
++char *__cdecl realpath (const char *name, char *resolved);
++
+ #ifdef __cplusplus
+ }
+ #endif
+diff --git a/mingw-w64-headers/crt/sys/stat.h b/mingw-w64-headers/crt/sys/stat.h
+index ed60219..d88b4f1 100644
+--- a/mingw-w64-headers/crt/sys/stat.h
++++ b/mingw-w64-headers/crt/sys/stat.h
+@@ -58,16 +58,21 @@ extern "C" {
+ #include <_mingw_stat64.h>
+
+ #define _S_IFMT 0xF000
++#define _S_IFLNK 0xA000
++#define _S_IFSOCK 0xC000
+ #define _S_IFDIR 0x4000
+ #define _S_IFCHR 0x2000
+ #define _S_IFIFO 0x1000
+ #define _S_IFREG 0x8000
++#define _S_ISUID 0x0400
++#define _S_ISGID 0x0200
+ #define _S_IREAD 0x0100
+ #define _S_IWRITE 0x0080
+ #define _S_IEXEC 0x0040
+
+ _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat);
+ _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat);
++ static inline int __cdecl _lstat32(const char *_Name,struct _stat32 *_Stat) {return _stat32(_Name, _Stat);}
+ _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat);
+ _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat);
+ int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat);
+@@ -97,6 +102,9 @@ extern "C" {
+ _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat);
+ _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat);
+ int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
++ static inline int __cdecl _lstat64(const char *_Name,struct _stat64 *_Stat) {return _stat64(_Name, _Stat);}
++ static inline int __cdecl _lstat32i64(const char *_Name,struct _stat32i64 *_Stat) {return _stat32i64(_Name, _Stat);}
++ static inline int __cdecl _lstat64i32(const char *_Name,struct _stat64i32 *_Stat) {return _stat64i32(_Name, _Stat);}
+ #ifndef __CRT__NO_INLINE
+ __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat)
+ {
+@@ -132,6 +140,8 @@ extern "C" {
+ #ifndef NO_OLDNAMES
+ #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
+
++#define S_IFLNK _S_IFLNK
++#define S_IFSOCK _S_IFSOCK
+ #define S_IFMT _S_IFMT
+ #define S_IFDIR _S_IFDIR
+ #define S_IFCHR _S_IFCHR
+@@ -162,6 +172,11 @@ extern "C" {
+ #define S_IXOTH (S_IXGRP >> 3)
+ #define S_IRWXO (S_IRWXG >> 3)
+
++#define S_ISUID _S_ISUID
++#define S_ISGID _S_ISGID
++
++#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
++#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+ #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+ #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+@@ -174,6 +189,7 @@ extern "C" {
+ int __cdecl stat(const char *_Filename,struct stat *_Stat);
+ int __cdecl fstat(int _Desc,struct stat *_Stat);
+ int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
++static inline int __cdecl lstat(const char *_Filename,struct stat *_Stat){return stat(_Filename, _Stat);}
+
+ #ifndef __CRT__NO_INLINE
+ #ifdef _USE_32BIT_TIME_T
+@@ -262,9 +278,11 @@ __CRT_INLINE int __cdecl
+
+ #if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
+ #ifdef _USE_32BIT_TIME_T
++#define lstat _lstat32i64
+ #define stat _stat32i64
+ #define fstat _fstat32i64
+ #else
++#define lstat _lstat64
+ #define stat _stat64
+ #define fstat _fstat64
+ #endif
+diff --git a/mingw-w64-headers/include/winnt.h b/mingw-w64-headers/include/winnt.h
+index 52af29b..8626396 100644
+--- a/mingw-w64-headers/include/winnt.h
++++ b/mingw-w64-headers/include/winnt.h
+@@ -6895,7 +6895,12 @@ __buildmemorybarrier()
+ DWORD Reg : 3;
+ DWORD R : 1;
+ DWORD L : 1;
++/* C is used as a const specifier */
++#define save_C C
++#undef C
+ DWORD C : 1;
++#define C save_C
++#undef save_C
+ DWORD StackAdjust : 10;
+ } DUMMYSTRUCTNAME;
+ } DUMMYUNIONNAME;
--
2.9.2
[-- 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] 21+ messages in thread
* [PATCH 03/12] gnu: cross-build: i686-w64-mingw32: new cross target.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 01/12] gnu: Add gcc-cross-x86_64 packages for testing Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 02/12] gnu: Add mingw-w64 Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 04/12] gnu: Add function libiconv-if-needed Jan Nieuwenhuizen
` (8 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 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 | 350 +++++++++++++++++++++++++++++---------------
guix/utils.scm | 5 +
2 files changed, 239 insertions(+), 116 deletions(-)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index cb53668..996e392 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -19,12 +19,12 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages cross-base)
- #:use-module (guix licenses)
#:use-module (gnu packages)
- #:use-module (gnu packages gcc)
#:use-module (gnu packages base)
+ #:use-module (gnu packages gcc)
#:use-module (gnu packages commencement)
#:use-module (gnu packages linux)
+ #:use-module (gnu packages mingw)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix utils)
@@ -35,13 +35,23 @@
#: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
;; be 'gcc' and can be a specific variant such as 'gcc-4.8'.
gcc)
+(define %gcc-include-paths
+ '("C_INCLUDE_PATH"
+ "CPLUS_INCLUDE_PATH"
+ "OBJC_INCLUDE_PATH"
+ "OBJCPLUS_INCLUDE_PATH"))
+
+(define %gcc-cross-include-paths
+ (map (cut string-append "CROSS_" <>) %gcc-include-paths))
+
(define (cross p target)
(package (inherit p)
(name (string-append (package-name p) "-cross-" target))
@@ -129,7 +139,12 @@ may be either a libc package or #f.)"
"--disable-libitm"
"--disable-libvtv"
"--disable-libsanitizer"
- )))
+ ))
+
+ ;; For a newlib (non-glibc) target
+ ,@(if (cross-newlib? target)
+ '("--with-newlib")
+ '()))
,(if libc
flags
@@ -171,12 +186,82 @@ may be either a libc package or #f.)"
;; for cross-compilers.
(zero? (system* "make" "install-strip")))
,phases))))
- (if libc
+ (cond
+ ((target-mingw? 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)))
+ (define (unpacked-mingw-dir)
+ (match
+ (scandir
+ "."
+ (lambda (name) (string-contains name "mingw-w64")))
+ ((mingw-dir)
+ (string-append
+ (getcwd) "/" mingw-dir "/mingw-w64-headers"))))
+ (if libc
+ (let ((cpath (string-append
+ libc "/include"
+ ":" libc "/i686-w64-mingw32/include")))
+ (for-each (cut setenv <> cpath)
+ ',%gcc-cross-include-paths))
+ ;; libc is false, so we are building xgcc-sans-libc
+ ;; Add essential headers from mingw-w64.
+ (let ((mingw-source (assoc-ref inputs "mingw-source")))
+ (system* "tar" "xf" mingw-source)
+ (let ((mingw-headers (unpacked-mingw-dir)))
+ ;; We need _mingw.h which will gets built from
+ ;; _mingw.h.in by mingw-w64's configure. We
+ ;; cannot configure mingw-w64 until we have
+ ;; xgcc-sans-libc; substitute to the rescue.
+ (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)
+ (cons
+ "CROSS_LIBRARY_PATH"
+ ',%gcc-cross-include-paths))))
+ (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)))))
+ (cons "LIBRARY_PATH" ',%gcc-include-paths))
+ #t)))))
+ (libc
`(alist-cons-before
'configure 'set-cross-path
(lambda* (#:key inputs #:allow-other-keys)
- ;; Add the cross kernel headers to CROSS_CPATH, and remove them
- ;; from CPATH.
+ ;; Add the cross kernel headers to CROSS_CPATH, and remove
+ ;; them from CPATH.
(let ((libc (assoc-ref inputs "libc"))
(kernel (assoc-ref inputs "xkernel-headers")))
(define (cross? x)
@@ -187,37 +272,40 @@ may be either a libc package or #f.)"
libc "/include"
":" kernel "/include")))
(for-each (cut setenv <> cpath)
- '("CROSS_C_INCLUDE_PATH"
- "CROSS_CPLUS_INCLUDE_PATH"
- "CROSS_OBJC_INCLUDE_PATH"
- "CROSS_OBJCPLUS_INCLUDE_PATH")))
+ ',%gcc-cross-include-paths))
(setenv "CROSS_LIBRARY_PATH"
(string-append libc "/lib:"
kernel "/lib")) ;for Hurd's libihash
(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"))
+ (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)))))
+ (cons "LIBRARY_PATH" ',%gcc-include-paths))
#t))
- ,phases)
- phases)))))))
+ ,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"))
+ ((target-mingw? target)
+ (search-patches "gcc-4.9.3-mingw-gthr-default.patch"))
(else '())))
+(define (cross-gcc-snippet target)
+ "Return GCC snippet needed for TARGET."
+ (cond ((target-mingw? target)
+ '(copy-recursively "libstdc++-v3/config/os/mingw32-w64"
+ "libstdc++-v3/config/os/newlib"))
+ (else #f)))
+
(define* (cross-gcc target
#:optional (xbinutils (cross-binutils target)) libc)
"Return a cross-compiler for TARGET, where TARGET is a GNU triplet. Use
@@ -232,7 +320,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.
@@ -242,6 +333,8 @@ GCC that does not target a libc; otherwise, target that libc."
`(#:implicit-inputs? #f
#:modules ((guix build gnu-build-system)
(guix build utils)
+ (ice-9 ftw)
+ (ice-9 match)
(ice-9 regex)
(srfi srfi-1)
(srfi srfi-26))
@@ -262,34 +355,36 @@ 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
- `(("libc" ,libc)
- ("xkernel-headers" ;the target headers
- ,@(assoc-ref (package-propagated-inputs libc)
- "kernel-headers"))
- ,@inputs)
- inputs))))
+ (cond
+ ((target-mingw? target)
+ (if libc
+ `(("libc" ,mingw-w64)
+ ,@inputs)
+ `(("mingw-source" ,(package-source mingw-w64))
+ ,@inputs)))
+ (libc
+ `(("libc" ,libc)
+ ("xkernel-headers" ;the target headers
+ ,@(assoc-ref (package-propagated-inputs libc)
+ "kernel-headers"))
+ ,@inputs))
+ (else inputs)))))
(inputs '())
;; Only search target inputs, not host inputs.
;; Note: See <http://bugs.gnu.org/22186> for why not 'CPATH'.
(search-paths
- (list (search-path-specification
- (variable "CROSS_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")
- (files '("lib" "lib64")))))
+ (cons
+ (search-path-specification
+ (variable "CROSS_LIBRARY_PATH")
+ (files '("lib" "lib64")))
+ (map
+ (lambda (path)
+ (search-path-specification
+ (variable path)
+ (files '("include"))))
+ %gcc-cross-include-paths)))
(native-search-paths '())))
(define* (cross-libc target
@@ -298,75 +393,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
-
- ;; We need 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)
- ,flags))
- ((#:phases phases)
- `(alist-cons-before
- 'configure 'set-cross-kernel-headers-path
- (lambda* (#:key inputs #:allow-other-keys)
- (let* ((kernel (assoc-ref inputs "kernel-headers"))
- (cpath (string-append kernel "/include")))
- (for-each (cut setenv <> cpath)
- '("CROSS_C_INCLUDE_PATH"
- "CROSS_CPLUS_INCLUDE_PATH"
- "CROSS_OBJC_INCLUDE_PATH"
- "CROSS_OBJCPLUS_INCLUDE_PATH"))
- #t))
- ,phases))))
-
- ;; Shadow the native "kernel-headers" because glibc's recipe expects the
- ;; "kernel-headers" input to point to the right thing.
- (propagated-inputs `(("kernel-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)
+ (native-libc 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
+
+ ;; We need 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)
+ ,flags))
+ ((#:phases phases)
+ `(alist-cons-before
+ 'configure 'set-cross-kernel-headers-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((kernel (assoc-ref inputs "kernel-headers"))
+ (cpath (string-append kernel "/include")))
+ (for-each (cut setenv <> cpath) ',%gcc-cross-include-paths)
+ #t))
+ ,phases))))
+
+ ;; Shadow the native "kernel-headers" because glibc's recipe expects the
+ ;; "kernel-headers" input to point to the right thing.
+ (propagated-inputs `(("kernel-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 (target-mingw? target)
+ mingw-w64
+ glibc))
+
+(define (cross-newlib? target)
+ (not (eq? (native-libc target) glibc)))
\f
;;;
@@ -413,3 +516,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 c68094c..c7123c3 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -69,6 +69,7 @@
%current-system
%current-target-system
package-name->name+version
+ target-mingw?
version-compare
version>?
version>=?
@@ -496,6 +497,10 @@ returned. Both parts must not contain any '@'."
(idx (values (substring spec 0 idx)
(substring spec (1+ idx))))))
+(define* (target-mingw? #:optional (target (%current-target-system)))
+ (and target
+ (string-suffix? "-mingw32" target)))
+
(define version-compare
(let ((strverscmp
(let ((sym (or (dynamic-func "strverscmp" (dynamic-link))
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/12] gnu: Add function libiconv-if-needed.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (2 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 03/12] gnu: cross-build: i686-w64-mingw32: new cross target Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 05/12] gnu: libunistring: support mingw: propagate libiconv if needed Jan Nieuwenhuizen
` (7 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 UTC (permalink / raw)
To: guix-devel
* gnu/packages/base.scm (libiconv-if-needed): New function.
---
gnu/packages/base.scm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index a476837..fe11a87 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -46,7 +46,8 @@
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (ice-9 match)
- #:export (glibc))
+ #:export (glibc
+ libiconv-if-needed))
;;; Commentary:
;;;
@@ -997,6 +998,16 @@ 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)))
+ "Return either a libiconv package specification to include in a dependency
+list for platforms that have an incomplete libc, or the empty list. If a
+package needs iconv ,@(libiconv-if-needed) should be added."
+ ;; POSIX C libraries provide iconv. Platforms with an incomplete libc
+ ;; without iconv, such as MinGW, must return the then clause.
+ (if (target-mingw? target)
+ `(("libiconv" ,libiconv))
+ '()))
+
(define-public (canonical-package package)
;; Avoid circular dependency by lazily resolving 'commencement'.
(let* ((iface (resolve-interface '(gnu packages commencement)))
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/12] gnu: libunistring: support mingw: propagate libiconv if needed.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (3 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 04/12] gnu: Add function libiconv-if-needed Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 06/12] gnu: gmp: build shared library for mingw Jan Nieuwenhuizen
` (6 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 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..a9779d4 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.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/12] gnu: gmp: build shared library for mingw.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (4 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 05/12] gnu: libunistring: support mingw: propagate libiconv if needed Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 07/12] gnu: ncurses: support mingw Jan Nieuwenhuizen
` (5 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 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 46540be..0084ca1 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 ((target-mingw?)
+ ;; 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.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/12] gnu: ncurses: support mingw.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (5 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 06/12] gnu: gmp: build shared library for mingw Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 08/12] gnu: cross-base: Add cross-libtool Jan Nieuwenhuizen
` (4 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 UTC (permalink / raw)
To: guix-devel
From: Mark H Weaver <mhw@netris.org>
* gnu/packages/patches/ncurses-mingw.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/ncurses.scm (ncurses): Support MinGW.
Co-Authored-By: Jan Nieuwenhuizen <janneke@gnu.org>
---
gnu/packages/ncurses.scm | 234 ++++++++++++++++++++++++++---------------------
1 file changed, 132 insertions(+), 102 deletions(-)
diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index 147033a..4d26fde 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -1,7 +1,8 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014, 2016 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,124 +20,153 @@
;;; 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
- (let ((patch-makefile-phase
- '(lambda _
- (for-each patch-makefile-SHELL
- (find-files "." "Makefile.in"))))
- (configure-phase
- ;; The 'configure' script does not understand '--docdir', so we must
- ;; override that and use '--mandir' instead.
- '(lambda* (#:key build target outputs configure-flags
- #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (doc (assoc-ref outputs "doc")))
- (zero? (apply system* "./configure"
- (string-append "SHELL=" (which "sh"))
- (string-append "--build=" build)
- (string-append "--prefix=" out)
- (string-append "--mandir=" doc "/share/man")
- (if target
- (cons (string-append "--host=" target)
- configure-flags)
- configure-flags))))))
- (remove-shebang-phase
- '(lambda _
- ;; To avoid retaining a reference to the bootstrap Bash via the
- ;; shebang of the 'ncursesw6-config' script, simply remove that
- ;; shebang: it'll work just as well without it. Likewise, do not
- ;; retain a reference to the "doc" output.
- (substitute* "misc/ncurses-config.in"
- (("#!@SHELL@")
- "# No shebang here, use /bin/sh!\n")
- (("@SHELL@ \\$0")
- "$0")
- (("mandir=.*$")
- "mandir=share/man"))
- #t))
- (post-install-phase
- '(lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out")))
- ;; 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"))
-
- (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")))))))
- (package
- (name "ncurses")
- (version "6.0")
- (source (origin
+ (package
+ (name "ncurses")
+ (version "6.0")
+ (source (origin
(method url-fetch)
(uri (string-append "mirror://gnu/ncurses/ncurses-"
version ".tar.gz"))
(sha256
(base32
- "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm"))))
- (build-system gnu-build-system)
- (outputs '("out"
- "doc")) ;1 MiB of man pages
- (arguments
- `(#:configure-flags
- `("--with-shared" "--without-debug" "--enable-widec"
+ "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm"))
+ (patches (if (target-mingw?)
+ (search-patches "ncurses-mingw.patch")
+ '()))))
+ (build-system gnu-build-system)
+ (outputs '("out"
+ "doc")) ;1 MiB of man pages
+ (arguments
+ (let ((patch-makefile-phase
+ '(lambda _
+ (for-each patch-makefile-SHELL
+ (find-files "." "Makefile.in"))))
+ (configure-phase
+ ;; The 'configure' script does not understand '--docdir', so we must
+ ;; override that and use '--mandir' instead.
+ '(lambda* (#:key build target outputs configure-flags
+ #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (doc (assoc-ref outputs "doc")))
+ (zero? (apply system* "./configure"
+ (string-append "SHELL=" (which "sh"))
+ (string-append "--build=" build)
+ (string-append "--prefix=" out)
+ (string-append "--mandir=" doc "/share/man")
+ (if target
+ (cons (string-append "--host=" target)
+ configure-flags)
+ configure-flags))))))
+ (remove-shebang-phase
+ '(lambda _
+ ;; To avoid retaining a reference to the bootstrap Bash via the
+ ;; shebang of the 'ncursesw6-config' script, simply remove that
+ ;; shebang: it'll work just as well without it. Likewise, do not
+ ;; retain a reference to the "doc" output.
+ (substitute* "misc/ncurses-config.in"
+ (("#!@SHELL@")
+ "# No shebang here, use /bin/sh!\n")
+ (("@SHELL@ \\$0")
+ "$0")
+ (("mandir=.*$")
+ "mandir=share/man"))
+ #t))
+ (post-install-phase
+ `(lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ ;; 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).
+ ,@(if (target-mingw?)
+ '( ;; TODO: create .la files to link to the .dll?
+ (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)))
+ '("curses" "ncurses" "form" "panel" "menu"))))
+ '())
+ (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"))
+
+ ,@(if (not (target-mingw?))
+ '((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")))
+ '())
- ;; By default headers land in an `ncursesw' subdir, which is not
- ;; what users expect.
- ,(string-append "--includedir=" (assoc-ref %outputs "out")
- "/include")
- "--enable-overwrite" ;really honor --includedir
+ (when (file-exists? libw.a)
+ (format #t "creating symlinks for `lib~a'~%" lib)
+ (symlink libw.a lib.a)
+ ,@(if (not (target-mingw?))
+ '((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")))))))
+ `(#:configure-flags
+ ,(cons*
+ 'quasiquote
+ `(("--with-shared" "--without-debug" "--enable-widec"
+
+ ;; By default headers land in an `ncursesw' subdir, which is not
+ ;; what users expect.
+ ,(list 'unquote '(string-append "--includedir=" (assoc-ref %outputs "out")
+ "/include"))
+ "--enable-overwrite" ;really honor --includedir
- ;; Make sure programs like 'tic', 'reset', and 'clear' have a
- ;; correct RUNPATH.
- ,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out")
- "/lib"))
- #:tests? #f ; no "check" target
- #:phases (modify-phases %standard-phases
- (replace 'configure ,configure-phase)
- (add-after 'install 'post-install
- ,post-install-phase)
- (add-before 'configure 'patch-makefile-SHELL
- ,patch-makefile-phase)
- (add-after 'unpack 'remove-unneeded-shebang
- ,remove-shebang-phase))))
- (self-native-input? #t) ; for `tic'
- (native-search-paths
- (list (search-path-specification
- (variable "TERMINFO_DIRS")
- (files '("share/terminfo")))))
- (synopsis "Terminal emulation (termcap, terminfo) library")
- (description
- "GNU Ncurses is a library which provides capabilities to write text to
+ ;; Make sure programs like 'tic', 'reset', and 'clear' have a
+ ;; correct RUNPATH.
+ ,(list 'unquote '(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out")
+ "/lib"))
+ ;; MinGW: Use term-driver created for the MinGW port.
+ ,@(if (target-mingw?) '("--enable-term-driver") '()))))
+ #:tests? #f ; no "check" target
+ #:phases (modify-phases %standard-phases
+ (replace 'configure ,configure-phase)
+ (add-after 'install 'post-install
+ ,post-install-phase)
+ (add-before 'configure 'patch-makefile-SHELL
+ ,patch-makefile-phase)
+ (add-after 'unpack 'remove-unneeded-shebang
+ ,remove-shebang-phase)))))
+ (self-native-input? #t) ; for `tic'
+ (native-search-paths
+ (list (search-path-specification
+ (variable "TERMINFO_DIRS")
+ (files '("share/terminfo")))))
+ (synopsis "Terminal emulation (termcap, terminfo) library")
+ (description
+ "GNU Ncurses is a library which provides capabilities to write text to
a terminal in a terminal-independent manner. It supports pads and color as
well as multiple highlights and forms characters. It is typically used to
implement user interfaces for command-line applications. The accompanying
ncursesw library provides wide character support.")
- (license x11)
- (home-page "http://www.gnu.org/software/ncurses/"))))
+ (license x11)
+ (home-page "http://www.gnu.org/software/ncurses/")))
(define-public dialog
(package
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/12] gnu: cross-base: Add cross-libtool.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (6 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 07/12] gnu: ncurses: support mingw Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 09/12] gnu: libtool: support cross-libtool mingw Jan Nieuwenhuizen
` (3 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 UTC (permalink / raw)
To: guix-devel
* gnu/packages/cross-base.scm (cross-libtool): New function.
---
gnu/packages/cross-base.scm | 48 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 996e392..f11e8c1 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -21,6 +21,7 @@
(define-module (gnu packages cross-base)
#:use-module (gnu packages)
#:use-module (gnu packages base)
+ #:use-module (gnu packages autotools)
#:use-module (gnu packages gcc)
#:use-module (gnu packages commencement)
#:use-module (gnu packages linux)
@@ -35,6 +36,7 @@
#:use-module (ice-9 match)
#:export (cross-binutils
cross-libc
+ cross-libtool
cross-gcc
cross-newlib?))
@@ -463,6 +465,52 @@ XBINUTILS and the cross tool chain."
,@(package-inputs glibc) ;FIXME: static-bash
,@(package-native-inputs glibc))))))))
+(define* (cross-libtool target
+ #:optional
+ (xgcc (cross-gcc target
+ (cross-binutils target)
+ (cross-libc target)))
+ (xbinutils (cross-binutils target))
+ (xlibc (cross-libc target)))
+ (package
+ (inherit libtool)
+ (name (string-append "cross-libtool-" target))
+ (inputs `(("xlibc" ,xlibc)))
+ (native-inputs `(("xgcc" ,xgcc)
+ ("xbinutils" ,xbinutils)
+ ("xlibc" ,xlibc)
+ ,@(package-native-inputs libtool)))
+ (arguments
+ `(;; Libltdl is provided as a separate package, so don't install it here.
+ #:configure-flags
+ `("--disable-ltdl-install"
+ ;; The libtool script uses `host' rather than `target' to decide
+ ;; whether to use -lc, for example.
+ ,(string-append "--host=" ,target)
+ ,(string-append "--target=" ,target)
+ ,(string-append "--program-prefix=" ,target "-")
+ ,(string-append "CC=" ,target "-gcc"))
+ #:tests? #f
+ #:phases (modify-phases %standard-phases
+ ;; As we are setup as a cross package, PATHs get setup
+ ;; without the CROSS_ prefix. Change that here.
+ (add-before 'configure 'setenv
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((xgcc (assoc-ref inputs "xgcc"))
+ (xgcc-bin (string-append xgcc "/bin/"
+ ,target "-cpp")))
+ (setenv "CPP" xgcc-bin)
+ (setenv "CXXCPP" xgcc-bin))
+ (for-each (lambda (var)
+ (and=> (getenv var)
+ (lambda (value)
+ (let ((cross
+ (string-append "CROSS_" var)))
+ (setenv cross value))
+ (unsetenv var))))
+ (cons "LIBRARY_PATH" ',%gcc-include-paths))
+ #t)))))))
+
(define (native-libc target)
(if (target-mingw? target)
mingw-w64
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/12] gnu: libtool: support cross-libtool mingw.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (7 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 08/12] gnu: cross-base: Add cross-libtool Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 10/12] gnu: ncurses: build mingw with libtool Jan Nieuwenhuizen
` (2 subsequent siblings)
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 UTC (permalink / raw)
To: guix-devel
* gnu/packages/patches/libtool-mingw.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/autotools.scm (libtool): Support cross-libtool for MinGW.
---
gnu/packages/autotools.scm | 3 ++-
gnu/packages/patches/libtool-mingw.patch | 28 ++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/libtool-mingw.patch
diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm
index 21ed0e6..f6706ca 100644
--- a/gnu/packages/autotools.scm
+++ b/gnu/packages/autotools.scm
@@ -295,7 +295,8 @@ Makefile, simplifying the entire process for the developer.")
(sha256
(base32
"0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
- (patches (search-patches "libtool-skip-tests2.patch"))))
+ (patches (search-patches "libtool-skip-tests2.patch"
+ "libtool-mingw.patch"))))
(build-system gnu-build-system)
(propagated-inputs `(("m4" ,m4)))
(native-inputs `(("m4" ,m4)
diff --git a/gnu/packages/patches/libtool-mingw.patch b/gnu/packages/patches/libtool-mingw.patch
new file mode 100644
index 0000000..d406f63
--- /dev/null
+++ b/gnu/packages/patches/libtool-mingw.patch
@@ -0,0 +1,28 @@
+With lstat and _lstat are added to MinGW we need to #define lstat along with
+stat because #define'ing stat impacts struct stat, which would otherwise break
+lstat's signature.
+
+Jan Nieuwenhuizen
+
+Upstream status: not yet presented upstream.
+
+--- libtool-2.4.6/build-aux/ltmain.in~ 2015-02-06 13:57:56.000000000 +0100
++++ libtool-2.4.6/build-aux/ltmain.in 2016-05-06 07:46:29.425142546 +0200
+@@ -3658,6 +3658,7 @@
+ # define S_IXUSR _S_IEXEC
+ #elif defined __MINGW32__
+ # define setmode _setmode
++# define lstat _lstat
+ # define stat _stat
+ # define chmod _chmod
+ # define getcwd _getcwd
+--- libtool-2.4.6/build-aux/ltmain.sh~ 2015-02-15 17:15:12.000000000 +0100
++++ libtool-2.4.6/build-aux/ltmain.sh 2016-05-06 08:31:53.854857844 +0200
+@@ -5576,6 +5577,7 @@
+ # define S_IXUSR _S_IEXEC
+ #elif defined __MINGW32__
+ # define setmode _setmode
++# define lstat _lstat
+ # define stat _stat
+ # define chmod _chmod
+ # define getcwd _getcwd
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/12] gnu: ncurses: build mingw with libtool.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (8 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 09/12] gnu: libtool: support cross-libtool mingw Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-12-07 9:36 ` MinGW cross-compilation support Ludovic Courtès
2016-08-18 6:08 ` [PATCH 11/12] gnu: readline: support mingw Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 12/12] gnu: guile-2.0: " Jan Nieuwenhuizen
11 siblings, 1 reply; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 UTC (permalink / raw)
To: guix-devel
* gnu/packages/ncurses.scm (ncurses)[MINGW]: Build with libtool, as
recommended; enables dlopen'ing.
---
gnu/packages/ncurses.scm | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/gnu/packages/ncurses.scm b/gnu/packages/ncurses.scm
index 4d26fde..74a8470 100644
--- a/gnu/packages/ncurses.scm
+++ b/gnu/packages/ncurses.scm
@@ -27,6 +27,11 @@
#:use-module (guix utils)
#:use-module (guix build-system gnu))
+(define* (cross-libtool #:optional (target (%current-target-system)))
+ (let* ((libtool (resolve-interface '(gnu packages cross-base)))
+ (cross-libtool (module-ref libtool 'cross-libtool)))
+ `(("xlibtool" ,(cross-libtool target)))))
+
(define-public ncurses
(package
(name "ncurses")
@@ -41,6 +46,9 @@
(patches (if (target-mingw?)
(search-patches "ncurses-mingw.patch")
'()))))
+ (native-inputs `(,@(if (target-mingw?)
+ `(,@(cross-libtool))
+ '())))
(build-system gnu-build-system)
(outputs '("out"
"doc")) ;1 MiB of man pages
@@ -92,12 +100,12 @@
(lambda (lib)
(define lib.dll
(string-append "lib" lib ".dll"))
- (define libw6.dll
- (string-append "lib" lib "w6.dll"))
+ (define libw-6.dll
+ (string-append "lib" lib "w-6.dll"))
- (when (file-exists? libw6.dll)
+ (when (file-exists? libw-6.dll)
(format #t "creating symlinks for `lib~a'~%" lib)
- (symlink libw6.dll lib.dll)))
+ (symlink libw-6.dll lib.dll)))
'("curses" "ncurses" "form" "panel" "menu"))))
'())
(with-directory-excursion (string-append out "/lib")
@@ -114,7 +122,10 @@
(string-append "lib" lib ".so.6"))
(define lib.so
(string-append "lib" lib ".so")))
- '())
+ '((define libw.la
+ (string-append "lib" lib "w.la"))
+ (define lib.la
+ (string-append "lib" lib ".la"))))
(when (file-exists? libw.a)
(format #t "creating symlinks for `lib~a'~%" lib)
@@ -125,7 +136,13 @@
(call-with-output-file lib.so
(lambda (p)
(format p "INPUT (-l~aw)~%" lib))))
- '())))
+ '()))
+
+ ,@(if (target-mingw?)
+ '((when (file-exists? libw.la)
+ (format #t "creating symlinks for `lib~a'~%" lib)
+ (symlink libw.la lib.la)))
+ '()))
'("curses" "ncurses" "form" "panel" "menu")))))))
`(#:configure-flags
,(cons*
@@ -142,8 +159,8 @@
;; correct RUNPATH.
,(list 'unquote '(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out")
"/lib"))
- ;; MinGW: Use term-driver created for the MinGW port.
- ,@(if (target-mingw?) '("--enable-term-driver") '()))))
+ ;; MinGW: Use term-driver created for the MinGW port, libtool.
+ ,@(if (target-mingw?) '("--enable-term-driver" "--with-libtool") '()))))
#:tests? #f ; no "check" target
#:phases (modify-phases %standard-phases
(replace 'configure ,configure-phase)
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* MinGW cross-compilation support
2016-08-18 6:08 ` [PATCH 10/12] gnu: ncurses: build mingw with libtool Jan Nieuwenhuizen
@ 2016-12-07 9:36 ` Ludovic Courtès
2016-12-07 10:53 ` Manolis Ragkousis
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Ludovic Courtès @ 2016-12-07 9:36 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: guix-devel
Hello Guix!
After all this time I’m happy to report that I’ve finally merged MinGW
cross-compilation support, woohoo!
So we should now be able to do:
guix build --target=i686-w64-mingw32 guile
to cross-compile Guile to MinGW.
Hydra will build the cross-compilation toolchain and some example
packages.
I didn’t merge the cross-libtool patch and this one:
Jan Nieuwenhuizen <janneke@gnu.org> skribis:
> * gnu/packages/ncurses.scm (ncurses)[MINGW]: Build with libtool, as
> recommended; enables dlopen'ing.
I’m not sure what this means (and the explanation should be as a comment
in the code). Could you explain a bit more?
The idea of Libtool is normally to bundle it in the package tarball.
That ncurses can optionally take an externally-provided Libtool is weird
and I’d rather avoid relying on that if possible.
Adding a new cross-compilation target is a commitment. So I hope you
and others will make sure it remains functional and useful!
I also think that together with Manolis and everyone else who’s played
with cross-compilation, we must clean up the mess that this has become.
;-) Namely, we must more clearly separate target-specific things and
also separate build-side from host-side code (in cross-base.scm).
Suggestions and hacks welcome!
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: MinGW cross-compilation support
2016-12-07 9:36 ` MinGW cross-compilation support Ludovic Courtès
@ 2016-12-07 10:53 ` Manolis Ragkousis
2016-12-07 21:34 ` Ludovic Courtès
2016-12-07 11:17 ` Chris Marusich
2016-12-07 14:09 ` Jan Nieuwenhuizen
2 siblings, 1 reply; 21+ messages in thread
From: Manolis Ragkousis @ 2016-12-07 10:53 UTC (permalink / raw)
To: Ludovic Courtès, Jan Nieuwenhuizen; +Cc: guix-devel
Hello everyone,
On 12/07/16 11:36, Ludovic Courtès wrote:
> Hello Guix!
>
> After all this time I’m happy to report that I’ve finally merged MinGW
> cross-compilation support, woohoo!
>
> So we should now be able to do:
>
> guix build --target=i686-w64-mingw32 guile
>
> to cross-compile Guile to MinGW.
>
> Hydra will build the cross-compilation toolchain and some example
> packages.
Yay! Well done!
>
> Adding a new cross-compilation target is a commitment. So I hope you
> and others will make sure it remains functional and useful!
>
> I also think that together with Manolis and everyone else who’s played
> with cross-compilation, we must clean up the mess that this has become.
> ;-) Namely, we must more clearly separate target-specific things and
> also separate build-side from host-side code (in cross-base.scm).
You are right, now and then cross-compilation breaks with no apparent
reason as the code gets bigger and more complex (especially after adding
non-Linux targets).
I was thinking that maybe we need to abstract and remove all the target
specific from cross-base.scm into new files. I haven't thought about the
actual implementation yet, but it could be something like what I did
with (cross-kernel-headers ...), which simplifies how (cross-libc ...)
chooses which headers to use.
Everyone please share any ideas you have :-)
Manolis
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: MinGW cross-compilation support
2016-12-07 10:53 ` Manolis Ragkousis
@ 2016-12-07 21:34 ` Ludovic Courtès
0 siblings, 0 replies; 21+ messages in thread
From: Ludovic Courtès @ 2016-12-07 21:34 UTC (permalink / raw)
To: Manolis Ragkousis; +Cc: guix-devel
Hey!
Manolis Ragkousis <manolis837@gmail.com> skribis:
> On 12/07/16 11:36, Ludovic Courtès wrote:
[...]
>> Adding a new cross-compilation target is a commitment. So I hope you
>> and others will make sure it remains functional and useful!
>>
>> I also think that together with Manolis and everyone else who’s played
>> with cross-compilation, we must clean up the mess that this has become.
>> ;-) Namely, we must more clearly separate target-specific things and
>> also separate build-side from host-side code (in cross-base.scm).
>
> You are right, now and then cross-compilation breaks with no apparent
> reason as the code gets bigger and more complex (especially after adding
> non-Linux targets).
>
> I was thinking that maybe we need to abstract and remove all the target
> specific from cross-base.scm into new files. I haven't thought about the
> actual implementation yet, but it could be something like what I did
> with (cross-kernel-headers ...), which simplifies how (cross-libc ...)
> chooses which headers to use.
>
> Everyone please share any ideas you have :-)
I moved code that relates to phases to a new (gnu build cross-toolchain)
module in commit 3593e5d5c50b08cf69739aac98cd7c89247fa6da. We could
probably do the same configure flags and make flags.
Going further I was thinking we could have an abstract representation of
“platform” to cater to GNU/Linux (including on ARM), GNU/Hurd, and maybe
MinGW, say:
;; Description of a platform supported by the GNU system.
(define-record-type* <platform> platform make-platform
platform?
(triplet platform-triplet) ;"x86_64-linux-gnu"
(system-type platform-system-type) ;"x86_64-linux"
(linux-architecture platform-linux-architecture) ;"amd64"
(kernel platform-kernel) ;<package>
(ld.so platform-ld.so) ;"ld-linux-x86-64.so.2"
(gcc platform-gcc) ;<package>
(binutils platform-binutils) ;<package>
(libc platform-libc)) ;<package>
Probably this should include cross-compilation hints somehow.
Ideally it should be something like “sysdeps” in glibc: a mechanism that
allows us to separate platform-specific code from generic code.
Ludo’.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: MinGW cross-compilation support
2016-12-07 9:36 ` MinGW cross-compilation support Ludovic Courtès
2016-12-07 10:53 ` Manolis Ragkousis
@ 2016-12-07 11:17 ` Chris Marusich
2016-12-07 14:09 ` Jan Nieuwenhuizen
2 siblings, 0 replies; 21+ messages in thread
From: Chris Marusich @ 2016-12-07 11:17 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 395 bytes --]
ludo@gnu.org (Ludovic Courtès) writes:
> Hello Guix!
>
> After all this time I’m happy to report that I’ve finally merged MinGW
> cross-compilation support, woohoo!
That's very cool! I don't have much to contribute in that area right
now since I'm not really a cross-compilation or MinGW expert, but I do
think this is cool, so I just wanted to cheer you all on!
--
Chris
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: MinGW cross-compilation support
2016-12-07 9:36 ` MinGW cross-compilation support Ludovic Courtès
2016-12-07 10:53 ` Manolis Ragkousis
2016-12-07 11:17 ` Chris Marusich
@ 2016-12-07 14:09 ` Jan Nieuwenhuizen
2016-12-07 21:39 ` Ludovic Courtès
2 siblings, 1 reply; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-12-07 14:09 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès writes:
> After all this time I’m happy to report that I’ve finally merged MinGW
> cross-compilation support, woohoo!
Yay, thanks Ludovic, Manolis and Mark!!!
> Hydra will build the cross-compilation toolchain and some example
> packages.
Great!
> I didn’t merge the cross-libtool patch and this one:
>
> Jan Nieuwenhuizen <janneke@gnu.org> skribis:
>
>> * gnu/packages/ncurses.scm (ncurses)[MINGW]: Build with libtool, as
>> recommended; enables dlopen'ing.
>
> I’m not sure what this means (and the explanation should be as a comment
> in the code). Could you explain a bit more?
The ncurses README.MinGW says
I recommend using libtool to build ncurses on MinGW, because libtool
knows exactly how to build dll's on Windows for use with MinGW.
and if you use libtool, it will generate .la files that are necessary
to dlopen the DLLs.
> The idea of Libtool is normally to bundle it in the package tarball.
> That ncurses can optionally take an externally-provided Libtool is weird
> and I’d rather avoid relying on that if possible.
I agree; this is quite a trick silly setup, esp. using cross builds.
I thought there was a better reason for doing this; that it was needed
to build readline or use readline from guile.exe...I can't remember;
we'll find out.
> Adding a new cross-compilation target is a commitment. So I hope you
> and others will make sure it remains functional and useful!
Yes. There are two things I want to do next. I have another 10 patches
bitrotting around that enable cross building LilyPond. I want to clean
them up and merge them one by one. Also I'd like to look into deploying
guile.exe on Wine/Windows; maybe this should be a first. I could do
with some ideas here. Create packages that can be installed/unpacked,
or port some minimal part of guix so that it can fetch and install
binaries from the store?
> I also think that together with Manolis and everyone else who’s played
> with cross-compilation, we must clean up the mess that this has become.
> ;-) Namely, we must more clearly separate target-specific things and
> also separate build-side from host-side code (in cross-base.scm).
That would be nice!
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] 21+ messages in thread
* Re: MinGW cross-compilation support
2016-12-07 14:09 ` Jan Nieuwenhuizen
@ 2016-12-07 21:39 ` Ludovic Courtès
0 siblings, 0 replies; 21+ messages in thread
From: Ludovic Courtès @ 2016-12-07 21:39 UTC (permalink / raw)
To: Jan Nieuwenhuizen; +Cc: guix-devel
Jan Nieuwenhuizen <janneke@gnu.org> skribis:
> Ludovic Courtès writes:
>
>> After all this time I’m happy to report that I’ve finally merged MinGW
>> cross-compilation support, woohoo!
>
> Yay, thanks Ludovic, Manolis and Mark!!!
Well, thank *you*! There were a lot of iterations on this patch series,
a lot of work, probably a lot of time waiting for compilations to finish
;-), and then a lot of time waiting for the thing to be finally merged.
>> I didn’t merge the cross-libtool patch and this one:
>>
>> Jan Nieuwenhuizen <janneke@gnu.org> skribis:
>>
>>> * gnu/packages/ncurses.scm (ncurses)[MINGW]: Build with libtool, as
>>> recommended; enables dlopen'ing.
>>
>> I’m not sure what this means (and the explanation should be as a comment
>> in the code). Could you explain a bit more?
>
> The ncurses README.MinGW says
>
> I recommend using libtool to build ncurses on MinGW, because libtool
> knows exactly how to build dll's on Windows for use with MinGW.
>
> and if you use libtool, it will generate .la files that are necessary
> to dlopen the DLLs.
>
>> The idea of Libtool is normally to bundle it in the package tarball.
>> That ncurses can optionally take an externally-provided Libtool is weird
>> and I’d rather avoid relying on that if possible.
>
> I agree; this is quite a trick silly setup, esp. using cross builds.
> I thought there was a better reason for doing this; that it was needed
> to build readline or use readline from guile.exe...I can't remember;
> we'll find out.
OK!
>> Adding a new cross-compilation target is a commitment. So I hope you
>> and others will make sure it remains functional and useful!
>
> Yes. There are two things I want to do next. I have another 10 patches
> bitrotting around that enable cross building LilyPond. I want to clean
> them up and merge them one by one. Also I'd like to look into deploying
> guile.exe on Wine/Windows; maybe this should be a first. I could do
> with some ideas here. Create packages that can be installed/unpacked,
> or port some minimal part of guix so that it can fetch and install
> binaries from the store?
When we have ‘guix pack’ (a generalization of “make
guix-binary.x86_64-linux.tar.xz”), that will be a simple way to transfer
a bunch of store items to a Windows box.
Besides, having a test that runs guile.exe in Wine could be useful.
(Though now that Windows implements the Linux syscalls we should make
sure the investment is worth it!)
Ludo’.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 11/12] gnu: readline: support mingw.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (9 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 10/12] gnu: ncurses: build mingw with libtool Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
2016-08-18 6:08 ` [PATCH 12/12] gnu: guile-2.0: " Jan Nieuwenhuizen
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 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/packages/readline.scm | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/readline.scm b/gnu/packages/readline.scm
index 169a738..e15282e 100644
--- a/gnu/packages/readline.scm
+++ b/gnu/packages/readline.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; 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,8 @@
#:use-module (gnu packages perl)
#: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
@@ -61,8 +63,18 @@
;; cross-compiling, so provide the correct answer.
,@(if (%current-target-system)
'("bash_cv_wcwidth_broken=no")
+ '())
+ ;; MinGW: ncurses provides the termcap api.
+ ,@(if (target-mingw?)
+ '("bash_cv_termcap_lib=ncurses")
'()))
+ ,@(if (target-mingw?)
+ ;; MinGW: termcap in ncurses
+ ;; some SIG_* #defined in _POSIX
+ '(#:make-flags '("TERMCAP_LIB=-lncurses"
+ "CPPFLAGS=-D_POSIX"))
+ '())
#:phases (alist-cons-after
'install 'post-install
,post-install-phase
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/12] gnu: guile-2.0: support mingw.
2016-08-18 6:08 MinGW guile.exe cross build patch series v10 Jan Nieuwenhuizen
` (10 preceding siblings ...)
2016-08-18 6:08 ` [PATCH 11/12] gnu: readline: support mingw Jan Nieuwenhuizen
@ 2016-08-18 6:08 ` Jan Nieuwenhuizen
11 siblings, 0 replies; 21+ messages in thread
From: Jan Nieuwenhuizen @ 2016-08-18 6:08 UTC (permalink / raw)
To: guix-devel
* gnu/packages/guile.scm (guile-2.0): Support MinGW.
---
gnu/packages/guile.scm | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index f26cc22..ee84c05 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -143,8 +143,8 @@ without requiring the source code to be rewritten.")
(native-inputs `(("pkgconfig" ,pkg-config)))
(inputs `(("libffi" ,libffi)
("readline" ,readline)
- ("bash" ,bash)))
-
+ ,@(libiconv-if-needed)
+ ,@(if (target-mingw?) '() `(("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
@@ -173,8 +173,15 @@ without requiring the source code to be rewritten.")
;; Tell (ice-9 popen) the file name of Bash.
(let ((bash (assoc-ref inputs "bash")))
(substitute* "module/ice-9/popen.scm"
+ ;; If bash is #f allow fallback for user to provide
+ ;; "bash" in PATH. This happens when cross-building to
+ ;; MinGW for which we do not have Bash yet.
(("/bin/sh")
- (string-append bash "/bin/bash")))))
+ ,@(if (target-mingw?)
+ '((if bash
+ (string-append bash "/bin/bash")
+ "bash"))
+ '((string-append bash "/bin/bash")))))))
%standard-phases)))
(native-search-paths
--
2.9.2
^ permalink raw reply related [flat|nested] 21+ messages in thread