summaryrefslogtreecommitdiff
path: root/dev-util/mingw-runtime
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-util/mingw-runtime
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-util/mingw-runtime')
-rw-r--r--dev-util/mingw-runtime/Manifest13
-rw-r--r--dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch27
-rw-r--r--dev-util/mingw-runtime/files/mingw-runtime-3.20-LDBL_MIN_EXP.patch145
-rw-r--r--dev-util/mingw-runtime/metadata.xml11
-rw-r--r--dev-util/mingw-runtime/mingw-runtime-3.18.ebuild75
-rw-r--r--dev-util/mingw-runtime/mingw-runtime-3.20.2.ebuild78
-rw-r--r--dev-util/mingw-runtime/mingw-runtime-3.20.ebuild76
-rw-r--r--dev-util/mingw-runtime/mingw-runtime-4.0.3.1.ebuild83
8 files changed, 508 insertions, 0 deletions
diff --git a/dev-util/mingw-runtime/Manifest b/dev-util/mingw-runtime/Manifest
new file mode 100644
index 000000000000..c403f81b6e76
--- /dev/null
+++ b/dev-util/mingw-runtime/Manifest
@@ -0,0 +1,13 @@
+AUX mingw-runtime-3.18-gcc-4.6.patch 861 SHA256 5106cdb8a450ca152dbff873f5165b6ec3c5fc595fc340cda47ee6f350b975e1 SHA512 696469f42f03f79219d946ea046aa2cf419f3abd6664db60b477a3ea474a652f42521ab039f4e4ccbd2d0c15d6816d54b4ac3551fbea3d5539dfcda71e17139d WHIRLPOOL 3049e9cfb74299b54c932e375a16b0b63cfda1f7686cab292900efd12c78e57d1b8d6f8828a25a9be6a02af3133e0256017a9dbd49adc155ccadacaa406189b2
+AUX mingw-runtime-3.20-LDBL_MIN_EXP.patch 5806 SHA256 16eab6a941eb6dc820dda592d8a80e94d4eccaa2cfd666213d5e894e187cd4ed SHA512 2013860ca92e5eeeaf94b5b78882a453d2f3312a51b6d8b37665e9d1f70aa80364355b5d3cb60a561adc6f2fb0001de41069548d715ffeb65793cdcc6c4b97ea WHIRLPOOL 8f21eaedb8203c20fafda4b76e0bae3ad8e08b13ca88572fe76de9350b7827d4c7a00b10223dd982f37219cb72d80080f4665be6cb0e842c02730a93e046ccd2
+DIST mingwrt-3.18-mingw32-src.tar.gz 391939 SHA256 de4979fd6eedeb21d2d506fe4880a838706dc88cbebe031e38561967fb7cbd42 SHA512 87778f08469a806dda606b0945d00511fccd0f7e0d545a33e2b4685db2490ec6a3e5e4267090b79a88eb963f97035fe8149097892f1f4a6e85f3a4661eb5e977 WHIRLPOOL c8883fcb3a4d04e9bf28e8ee15c9d5eb1fea62d7d3aed1dcfd4ae90f7186468296dc67dcd27f2e11b4af762e0fd833749a0065f4744992295c45a881aa58817a
+DIST mingwrt-3.20-2-mingw32-src.tar.lzma 302072 SHA256 398d300407861dda1d11cc5e2a4e44a1798503f364169459633020ea224a987c SHA512 ffb8e3d46a4646b236b67df0d9d21571a0ee8b78125989d506c176e03922e520201770a03093f27789f0e4373bf64f69d41e377d861ddd008b5e29da65fb1d55 WHIRLPOOL 46efda9e299fb29d538b4bb3aba9743f141e96bb60b15c62668a0b565bb84825d5a0e6accc97dafba5ec51dac904c917d6cea7c1e48676050be8ef3b7744c2e7
+DIST mingwrt-3.20-mingw32-src.tar.gz 393946 SHA256 f1869483318ed1df5e15e49b8315173e90c1caa2968c4956b7657854c36bfe0a SHA512 2d2d3c7decc7b35ab4759034dcd291c8e322a46205ae70fd4c4d68224c9d7c75454b908f61ba8ca7e0fdf18ff121c5b7ffd02e0658b7557e3af1f89ed28ed58c WHIRLPOOL c66a805cdd4500f142e0d38cd3add06046608addba67e1c0167d96dc4838eacd938c6d38c5d423ab7dd6344070445df5105eeac9bbe3529ca528d02c3f31bad3
+DIST mingwrt-4.0.3-1-mingw32-src.tar.lzma 1341612 SHA256 409be571382cad83a7304d37e13c620aa98757014b0107efe7e2895a1feafcc2 SHA512 2aa429f939038c86441ccfd32b4ddd40347582557f9427df92ea7454eb5bf743b8e1aafbb627b527be755976be807f415aad3920f700d93aa86d07bf40f12bde WHIRLPOOL 12be2c230370ff794a79635d8f12861f022f2551ff7d009882df6c358dd2bbaf1ae16e2944136055948a44b5f187893f9bedacdc49122570324cb726f38addd2
+EBUILD mingw-runtime-3.18.ebuild 1781 SHA256 181409f03132efb652aa9d9abed29ac837a49971c418f53400b70081eb162f5e SHA512 17d45119f34f9701f7aa9e46a024fd5a5f211f16e2c7565911b8c0f74f32ec399ed38e3e64190d17bc656894a6d0c17b510d4b828747762c9feaeac31b62c01d WHIRLPOOL 46999b30f2eb079340b3b32d74fb4612c9a827c5f98379942ac59d26d874f29931132b9201c50f22432a42852a66f7279c9ab1ae15322efe78241a5f8f6ab72c
+EBUILD mingw-runtime-3.20.2.ebuild 1933 SHA256 a548d0f340f4140e6495b1db35140121767d865b2719ef109714fa00e820a382 SHA512 e234e784d8c8c0c8683a2479cf7a5e5dbc8b7f54265f3d95ba178954c929788cee50b80e5e5f14051e8ec2fd5ac5ac30d3ebedb763fac4d36a35a5009ae2798f WHIRLPOOL 12bb82b06860a5347515d69332d0b599ca7df778f38eb34236d8492f17258f7f9d9930d2909f8827487498c99f2bd3aa8c2998e9629834cf86a483976d477bff
+EBUILD mingw-runtime-3.20.ebuild 1861 SHA256 3704201d074bbafb1fdcf3d242c4b5f7e823221c35797569513fd321b06fe1c7 SHA512 324ee8e82c4ad2a8590274100249983d1bd3650800d0b32bc14a9fe7e4fa7efd6b2b32bf710d7a593b886cf784806e951969f99a8a229b9fce1ba383bf9eac51 WHIRLPOOL 3899803948ad63f2d183fb369021941aff0d7aee0b0756cce68102cb6a03075feefd2871e1e6bd83ba1189e8d2d625a21f51c9eb2ca30e3d393048a516d351fb
+EBUILD mingw-runtime-4.0.3.1.ebuild 1922 SHA256 ae830baeada533c0ea45152f87bb0cae8916a79cf318677df9d5181a95d97d34 SHA512 c391f7d5da2530f9d7e8394427a48c0efefbbbdeebc135949894863617c91c76ef846fc289b6b2c0ce62d6576601db80b31f4c2ce4465e356ea8bfedaa223f15 WHIRLPOOL ebb12c06495bcad40a693825b6ed4277b1344f79e34ad7afa47365f62833535cf3287a6c6af8a971ac43f4572856eaf67d2b6d2cc1f31955c53a6ac6949e3417
+MISC ChangeLog 3042 SHA256 fe7cbf0a33077c102adea5b73bf308972f83c1d51e7d029a3ff247db82c9ad0e SHA512 645bb20ed6a4998416fb52cd2ce27c1ae258be8b838de6bb3694ebcd6ca2a594346f3a58637b3dbeb7e3875d9bedb4d3a2beecc2ac60d5f0384e054208522ea1 WHIRLPOOL 45cd1b219b0a722d1f39761be130b3ddba8d1ecd69d0a98c56d0510b259b0f500c8bc8095c4e7f49f8ce68bbf098ffebd3871e963e1a46a69a9ac1be10476b58
+MISC ChangeLog-2015 4923 SHA256 3cb31c87e4f16d8e3488b0386e2eb110d40e2c7a03e5834552c3d2e0b7bb99b4 SHA512 7d21bb219d1503533c22b6c7ac895755d2e322ba3c29ea1489682ef0c9f0d4faf399c470b99f7667cb2c6da0fc487799c410612a2d31316e457777bac761349e WHIRLPOOL 147f103b47a41c6f22ef93f1ac27a3f9b2bff003716f60fad010f2c2c9831f7e33c0c22b001ca450928ca90b1b70315b2ce54668d2e0b69d34f3b68eb27a43b9
+MISC metadata.xml 336 SHA256 a0331895152c717fa18ca5b1dcfe6e508c1a658c70f7302ae94b35126eab361b SHA512 c15c4f7fe2796147558f99a89942b216159b291e18dfb02358f0985fef55e7ce166dbd0831ef24938a5bc76377634036932e0ce1526d01c2b07be35cac17cbf9 WHIRLPOOL 1243f7c570849051d8b915f29664c42cb68d91debad0496179187dff896f677e9a6bd560c8d9aa75e3ab8c5254843825c55d4b5b2abc620cc56135a5c8c1ad52
diff --git a/dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch b/dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch
new file mode 100644
index 000000000000..eff81002e624
--- /dev/null
+++ b/dev-util/mingw-runtime/files/mingw-runtime-3.18-gcc-4.6.patch
@@ -0,0 +1,27 @@
+https://sourceforge.net/tracker/?func=detail&aid=3446009&group_id=2435&atid=302435
+https://bugs.gentoo.org/419627
+
+--- a/tlssup.c
++++ b/tlssup.c
+@@ -84,6 +84,7 @@ BOOL WINAPI
+ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
+ {
+ _PVFV *pfunc;
++ int nfuncs, ifunc;
+
+ /* We don't let us trick here. */
+ if (_CRT_MT != 2)
+@@ -96,8 +97,12 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
+ return TRUE;
+ }
+
+- for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc)
++ /* Use the nfuncs variable to iterate the TLS functions instead of pfunc to
++ avoid nasty compiler optimizations when comparing two global pointers. */
++ nfuncs = &__xd_z - (&__xd_a + 1);
++ for (ifunc=0; ifunc < nfuncs; ++ifunc)
+ {
++ pfunc = (&__xd_a + 1) + ifunc;
+ if (*pfunc != NULL)
+ (*pfunc)();
+ }
diff --git a/dev-util/mingw-runtime/files/mingw-runtime-3.20-LDBL_MIN_EXP.patch b/dev-util/mingw-runtime/files/mingw-runtime-3.20-LDBL_MIN_EXP.patch
new file mode 100644
index 000000000000..49377fe2b099
--- /dev/null
+++ b/dev-util/mingw-runtime/files/mingw-runtime-3.20-LDBL_MIN_EXP.patch
@@ -0,0 +1,145 @@
+https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3441135&group_id=2435
+https://bugs.gentoo.org/395893
+
+????-??-?? Keith Marshall <keithmarshall@...>
+
+ Support pragmatic identification for w32api source directory.
+
+ * aclocal.m4 (MINGW_AC_W32API_SRCDIR): New macro; implement it.
+ * configure.in (W32API_INCLUDE): Assign using MINGW_AC_W32API_SRCDIR.
+ * Makefile.in (W32API_INCLUDE): Prefix -I flag to AC_SUBST value.
+ * mingwex/Makefile.in (W32API_INCLUDE): Likewise.
+ * profile/Makefile.in (W32API_INCLUDE): Likewise.
+
+diff -r 62c176864807 Makefile.in
+--- a/Makefile.in Mon Nov 28 11:32:25 2011 +0000
++++ b/Makefile.in Mon Nov 28 21:18:55 2011 +0000
+@@ -166,9 +166,9 @@ THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_
+ # Various libraries.
+ LIBM_A=@LIBM_A@
+
+-W32API_INCLUDE = @W32API_INCLUDE@
+-INCLUDES = -I$(srcdir)/include \
+- -I$(srcdir)/../include \
++W32API_INCLUDE = -I @W32API_INCLUDE@
++INCLUDES = -I $(srcdir)/include \
++ -I $(srcdir)/../include \
+ -nostdinc \
+ -iwithprefixbefore include
+ ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(W32API_INCLUDE)
+diff -r 62c176864807 aclocal.m4
+--- a/aclocal.m4 Mon Nov 28 11:32:25 2011 +0000
++++ b/aclocal.m4 Mon Nov 28 21:18:55 2011 +0000
+@@ -15,7 +15,65 @@ AC_DEFUN([MINGW_AC_CONFIG_SRCDIR],
+ AC_MSG_CHECKING([package version])
+ PACKAGE_VERSION=`awk '$[2] == "'"$1"'" { print $[3] }' ${srcdir}/$2`
+ AC_MSG_RESULT([$PACKAGE_VERSION])dnl
+-]) #MINGW_AC_CONFIG_SRCDIR
++])# MINGW_AC_CONFIG_SRCDIR
++
++# MINGW_AC_W32API_SRCDIR
++# ----------------------
++# Attempt to identify the location of the w32api sources.
++# Accept an explicit location specified by to user, as argument
++# to --with-w32api-srcdir; if unspecified, fall back to standard
++# location relative to ${srcdir}. Identification requires that
++# include/windows.h is present within the nominated directory.
++# This is naive, but AC_CHECK_HEADER cannot be used because
++# the system's w32api headers will interfere.
++#
++AC_DEFUN([MINGW_AC_W32API_SRCDIR],
++[AC_ARG_WITH([w32api-srcdir],
++ [AS_HELP_STRING([--with-w32api-srcdir=DIR],
++ [locate w32api sources in DIR [SRCDIR/../w32api]])
++ ],[],[with_w32api_srcdir=NONE])
++ AS_IF([test "x${with_w32api_srcdir}" = xNONE],
++ [AC_MSG_CHECKING([include path for w32api headers])
++ for with_w32api_srcdir in ${srcdir}/../w32api*; do
++ test -f "${with_w32api_srcdir}/include/windows.h" && break
++ with_w32api_srcdir=NONE
++ done
++ AS_IF([test "x${with_w32api_srcdir}" = xNONE],
++ [AC_MSG_RESULT([none found])
++ AC_MSG_RESULT
++ AC_MSG_WARN([source directory containing include/windows.h not found])
++ AC_MSG_WARN([ensure w32api sources are installed at \${top_srcdir}/../w32api*])
++ AC_MSG_WARN([or use --with-w32api-srcdir=DIR to specify an alternative])
++ ],
++ [case "${with_w32api_srcdir}" in
++ "${srcdir}/"*) with_w32api_srcdir="`echo "${with_w32api_srcdir}"dnl
++ | sed s,"^${srcdir}/",'${top_srcdir}/',`" ;;
++ esac
++ AC_MSG_RESULT([${with_w32api_srcdir}/include])
++ ])
++ ],
++ [AC_MSG_CHECKING([for windows.h in ${with_w32api_srcdir}/include])
++ AS_IF([test -f "${with_w32api_srcdir}/include/windows.h"],
++ [AC_MSG_RESULT([yes])
++ case "${with_w32api_srcdir}" in /*) ;;
++ *) with_w32api_srcdir='${top_builddir}/'"${with_w32api_srcdir}" ;;
++ esac
++ ],
++ [AC_MSG_RESULT([no])
++ AC_MSG_RESULT
++ AC_MSG_WARN([the nominated directory, ${with_w32api_srcdir}])
++ AC_MSG_WARN([does not appear to contain valid w32api source code])
++ AC_MSG_WARN([(file '${with_w32api_srcdir}/include/windows.h' is not present)])
++ with_w32api_srcdir=NONE
++ ])
++ ])
++ AS_IF([test "x${with_w32api_srcdir}" = xNONE],
++ [AC_MSG_WARN([please correct this omission and run configure again])
++ AC_MSG_RESULT
++ AC_MSG_ERROR([unable to continue until this issue is resolved])
++ ])
++ W32API_INCLUDE="${with_w32api_srcdir}/include"
++])# MINGW_AC_W32API_SRCDIR
+
+ # The following is copied from `no-executables.m4', in the top
+ # `src/config' directory.
+diff -r 62c176864807 configure.in
+--- a/configure.in Mon Nov 28 11:32:25 2011 +0000
++++ b/configure.in Mon Nov 28 21:18:55 2011 +0000
+@@ -44,7 +44,7 @@ AC_CHECK_TOOL([WINDRES], [windres], [win
+
+ AC_SUBST([NO_CYGWIN])
+ AC_SUBST([HEADER_SUBDIR])
+-AC_SUBST([W32API_INCLUDE], ['-I ${top_srcdir}/../w32api/include'])
++AC_SUBST([W32API_INCLUDE], [MINGW_AC_W32API_SRCDIR])
+
+ # The following are used by the GCC profiling hooks...
+ #
+diff -r 62c176864807 mingwex/Makefile.in
+--- a/mingwex/Makefile.in Mon Nov 28 11:32:25 2011 +0000
++++ b/mingwex/Makefile.in Mon Nov 28 21:18:55 2011 +0000
+@@ -126,10 +126,9 @@ ifdef NO_CYGWIN
+ override CC := ${NO_CYGWIN} $(firstword $(filter-out ${NO_CYGWIN},${CC}))
+ endif
+
+-W32API_INCLUDE = @W32API_INCLUDE@
+-INCLUDES = -I${srcdir} -I${top_srcdir} -I${top_srcdir}/include \
+- -nostdinc \
+- -iwithprefixbefore include
++W32API_INCLUDE = -I @W32API_INCLUDE@
++INCLUDES = -I ${srcdir} -I ${top_srcdir} -I ${top_srcdir}/include \
++ -nostdinc -isystem @W32API_INCLUDE@ -iwithprefixbefore include
+ ALL_CFLAGS = $(CFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(INCLUDES) $(W32API_INCLUDE)
+ ALL_CXXFLAGS = $(CXXFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(INCLUDES) -nostdinc++ $(W32API_INCLUDE)
+
+diff -r 62c176864807 profile/Makefile.in
+--- a/profile/Makefile.in Mon Nov 28 11:32:25 2011 +0000
++++ b/profile/Makefile.in Mon Nov 28 21:18:55 2011 +0000
+@@ -65,10 +65,9 @@ THREAD_DLL = @THREAD_DLL@
+ THREAD_DLL_VERSION = 10
+ THREAD_DLL_NAME = $(THREAD_DLL)$(THREAD_DLL_VERSION).dll
+
+-W32API_INCLUDE = @W32API_INCLUDE@
+-INCLUDES = -I${srcdir} -I${top_srcdir}/include \
+- -nostdinc \
+- -iwithprefixbefore include
++W32API_INCLUDE = -I @W32API_INCLUDE@
++INCLUDES = -I ${srcdir} -I ${top_srcdir}/include \
++ -nostdinc -iwithprefixbefore include
+ ALL_CFLAGS = $(CFLAGS) $(INCLUDES) $(W32API_INCLUDE)
+ ALL_CXXFLAGS = $(CXXFLAGS) $(INCLUDES) -nostdinc++ $(W32API_INCLUDE)
+
diff --git a/dev-util/mingw-runtime/metadata.xml b/dev-util/mingw-runtime/metadata.xml
new file mode 100644
index 000000000000..6c377f90be9b
--- /dev/null
+++ b/dev-util/mingw-runtime/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>toolchain@gentoo.org</email>
+ <name>Gentoo Toolchain Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">mingw</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-util/mingw-runtime/mingw-runtime-3.18.ebuild b/dev-util/mingw-runtime/mingw-runtime-3.18.ebuild
new file mode 100644
index 000000000000..fb7b3aaaadba
--- /dev/null
+++ b/dev-util/mingw-runtime/mingw-runtime-3.18.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+inherit flag-o-matic eutils
+
+MY_P="mingwrt-${PV}-mingw32"
+DESCRIPTION="Free Win32 runtime and import library definitions"
+HOMEPAGE="http://www.mingw.org/"
+SRC_URI="mirror://sourceforge/mingw/${MY_P}-src.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="amd64 ~ppc ~sparc x86"
+IUSE="crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+S=${WORKDIR}/${MY_P}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+just_headers() {
+ use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
+}
+
+pkg_setup() {
+ if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
+ die "Invalid configuration"
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-gcc-4.6.patch #419627
+ sed -i \
+ -e "/W32API_INCLUDE/s:=.*:='-I /usr/${CTARGET}/usr/include':" \
+ $(find -name configure) || die
+ sed -i \
+ -e '/^install_dlls_host:/s:$: install-dirs:' \
+ Makefile.in || die # fix parallel install
+}
+
+src_compile() {
+ just_headers && return 0
+
+ CHOST=${CTARGET} strip-unsupported-flags
+ econf --host=${CTARGET} || die
+ emake || die
+}
+
+src_install() {
+ if just_headers ; then
+ insinto /usr/${CTARGET}/usr/include
+ doins -r include/* || die
+ else
+ local insdir
+ is_crosscompile \
+ && insdir="${D}/usr/${CTARGET}" \
+ || insdir="${D}"
+ emake install DESTDIR="${insdir}" || die
+ env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ rm -rf "${insdir}"/usr/doc
+ dodoc CONTRIBUTORS ChangeLog README TODO readme.txt
+ fi
+ is_crosscompile && dosym usr /usr/${CTARGET}/mingw
+}
diff --git a/dev-util/mingw-runtime/mingw-runtime-3.20.2.ebuild b/dev-util/mingw-runtime/mingw-runtime-3.20.2.ebuild
new file mode 100644
index 000000000000..21f0e6d6c3be
--- /dev/null
+++ b/dev-util/mingw-runtime/mingw-runtime-3.20.2.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="4"
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+inherit flag-o-matic autotools versionator eutils
+
+MY_P="mingwrt-$(version_format_string '$1.$2-$3')-mingw32"
+DESCRIPTION="Free Win32 runtime and import library definitions"
+HOMEPAGE="http://www.mingw.org/"
+# https://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/
+SRC_URI="mirror://sourceforge/mingw/${MY_P}-src.tar.lzma"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE="crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+DEPEND="app-arch/xz-utils"
+
+S=${WORKDIR}/${MY_P}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+just_headers() {
+ use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
+}
+
+pkg_setup() {
+ if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
+ die "Invalid configuration"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.20-LDBL_MIN_EXP.patch #395893
+ eautoconf
+ sed -i \
+ -e '/^install_dlls_host:/s:$: install-dirs:' \
+ Makefile.in || die # fix parallel install
+}
+
+src_configure() {
+ just_headers && return 0
+
+ CHOST=${CTARGET} strip-unsupported-flags
+ econf \
+ --host=${CTARGET} \
+ --with-w32api-srcdir="/usr/${CTARGET}/usr"
+}
+
+src_install() {
+ if just_headers ; then
+ insinto /usr/${CTARGET}/usr/include
+ doins -r include/* || die
+ else
+ local insdir
+ is_crosscompile \
+ && insdir="${D}/usr/${CTARGET}" \
+ || insdir="${D}"
+ emake install DESTDIR="${insdir}" || die
+ env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ rm -rf "${insdir}"/usr/doc
+ docinto ${CTARGET} # Avoid collisions with other cross-compilers.
+ dodoc CONTRIBUTORS ChangeLog README TODO readme.txt
+ fi
+ is_crosscompile && dosym usr /usr/${CTARGET}/mingw
+}
diff --git a/dev-util/mingw-runtime/mingw-runtime-3.20.ebuild b/dev-util/mingw-runtime/mingw-runtime-3.20.ebuild
new file mode 100644
index 000000000000..d456e763daa6
--- /dev/null
+++ b/dev-util/mingw-runtime/mingw-runtime-3.20.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="4"
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+inherit flag-o-matic autotools eutils
+
+MY_P="mingwrt-${PV}-mingw32"
+DESCRIPTION="Free Win32 runtime and import library definitions"
+HOMEPAGE="http://www.mingw.org/"
+# https://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/
+SRC_URI="mirror://sourceforge/mingw/${MY_P}-src.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE="crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+S=${WORKDIR}/${MY_P}
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+just_headers() {
+ use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
+}
+
+pkg_setup() {
+ if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
+ die "Invalid configuration"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-3.20-LDBL_MIN_EXP.patch #395893
+ eautoconf
+ sed -i \
+ -e '/^install_dlls_host:/s:$: install-dirs:' \
+ Makefile.in || die # fix parallel install
+}
+
+src_configure() {
+ just_headers && return 0
+
+ CHOST=${CTARGET} strip-unsupported-flags
+ econf \
+ --host=${CTARGET} \
+ --with-w32api-srcdir="/usr/${CTARGET}/usr"
+}
+
+src_install() {
+ if just_headers ; then
+ insinto /usr/${CTARGET}/usr/include
+ doins -r include/* || die
+ else
+ local insdir
+ is_crosscompile \
+ && insdir="${D}/usr/${CTARGET}" \
+ || insdir="${D}"
+ emake install DESTDIR="${insdir}" || die
+ env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ rm -rf "${insdir}"/usr/doc
+ docinto ${CTARGET} # Avoid collisions with other cross-compilers.
+ dodoc CONTRIBUTORS ChangeLog README TODO readme.txt
+ fi
+ is_crosscompile && dosym usr /usr/${CTARGET}/mingw
+}
diff --git a/dev-util/mingw-runtime/mingw-runtime-4.0.3.1.ebuild b/dev-util/mingw-runtime/mingw-runtime-4.0.3.1.ebuild
new file mode 100644
index 000000000000..29cc5a875193
--- /dev/null
+++ b/dev-util/mingw-runtime/mingw-runtime-4.0.3.1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="4"
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ export CTARGET=${CATEGORY#cross-}
+ fi
+fi
+
+inherit flag-o-matic toolchain-funcs versionator
+
+MY_P="mingwrt-$(version_format_string '$1.$2.$3-$4')-mingw32"
+DESCRIPTION="Free Win32 runtime and import library definitions"
+HOMEPAGE="http://www.mingw.org/"
+# https://sourceforge.net/projects/mingw/files/MinGW/Base/mingw-rt/
+SRC_URI="mirror://sourceforge/mingw/${MY_P}-src.tar.lzma"
+
+LICENSE="BSD"
+SLOT="0"
+# Collides with w32api-4.x
+#KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+IUSE="crosscompile_opts_headers-only"
+RESTRICT="strip"
+
+DEPEND="app-arch/xz-utils"
+RDEPEND=""
+
+S=${WORKDIR}/${MY_P}-src
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+just_headers() {
+ use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
+}
+
+pkg_setup() {
+ if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
+ die "Invalid configuration"
+ fi
+}
+
+src_prepare() {
+ sed -i \
+ -e '/^install_dlls_host:/s:$: install-dirs:' \
+ Makefile.in || die # fix parallel install
+}
+
+src_configure() {
+ just_headers && return 0
+
+ CHOST=${CTARGET} strip-unsupported-flags
+ filter-flags -frecord-gcc-switches
+ tc-export AR
+ econf \
+ --host=${CTARGET} \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}"
+}
+
+src_compile() {
+ emake -j1
+}
+
+src_install() {
+ if just_headers ; then
+ insinto /usr/${CTARGET}/usr/include
+ doins -r include/*
+ else
+ local insdir
+ is_crosscompile \
+ && insdir="${D}/usr/${CTARGET}" \
+ || insdir="${D}"
+ emake -j1 install DESTDIR="${insdir}"
+ env -uRESTRICT CHOST=${CTARGET} prepallstrip
+ rm -rf "${insdir}"/usr/doc
+ docinto ${CTARGET} # Avoid collisions with other cross-compilers.
+ fi
+ is_crosscompile && dosym usr /usr/${CTARGET}/mingw
+}