From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Nieuwenhuizen Subject: [PATCH 01/11] gnu: Add mingw-w64. Date: Sun, 8 May 2016 22:42:39 +0200 Message-ID: <1462740169-15029-2-git-send-email-janneke@gnu.org> References: <1462740169-15029-1-git-send-email-janneke@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azVXZ-0004B6-Bo for guix-devel@gnu.org; Sun, 08 May 2016 16:43:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azVXU-0008DD-LJ for guix-devel@gnu.org; Sun, 08 May 2016 16:43:01 -0400 In-Reply-To: <1462740169-15029-1-git-send-email-janneke@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * 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 cea6a73..d0345e9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -230,6 +230,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 \ @@ -491,6 +492,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 \ @@ -626,6 +628,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 +;;; +;;; 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 . + +(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..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 */ + + /* 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 + #include ++#include + + #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.7.3