From 26344720d82a575f7c59fa0ac65ae4ff3e3fc219 Mon Sep 17 00:00:00 2001 From: Alexpux Date: Tue, 19 Nov 2013 12:15:51 +0400 Subject: [PATCH] Initial add toolchain packages. --- mingw-w64-binutils/PKGBUILD | 80 ++ .../binutils-2.23.2-texinfo-5.0.patch | 162 ++++ mingw-w64-cloog/PKGBUILD | 51 ++ .../cloog-0.18.1-no-undefined.patch | 44 + mingw-w64-crt/PKGBUILD | 62 ++ mingw-w64-gcc/4.8-libgcc-references.patch | 45 + mingw-w64-gcc/PKGBUILD | 314 +++++++ mingw-w64-gcc/gcc-4.7-stdthreads.patch | 11 + mingw-w64-gcc/gcc-4.8-filename-output.patch | 17 + mingw-w64-gcc/gcc-4.8-iconv.patch | 13 + mingw-w64-gcc/gcc-4.8-lambda-ICE.patch | 35 + mingw-w64-gcc/gcc-4.8-libstdc++export.patch | 13 + ...mmintrin-header-cplusplus-compatible.patch | 24 + mingw-w64-gmp/PKGBUILD | 37 + mingw-w64-headers/PKGBUILD | 57 ++ mingw-w64-isl/PKGBUILD | 45 + mingw-w64-isl/isl-0.12.1-no-undefined.patch | 24 + mingw-w64-libiconv/PKGBUILD | 37 + mingw-w64-mpc/PKGBUILD | 39 + mingw-w64-mpfr/PKGBUILD | 47 + mingw-w64-mpfr/mpfr-3.1.2-p4.patch | 863 ++++++++++++++++++ mingw-w64-winpthreads/PKGBUILD | 56 ++ .../01-zlib-1.2.7-1-buildsys.mingw.patch | 307 +++++++ mingw-w64-zlib/02-no-undefined.mingw.patch | 11 + .../03-dont-put-sodir-into-L.mingw.patch | 9 + mingw-w64-zlib/04-wrong-w8-check.mingw.patch | 15 + mingw-w64-zlib/05-fix-a-typo.mingw.patch | 20 + mingw-w64-zlib/PKGBUILD | 53 ++ 28 files changed, 2491 insertions(+) create mode 100644 mingw-w64-binutils/PKGBUILD create mode 100644 mingw-w64-binutils/binutils-2.23.2-texinfo-5.0.patch create mode 100644 mingw-w64-cloog/PKGBUILD create mode 100644 mingw-w64-cloog/cloog-0.18.1-no-undefined.patch create mode 100644 mingw-w64-crt/PKGBUILD create mode 100644 mingw-w64-gcc/4.8-libgcc-references.patch create mode 100644 mingw-w64-gcc/PKGBUILD create mode 100644 mingw-w64-gcc/gcc-4.7-stdthreads.patch create mode 100644 mingw-w64-gcc/gcc-4.8-filename-output.patch create mode 100644 mingw-w64-gcc/gcc-4.8-iconv.patch create mode 100644 mingw-w64-gcc/gcc-4.8-lambda-ICE.patch create mode 100644 mingw-w64-gcc/gcc-4.8-libstdc++export.patch create mode 100644 mingw-w64-gcc/gcc-make-xmmintrin-header-cplusplus-compatible.patch create mode 100644 mingw-w64-gmp/PKGBUILD create mode 100644 mingw-w64-headers/PKGBUILD create mode 100644 mingw-w64-isl/PKGBUILD create mode 100644 mingw-w64-isl/isl-0.12.1-no-undefined.patch create mode 100644 mingw-w64-libiconv/PKGBUILD create mode 100644 mingw-w64-mpc/PKGBUILD create mode 100644 mingw-w64-mpfr/PKGBUILD create mode 100644 mingw-w64-mpfr/mpfr-3.1.2-p4.patch create mode 100644 mingw-w64-winpthreads/PKGBUILD create mode 100644 mingw-w64-zlib/01-zlib-1.2.7-1-buildsys.mingw.patch create mode 100644 mingw-w64-zlib/02-no-undefined.mingw.patch create mode 100644 mingw-w64-zlib/03-dont-put-sodir-into-L.mingw.patch create mode 100644 mingw-w64-zlib/04-wrong-w8-check.mingw.patch create mode 100644 mingw-w64-zlib/05-fix-a-typo.mingw.patch create mode 100644 mingw-w64-zlib/PKGBUILD diff --git a/mingw-w64-binutils/PKGBUILD b/mingw-w64-binutils/PKGBUILD new file mode 100644 index 0000000000..bff4ad251a --- /dev/null +++ b/mingw-w64-binutils/PKGBUILD @@ -0,0 +1,80 @@ +# Maintainer: Alexey Pavlov + +_realname=binutils +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +pkgver=2.23.2 +pkgrel=1 +pkgdesc="A set of programs to assemble and manipulate binary and object files" +arch=('any') +url="http://www.gnu.org/software/binutils/" +license=('GPL') +groups=("${_mingw_suff}-toolchain") +depends=("${_mingw_suff}-libiconv" "${_mingw_suff}-zlib") +checkdepends=('dejagnu' 'bc') +makedepends=("${_mingw_suff}-libiconv" "${_mingw_suff}-zlib") +options=('staticlibs' '!distcc' '!ccache') +#install=binutils.install +source=("ftp://mirrors.kernel.org/sources.redhat.com/binutils/releases/binutils-${pkgver}.tar.bz2" + 'binutils-2.23.2-texinfo-5.0.patch') +md5sums=('4f8fa651e35ef262edc01d60fb45702e' + '34e439ce23213a91e2af872dfbb5094c') + +prepare() { + cd ${srcdir}/binutils-${pkgver} + + # http://sourceware.org/git/?p=binutils.git;a=patch;h=e02bf935 + # http://sourceware.org/git/?p=binutils.git;a=patch;h=935f8542 + patch -p1 -i ${srcdir}/binutils-2.23.2-texinfo-5.0.patch + + #do not install libiberty + sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in + # hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS" + sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure + + mkdir ${srcdir}/binutils-build +} + +build() { + cd ${srcdir}/binutils-build + + if [ "${CARCH}" = "x86_64" ]; then + local _conf='--enable-64-bit-bfd' + local _ldflags="${LDFLAGS}" + else + local _conf='' + local _ldflags="${LDFLAGS} -Wl,--large-address-aware" + fi + ${srcdir}/binutils-${pkgver}/configure --build=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --disable-werror \ + --enable-lto \ + --with-sysroot=${MINGW_PREFIX} \ + --with-libiconv-prefix=${MINGW_PREFIX} \ + $_conf \ + --disable-nls \ + --disable-rpath \ + LDFLAGS="${_ldflags}" + + make +} + +check() { + cd ${srcdir}/binutils-build + + # unset LDFLAGS as testsuite makes assumptions about which ones are active + # do not abort on errors - manually check log files + make LDFLAGS="" -k check || true +} + +package() { + cd ${srcdir}/binutils-build + make DESTDIR=${pkgdir} install + + # Remove unwanted files + #rm ${destdir}/usr/share/info/{configure,standards}.info + + # Add some useful headers + #install -m644 ${srcdir}/binutils-${pkgver}/include/libiberty.h ${destdir}${MINGW_PREFIX}/include + #install -m644 ${srcdir}/binutils-${pkgver}/include/demangle.h ${destdir}${MINGW_PREFIX}/include +} diff --git a/mingw-w64-binutils/binutils-2.23.2-texinfo-5.0.patch b/mingw-w64-binutils/binutils-2.23.2-texinfo-5.0.patch new file mode 100644 index 0000000000..38dc19fb0f --- /dev/null +++ b/mingw-w64-binutils/binutils-2.23.2-texinfo-5.0.patch @@ -0,0 +1,162 @@ +diff --git a/bfd/doc/bfd.texinfo b/bfd/doc/bfd.texinfo +index 45ffa73..3aa3300 100644 +--- a/bfd/doc/bfd.texinfo ++++ b/bfd/doc/bfd.texinfo +@@ -322,7 +324,7 @@ All of BFD lives in one directory. + @printindex cp + + @tex +-% I think something like @colophon should be in texinfo. In the ++% I think something like @@colophon should be in texinfo. In the + % meantime: + \long\def\colophon{\hbox to0pt{}\vfill + \centerline{The body of this manual is set in} +@@ -333,7 +335,7 @@ All of BFD lives in one directory. + \centerline{{\sl\fontname\tensl\/}} + \centerline{are used for emphasis.}\vfill} + \page\colophon +-% Blame: doc@cygnus.com, 28mar91. ++% Blame: doc@@cygnus.com, 28mar91. + @end tex + + @bye +diff --git a/binutils/doc/binutils.texi b/binutils/doc/binutils.texi +index 56a0510..fb1802b 100644 +--- a/binutils/doc/binutils.texi ++++ b/binutils/doc/binutils.texi +@@ -148,18 +148,18 @@ in the section entitled ``GNU Free Documentation License''. + * objcopy:: Copy and translate object files + * objdump:: Display information from object files + * ranlib:: Generate index to archive contents +-* readelf:: Display the contents of ELF format files + * size:: List section sizes and total size + * strings:: List printable strings from files + * strip:: Discard symbols +-* elfedit:: Update the ELF header of ELF files + * c++filt:: Filter to demangle encoded C++ symbols + * cxxfilt: c++filt. MS-DOS name for c++filt + * addr2line:: Convert addresses to file and line + * nlmconv:: Converts object code into an NLM +-* windres:: Manipulate Windows resources + * windmc:: Generator for Windows message resources ++* windres:: Manipulate Windows resources + * dlltool:: Create files needed to build and use DLLs ++* readelf:: Display the contents of ELF format files ++* elfedit:: Update the ELF header of ELF files + * Common Options:: Command-line options for all utilities + * Selecting the Target System:: How these utilities determine the target + * Reporting Bugs:: Reporting Bugs +@@ -2907,7 +2907,7 @@ the Info entries for @file{binutils}. + @c man end + @end ignore + +-@node c++filt, addr2line, elfedit, Top ++@node c++filt, addr2line, strip, Top + @chapter c++filt + + @kindex c++filt +@@ -4384,7 +4384,7 @@ equivalent. At least one of the @option{--output-mach}, + + @table @env + +-@itemx --input-mach=@var{machine} ++@item --input-mach=@var{machine} + Set the matching input ELF machine type to @var{machine}. If + @option{--input-mach} isn't specified, it will match any ELF + machine types. +@@ -4392,21 +4392,21 @@ machine types. + The supported ELF machine types are, @var{L1OM}, @var{K1OM} and + @var{x86-64}. + +-@itemx --output-mach=@var{machine} ++@item --output-mach=@var{machine} + Change the ELF machine type in the ELF header to @var{machine}. The + supported ELF machine types are the same as @option{--input-mach}. + +-@itemx --input-type=@var{type} ++@item --input-type=@var{type} + Set the matching input ELF file type to @var{type}. If + @option{--input-type} isn't specified, it will match any ELF file types. + + The supported ELF file types are, @var{rel}, @var{exec} and @var{dyn}. + +-@itemx --output-type=@var{type} ++@item --output-type=@var{type} + Change the ELF file type in the ELF header to @var{type}. The + supported ELF types are the same as @option{--input-type}. + +-@itemx --input-osabi=@var{osabi} ++@item --input-osabi=@var{osabi} + Set the matching input ELF file OSABI to @var{osabi}. If + @option{--input-osabi} isn't specified, it will match any ELF OSABIs. + +@@ -4416,7 +4416,7 @@ The supported ELF OSABIs are, @var{none}, @var{HPUX}, @var{NetBSD}, + @var{FreeBSD}, @var{TRU64}, @var{Modesto}, @var{OpenBSD}, @var{OpenVMS}, + @var{NSK}, @var{AROS} and @var{FenixOS}. + +-@itemx --output-osabi=@var{osabi} ++@item --output-osabi=@var{osabi} + Change the ELF OSABI in the ELF header to @var{osabi}. The + supported ELF OSABI are the same as @option{--input-osabi}. + +diff --git a/ld/ld.texinfo b/ld/ld.texinfo +index c7ae2a5..4777ad5 100644 +--- a/ld/ld.texinfo ++++ b/ld/ld.texinfo +@@ -142,12 +144,12 @@ in the section entitled ``GNU Free Documentation License''. + @ifset ARM + * ARM:: ld and the ARM family + @end ifset +-@ifset HPPA +-* HPPA ELF32:: ld and HPPA 32-bit ELF +-@end ifset + @ifset M68HC11 + * M68HC11/68HC12:: ld and the Motorola 68HC11 and 68HC12 families + @end ifset ++@ifset HPPA ++* HPPA ELF32:: ld and HPPA 32-bit ELF ++@end ifset + @ifset M68K + * M68K:: ld and Motorola 68K family + @end ifset +@@ -6012,6 +6014,9 @@ functionality are not listed. + @ifset I960 + * i960:: @command{ld} and the Intel 960 family + @end ifset ++@ifset M68HC11 ++* M68HC11/68HC12:: @code{ld} and the Motorola 68HC11 and 68HC12 families ++@end ifset + @ifset ARM + * ARM:: @command{ld} and the ARM family + @end ifset +@@ -6027,9 +6032,6 @@ functionality are not listed. + @ifset MSP430 + * MSP430:: @command{ld} and MSP430 + @end ifset +-@ifset M68HC11 +-* M68HC11/68HC12:: @code{ld} and the Motorola 68HC11 and 68HC12 families +-@end ifset + @ifset POWERPC + * PowerPC ELF32:: @command{ld} and PowerPC 32-bit ELF Support + @end ifset +@@ -7877,7 +7879,7 @@ If you have more than one @code{SECT} statement for the same + @printindex cp + + @tex +-% I think something like @colophon should be in texinfo. In the ++% I think something like @@colophon should be in texinfo. In the + % meantime: + \long\def\colophon{\hbox to0pt{}\vfill + \centerline{The body of this manual is set in} +@@ -7888,7 +7890,7 @@ If you have more than one @code{SECT} statement for the same + \centerline{{\sl\fontname\tensl\/}} + \centerline{are used for emphasis.}\vfill} + \page\colophon +-% Blame: doc@cygnus.com, 28mar91. ++% Blame: doc@@cygnus.com, 28mar91. + @end tex + + @bye +-- +1.7.1 + diff --git a/mingw-w64-cloog/PKGBUILD b/mingw-w64-cloog/PKGBUILD new file mode 100644 index 0000000000..2dd58e3344 --- /dev/null +++ b/mingw-w64-cloog/PKGBUILD @@ -0,0 +1,51 @@ +# Maintainer: Alexey Pavlov + +_realname=cloog +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +pkgver=0.18.1 +pkgrel=1 +groups=("${_mingw_suff}") +pkgdesc="Library that generates loops for scanning polyhedra" +arch=('any') +url="http://www.bastoul.net/cloog/" +license=('GPL') +depends=("${_mingw_suff}-isl") +makedepends=("${_mingw_suff}-isl") +options=('staticlibs') +source=(http://www.bastoul.net/cloog/pages/download/${_realname}-${pkgver}.tar.gz + 'cloog-0.18.1-no-undefined.patch') +md5sums=('e34fca0540d840e5d0f6427e98c92252' + 'b976d088b7fab0471431655f561e679f') + +prepare() { + cd "$srcdir/${_realname}-${pkgver}" + patch -p1 -i ${srcdir}/cloog-0.18.1-no-undefined.patch + + autoreconf -fi +} + +build() { + cd $srcdir/${_realname}-${pkgver} + ./configure --build=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --enable-static \ + --disable-shared \ + --with-isl=system \ + --with-bits=gmp \ + --with-isl-prefix=${MINGW_PREFIX} \ + --with-gmp-prefix=${MINGW_PREFIX} \ + --program-suffix=-isl + make +} + +check() { + cd $srcdir/${_realname}-${pkgver} + make check +} + +package() { + cd "${srcdir}/${_realname}-${pkgver}" + make DESTDIR="${pkgdir}" install + rm -f ${pkgdir}${MINGW_PREFIX}/bin/*.exe +} diff --git a/mingw-w64-cloog/cloog-0.18.1-no-undefined.patch b/mingw-w64-cloog/cloog-0.18.1-no-undefined.patch new file mode 100644 index 0000000000..9ac02f83a9 --- /dev/null +++ b/mingw-w64-cloog/cloog-0.18.1-no-undefined.patch @@ -0,0 +1,44 @@ +--- cloog-0.18.1/Makefile.am.orig 2013-10-16 21:08:32.616800000 +0400 ++++ cloog-0.18.1/Makefile.am 2013-10-11 11:27:03.000000000 +0400 +@@ -90,7 +90,7 @@ + AM_CPPFLAGS = -I. -I$(top_builddir)/include -I$(top_srcdir)/include + AM_CFLAGS = $(CFLAGS_WARN) + libcloog_isl_la_CPPFLAGS = -I. -I$(top_builddir)/include -I$(top_srcdir)/include @ISL_CPPFLAGS@ @OSL_CPPFLAGS@ +-libcloog_isl_la_LDFLAGS = -version-info @versioninfo@ \ ++libcloog_isl_la_LDFLAGS = -version-info @versioninfo@ -no-undefined \ + -rpath $(libdir) @ISL_LDFLAGS@ @OSL_LDFLAGS@ + libcloog_isl_la_LIBADD = @ISL_LIBS@ @OSL_LIBS@ $(ISL_LA) $(OSL_LA) + libcloog_isl_la_SOURCES = \ +--- cloog-0.18.1/Makefile.in.orig 2013-10-16 21:09:19.058000000 +0400 ++++ cloog-0.18.1/Makefile.in 2013-10-11 11:27:50.000000000 +0400 +@@ -444,7 +444,7 @@ + AM_CPPFLAGS = -I. -I$(top_builddir)/include -I$(top_srcdir)/include + AM_CFLAGS = $(CFLAGS_WARN) + libcloog_isl_la_CPPFLAGS = -I. -I$(top_builddir)/include -I$(top_srcdir)/include @ISL_CPPFLAGS@ @OSL_CPPFLAGS@ +-libcloog_isl_la_LDFLAGS = -version-info @versioninfo@ \ ++libcloog_isl_la_LDFLAGS = -version-info @versioninfo@ -no-undefined \ + -rpath $(libdir) @ISL_LDFLAGS@ @OSL_LDFLAGS@ + + libcloog_isl_la_LIBADD = @ISL_LIBS@ @OSL_LIBS@ $(ISL_LA) $(OSL_LA) +--- cloog-0.18.1/isl/Makefile.am.orig 2013-10-16 21:09:33.160400000 +0400 ++++ cloog-0.18.1/isl/Makefile.am 2013-10-11 11:27:21.000000000 +0400 +@@ -154,7 +154,7 @@ + isl_sample_piplib.h \ + isl_piplib.c + libisl_la_LIBADD = @PIPLIB_LIBS@ @GMP_LIBS@ +-libisl_la_LDFLAGS = -version-info @versioninfo@ \ ++libisl_la_LDFLAGS = -version-info @versioninfo@ -no-undefined \ + @PIPLIB_LDFLAGS@ @GMP_LDFLAGS@ + libisl_la_CPPFLAGS = $(INCLUDES) @PIPLIB_CPPFLAGS@ @GMP_CPPFLAGS@ + +--- cloog-0.18.1/isl/Makefile.in.orig 2013-10-16 21:09:54.282800000 +0400 ++++ cloog-0.18.1/isl/Makefile.in 2013-10-11 11:27:40.000000000 +0400 +@@ -645,7 +645,7 @@ + isl_piplib.c + + libisl_la_LIBADD = @PIPLIB_LIBS@ @GMP_LIBS@ +-libisl_la_LDFLAGS = -version-info @versioninfo@ \ ++libisl_la_LDFLAGS = -version-info @versioninfo@ -no-undefined \ + @PIPLIB_LDFLAGS@ @GMP_LDFLAGS@ + + libisl_la_CPPFLAGS = $(INCLUDES) @PIPLIB_CPPFLAGS@ @GMP_CPPFLAGS@ diff --git a/mingw-w64-crt/PKGBUILD b/mingw-w64-crt/PKGBUILD new file mode 100644 index 0000000000..73f8de3976 --- /dev/null +++ b/mingw-w64-crt/PKGBUILD @@ -0,0 +1,62 @@ +# Maintainer: Alexey Pavlov + +_realname=crt +_mingw_suff=mingw-w64-${CARCH} +pkgname="${_mingw_suff}-${_realname}-svn" +_ver_base=4.0.0 +pkgver=4.0.0.6379 +pkgrel=1 +pkgdesc='MinGW-w64 CRT for Windows' +arch=('any') +url='http://mingw-w64.sourceforge.net' +license=('custom') +groups=("${_mingw_suff}-toolchain" "${_mingw_suff}") +depends=("${_mingw_suff}-headers-svn") +makedepends=("subversion" "${_mingw_suff}-gcc" "${_mingw_suff}-binutils") +optdepends=() +provides=("${_mingw_suff}-${_realname}") +conflicts=("${_mingw_suff}-${_realname}") +replaces=() +backup=() +options=('!strip' 'staticlibs' '!emptydirs') +source=("${_realname}"::"svn+svn://svn.code.sf.net/p/mingw-w64/code/trunk/mingw-w64-crt") +md5sums=(SKIP) + +pkgver() { + cd "$srcdir/${_realname}" + local ver="$(svnversion)" + printf "%s.%s" "${_ver_base}" "${ver//[[:alpha:]]}" +} + +build() { + msg "Building ${MINGW_CHOST} CRT" + case "$CARCH" in + i686) + _crt_configure_args="--disable-lib64 --enable-lib32" + ;; + x86_64) + _crt_configure_args="--disable-lib32 --enable-lib64" + ;; + esac + mkdir -p ${srcdir}/crt-${MINGW_CHOST} && cd ${srcdir}/crt-${MINGW_CHOST} + ${srcdir}/${_realname}/configure \ + --prefix=${MINGW_PREFIX} \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --with-sysroot=${MINGW_PREFIX}/${MINGW_CHOST} \ + --enable-wildcard \ + ${_crt_configure_args} + make +} + +package() { + msg "Installing ${MINGW_CHOST} crt" + cd ${srcdir}/crt-${MINGW_CHOST} + make DESTDIR=${pkgdir} install + + mkdir -p ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST} + mv ${pkgdir}${MINGW_PREFIX}/include ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/ + mv ${pkgdir}${MINGW_PREFIX}/lib ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/ +} + diff --git a/mingw-w64-gcc/4.8-libgcc-references.patch b/mingw-w64-gcc/4.8-libgcc-references.patch new file mode 100644 index 0000000000..c8918b8ffa --- /dev/null +++ b/mingw-w64-gcc/4.8-libgcc-references.patch @@ -0,0 +1,45 @@ +--- libgcc/config/i386/cygming-crtbegin.c.orig 2013-07-25 18:39:34.579552100 +0800 ++++ libgcc/config/i386/cygming-crtbegin.c 2013-07-25 18:43:51.778712300 +0800 +@@ -100,6 +100,8 @@ + extern void __gcc_register_frame (void); + extern void __gcc_deregister_frame (void); + ++static HANDLE libgcc_dll; ++ + void + __gcc_register_frame (void) + { +@@ -112,8 +114,11 @@ + void (*register_frame_fn) (const void *, struct object *); + HANDLE h = GetModuleHandle (LIBGCC_SONAME); + if (h) +- register_frame_fn = (void (*) (const void *, struct object *)) +- GetProcAddress (h, "__register_frame_info"); ++ { ++ libgcc_dll = LoadLibrary (LIBGCC_SONAME); /* Hold reference */ ++ register_frame_fn = (void (*) (const void *, struct object *)) ++ GetProcAddress (h, "__register_frame_info"); ++ } + else + register_frame_fn = __register_frame_info; + if (register_frame_fn) +@@ -142,13 +147,16 @@ + { + #if DWARF2_UNWIND_INFO + void * (*deregister_frame_fn) (const void *); +- HANDLE h = GetModuleHandle (LIBGCC_SONAME); +- if (h) ++ if (libgcc_dll) + deregister_frame_fn = (void* (*) (const void *)) +- GetProcAddress (h, "__deregister_frame_info"); ++ GetProcAddress (libgcc_dll, "__deregister_frame_info"); + else + deregister_frame_fn = __deregister_frame_info; + if (deregister_frame_fn) + deregister_frame_fn (__EH_FRAME_BEGIN__); ++ ++if (libgcc_dll) ++ FreeLibrary (libgcc_dll); ++ + #endif + } diff --git a/mingw-w64-gcc/PKGBUILD b/mingw-w64-gcc/PKGBUILD new file mode 100644 index 0000000000..c0efacd99e --- /dev/null +++ b/mingw-w64-gcc/PKGBUILD @@ -0,0 +1,314 @@ +# Maintainer: Alexey Pavlov + +_realname=gcc +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}" "${_mingw_suff}-${_realname}-ada" "${_mingw_suff}-${_realname}-fortran" "${_mingw_suff}-${_realname}-objc" "${_mingw_suff}-${_realname}-libs") +pkgver=4.8.2 +pkgrel=1 +pkgdesc="GCC for the MinGW-w64" +arch=('any') +url="http://gcc.gnu.org" +license=('GPL' 'LGPL' 'FDL' 'custom') +groups=("${_mingw_suff}-toolchain" "${_mingw_suff}") +depends=("${_mingw_suff}-zlib" "${_mingw_suff}-mpc" "${_mingw_suff}-cloog" "${_mingw_suff}-crt" "${_mingw_suff}-binutils" "${_mingw_suff}-winpthreads" "${_mingw_suff}-headers") +makedepends=("${_mingw_suff}-${_realname}-ada=${pkgver}" "${_mingw_suff}-${_realname}" 'lndir') +#checkdepends=('dejagnu') +optdepends=() +provides=("${_mingw_suff}-${_realname}-base") +conflicts=("${_mingw_suff}-${_realname}-base") +replaces=() +backup=() +options=('!strip' 'staticlibs' '!emptydirs') # '!buildflags' +source=("ftp://gcc.gnu.org/pub/gcc/releases/${_realname}-${pkgver}/${_realname}-${pkgver}.tar.bz2" + 'gcc-make-xmmintrin-header-cplusplus-compatible.patch' + 'gcc-4.8-filename-output.patch' + 'gcc-4.8-filename-output.patch' + 'gcc-4.8-lambda-ICE.patch' + 'gcc-4.8-iconv.patch' + '4.8-libgcc-references.patch' + 'gcc-4.8-libstdc++export.patch' + 'gcc-4.7-stdthreads.patch') +md5sums=('a3d7d63b9cb6b6ea049469a0c4a43c9d' + 'da6c9ba6baebe1286f3219d4181cdbb8' + '40cb437805e2f7a006aa0d0c3098ab0f' + '40cb437805e2f7a006aa0d0c3098ab0f' + '6eb6e080dbf7bc6825f53a0aaa6c4ef9' + 'd28f5653282c67bcfd1a8f81aebef72d' + '928e151b33981e68d0e67a9bd387b37e' + 'f6b5fb08ff06a7d60ee3280e14240bb2' + '71cdb550528efcf2a5c9112464bfbabc') + +_threads="posix" + +prepare() { + cd ${srcdir}/${_realname}-${pkgver} + + #do not install libiberty + sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in + # hack! - some configure tests for header files using "$CPP $CPPFLAGS" + #sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure + + # The file xmmintrin.h doesn't contain an extern "C" part + # This conflicts with mingw-w64 intrin.h and results in build + # failure like this one in mingw-w64-qt5-qtbase: + # /usr/lib/gcc/i686-w64-mingw32/4.8.0/include/xmmintrin.h:997:1: error: previous declaration of 'int _m_pextrw(__m64, int)' with 'C++' linkage + # /usr/i686-w64-mingw32/include/intrin.h:561:28: error: conflicts with new declaration with 'C' linkage + #patch -p0 -i ${srcdir}/gcc-make-xmmintrin-header-cplusplus-compatible.patch + + patch -p0 -i ${srcdir}/gcc-4.8-filename-output.patch + patch -p1 -i ${srcdir}/gcc-4.8-lambda-ICE.patch + patch -p1 -i ${srcdir}/gcc-4.8-iconv.patch + + patch -p0 -i ${srcdir}/4.8-libgcc-references.patch + patch -p1 -i ${srcdir}/gcc-4.8-libstdc++export.patch + patch -p1 -i ${srcdir}/gcc-4.7-stdthreads.patch + +} + +hack_cleanup() { + if [ -d ${MINGW_PREFIX}/mingw ]; + then + rm -rf ${MINGW_PREFIX}/mingw + fi +} + +build() { + mkdir -p ${srcdir}/gcc-build-${MINGW_CHOST} && cd ${srcdir}/gcc-build-${MINGW_CHOST} + + LDFLAGS+=" -L${MINGW_PREFIX}/lib" + CFLAGS+=" -I${MINGW_PREFIX}/include" + CXXFLAGS+=" -I${MINGW_PREFIX}/include" + CPPFLAGS+="-I${MINGW_PREFIX}/include" + case "${CARCH}" in + i686) + local _conf="--disable-sjlj-exceptions --with-dwarf2" + LDFLAGS+=" -Wl,--large-address-aware" + local _arch=i686 + ;; + + x86_64) + local _arch=x86-64 + local _conf="" + ;; + esac + + ../${_realname}-${pkgver}/configure \ + --prefix=${MINGW_PREFIX} \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --with-sysroot=${MINGW_PREFIX} \ + --libexecdir=${MINGW_PREFIX}/lib \ + --enable-bootstrap \ + --with-arch=${_arch} \ + --with-tune=generic \ + --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada \ + --enable-shared --enable-static \ + --enable-threads=${_threads} \ + --enable-graphite \ + --enable-fully-dynamic-string \ + --enable-libstdcxx-time=yes \ + --disable-libstdcxx-pch \ + --disable-libstdcxx-debug \ + --enable-cloog-backend=isl \ + --disable-cloog-version-check --disable-isl-version-check \ + --enable-lto \ + --enable-libgomp \ + --disable-multilib \ + --enable-checking=release \ + --disable-rpath \ + --disable-win32-registry \ + --disable-nls \ + --disable-werror \ + --disable-symvers \ + --with-libiconv \ + --with-system-zlib \ + --with-{gmp,mpfr,mpc,isl,cloog}="${MINGW_PREFIX}" \ + --with-pkgversion="Rev${pkgrel}, Built by MSYS2 project" \ + --with-bugurl="http://sourceforge.net/projects/msys2" \ + --with-gnu-as --with-gnu-ld \ + ${_conf} + + mkdir -p ${MINGW_PREFIX}/mingw + lndir ${MINGW_PREFIX}/${MINGW_CHOST} ${MINGW_PREFIX}/mingw + make all || hack_cleanup + + hack_cleanup +} + +setup() { + cd ${srcdir}/gcc-build-${MINGW_CHOST} + make DESTDIR=${destdir} install +} + +package_mingw-w64-gcc() { + mkdir -p ${pkgdir}${MINGW_PREFIX}/{bin,lib,share} + + cd ${destdir}${MINGW_PREFIX} + cp bin/cpp.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gcc.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gcc-ar.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gcc-nm.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gcc-ranlib.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gcov.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/c++.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/g++.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-c++.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-g++.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-gcc-${pkgver}.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-gcc.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-gcc-ar.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-gcc-nm.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-gcc-ranlib.exe ${pkgdir}${MINGW_PREFIX}/bin/ + + mkdir -p ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/include + cp lib/gcc/${MINGW_CHOST}/${pkgver}/include/*.h ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/include/ + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/include/ssp ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/include/ + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/include-fixed ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/install-tools ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/cc1.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/collect2.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/crt*.o ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/liblto_plugin.dll ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/liblto_plugin.dll.a ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libgcc* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libgcov.* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libgomp.* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libquadmath.* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libssp* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/lto*.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + + mkdir -p ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/lib + cp lib/gcc/${MINGW_CHOST}/lib/libgcc*.a ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/lib/ + + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/include/c++ ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/include/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/cc1plus.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libstdc++* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libsupc++* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + + mkdir -p ${pkgdir}${MINGW_PREFIX}/share/{doc,info,locale,man} + cp -r share/doc/gcc-${pkgver} ${pkgdir}${MINGW_PREFIX}/share/doc/ + cp share/info/cpp.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/cppinternals.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/gcc.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/gccinstall.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/gccint.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/libgomp.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/libquadmath.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + + cp share/locale/* ${pkgdir}${MINGW_PREFIX}/share/locale/ + mkdir -p ${pkgdir}${MINGW_PREFIX}/share/gcc-${pkgver}/python + cp -r share/gcc-${pkgver}/python/libstdcxx ${pkgdir}${MINGW_PREFIX}/share/gcc-${pkgver}/python/ + mkdir -p ${pkgdir}${MINGW_PREFIX}/share/man/man1 + cp share/man/man1/cpp.1* ${pkgdir}${MINGW_PREFIX}/share/man/man1/ + cp share/man/man1/gcc.1* ${pkgdir}${MINGW_PREFIX}/share/man/man1/ + cp share/man/man1/gcov.1* ${pkgdir}${MINGW_PREFIX}/share/man/man1/ + cp share/man/man7/fsf-funding.7* ${pkgdir}${MINGW_PREFIX}/share/man/man1/ + cp share/man/man7/gfdl.7* ${pkgdir}${MINGW_PREFIX}/share/man/man1/ + cp share/man/man7/gpl.7* ${pkgdir}${MINGW_PREFIX}/share/man/man1/ + cp share/man/man1/g++.1* ${pkgdir}${MINGW_PREFIX}/share/man/man1/ +} + +package_mingw-w64-gcc-ada() { + mkdir -p ${pkgdir}${MINGW_PREFIX}/{bin,lib,share} + + cd ${destdir}${MINGW_PREFIX} + cp bin/gnat.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatbind.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatchop.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatclean.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatfind.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatkr.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatlink.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatls.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatmake.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatname.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatprep.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gnatxref.exe ${pkgdir}${MINGW_PREFIX}/bin/ + + mkdir -p ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver} + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/adainclude ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/adalib ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/gnat1.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + + mkdir -p ${pkgdir}${MINGW_PREFIX}/share/info + cp share/info/gnat-style.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/gnat_rm.info* ${pkgdir}${MINGW_PREFIX}/share/info/ + cp share/info/gnat_ugn.info* ${pkgdir}${MINGW_PREFIX}/share/info/ +} + +package_mingw-w64-gcc-fortran() { + mkdir -p ${pkgdir}${MINGW_PREFIX}/{bin,lib,share} + + cd ${destdir}${MINGW_PREFIX} + cp bin/cpp.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/gfortran.exe ${pkgdir}${MINGW_PREFIX}/bin/ + cp bin/${MINGW_CHOST}-gfortran.exe ${pkgdir}${MINGW_PREFIX}/bin/ + mkdir -p ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver} + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/finclude ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/f951.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libcaf_single.a ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libgfortran* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + mkdir -p ${pkgdir}${MINGW_PREFIX}/share/man/man1 + cp share/info/gfortran.info* + cp share/man/man1/gfortran.1* +} + +package_mingw-w64-gcc-objc() { + mkdir -p ${pkgdir}${MINGW_PREFIX}/{bin,lib} + + cd ${destdir}${MINGW_PREFIX} + #cp bin/*objc*.dll ${pkgdir}${MINGW_PREFIX}/bin/ + mkdir -p ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/include + cp -r lib/gcc/${MINGW_CHOST}/${pkgver}/include/objc ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/include/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/cc1obj.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/libobjc.* ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ + cp lib/gcc/${MINGW_CHOST}/${pkgver}/cc1objplus.exe ${pkgdir}${MINGW_PREFIX}/lib/gcc/${MINGW_CHOST}/${pkgver}/ +} + +package_mingw-w64-gcc-libs() { + mkdir -p ${pkgdir}${MINGW_PREFIX}/bin + + cd ${destdir}${MINGW_PREFIX} + cp bin/*.dll ${pkgdir}${MINGW_PREFIX}/bin/ +} + +package_mingw-w64-i686-gcc() { + package_mingw-w64-gcc +} + +package_mingw-w64-i686-gcc-ada() { + package_mingw-w64-gcc-ada +} + +package_mingw-w64-i686-gcc-fortran() { + package_mingw-w64-gcc-fortran +} + +package_mingw-w64-i686-gcc-objc() { + package_mingw-w64-gcc-objc +} + +package_mingw-w64-i686-gcc-libs() { + package_mingw-w64-gcc-libs +} + +package_mingw-w64-x86_64-gcc() { + package_mingw-w64-gcc +} + +package_mingw-w64-x86_64-gcc-ada() { + package_mingw-w64-gcc-ada +} + +package_mingw-w64-x86_64-gcc-fortran() { + package_mingw-w64-gcc-fortran +} + +package_mingw-w64-x86_64-gcc-objc() { + package_mingw-w64-gcc-objc +} + +package_mingw-w64-x86_64-gcc-libs() { + package_mingw-w64-gcc-libs +} diff --git a/mingw-w64-gcc/gcc-4.7-stdthreads.patch b/mingw-w64-gcc/gcc-4.7-stdthreads.patch new file mode 100644 index 0000000000..439e1f9e98 --- /dev/null +++ b/mingw-w64-gcc/gcc-4.7-stdthreads.patch @@ -0,0 +1,11 @@ +--- a/libgcc/gthr-posix.h (revision 186092) ++++ b/libgcc/gthr-posix.h (working copy) +@@ -88,7 +88,7 @@ + # define __GTHREAD_COND_INIT_FUNCTION __gthread_cond_init_function + #endif + +-#if SUPPORTS_WEAK && GTHREAD_USE_WEAK ++#if SUPPORTS_WEAK && GTHREAD_USE_WEAK && !defined(__MINGW32__) + # ifndef __gthrw_pragma + # define __gthrw_pragma(pragma) + # endif diff --git a/mingw-w64-gcc/gcc-4.8-filename-output.patch b/mingw-w64-gcc/gcc-4.8-filename-output.patch new file mode 100644 index 0000000000..6951eb239b --- /dev/null +++ b/mingw-w64-gcc/gcc-4.8-filename-output.patch @@ -0,0 +1,17 @@ +--- gcc/c-family/c-opts.c (revision 200330) ++++ gcc/c-family/c-opts.c (working copy) +@@ -1338,10 +1338,14 @@ c_finish_options (void) + + /* Give CPP the next file given by -include, if any. */ + static void + push_command_line_include (void) + { ++ // This can happen if disabled by -imacros for example. ++ if (include_cursor > deferred_count) ++ return; ++ + if (!done_preinclude) + { + done_preinclude = true; + if (flag_hosted && std_inc && !cpp_opts->preprocessed) + { diff --git a/mingw-w64-gcc/gcc-4.8-iconv.patch b/mingw-w64-gcc/gcc-4.8-iconv.patch new file mode 100644 index 0000000000..31ab60b7d2 --- /dev/null +++ b/mingw-w64-gcc/gcc-4.8-iconv.patch @@ -0,0 +1,13 @@ +Index: gcc/config/i386/mingw-w64.h +=================================================================== +--- a/gcc/config/i386/mingw-w64.h (revision 186417) ++++ b/gcc/config/i386/mingw-w64.h (working copy) +@@ -44,7 +44,7 @@ + #define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \ + "%{" SPEC_PTHREAD2 ": } " \ + "%{mwindows:-lgdi32 -lcomdlg32} " \ +- "-ladvapi32 -lshell32 -luser32 -lkernel32" ++ "-ladvapi32 -lshell32 -luser32 -lkernel32 -liconv" + + #undef SPEC_32 + #undef SPEC_64 diff --git a/mingw-w64-gcc/gcc-4.8-lambda-ICE.patch b/mingw-w64-gcc/gcc-4.8-lambda-ICE.patch new file mode 100644 index 0000000000..cf77a9b352 --- /dev/null +++ b/mingw-w64-gcc/gcc-4.8-lambda-ICE.patch @@ -0,0 +1,35 @@ +diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c +index 0b8e2f7..ad1c209 100644 +--- a/gcc/cp/semantics.c ++++ b/gcc/cp/semantics.c +@@ -2719,8 +2719,10 @@ finish_member_declaration (tree decl) + /*friend_p=*/0); + } + } +- /* Enter the DECL into the scope of the class. */ +- else if (pushdecl_class_level (decl)) ++ /* Enter the DECL into the scope of the class, if the class ++ isn't a closure (whose fields are supposed to be unnamed). */ ++ else if (CLASSTYPE_LAMBDA_EXPR (current_class_type) ++ || pushdecl_class_level (decl)) + { + if (TREE_CODE (decl) == USING_DECL) + { +diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C +new file mode 100644 +index 0000000..df2b037 +--- /dev/null ++++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-names1.C +@@ -0,0 +1,9 @@ ++// PR c++/56710 ++// { dg-options "-std=c++11 -Wall" } ++ ++int main() ++{ ++ int t = 0; ++ return [&]() -> int {int __t; __t = t; return __t; }(); ++ return [&t]() -> int {int __t; __t = t; return __t; }(); ++} +-- +1.8.4.2 + diff --git a/mingw-w64-gcc/gcc-4.8-libstdc++export.patch b/mingw-w64-gcc/gcc-4.8-libstdc++export.patch new file mode 100644 index 0000000000..ee74ee4212 --- /dev/null +++ b/mingw-w64-gcc/gcc-4.8-libstdc++export.patch @@ -0,0 +1,13 @@ +diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver +index cd0be4e..759dcfb 100644 +--- a/libstdc++-v3/config/abi/pre/gnu.ver ++++ b/libstdc++-v3/config/abi/pre/gnu.ver +@@ -1513,7 +1513,7 @@ CXXABI_1.3.6 { + __cxa_allocate_dependent_exception; + __cxa_free_dependent_exception; + __cxa_deleted_virtual; +- ++ _ZTC*; + } CXXABI_1.3.5; + + diff --git a/mingw-w64-gcc/gcc-make-xmmintrin-header-cplusplus-compatible.patch b/mingw-w64-gcc/gcc-make-xmmintrin-header-cplusplus-compatible.patch new file mode 100644 index 0000000000..c5ca432098 --- /dev/null +++ b/mingw-w64-gcc/gcc-make-xmmintrin-header-cplusplus-compatible.patch @@ -0,0 +1,24 @@ +--- gcc/config/i386/xmmintrin.h.orig 2013-01-18 14:57:27.762645582 +0100 ++++ gcc/config/i386/xmmintrin.h 2013-01-18 14:58:27.604561940 +0100 +@@ -37,6 +37,10 @@ + /* Get _mm_malloc () and _mm_free (). */ + #include + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + /* The Intel API is flexible enough that we must allow aliasing with other + vector types, and their scalar components. */ + typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +@@ -1241,6 +1245,10 @@ + (row3) = __builtin_ia32_movhlps (__t3, __t2); \ + } while (0) + ++#ifdef __cplusplus ++} ++#endif ++ + /* For backward source compatibility. */ + #ifdef __SSE2__ + # include diff --git a/mingw-w64-gmp/PKGBUILD b/mingw-w64-gmp/PKGBUILD new file mode 100644 index 0000000000..c0371d7d59 --- /dev/null +++ b/mingw-w64-gmp/PKGBUILD @@ -0,0 +1,37 @@ +# Maintainer: Alexey Pavlov + +_realname=gmp +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +pkgver=5.1.3 +pkgrel=1 +pkgdesc="A free library for arbitrary precision arithmetic" +arch=('any') +groups=("${_mingw_suff}") +url="http://gmplib.org/" +license=('LGPL3') +source=(ftp://ftp.gmplib.org/pub/gmp-${pkgver}/${_realname}-${pkgver}.tar.xz{,.sig}) +options=('staticlibs') +md5sums=('e5fe367801ff067b923d1e6a126448aa' + 'SKIP') + +build() { + cd "${srcdir}/${_realname}-${pkgver}" + + ./configure --build=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --enable-cxx \ + --enable-static \ + --disable-shared + make +} + +check() { + cd "${srcdir}/${_realname}-${pkgver}" + make check +} + +package() { + cd "${srcdir}/${_realname}-${pkgver}" + make DESTDIR="${pkgdir}" install +} diff --git a/mingw-w64-headers/PKGBUILD b/mingw-w64-headers/PKGBUILD new file mode 100644 index 0000000000..4da97fd76b --- /dev/null +++ b/mingw-w64-headers/PKGBUILD @@ -0,0 +1,57 @@ +# Maintainer: Alexey Pavlov + +pkgname='mingw-w64-headers-svn' +pkgdesc="MinGW-w64 headers for Windows" +_ver_base=4.0.0 +pkgver=4.0.0.6378 +pkgrel=1 +arch=('i686' 'x86_64') +url="http://mingw-w64.sourceforge.net" +license=('custom') +groups=('mingw-w64-toolchain' 'mingw-w64') +depends=() +makedepends=('subversion') +optdepends=() +provides=('mingw-w64-headers') +conflicts=('mingw-w64-headers') +replaces=() +backup=() +options=('!strip' '!libtool' '!emptydirs') +source=("${pkgname}"::'svn+svn://svn.code.sf.net/p/mingw-w64/code/trunk/mingw-w64-headers') +md5sums=(SKIP) + +pkgver() { + cd "$srcdir/$pkgname" + local ver="$(svnversion)" + printf "%s.%s" "${_ver_base}" "${ver//[[:alpha:]]}" +} + +build() { + msg "Configuring ${MINGW_CHOST} headers" + mkdir -p ${srcdir}/headers-${MINGW_CHOST} && cd ${srcdir}/headers-${MINGW_CHOST} + ${srcdir}/${pkgname}/configure \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --enable-sdk=all \ + --enable-secure-api +} + +package() { + msg "Installing ${MINGW_CHOST} headers" + cd ${srcdir}/headers-${MINGW_CHOST} + make DESTDIR=${pkgdir} install + + mkdir -p ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST} + mv ${pkgdir}${MINGW_PREFIX}/include ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/ + + rm ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/include/pthread_signal.h + rm ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/include/pthread_time.h + rm ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/include/pthread_unistd.h + + msg "Installing MinGW-w64 licenses" + install -Dm644 ${srcdir}/${pkgname}/ddk/readme.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/${pkgname}/ddk-readme.txt + install -Dm644 ${srcdir}/${pkgname}/direct-x/COPYING.LIB ${pkgdir}${MINGW_PREFIX}/share/licenses/${pkgname}/direct-x-COPYING.LIB + install -Dm644 ${srcdir}/${pkgname}/direct-x/readme.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/${pkgname}/direct-x-readme.txt +} diff --git a/mingw-w64-isl/PKGBUILD b/mingw-w64-isl/PKGBUILD new file mode 100644 index 0000000000..b7160923dd --- /dev/null +++ b/mingw-w64-isl/PKGBUILD @@ -0,0 +1,45 @@ +# Maintainer: Alexey Pavlov + +_realname=isl +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +pkgver=0.12.1 +pkgrel=1 +pkgdesc="Library for manipulating sets and relations of integer points bounded by linear constraints" +arch=('any') +url="http://freecode.com/projects/isl" +groups=("${_mingw_suff}") +#depends=("${_mingw_suff}-gmp") +makedepends=("${_mingw_suff}-gmp") +options=('staticlibs') +license=('MIT') +source=(http://isl.gforge.inria.fr/${_realname}-${pkgver}.tar.bz2 +#ftp://ftp.linux.student.kuleuven.be/pub/people/skimo/isl/${_realname}-$pkgver.tar.bz2 + isl-0.12.1-no-undefined.patch) +md5sums=('27d381085ff1b5733c3e8a9b6ad24a4d' + 'ca9a6f7dd457cfa1cd33597d23046fe9') + +prepare() { + cd "$srcdir/${_realname}-$pkgver" + patch -p1 -i ${srcdir}/isl-0.12.1-no-undefined.patch +} + +build() { + cd "$srcdir/${_realname}-$pkgver" + ./configure --prefix=${MINGW_PREFIX} \ + --build=${MINGW_CHOST} \ + --enable-static \ + --disable-shared \ + --with-gmp-prefix=${MINGW_PREFIX} + make +} + +check() { + cd "$srcdir/${_realname}-$pkgver" + make check +} + +package() { + cd "${srcdir}/${_realname}-${pkgver}" + make DESTDIR="${pkgdir}" install +} diff --git a/mingw-w64-isl/isl-0.12.1-no-undefined.patch b/mingw-w64-isl/isl-0.12.1-no-undefined.patch new file mode 100644 index 0000000000..7b6a2e468c --- /dev/null +++ b/mingw-w64-isl/isl-0.12.1-no-undefined.patch @@ -0,0 +1,24 @@ +diff -Naur isl-0.12.1-orig/Makefile.am isl-0.12.1/Makefile.am +--- isl-0.12.1-orig/Makefile.am 2013-07-24 15:04:50.000000000 +0400 ++++ isl-0.12.1/Makefile.am 2013-09-02 09:13:41.915039100 +0400 +@@ -155,7 +155,7 @@ + isl_piplib.c + libisl_la_LIBADD = @PIPLIB_LIBS@ @GMP_LIBS@ + libisl_la_LDFLAGS = -version-info @versioninfo@ \ +- @PIPLIB_LDFLAGS@ @GMP_LDFLAGS@ ++ @PIPLIB_LDFLAGS@ @GMP_LDFLAGS@ -no-undefined + libisl_la_CPPFLAGS = $(INCLUDES) @PIPLIB_CPPFLAGS@ @GMP_CPPFLAGS@ + + isl_test_CPPFLAGS = $(INCLUDES) @GMP_CPPFLAGS@ +diff -Naur isl-0.12.1-orig/Makefile.in isl-0.12.1/Makefile.in +--- isl-0.12.1-orig/Makefile.in 2013-07-24 15:05:05.000000000 +0400 ++++ isl-0.12.1/Makefile.in 2013-09-02 09:13:41.868164100 +0400 +@@ -646,7 +646,7 @@ + + libisl_la_LIBADD = @PIPLIB_LIBS@ @GMP_LIBS@ + libisl_la_LDFLAGS = -version-info @versioninfo@ \ +- @PIPLIB_LDFLAGS@ @GMP_LDFLAGS@ ++ @PIPLIB_LDFLAGS@ @GMP_LDFLAGS@ -no-undefined + + libisl_la_CPPFLAGS = $(INCLUDES) @PIPLIB_CPPFLAGS@ @GMP_CPPFLAGS@ + isl_test_CPPFLAGS = $(INCLUDES) @GMP_CPPFLAGS@ diff --git a/mingw-w64-libiconv/PKGBUILD b/mingw-w64-libiconv/PKGBUILD new file mode 100644 index 0000000000..1c4a261e5a --- /dev/null +++ b/mingw-w64-libiconv/PKGBUILD @@ -0,0 +1,37 @@ +# Maintainer: Alexey Pavlov + +_realname=libiconv +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +pkgver=1.14 +pkgrel=1 +pkgdesc='Libiconv is a conversion library' +groups=("${_mingw_suff}") +arch=('any') +url='http://www.gnu.org/software/libiconv/' +license=('LGPL') +source=("http://ftp.gnu.org/pub/gnu/${_realname}/${_realname}-${pkgver}.tar.gz") +md5sums=('e34509b1623cec449dfeb73d7ce9c6c6') +options=('!libtool' 'staticlibs') + +build() { + cd $srcdir/${_realname}-${pkgver} + ./configure --prefix=${MINGW_PREFIX} \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --enable-static \ + --enable-shared + make +} + +check() { + cd ${srcdir}/${_realname}-${pkgver} + make check +} + +package() { + cd ${srcdir}/${_realname}-${pkgver} + make install DESTDIR="${pkgdir}" + rm -f ${pkgdir}${MINGW_PREFIX}/lib/charset.alias +} diff --git a/mingw-w64-mpc/PKGBUILD b/mingw-w64-mpc/PKGBUILD new file mode 100644 index 0000000000..6d37f16089 --- /dev/null +++ b/mingw-w64-mpc/PKGBUILD @@ -0,0 +1,39 @@ +# Maintainer: Alexey Pavlov + +_realname=mpc +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +pkgver=1.0.1 +pkgrel=1 +pkgdesc="Multiple precision complex arithmetic library" +groups=("${_mingw_suff}") +url='http://www.multiprecision.org' +license=('LGPL') +arch=('any') +makedepends=("${_mingw_suff}-gmp>=5.0" "${_mingw_suff}-mpfr") +options=('staticlibs') +source=("http://www.multiprecision.org/mpc/download/${_realname}-${pkgver}.tar.gz") +sha1sums=('8c7e19ad0dd9b3b5cc652273403423d6cf0c5edf') + +options=('!emptydirs') + +build() { + cd "${srcdir}/${_realname}-${pkgver}" + ./configure --build=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --enable-static \ + --disable-shared \ + --with-gmp=${MINGW_PREFIX} \ + --with-mpfr=${MINGW_PREFIX} + make +} + +check() { + cd "${srcdir}/${_realname}-${pkgver}" + make check +} + +package() { + cd "${srcdir}/${_realname}-${pkgver}" + make DESTDIR="${pkgdir}" install +} diff --git a/mingw-w64-mpfr/PKGBUILD b/mingw-w64-mpfr/PKGBUILD new file mode 100644 index 0000000000..f0d5236bf0 --- /dev/null +++ b/mingw-w64-mpfr/PKGBUILD @@ -0,0 +1,47 @@ +# Maintainer: Alexey Pavlov + +_realname=mpfr +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +_pkgver=3.1.2 +_patchlevel=p4 +pkgver=${_pkgver}.${_patchlevel} +pkgrel=1 +pkgdesc="Multiple-precision floating-point library" +arch=('any') +url="http://www.mpfr.org/" +groups=("${_mingw_suff}") +license=('LGPL') +options=('staticlibs') +makedepends=("${_mingw_suff}-gmp>=5.0") +source=(http://www.mpfr.org/mpfr-current/mpfr-${_pkgver}.tar.xz{,.asc} + mpfr-${_pkgver}-${_patchlevel}.patch) +md5sums=('e3d203d188b8fe60bb6578dd3152e05c' + 'SKIP' + '88d56f526326914743428c64ab596382') + +prepare() { + cd "${srcdir}/${_realname}-${_pkgver}" + patch -p1 -i $srcdir/${_realname}-${_pkgver}-${_patchlevel}.patch +} + +build() { + cd "${srcdir}/${_realname}-${_pkgver}" + + ./configure --build=${MINGW_CHOST} \ + --prefix=${MINGW_PREFIX} \ + --enable-static \ + --disable-shared \ + --with-gmp=${MINGW_PREFIX} + make +} + +check() { + cd "${srcdir}/${_realname}-${_pkgver}" + make check +} + +package() { + cd "${srcdir}/${_realname}-${_pkgver}" + make DESTDIR="${pkgdir}" install +} diff --git a/mingw-w64-mpfr/mpfr-3.1.2-p4.patch b/mingw-w64-mpfr/mpfr-3.1.2-p4.patch new file mode 100644 index 0000000000..bf07e11344 --- /dev/null +++ b/mingw-w64-mpfr/mpfr-3.1.2-p4.patch @@ -0,0 +1,863 @@ +diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES +--- mpfr-3.1.2-a/PATCHES 2013-09-26 10:52:52.000000000 +0000 ++++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:52:52.000000000 +0000 +@@ -0,0 +1 @@ ++exp_2 +diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION +--- mpfr-3.1.2-a/VERSION 2013-03-13 15:37:28.000000000 +0000 ++++ mpfr-3.1.2-b/VERSION 2013-09-26 10:52:52.000000000 +0000 +@@ -1 +1 @@ +-3.1.2 ++3.1.2-p1 +diff -Naurd mpfr-3.1.2-a/src/exp_2.c mpfr-3.1.2-b/src/exp_2.c +--- mpfr-3.1.2-a/src/exp_2.c 2013-03-13 15:37:28.000000000 +0000 ++++ mpfr-3.1.2-b/src/exp_2.c 2013-09-26 10:52:52.000000000 +0000 +@@ -204,7 +204,7 @@ + for (k = 0; k < K; k++) + { + mpz_mul (ss, ss, ss); +- exps <<= 1; ++ exps *= 2; + exps += mpz_normalize (ss, ss, q); + } + mpfr_set_z (s, ss, MPFR_RNDN); +diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h +--- mpfr-3.1.2-a/src/mpfr.h 2013-03-13 15:37:37.000000000 +0000 ++++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 +@@ -27,7 +27,7 @@ + #define MPFR_VERSION_MAJOR 3 + #define MPFR_VERSION_MINOR 1 + #define MPFR_VERSION_PATCHLEVEL 2 +-#define MPFR_VERSION_STRING "3.1.2" ++#define MPFR_VERSION_STRING "3.1.2-p1" + + /* Macros dealing with MPFR VERSION */ + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) +diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c +--- mpfr-3.1.2-a/src/version.c 2013-03-13 15:37:34.000000000 +0000 ++++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:52:52.000000000 +0000 +@@ -25,5 +25,5 @@ + const char * + mpfr_get_version (void) + { +- return "3.1.2"; ++ return "3.1.2-p1"; + } +diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES +--- mpfr-3.1.2-a/PATCHES 2013-09-26 10:56:55.000000000 +0000 ++++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:56:55.000000000 +0000 +@@ -0,0 +1 @@ ++fits-smallneg +diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION +--- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000 ++++ mpfr-3.1.2-b/VERSION 2013-09-26 10:56:55.000000000 +0000 +@@ -1 +1 @@ +-3.1.2-p1 ++3.1.2-p2 +diff -Naurd mpfr-3.1.2-a/src/fits_u.h mpfr-3.1.2-b/src/fits_u.h +--- mpfr-3.1.2-a/src/fits_u.h 2013-03-13 15:37:35.000000000 +0000 ++++ mpfr-3.1.2-b/src/fits_u.h 2013-09-26 10:56:55.000000000 +0000 +@@ -32,17 +32,20 @@ + int res; + + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) +- /* Zero always fit */ +- return MPFR_IS_ZERO (f) ? 1 : 0; +- else if (MPFR_IS_NEG (f)) +- /* Negative numbers don't fit */ +- return 0; +- /* now it fits if +- (a) f <= MAXIMUM +- (b) round(f, prec(slong), rnd) <= MAXIMUM */ ++ return MPFR_IS_ZERO (f) ? 1 : 0; /* Zero always fits */ + + e = MPFR_GET_EXP (f); + ++ if (MPFR_IS_NEG (f)) ++ return e >= 1 ? 0 /* f <= -1 does not fit */ ++ : rnd != MPFR_RNDN ? MPFR_IS_LIKE_RNDU (rnd, -1) /* directed mode */ ++ : e < 0 ? 1 /* f > -1/2 fits in MPFR_RNDN */ ++ : mpfr_powerof2_raw(f); /* -1/2 fits, -1 < f < -1/2 don't */ ++ ++ /* Now it fits if ++ (a) f <= MAXIMUM ++ (b) round(f, prec(slong), rnd) <= MAXIMUM */ ++ + /* first compute prec(MAXIMUM); fits in an int */ + for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++); + +diff -Naurd mpfr-3.1.2-a/src/fits_uintmax.c mpfr-3.1.2-b/src/fits_uintmax.c +--- mpfr-3.1.2-a/src/fits_uintmax.c 2013-03-13 15:37:33.000000000 +0000 ++++ mpfr-3.1.2-b/src/fits_uintmax.c 2013-09-26 10:56:55.000000000 +0000 +@@ -27,51 +27,19 @@ + #include "mpfr-intmax.h" + #include "mpfr-impl.h" + +-#ifdef _MPFR_H_HAVE_INTMAX_T +- +-/* We can't use fits_u.h <= mpfr_cmp_ui */ +-int +-mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) +-{ +- mpfr_exp_t e; +- int prec; +- uintmax_t s; +- mpfr_t x; +- int res; +- +- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) +- /* Zero always fit */ +- return MPFR_IS_ZERO (f) ? 1 : 0; +- else if (MPFR_IS_NEG (f)) +- /* Negative numbers don't fit */ +- return 0; +- /* now it fits if +- (a) f <= MAXIMUM +- (b) round(f, prec(slong), rnd) <= MAXIMUM */ +- +- e = MPFR_GET_EXP (f); +- +- /* first compute prec(MAXIMUM); fits in an int */ +- for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++); +- +- /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */ +- +- /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */ +- if (e <= prec - 1) +- return 1; ++/* Note: though mpfr-impl.h is included in fits_u.h, we also include it ++ above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not ++ defined; this is necessary to avoid an empty translation unit, which ++ is forbidden by ISO C. Without this, a failing test can be reproduced ++ by creating an invalid stdint.h somewhere in the default include path ++ and by compiling MPFR with "gcc -ansi -pedantic-errors". */ + +- /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */ +- if (e >= prec + 1) +- return 0; ++#ifdef _MPFR_H_HAVE_INTMAX_T + +- MPFR_ASSERTD (e == prec); ++#define FUNCTION mpfr_fits_uintmax_p ++#define MAXIMUM MPFR_UINTMAX_MAX ++#define TYPE uintmax_t + +- /* hard case: first round to prec bits, then check */ +- mpfr_init2 (x, prec); +- mpfr_set (x, f, rnd); +- res = MPFR_GET_EXP (x) == e; +- mpfr_clear (x); +- return res; +-} ++#include "fits_u.h" + + #endif +diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h +--- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 ++++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:56:55.000000000 +0000 +@@ -27,7 +27,7 @@ + #define MPFR_VERSION_MAJOR 3 + #define MPFR_VERSION_MINOR 1 + #define MPFR_VERSION_PATCHLEVEL 2 +-#define MPFR_VERSION_STRING "3.1.2-p1" ++#define MPFR_VERSION_STRING "3.1.2-p2" + + /* Macros dealing with MPFR VERSION */ + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) +diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c +--- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000 ++++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:56:55.000000000 +0000 +@@ -25,5 +25,5 @@ + const char * + mpfr_get_version (void) + { +- return "3.1.2-p1"; ++ return "3.1.2-p2"; + } +diff -Naurd mpfr-3.1.2-a/tests/tfits.c mpfr-3.1.2-b/tests/tfits.c +--- mpfr-3.1.2-a/tests/tfits.c 2013-03-13 15:37:45.000000000 +0000 ++++ mpfr-3.1.2-b/tests/tfits.c 2013-09-26 10:56:55.000000000 +0000 +@@ -33,155 +33,176 @@ + #include "mpfr-intmax.h" + #include "mpfr-test.h" + +-#define ERROR1 { printf("Initial error for x="); mpfr_dump(x); exit(1); } +-#define ERROR2 { printf("Error for x="); mpfr_dump(x); exit(1); } ++#define ERROR1(N) \ ++ do \ ++ { \ ++ printf("Error %d for rnd = %s and x = ", N, \ ++ mpfr_print_rnd_mode ((mpfr_rnd_t) r)); \ ++ mpfr_dump(x); \ ++ exit(1); \ ++ } \ ++ while (0) + + static void check_intmax (void); + + int + main (void) + { +- mpfr_t x; ++ mpfr_t x, y; ++ int i, r; + + tests_start_mpfr (); + + mpfr_init2 (x, 256); ++ mpfr_init2 (y, 8); + +- /* Check NAN */ +- mpfr_set_nan (x); +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR1; ++ RND_LOOP (r) ++ { + +- /* Check INF */ +- mpfr_set_inf (x, 1); +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR1; ++ /* Check NAN */ ++ mpfr_set_nan (x); ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (1); ++ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (2); ++ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (3); ++ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (4); ++ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (5); ++ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (6); + +- /* Check Zero */ +- MPFR_SET_ZERO (x); +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR2; ++ /* Check INF */ ++ mpfr_set_inf (x, 1); ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (7); ++ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (8); ++ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (9); ++ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (10); ++ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (11); ++ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (12); + +- /* Check small op */ +- mpfr_set_str1 (x, "1@-1"); +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR2; ++ /* Check Zero */ ++ MPFR_SET_ZERO (x); ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (13); ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (14); ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (15); ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (16); ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (17); ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (18); + +- /* Check 17 */ +- mpfr_set_ui (x, 17, MPFR_RNDN); +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR2; ++ /* Check small positive op */ ++ mpfr_set_str1 (x, "1@-1"); ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (19); ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (20); ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (21); ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (22); ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (23); ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (24); + +- /* Check all other values */ +- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); +- mpfr_mul_2exp (x, x, 1, MPFR_RNDN); +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR1; +- mpfr_mul_2exp (x, x, 40, MPFR_RNDN); +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR1; ++ /* Check 17 */ ++ mpfr_set_ui (x, 17, MPFR_RNDN); ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (25); ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (26); ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (27); ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (28); ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (29); ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (30); + +- mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); +- if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); +- if (!mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_set_ui (x, INT_MAX, MPFR_RNDN); +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); +- if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR2; ++ /* Check all other values */ ++ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); ++ mpfr_mul_2exp (x, x, 1, MPFR_RNDN); ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (31); ++ if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (32); ++ mpfr_mul_2exp (x, x, 40, MPFR_RNDN); ++ if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (33); ++ if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (34); ++ if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (35); ++ if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (36); ++ if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (37); + +- mpfr_set_si (x, 1, MPFR_RNDN); +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR2; ++ mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (38); ++ mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (39); ++ mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (40); ++ mpfr_set_ui (x, INT_MAX, MPFR_RNDN); ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (41); ++ mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (42); ++ mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (43); + +- /* Check negative value */ +- mpfr_set_si (x, -1, MPFR_RNDN); +- if (!mpfr_fits_sint_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_slong_p (x, MPFR_RNDN)) +- ERROR2; +- if (mpfr_fits_uint_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_ushort_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_ulong_p (x, MPFR_RNDN)) +- ERROR1; ++ mpfr_set_si (x, 1, MPFR_RNDN); ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (44); ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (45); ++ ++ /* Check negative op */ ++ for (i = 1; i <= 4; i++) ++ { ++ int inv; ++ ++ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); ++ mpfr_rint (y, x, (mpfr_rnd_t) r); ++ inv = MPFR_NOTZERO (y); ++ if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r) ^ inv) ++ ERROR1 (46); ++ if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (47); ++ if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r) ^ inv) ++ ERROR1 (48); ++ if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (49); ++ if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r) ^ inv) ++ ERROR1 (50); ++ if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (51); ++ } ++ } + + mpfr_clear (x); ++ mpfr_clear (y); + + check_intmax (); + +@@ -189,85 +210,98 @@ + return 0; + } + +-static void check_intmax (void) ++static void ++check_intmax (void) + { + #ifdef _MPFR_H_HAVE_INTMAX_T +- mpfr_t x; ++ mpfr_t x, y; ++ int i, r; + +- mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT); ++ mpfr_init2 (x, sizeof (uintmax_t) * CHAR_BIT); ++ mpfr_init2 (y, 8); + +- /* Check NAN */ +- mpfr_set_nan (x); +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR1; ++ RND_LOOP (r) ++ { ++ /* Check NAN */ ++ mpfr_set_nan (x); ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (52); ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (53); + +- /* Check INF */ +- mpfr_set_inf (x, 1); +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR1; ++ /* Check INF */ ++ mpfr_set_inf (x, 1); ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (54); ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (55); + +- /* Check Zero */ +- MPFR_SET_ZERO (x); +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR2; ++ /* Check Zero */ ++ MPFR_SET_ZERO (x); ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (56); ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (57); + +- /* Check small op */ +- mpfr_set_str1 (x, "1@-1"); +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR2; ++ /* Check positive small op */ ++ mpfr_set_str1 (x, "1@-1"); ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (58); ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (59); + +- /* Check 17 */ +- mpfr_set_ui (x, 17, MPFR_RNDN); +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR2; +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR2; ++ /* Check 17 */ ++ mpfr_set_ui (x, 17, MPFR_RNDN); ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (60); ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (61); + +- /* Check hugest */ +- mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR1; +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR1; ++ /* Check hugest */ ++ mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (62); ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (63); + +- /* Check all other values */ +- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); +- mpfr_add_ui (x, x, 1, MPFR_RNDN); +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR1; +- mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); +- if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); +- mpfr_add_ui (x, x, 1, MPFR_RNDN); +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR1; +- mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR2; +- mpfr_sub_ui (x, x, 1, MPFR_RNDN); +- if (mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR1; ++ /* Check all other values */ ++ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); ++ mpfr_add_ui (x, x, 1, MPFR_RNDN); ++ if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (64); ++ mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (65); ++ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); ++ mpfr_add_ui (x, x, 1, MPFR_RNDN); ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (66); ++ mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (67); ++ mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (68); ++ mpfr_sub_ui (x, x, 1, MPFR_RNDN); ++ if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (69); + +- /* Check negative value */ +- mpfr_set_si (x, -1, MPFR_RNDN); +- if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) +- ERROR2; +- if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) +- ERROR1; ++ /* Check negative op */ ++ for (i = 1; i <= 4; i++) ++ { ++ int inv; ++ ++ mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); ++ mpfr_rint (y, x, (mpfr_rnd_t) r); ++ inv = MPFR_NOTZERO (y); ++ if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r) ^ inv) ++ ERROR1 (70); ++ if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) ++ ERROR1 (71); ++ } ++ } + + mpfr_clear (x); ++ mpfr_clear (y); + #endif + } +- +diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES +--- mpfr-3.1.2-a/PATCHES 2013-10-09 13:34:21.000000000 +0000 ++++ mpfr-3.1.2-b/PATCHES 2013-10-09 13:34:21.000000000 +0000 +@@ -0,0 +1 @@ ++clang-divby0 +diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION +--- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000 ++++ mpfr-3.1.2-b/VERSION 2013-10-09 13:34:21.000000000 +0000 +@@ -1 +1 @@ +-3.1.2-p2 ++3.1.2-p3 +diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h +--- mpfr-3.1.2-a/src/mpfr-impl.h 2013-03-13 15:37:36.000000000 +0000 ++++ mpfr-3.1.2-b/src/mpfr-impl.h 2013-10-09 13:34:21.000000000 +0000 +@@ -468,8 +468,16 @@ + #define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1) + + /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0 +- at compile time. */ +-#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200) ++ at compile time. ++ Clang with -fsanitize=undefined is a bit similar due to a bug: ++ http://llvm.org/bugs/show_bug.cgi?id=17381 ++ but even without its sanitizer, it may be better to use the ++ double_zero version until IEEE 754 division by zero is properly ++ supported: ++ http://llvm.org/bugs/show_bug.cgi?id=17000 ++*/ ++#if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \ ++ defined(__clang__) + static double double_zero = 0.0; + # define DBL_NAN (double_zero/double_zero) + # define DBL_POS_INF ((double) 1.0/double_zero) +@@ -501,6 +509,8 @@ + (with Xcode 2.4.1, i.e. the latest one). */ + #define LVALUE(x) (&(x) == &(x) || &(x) != &(x)) + #define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX)) ++/* The DOUBLE_ISNAN(x) macro is also valid on long double x ++ (assuming that the compiler isn't too broken). */ + #ifdef MPFR_NANISNAN + /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations. + The + must not be replaced by a ||. With gcc -ffast-math, NaN is +diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h +--- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 ++++ mpfr-3.1.2-b/src/mpfr.h 2013-10-09 13:34:21.000000000 +0000 +@@ -27,7 +27,7 @@ + #define MPFR_VERSION_MAJOR 3 + #define MPFR_VERSION_MINOR 1 + #define MPFR_VERSION_PATCHLEVEL 2 +-#define MPFR_VERSION_STRING "3.1.2-p2" ++#define MPFR_VERSION_STRING "3.1.2-p3" + + /* Macros dealing with MPFR VERSION */ + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) +diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c +--- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000 ++++ mpfr-3.1.2-b/src/version.c 2013-10-09 13:34:21.000000000 +0000 +@@ -25,5 +25,5 @@ + const char * + mpfr_get_version (void) + { +- return "3.1.2-p2"; ++ return "3.1.2-p3"; + } +diff -Naurd mpfr-3.1.2-a/tests/tget_flt.c mpfr-3.1.2-b/tests/tget_flt.c +--- mpfr-3.1.2-a/tests/tget_flt.c 2013-03-13 15:37:44.000000000 +0000 ++++ mpfr-3.1.2-b/tests/tget_flt.c 2013-10-09 13:34:21.000000000 +0000 +@@ -28,9 +28,17 @@ + main (void) + { + mpfr_t x, y; +- float f, g, infp; ++ float f, g; + int i; ++#if !defined(MPFR_ERRDIVZERO) ++ float infp; ++#endif ++ ++ tests_start_mpfr (); + ++#if !defined(MPFR_ERRDIVZERO) ++ /* The definition of DBL_POS_INF involves a division by 0. This makes ++ "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */ + infp = (float) DBL_POS_INF; + if (infp * 0.5 != infp) + { +@@ -38,8 +46,7 @@ + fprintf (stderr, "(this is probably a compiler bug, please report)\n"); + exit (1); + } +- +- tests_start_mpfr (); ++#endif + + mpfr_init2 (x, 24); + mpfr_init2 (y, 24); +@@ -353,6 +360,7 @@ + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } ++#if !defined(MPFR_ERRDIVZERO) + f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule), + thus we should get +Inf */ + g = infp; +@@ -376,6 +384,7 @@ + printf ("expected %.8e, got %.8e\n", g, f); + exit (1); + } ++#endif + + mpfr_clear (x); + mpfr_clear (y); +diff -Naurd mpfr-3.1.2-a/tests/tset_ld.c mpfr-3.1.2-b/tests/tset_ld.c +--- mpfr-3.1.2-a/tests/tset_ld.c 2013-03-13 15:37:44.000000000 +0000 ++++ mpfr-3.1.2-b/tests/tset_ld.c 2013-10-09 13:34:21.000000000 +0000 +@@ -47,8 +47,11 @@ + static int + Isnan_ld (long double d) + { +- double e = (double) d; +- if (DOUBLE_ISNAN (e)) ++ /* Do not convert d to double as this can give an overflow, which ++ may confuse compilers without IEEE 754 support (such as clang ++ -fsanitize=undefined), or trigger a trap if enabled. ++ The DOUBLE_ISNAN macro should work fine on long double. */ ++ if (DOUBLE_ISNAN (d)) + return 1; + LONGDOUBLE_NAN_ACTION (d, goto yes); + return 0; +diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES +--- mpfr-3.1.2-a/PATCHES 2013-11-15 00:51:49.211333830 +0000 ++++ mpfr-3.1.2-b/PATCHES 2013-11-15 00:51:49.323334999 +0000 +@@ -0,0 +1 @@ ++printf-alt0 +diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION +--- mpfr-3.1.2-a/VERSION 2013-11-15 00:51:49.211333830 +0000 ++++ mpfr-3.1.2-b/VERSION 2013-11-15 00:51:49.323334999 +0000 +@@ -1 +1 @@ +-3.1.2-p3 ++3.1.2-p4 +diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h +--- mpfr-3.1.2-a/src/mpfr.h 2013-11-15 00:51:49.211333830 +0000 ++++ mpfr-3.1.2-b/src/mpfr.h 2013-11-15 00:51:49.323334999 +0000 +@@ -27,7 +27,7 @@ + #define MPFR_VERSION_MAJOR 3 + #define MPFR_VERSION_MINOR 1 + #define MPFR_VERSION_PATCHLEVEL 2 +-#define MPFR_VERSION_STRING "3.1.2-p3" ++#define MPFR_VERSION_STRING "3.1.2-p4" + + /* Macros dealing with MPFR VERSION */ + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) +diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c +--- mpfr-3.1.2-a/src/vasprintf.c 2013-03-13 15:37:37.000000000 +0000 ++++ mpfr-3.1.2-b/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000 +@@ -1040,7 +1040,7 @@ + } + + /* Determine the different parts of the string representation of the regular +- number P when SPEC.SPEC is 'e', 'E', 'g', or 'G'. ++ number P when spec.spec is 'e', 'E', 'g', or 'G'. + DEC_INFO contains the previously computed exponent and string or is NULL. + + return -1 if some field > INT_MAX */ +@@ -1167,7 +1167,7 @@ + } + + /* Determine the different parts of the string representation of the regular +- number P when SPEC.SPEC is 'f', 'F', 'g', or 'G'. ++ number P when spec.spec is 'f', 'F', 'g', or 'G'. + DEC_INFO contains the previously computed exponent and string or is NULL. + + return -1 if some field of number_parts is greater than INT_MAX */ +@@ -1559,7 +1559,7 @@ + /* fractional part */ + { + np->point = MPFR_DECIMAL_POINT; +- np->fp_trailing_zeros = (spec.spec == 'g' && spec.spec == 'G') ? ++ np->fp_trailing_zeros = (spec.spec == 'g' || spec.spec == 'G') ? + spec.prec - 1 : spec.prec; + } + else if (spec.alt) +diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c +--- mpfr-3.1.2-a/src/version.c 2013-11-15 00:51:49.211333830 +0000 ++++ mpfr-3.1.2-b/src/version.c 2013-11-15 00:51:49.323334999 +0000 +@@ -25,5 +25,5 @@ + const char * + mpfr_get_version (void) + { +- return "3.1.2-p3"; ++ return "3.1.2-p4"; + } +diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c +--- mpfr-3.1.2-a/tests/tsprintf.c 2013-03-13 15:37:44.000000000 +0000 ++++ mpfr-3.1.2-b/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000 +@@ -456,10 +456,16 @@ + check_sprintf ("1.999900 ", "%-#10.7RG", x); + check_sprintf ("1.9999 ", "%-10.7RG", x); + mpfr_set_ui (x, 1, MPFR_RNDN); ++ check_sprintf ("1.", "%#.1Rg", x); ++ check_sprintf ("1. ", "%-#5.1Rg", x); ++ check_sprintf (" 1.0", "%#5.2Rg", x); + check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x); + check_sprintf ("1", "%.30Rg", x); + mpfr_set_ui (x, 0, MPFR_RNDN); +- check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x); ++ check_sprintf ("0.", "%#.1Rg", x); ++ check_sprintf ("0. ", "%-#5.1Rg", x); ++ check_sprintf (" 0.0", "%#5.2Rg", x); ++ check_sprintf ("0.00000000000000000000000000000", "%#.30Rg", x); + check_sprintf ("0", "%.30Rg", x); + + /* following tests with precision 53 bits */ diff --git a/mingw-w64-winpthreads/PKGBUILD b/mingw-w64-winpthreads/PKGBUILD new file mode 100644 index 0000000000..9244642bcf --- /dev/null +++ b/mingw-w64-winpthreads/PKGBUILD @@ -0,0 +1,56 @@ +# Maintainer: Alexey Pavlov + +_realname=winpthreads +_mingw_suff=mingw-w64-${CARCH} +pkgname="${_mingw_suff}-${_realname}-svn" +_ver_base=4.0.0 +pkgver=4.0.0.6379 +pkgrel=1 +pkgdesc="MinGW-w64 winpthreads library" +arch=('any') +url="http://mingw-w64.sourceforge.net" +license=('custom') +groups=("${_mingw_suff}-toolchain" "${_mingw_suff}") +makedepends=("subversion" "${_mingw_suff}-gcc" "${_mingw_suff}-binutils" "${_mingw_suff}-crt-svn" "${_mingw_suff}-headers-svn") +provides=("${_mingw_suff}-${_realname}") +conflicts=("${_mingw_suff}-${_realname}") +depends=("${_mingw_suff}-crt-svn") +optdepends=() +backup=() +options=('!strip' '!buildflags' 'staticlibs' '!emptydirs') +source=("${_realname}"::"svn+svn://svn.code.sf.net/p/mingw-w64/code/trunk/mingw-w64-libraries/winpthreads") +md5sums=(SKIP) + +pkgver() { + cd "${srcdir}/${_realname}" + local ver="$(svnversion)" + printf "%s.%s" "${_ver_base}" "${ver//[[:alpha:]]}" +} + +build() { + mkdir -p ${srcdir}/winpthreads-build-${MINGW_CHOST} && cd ${srcdir}/winpthreads-build-${MINGW_CHOST} + ${srcdir}/${_realname}/configure \ + --prefix=${MINGW_PREFIX} \ + --build=${MINGW_CHOST} \ + --host=${MINGW_CHOST} \ + --target=${MINGW_CHOST} \ + --enable-static \ + --enable-shared + make +} + +setup() { + cd ${srcdir}/winpthreads-build-${MINGW_CHOST} + make DESTDIR=${destdir} install +} + +package() { + cd ${srcdir}/winpthreads-build-${MINGW_CHOST} + make DESTDIR=${pkgdir} install + + mkdir -p ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST} + mv ${pkgdir}${MINGW_PREFIX}/include ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/ + mv ${pkgdir}${MINGW_PREFIX}/lib ${pkgdir}${MINGW_PREFIX}/${MINGW_CHOST}/ + + install -Dm644 ${srcdir}/${_realname}/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING +} diff --git a/mingw-w64-zlib/01-zlib-1.2.7-1-buildsys.mingw.patch b/mingw-w64-zlib/01-zlib-1.2.7-1-buildsys.mingw.patch new file mode 100644 index 0000000000..9513ef1e0e --- /dev/null +++ b/mingw-w64-zlib/01-zlib-1.2.7-1-buildsys.mingw.patch @@ -0,0 +1,307 @@ +--- origsrc/zlib-1.2.7/Makefile.in 2012-04-29 21:20:44.000000000 -0400 ++++ src/zlib-1.2.7/Makefile.in 2012-05-02 17:29:54.596560300 -0400 +@@ -34,6 +34,9 @@ STATICLIB=libz.a + SHAREDLIB=libz.so + SHAREDLIBV=libz.so.1.2.7 + SHAREDLIBM=libz.so.1 ++IMPORTLIB= ++SHAREDLIBPOST='(rm -f $(SHAREDLIB) $(SHAREDLIBM); ln -s $@ $(SHAREDLIB) ; ln -s $@ $(SHAREDLIBM) )' ++SHAREDTARGET=$(SHAREDLIBV) + LIBS=$(STATICLIB) $(SHAREDLIBV) + + AR=ar +@@ -48,7 +51,7 @@ + prefix = /usr/local + exec_prefix = ${prefix} + libdir = ${exec_prefix}/lib +-sharedlibdir = ${libdir} ++sharedlibdir = ${exec_prefix}/bin + includedir = ${prefix}/include + mandir = ${prefix}/share/man + man3dir = ${mandir}/man3 +@@ -114,17 +117,17 @@ test64: all64 + rm -f $$TMP64 + + infcover.o: test/infcover.c zlib.h zconf.h +- $(CC) $(CFLAGS) -I. -c -o $@ test/infcover.c ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I. -c -o $@ test/infcover.c + + infcover: infcover.o libz.a +- $(CC) $(CFLAGS) -o $@ infcover.o libz.a ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ infcover.o libz.a + + cover: infcover + rm -f *.gcda + ./infcover + gcov inf*.c + +-libz.a: $(OBJS) ++$(STATICLIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 + +@@ -141,48 +144,49 @@ match.lo: match.S + rm -f _match.s + + example.o: test/example.c zlib.h zconf.h +- $(CC) $(CFLAGS) -I. -c -o $@ test/example.c ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I. -c -o $@ test/example.c + + minigzip.o: test/minigzip.c zlib.h zconf.h +- $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I. -c -o $@ test/minigzip.c + + example64.o: test/example.c zlib.h zconf.h +- $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/example.c ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/example.c + + minigzip64.o: test/minigzip.c zlib.h zconf.h +- $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/minigzip.c ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/minigzip.c + + .SUFFIXES: .lo + ++.c.o: ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $*.o $< ++ + .c.lo: + -@mkdir objs 2>/dev/null || test -d objs +- $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $< ++ $(CC) $(SFLAGS) $(EXTRA_CFLAGS) -DPIC -c -o objs/$*.o $< + -@mv objs/$*.o $@ + +-placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a +- $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) +- rm -f $(SHAREDLIB) $(SHAREDLIBM) +- ln -s $@ $(SHAREDLIB) +- ln -s $@ $(SHAREDLIBM) ++placebo $(SHAREDTARGET): $(PIC_OBJS) $(STATICLIB) ++ $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) $(EXTRA_LDFLAGS) ++ $(SHAREDLIBPOST) + -@rmdir objs + + example$(EXE): example.o $(STATICLIB) +- $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ example.o $(TEST_LDFLAGS) $(EXTRA_LDFLAGS) + + minigzip$(EXE): minigzip.o $(STATICLIB) +- $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) $(EXTRA_LDFLAGS) + +-examplesh$(EXE): example.o $(SHAREDLIBV) +- $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV) ++examplesh$(EXE): example.o $(SHAREDTARGET) ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ example.o -L. $(SHAREDTARGET) + +-minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) +- $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV) ++minigzipsh$(EXE): minigzip.o $(SHAREDTARGET) ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ minigzip.o -L. $(SHAREDTARGET) + + example64$(EXE): example64.o $(STATICLIB) +- $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) $(EXTRA_LDFLAGS) + + minigzip64$(EXE): minigzip64.o $(STATICLIB) +- $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) ++ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) $(EXTRA_LDFLAGS) + + install-libs: $(LIBS) + -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi +@@ -190,18 +194,34 @@ install-libs: $(LIBS) + -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi + -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi + -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi +- cp $(STATICLIB) $(DESTDIR)$(libdir) +- chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB) +- -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1 +- -@if test -n "$(SHAREDLIBV)"; then \ +- cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \ +- echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \ +- chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \ +- echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \ +- rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ +- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \ +- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ +- ($(LDCONFIG) || true) >/dev/null 2>&1; \ ++ cp $(STATICLIB) $(DESTDIR)$(libdir) ++ -@(chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)) ++ -@($(RANLIB) $(DESTDIR)$(libdir)/$(STATICLIB) || true) >/dev/null 2>&1 ++ -@if test -n "$(IMPORTLIB)" ; then \ ++ cp $(IMPORTLIB) $(DESTDIR)$(libdir); \ ++ echo "cp $(IMPORTLIB) $(DESTDIR)$(libdir)"; \ ++ chmod 644 $(DESTDIR)$(libdir)/$(IMPORTLIB); \ ++ if test -n "$(SHAREDTARGET)" ; then \ ++ if test -f "$(SHAREDTARGET)" ; then \ ++ cp $(SHAREDTARGET) $(DESTDIR)$(sharedlibdir); \ ++ echo "cp $(SHAREDTARGET) $(DESTDIR)$(sharedlibdir)"; \ ++ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET); \ ++ echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET)"; \ ++ fi; \ ++ fi; \ ++ if test -n "$(SHAREDLIBV)"; then \ ++ if test -f "$(SHAREDLIBV)"; then \ ++ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ ++ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \ ++ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \ ++ ($(LDCONFIG) || true) >/dev/null 2>&1; \ ++ fi; \ ++ fi; \ ++ else \ ++ cp $(SHAREDTARGET) $(DESTDIR)$(sharedlibdir); \ ++ echo "cp $(SHAREDTARGET) $(DESTDIR)$(sharedlibdir)"; \ ++ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET); \ ++ echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET)"; \ + fi + cp zlib.3 $(DESTDIR)$(man3dir) + chmod 644 $(DESTDIR)$(man3dir)/zlib.3 +@@ -234,12 +234,13 @@ + + uninstall: + cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h +- cd $(DESTDIR)$(libdir) && rm -f libz.a; \ ++ cd $(DESTDIR)$(libdir) && rm -f $(STATCILIB) $(IMPORTLIB); \ + if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \ + rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ + fi + cd $(DESTDIR)$(man3dir) && rm -f zlib.3 + cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc ++ cd $(DESTDIR)$(sharedlibdir) && (rm -f $(SHAREDTARGET) || true) > /dev/null 2>&1 + + docs: zlib.3.pdf + +@@ -245,6 +263,7 @@ clean: + example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \ + example64$(EXE) minigzip64$(EXE) \ + infcover \ ++ $(STATICLIB) $(IMPORTLIB) $(SHAREDTARGET) $(SHAREDLIBV) $(SHAREDLIBV) $(SHAREDLIBM) \ + libz.* foo.gz so_locations \ + _match.s maketree contrib/infback9/*.o + rm -rf objs +--- origsrc/zlib-1.2.7/configure 2012-04-29 21:20:44.000000000 -0400 ++++ src/zlib-1.2.7/configure 2012-05-02 15:23:56.810267500 -0400 +@@ -26,6 +26,7 @@ fi + + # destination name for static library + STATICLIB=libz.a ++IMPORTLIB= + + # extract zlib version numbers from zlib.h + VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` +@@ -63,7 +63,7 @@ + prefix=${prefix-/usr/local} + exec_prefix=${exec_prefix-'${prefix}'} + libdir=${libdir-'${exec_prefix}/lib'} +-sharedlibdir=${sharedlibdir-'${libdir}'} ++sharedlibdir=${sharedlibdir-'${exec_prefix}/bin'} + includedir=${includedir-'${prefix}/include'} + mandir=${mandir-'${prefix}/share/man'} + shared_ext='.so' +@@ -74,6 +75,7 @@ build64=0 + gcc=0 + old_cc="$CC" + old_cflags="$CFLAGS" ++old_ldflags="$LDFLAGS" + OBJC='$(OBJZ) $(OBJG)' + PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' + +@@ -191,14 +191,24 @@ + LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} + LDCONFIG="ldconfig -m" ;; + CYGWIN* | Cygwin* | cygwin* | OS/2*) ++ CFLAGS="${CFLAGS} -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64" ++ SFLAGS="${CFLAGS}" ++ LDFLAGS="-L. ${old_ldflags}" ++ shared_ext=".dll" ++ SHAREDLIB='cygz.dll' ++ IMPORTLIB='libz.dll.a' ++ LDSHARED=${LDSHARED-"$cc -shared -Wl,-export-all -Wl,--enable-auto-image-base -Wl,--out-implib=${IMPORTLIB}"} ++ LDSHAREDLIBC='' + EXE='.exe' ;; + MINGW* | mingw*) + # temporary bypass +- rm -f $test.[co] $test $test$shared_ext +- echo "Please use win32/Makefile.gcc instead." | tee -a configure.log +- leave 1 +- LDSHARED=${LDSHARED-"$cc -shared"} +- LDSHAREDLIBC="" ++ SFLAGS="${CFLAGS}" ++ LDFLAGS="-L. ${old_ldflags}" ++ shared_ext=".dll" ++ SHAREDLIB='zlib1.dll' ++ IMPORTLIB='libz.dll.a' ++ LDSHARED=${LDSHARED-"$cc -shared -Wl,-export-all -Wl,--enable-auto-image-base -Wl,--out-implib=${IMPORTLIB}"} ++ LDSHAREDLIBC='' + EXE='.exe' ;; + QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 + # (alain.bonnefoy@icbt.com) +@@ -319,11 +329,32 @@ + esac + fi + ++case "$uname" in ++ *CYGWIN* | *Cygwin* | *cygwin* ) ++ # On cygwin, we always build both shared and static libs ++ ALL="static shared" ++ SHAREDLIBPOST='/bin/true' ++ SHAREDTARGET=${SHAREDLIB} ++ TEST="all teststatic testshared" ++ ;; ++ *MINGW* | *Mingw* | *mingw* ) ++ # On Mingw, we always build both shared and static libs ++ ALL="static shared" ++ SHAREDLIBPOST='/bin/true' ++ SHAREDTARGET=${SHAREDLIB} ++ TEST="all teststatic testshared" ++ ;; ++ *) ++ + # destination names for shared library if not defined above + SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} + SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} + SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} +- ++SHAREDLIBPOST='(rm -f $(SHAREDLIB) $(SHAREDLIBM); ln -s $@ $(SHAREDLIB) ; ln -s $@ $(SHAREDLIBM) )' ++SHAREDTARGET='$(SHAREDLIBV)' ++ ;; ++esac ++ + echo >> configure.log + + # define functions for testing compiler and library characteristics and logging the results +@@ -748,6 +780,9 @@ echo SHAREDLIB = $SHAREDLIB >> configure + echo SHAREDLIBM = $SHAREDLIBM >> configure.log + echo SHAREDLIBV = $SHAREDLIBV >> configure.log + echo STATICLIB = $STATICLIB >> configure.log ++echo IMPORTLIB = $IMPORTLIB >> configure.log ++echo SHAREDLIBPOST = $SHAREDLIBPOST >> configure.log ++echo SHAREDTARGET = $SHAREDTARGET >> configure.log + echo TEST = $TEST >> configure.log + echo VER = $VER >> configure.log + echo Z_U4 = $Z_U4 >> configure.log +@@ -771,9 +806,12 @@ sed < Makefile.in " + /^LDSHARED *=/s#=.*#=$LDSHARED# + /^CPP *=/s#=.*#=$CPP# + /^STATICLIB *=/s#=.*#=$STATICLIB# ++/^IMPORTLIB *=/s#=.*#=$IMPORTLIB# + /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# + /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# + /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# ++/^SHAREDLIBPOST *=/s#=.*#=$SHAREDLIBPOST# ++/^SHAREDTARGET *=/s#=.*#=$SHAREDTARGET# + /^AR *=/s#=.*#=$AR# + /^ARFLAGS *=/s#=.*#=$ARFLAGS# + /^RANLIB *=/s#=.*#=$RANLIB# +@@ -799,9 +837,12 @@ sed < zlib.pc.in " + /^CPP *=/s#=.*#=$CPP# + /^LDSHARED *=/s#=.*#=$LDSHARED# + /^STATICLIB *=/s#=.*#=$STATICLIB# ++/^IMPORTLIB *=/s#=.*#=$IMPORTLIB# + /^SHAREDLIB *=/s#=.*#=$SHAREDLIB# + /^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# + /^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# ++/^SHAREDLIBPOST *=/s#=.*#=$SHAREDLIBPOST# ++/^SHAREDTARGET *=/s#=.*#=$SHAREDTARGET# + /^AR *=/s#=.*#=$AR# + /^ARFLAGS *=/s#=.*#=$ARFLAGS# + /^RANLIB *=/s#=.*#=$RANLIB# diff --git a/mingw-w64-zlib/02-no-undefined.mingw.patch b/mingw-w64-zlib/02-no-undefined.mingw.patch new file mode 100644 index 0000000000..d28e31d4b2 --- /dev/null +++ b/mingw-w64-zlib/02-no-undefined.mingw.patch @@ -0,0 +1,11 @@ +--- a/zlib-1.2.7/contrib/minizip/Makefile.am.orig 2013-03-31 04:43:24 +0400 ++++ b/zlib-1.2.7/contrib/minizip/Makefile.am 2013-03-31 04:45:10 +0400 +@@ -8,7 +8,7 @@ + zlib_top_builddir = $(top_builddir)/../.. + + AM_CPPFLAGS = -I$(zlib_top_srcdir) +-AM_LDFLAGS = -L$(zlib_top_builddir) ++AM_LDFLAGS = -L$(zlib_top_builddir) -no-undefined + + if WIN32 + iowin32_src = iowin32.c diff --git a/mingw-w64-zlib/03-dont-put-sodir-into-L.mingw.patch b/mingw-w64-zlib/03-dont-put-sodir-into-L.mingw.patch new file mode 100644 index 0000000000..a901295a74 --- /dev/null +++ b/mingw-w64-zlib/03-dont-put-sodir-into-L.mingw.patch @@ -0,0 +1,9 @@ +--- a/zlib-1.2.7/zlib.pc.in.orig 2013-03-31 22:30:40 +0400 ++++ b/zlib-1.2.7/zlib.pc.in 2013-04-03 02:06:26 +0400 +@@ -9,5 +9,5 @@ + Version: @VERSION@ + + Requires: +-Libs: -L${libdir} -L${sharedlibdir} -lz ++Libs: -L${libdir} -lz + Cflags: -I${includedir} diff --git a/mingw-w64-zlib/04-wrong-w8-check.mingw.patch b/mingw-w64-zlib/04-wrong-w8-check.mingw.patch new file mode 100644 index 0000000000..d01aadc9e8 --- /dev/null +++ b/mingw-w64-zlib/04-wrong-w8-check.mingw.patch @@ -0,0 +1,15 @@ +--- a/zlib-1.2.8/contrib/minizip/iowin32.c.orig 2013-04-28 22:57:11.000000000 +0000 ++++ b/zlib-1.2.8/contrib/minizip/iowin32.c 2013-06-15 20:07:42.136103400 +0000 +@@ -26,11 +26,9 @@ + #endif + + +-#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) +-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) ++#if _WIN32_WINNT >= 0x0602 + #define IOWIN32_USING_WINRT_API 1 + #endif +-#endif + + voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode)); + uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); diff --git a/mingw-w64-zlib/05-fix-a-typo.mingw.patch b/mingw-w64-zlib/05-fix-a-typo.mingw.patch new file mode 100644 index 0000000000..20943f21da --- /dev/null +++ b/mingw-w64-zlib/05-fix-a-typo.mingw.patch @@ -0,0 +1,20 @@ +--- a/zlib-1.2.8/contrib/minizip/iowin32.c.orig 2013-06-16 05:56:52.023969100 +0000 ++++ b/zlib-1.2.8/contrib/minizip/iowin32.c 2013-06-16 08:27:31.931891600 +0000 +@@ -241,7 +241,7 @@ + return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod); + #else + LONG lHigh = pos.HighPart; +- DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, FILE_CURRENT); ++ DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod); + BOOL fOk = TRUE; + if (dwNewPos == 0xFFFFFFFF) + if (GetLastError() != NO_ERROR) +@@ -368,7 +368,7 @@ + { + LARGE_INTEGER pos; + pos.QuadPart = offset; +- if (!MySetFilePointerEx(hFile, pos, NULL, FILE_CURRENT)) ++ if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod)) + { + DWORD dwErr = GetLastError(); + ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr; diff --git a/mingw-w64-zlib/PKGBUILD b/mingw-w64-zlib/PKGBUILD new file mode 100644 index 0000000000..f360ece285 --- /dev/null +++ b/mingw-w64-zlib/PKGBUILD @@ -0,0 +1,53 @@ +# Maintainer: Alexey Pavlov + +_realname=zlib +_mingw_suff=mingw-w64-${CARCH} +pkgname=("${_mingw_suff}-${_realname}") +pkgver=1.2.8 +pkgrel=1 +pkgdesc="Compression library implementing the deflate compression method found in gzip and PKZIP" +arch=('any') +groups=("${_mingw_suff}") +license=('custom') +url="http://www.zlib.net/" +depends=('') +options=('staticlibs') +source=("http://zlib.net/current/${_realname}-${pkgver}.tar.gz" + 01-zlib-1.2.7-1-buildsys.mingw.patch + 02-no-undefined.mingw.patch + 03-dont-put-sodir-into-L.mingw.patch + 04-wrong-w8-check.mingw.patch + 05-fix-a-typo.mingw.patch) +md5sums=('44d667c142d7cda120332623eab69f40' + '63affd37e371768c6adc6e6561e66daf' + 'cf7e49f23103a7e42c2dee113ea29674' + 'bb6c8eeb7f03978982406bca35f62ca3' + '94f53bd0a4a4068bcedc195004e70316' + '076b81ef097c6916cb81daa3ba8c3afa') + +prepare() { + cd ${srcdir}/${_realname}-${pkgver} + grep -A 24 '^ Copyright' zlib.h > LICENSE + + patch -p2 -i ${srcdir}/01-zlib-1.2.7-1-buildsys.mingw.patch + patch -p2 -i ${srcdir}/02-no-undefined.mingw.patch + patch -p2 -i ${srcdir}/03-dont-put-sodir-into-L.mingw.patch + patch -p2 -i ${srcdir}/04-wrong-w8-check.mingw.patch + patch -p2 -i ${srcdir}/05-fix-a-typo.mingw.patch +} + +build() { + cd ${srcdir}/${_realname}-${pkgver} + CHOST=${MINGW_CHOST} ./configure --prefix=${MINGW_PREFIX} --shared + make all +} + +check() { + cd ${srcdir}/${_realname}-${pkgver} + make test +} + +package() { + cd ${srcdir}/${_realname}-${pkgver} + make install DESTDIR="${pkgdir}" +}