summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Theodore <tonyt@logyst.com>2013-05-23 14:35:29 (GMT)
committerTony Theodore <tonyt@logyst.com>2013-06-01 12:28:02 (GMT)
commitb974ef08d8b4fc555259eb49c9e34ef69c411948 (patch)
tree3d87088e9b6469153e5f33e9fc035410e9d08c3b
parent95e37fbe7e528bc61e324bde2608046db66521c3 (diff)
downloadmxe-b974ef08d8b4fc555259eb49c9e34ef69c411948.zip
mxe-b974ef08d8b4fc555259eb49c9e34ef69c411948.tar.gz
mxe-b974ef08d8b4fc555259eb49c9e34ef69c411948.tar.bz2
add mingw-w64 runtime and pthreads implementation, update related toolchain files
-rw-r--r--index.html19
-rw-r--r--src/binutils.mk1
-rw-r--r--src/gcc-3-intrinsics.patch813
-rw-r--r--src/gcc.mk70
-rw-r--r--src/mingw-utils.mk2
-rw-r--r--src/mingw-w64.mk29
-rw-r--r--src/mingwrt.mk2
-rw-r--r--src/pthreads-w32-1-fixes.patch (renamed from src/pthreads-1-fixes.patch)0
-rw-r--r--src/pthreads-w32.mk27
-rw-r--r--src/pthreads.mk25
-rw-r--r--src/w32api.mk15
-rw-r--r--src/winpthreads.mk28
12 files changed, 988 insertions, 43 deletions
diff --git a/index.html b/index.html
index 3e7c559..0bc601c 100644
--- a/index.html
+++ b/index.html
@@ -1718,6 +1718,11 @@ aptitude -t squeeze-backports install cmake yasm</pre>
<td id="mingw-utils-website"><a href="http://www.mingw.org/">MinGW Utilities</a></td>
</tr>
<tr>
+ <td id="mingw-w64-package">mingw-w64</td>
+ <td id="mingw-w64-version">c28722c</td>
+ <td id="mingw-w64-website"><a href="http://mingw-w64.sourceforge.net/">MinGW-w64 Runtime</a></td>
+ </tr>
+ <tr>
<td id="mingwrt-package">mingwrt</td>
<td id="mingwrt-version">3.20-2</td>
<td id="mingwrt-website"><a href="http://www.mingw.org/">MinGW Runtime</a></td>
@@ -1980,8 +1985,13 @@ aptitude -t squeeze-backports install cmake yasm</pre>
</tr>
<tr>
<td id="pthreads-package">pthreads</td>
- <td id="pthreads-version">2-9-1</td>
- <td id="pthreads-website"><a href="http://sourceware.org/pthreads-win32/">Pthreads-w32</a></td>
+ <td id="pthreads-version">POSIX 1003.1-2001</td>
+ <td id="pthreads-website"><a href="http://en.wikipedia.org/wiki/POSIX_Threads">POSIX Threads</a></td>
+ </tr>
+ <tr>
+ <td id="pthreads-w32-package">pthreads-w32</td>
+ <td id="pthreads-w32-version">2-9-1</td>
+ <td id="pthreads-w32-website"><a href="http://sourceware.org/pthreads-win32/">Pthreads-w32</a></td>
</tr>
<tr>
<td id="qdbm-package">qdbm</td>
@@ -2244,6 +2254,11 @@ aptitude -t squeeze-backports install cmake yasm</pre>
<td id="winpcap-website"><a href="http://www.winpcap.org/">WinPcap</a></td>
</tr>
<tr>
+ <td id="winpthreads-package">winpthreads</td>
+ <td id="winpthreads-version">c28722c</td>
+ <td id="winpthreads-website"><a href="http://mingw-w64.sourceforge.net/">MinGW w64 pthreads</a></td>
+ </tr>
+ <tr>
<td id="wt-package">wt</td>
<td id="wt-version">3.3.0</td>
<td id="wt-website"><a href="http://witty.sourceforge.net/">Wt</a></td>
diff --git a/src/binutils.mk b/src/binutils.mk
index 51ecf94..d022f74 100644
--- a/src/binutils.mk
+++ b/src/binutils.mk
@@ -30,6 +30,7 @@ define $(PKG)_BUILD
--target='$(TARGET)' \
--build="`config.guess`" \
--prefix='$(PREFIX)' \
+ --disable-multilib \
--with-gcc \
--with-gnu-ld \
--with-gnu-as \
diff --git a/src/gcc-3-intrinsics.patch b/src/gcc-3-intrinsics.patch
new file mode 100644
index 0000000..5fda900
--- /dev/null
+++ b/src/gcc-3-intrinsics.patch
@@ -0,0 +1,813 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+This patch has been taken from:
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56038
+
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/adxintrin.h gcc-4.8.0/gcc/config/i386/adxintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/adxintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/adxintrin.h 2013-03-25 20:56:28.799283008 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _ADXINTRIN_H_INCLUDED
+ #define _ADXINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline unsigned char
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _addcarryx_u32 (unsigned char __CF, unsigned int __X,
+@@ -46,4 +50,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _ADXINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/ammintrin.h gcc-4.8.0/gcc/config/i386/ammintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/ammintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/ammintrin.h 2013-03-25 20:57:25.809281634 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE3, SSE2 and SSE header files*/
+ #include <pmmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_stream_sd (double * __P, __m128d __Y)
+ {
+@@ -83,6 +87,10 @@
+ (unsigned int)(I), (unsigned int)(L)))
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE4A__ */
+
+ #endif /* _AMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/avx2intrin.h gcc-4.8.0/gcc/config/i386/avx2intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/avx2intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/avx2intrin.h 2013-03-25 20:58:19.069280351 +1100
+@@ -25,6 +25,10 @@
+ # error "Never use <avx2intrin.h> directly; include <immintrin.h> instead."
+ #endif
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Sum absolute 8-bit integer difference of adjacent groups of 4
+ byte integers in the first 2 operands. Starting offsets within
+ operands are determined by the 3rd mask operand. */
+@@ -1871,3 +1875,7 @@
+ (__v4si)(__m128i)MASK, \
+ (int)SCALE)
+ #endif /* __OPTIMIZE__ */
++
++#ifdef __cplusplus
++}
++#endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/avxintrin.h gcc-4.8.0/gcc/config/i386/avxintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/avxintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/avxintrin.h 2013-03-25 21:27:20.819238377 +1100
+@@ -28,6 +28,10 @@
+ # error "Never use <avxintrin.h> directly; include <immintrin.h> instead."
+ #endif
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Internal data types for implementing the intrinsics. */
+ typedef double __v4df __attribute__ ((__vector_size__ (32)));
+ typedef float __v8sf __attribute__ ((__vector_size__ (32)));
+@@ -1424,3 +1428,7 @@
+ {
+ return (__m256i) __builtin_ia32_si256_si ((__v4si)__A);
+ }
++
++#ifdef __cplusplus
++}
++#endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/bmi2intrin.h gcc-4.8.0/gcc/config/i386/bmi2intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/bmi2intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/bmi2intrin.h 2013-03-25 20:58:50.845946252 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _BMI2INTRIN_H_INCLUDED
+ #define _BMI2INTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline unsigned int
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _bzhi_u32 (unsigned int __X, unsigned int __Y)
+@@ -99,4 +103,8 @@
+
+ #endif /* !__x86_64__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _BMI2INTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/bmiintrin.h gcc-4.8.0/gcc/config/i386/bmiintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/bmiintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/bmiintrin.h 2013-03-25 20:59:19.032612239 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _BMIINTRIN_H_INCLUDED
+ #define _BMIINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ __tzcnt_u16 (unsigned short __X)
+ {
+@@ -116,4 +120,8 @@
+
+ #endif /* __x86_64__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _BMIINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/cpuid.h gcc-4.8.0/gcc/config/i386/cpuid.h
+--- gcc-4.8.0.orig/gcc/config/i386/cpuid.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/cpuid.h 2013-03-25 19:28:56.476076250 +1100
+@@ -21,6 +21,10 @@
+ * <http://www.gnu.org/licenses/>.
+ */
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* %ecx */
+ #define bit_SSE3 (1 << 0)
+ #define bit_PCLMUL (1 << 1)
+@@ -266,3 +270,8 @@
+ __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
+ return 1;
+ }
++
++#ifdef __cplusplus
++}
++#endif
++
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/emmintrin.h gcc-4.8.0/gcc/config/i386/emmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/emmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/emmintrin.h 2013-03-25 19:28:56.476076250 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE header files*/
+ #include <xmmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* SSE2 */
+ typedef double __v2df __attribute__ ((__vector_size__ (16)));
+ typedef long long __v2di __attribute__ ((__vector_size__ (16)));
+@@ -1515,6 +1519,10 @@
+ return (__m128d) __A;
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE2__ */
+
+ #endif /* _EMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/f16cintrin.h gcc-4.8.0/gcc/config/i386/f16cintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/f16cintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/f16cintrin.h 2013-03-25 21:00:27.905943912 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _F16CINTRIN_H_INCLUDED
+ #define _F16CINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline float __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _cvtsh_ss (unsigned short __S)
+ {
+@@ -88,5 +92,9 @@
+ ((__m128i) __builtin_ia32_vcvtps2ph256 ((__v8sf)(__m256) A, (int) (I)))
+ #endif /* __OPTIMIZE */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _F16CINTRIN_H_INCLUDED */
+ #endif /* __F16C__ */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/fma4intrin.h gcc-4.8.0/gcc/config/i386/fma4intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/fma4intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/fma4intrin.h 2013-03-25 19:28:56.479409583 +1100
+@@ -35,6 +35,10 @@
+ /* We need definitions from the SSE4A, SSE3, SSE2 and SSE header files. */
+ #include <ammintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* 128b Floating point multiply/add type instructions. */
+ extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_macc_ps (__m128 __A, __m128 __B, __m128 __C)
+@@ -231,6 +235,10 @@
+ return (__m256d) __builtin_ia32_vfmaddsubpd256 ((__v4df)__A, (__v4df)__B, -(__v4df)__C);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif
+
+ #endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/fmaintrin.h gcc-4.8.0/gcc/config/i386/fmaintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/fmaintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/fmaintrin.h 2013-03-25 21:01:36.072608935 +1100
+@@ -32,6 +32,10 @@
+ # error "FMA instruction set not enabled"
+ #else
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline __m128d
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_fmadd_pd (__m128d __A, __m128d __B, __m128d __C)
+@@ -292,6 +296,10 @@
+ -(__v8sf)__C);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif
+
+ #endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/fxsrintrin.h gcc-4.8.0/gcc/config/i386/fxsrintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/fxsrintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/fxsrintrin.h 2013-03-25 21:02:02.299274971 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _FXSRINTRIN_H_INCLUDED
+ #define _FXSRINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _fxsave (void *__P)
+@@ -58,4 +62,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _FXSRINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/gmm_malloc.h gcc-4.8.0/gcc/config/i386/gmm_malloc.h
+--- gcc-4.8.0.orig/gcc/config/i386/gmm_malloc.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/gmm_malloc.h 2013-03-25 19:28:56.479409583 +1100
+@@ -27,6 +27,10 @@
+ #include <stdlib.h>
+ #include <errno.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ static __inline__ void*
+ _mm_malloc (size_t size, size_t align)
+ {
+@@ -71,4 +75,8 @@
+ free (((void **) aligned_ptr) [-1]);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _MM_MALLOC_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/ia32intrin.h gcc-4.8.0/gcc/config/i386/ia32intrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/ia32intrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/ia32intrin.h 2013-03-25 21:30:01.905901162 +1100
+@@ -25,6 +25,10 @@
+ # error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
+ #endif
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* 32bit bsf */
+ extern __inline int
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+@@ -240,3 +244,7 @@
+ #define _rotwr(a,b) __rorw((a), (b))
+ #define _rotl(a,b) __rold((a), (b))
+ #define _rotr(a,b) __rord((a), (b))
++
++#ifdef __cplusplus
++}
++#endif
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/immintrin.h gcc-4.8.0/gcc/config/i386/immintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/immintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/immintrin.h 2013-03-25 21:11:37.879261100 +1100
+@@ -88,6 +88,10 @@
+ #include <xtestintrin.h>
+ #endif
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ #ifdef __RDRND__
+ extern __inline int
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+@@ -173,4 +177,8 @@
+ #endif /* __RDRND__ */
+ #endif /* __x86_64__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _IMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/lwpintrin.h gcc-4.8.0/gcc/config/i386/lwpintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/lwpintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/lwpintrin.h 2013-03-25 19:28:56.479409583 +1100
+@@ -32,6 +32,10 @@
+ # error "LWP instruction set not enabled"
+ #else
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ __llwpcb (void *pcbAddress)
+ {
+@@ -95,6 +99,10 @@
+ #endif
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __LWP__ */
+
+ #endif /* _LWPINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/lzcntintrin.h gcc-4.8.0/gcc/config/i386/lzcntintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/lzcntintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/lzcntintrin.h 2013-03-25 21:12:40.285926264 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _LZCNTINTRIN_H_INCLUDED
+ #define _LZCNTINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline unsigned short __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ __lzcnt16 (unsigned short __X)
+ {
+@@ -64,4 +68,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _LZCNTINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/mm3dnow.h gcc-4.8.0/gcc/config/i386/mm3dnow.h
+--- gcc-4.8.0.orig/gcc/config/i386/mm3dnow.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/mm3dnow.h 2013-03-25 19:28:56.482742915 +1100
+@@ -32,6 +32,10 @@
+ #include <mmintrin.h>
+ #include <prfchwintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _m_femms (void)
+ {
+@@ -205,6 +209,11 @@
+ }
+
+ #endif /* __3dNOW_A__ */
++
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __3dNOW__ */
+
+ #endif /* _MM3DNOW_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/mmintrin.h gcc-4.8.0/gcc/config/i386/mmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/mmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/mmintrin.h 2013-03-25 19:28:56.482742915 +1100
+@@ -30,6 +30,11 @@
+ #ifndef __MMX__
+ # error "MMX instruction set not enabled"
+ #else
++
++#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 int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));
+@@ -916,5 +921,9 @@
+ return _mm_set_pi8 (__b, __b, __b, __b, __b, __b, __b, __b);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __MMX__ */
+ #endif /* _MMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/pmm_malloc.h gcc-4.8.0/gcc/config/i386/pmm_malloc.h
+--- gcc-4.8.0.orig/gcc/config/i386/pmm_malloc.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/pmm_malloc.h 2013-03-25 19:28:56.482742915 +1100
+@@ -34,6 +34,10 @@
+ extern "C" int posix_memalign (void **, size_t, size_t) throw ();
+ #endif
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ static __inline void *
+ _mm_malloc (size_t size, size_t alignment)
+ {
+@@ -54,4 +58,8 @@
+ free (ptr);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _MM_MALLOC_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/pmmintrin.h gcc-4.8.0/gcc/config/i386/pmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/pmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/pmmintrin.h 2013-03-25 19:28:56.482742915 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE2 and SSE header files*/
+ #include <emmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Additional bits in the MXCSR. */
+ #define _MM_DENORMALS_ZERO_MASK 0x0040
+ #define _MM_DENORMALS_ZERO_ON 0x0040
+@@ -122,6 +126,10 @@
+ __builtin_ia32_mwait (__E, __H);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE3__ */
+
+ #endif /* _PMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/popcntintrin.h gcc-4.8.0/gcc/config/i386/popcntintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/popcntintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/popcntintrin.h 2013-03-25 19:28:56.482742915 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _POPCNTINTRIN_H_INCLUDED
+ #define _POPCNTINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Calculate a number of bits set to 1. */
+ extern __inline int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_popcnt_u32 (unsigned int __X)
+@@ -43,4 +47,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _POPCNTINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/prfchwintrin.h gcc-4.8.0/gcc/config/i386/prfchwintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/prfchwintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/prfchwintrin.h 2013-03-25 21:13:57.149257744 +1100
+@@ -33,10 +33,18 @@
+ #ifndef _PRFCHWINTRIN_H_INCLUDED
+ #define _PRFCHWINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _m_prefetchw (void *__P)
+ {
+ __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _PRFCHWINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/rdseedintrin.h gcc-4.8.0/gcc/config/i386/rdseedintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/rdseedintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/rdseedintrin.h 2013-03-25 21:14:16.099257288 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _RDSEEDINTRIN_H_INCLUDED
+ #define _RDSEEDINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline int
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _rdseed16_step (unsigned short *p)
+@@ -55,4 +59,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _RDSEEDINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/rtmintrin.h gcc-4.8.0/gcc/config/i386/rtmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/rtmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/rtmintrin.h 2013-03-25 21:23:20.389244172 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _RTMINTRIN_H_INCLUDED
+ #define _RTMINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ #define _XBEGIN_STARTED (~0u)
+ #define _XABORT_EXPLICIT (1 << 0)
+ #define _XABORT_RETRY (1 << 1)
+@@ -74,4 +78,8 @@
+ #define _xabort(N) __builtin_ia32_xabort (N)
+ #endif /* __OPTIMIZE__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _RTMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/smmintrin.h gcc-4.8.0/gcc/config/i386/smmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/smmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/smmintrin.h 2013-03-25 19:28:56.486076248 +1100
+@@ -35,6 +35,10 @@
+ files. */
+ #include <tmmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Rounding mode macros. */
+ #define _MM_FROUND_TO_NEAREST_INT 0x00
+ #define _MM_FROUND_TO_NEG_INF 0x01
+@@ -825,6 +829,10 @@
+
+ #endif /* __SSE4_2__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSE4_1__ */
+
+ #endif /* _SMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/tbmintrin.h gcc-4.8.0/gcc/config/i386/tbmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/tbmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/tbmintrin.h 2013-03-25 21:24:08.535909678 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _TBMINTRIN_H_INCLUDED
+ #define _TBMINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ #ifdef __OPTIMIZE__
+ extern __inline unsigned int __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ __bextri_u32 (unsigned int __X, const unsigned int __I)
+@@ -169,4 +173,9 @@
+
+
+ #endif /* __x86_64__ */
++
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _TBMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/tmmintrin.h gcc-4.8.0/gcc/config/i386/tmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/tmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/tmmintrin.h 2013-03-25 19:28:56.486076248 +1100
+@@ -34,6 +34,10 @@
+ /* We need definitions from the SSE3, SSE2 and SSE header files*/
+ #include <pmmintrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_hadd_epi16 (__m128i __X, __m128i __Y)
+ {
+@@ -239,6 +243,10 @@
+ return (__m64) __builtin_ia32_pabsd ((__v2si)__X);
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __SSSE3__ */
+
+ #endif /* _TMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/wmmintrin.h gcc-4.8.0/gcc/config/i386/wmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/wmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/wmmintrin.h 2013-03-25 21:34:25.419228145 +1100
+@@ -34,6 +34,10 @@
+ # error "AES/PCLMUL instructions not enabled"
+ #else
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* AES */
+
+ #ifdef __AES__
+@@ -115,6 +119,10 @@
+ #endif
+ #endif /* __PCLMUL__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __AES__/__PCLMUL__ */
+
+ #endif /* _WMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xmmintrin.h gcc-4.8.0/gcc/config/i386/xmmintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xmmintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xmmintrin.h 2013-03-25 19:28:56.486076248 +1100
+@@ -37,6 +37,10 @@
+ /* Get _mm_malloc () and _mm_free (). */
+ #include <mm_malloc.h>
+
++#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 <emmintrin.h>
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xopintrin.h gcc-4.8.0/gcc/config/i386/xopintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xopintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xopintrin.h 2013-03-25 19:28:56.489409581 +1100
+@@ -34,6 +34,10 @@
+
+ #include <fma4intrin.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Integer multiply/add intructions. */
+ extern __inline __m128i __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _mm_maccs_epi16(__m128i __A, __m128i __B, __m128i __C)
+@@ -830,6 +834,10 @@
+ (int)(I)))
+ #endif /* __OPTIMIZE__ */
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* __XOP__ */
+
+ #endif /* _XOPMMINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xsaveintrin.h gcc-4.8.0/gcc/config/i386/xsaveintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xsaveintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xsaveintrin.h 2013-03-25 21:24:35.619242359 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _XSAVEINTRIN_H_INCLUDED
+ #define _XSAVEINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _xsave (void *__P, long long __M)
+@@ -58,4 +62,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _XSAVEINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xsaveoptintrin.h gcc-4.8.0/gcc/config/i386/xsaveoptintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xsaveoptintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xsaveoptintrin.h 2013-03-25 21:24:56.469241856 +1100
+@@ -28,6 +28,10 @@
+ #ifndef _XSAVEOPTINTRIN_H_INCLUDED
+ #define _XSAVEOPTINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ extern __inline void
+ __attribute__((__gnu_inline__, __always_inline__, __artificial__))
+ _xsaveopt (void *__P, long long __M)
+@@ -44,4 +48,8 @@
+ }
+ #endif
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _XSAVEOPTINTRIN_H_INCLUDED */
+diff -Nur gcc-4.8.0.orig/gcc/config/i386/xtestintrin.h gcc-4.8.0/gcc/config/i386/xtestintrin.h
+--- gcc-4.8.0.orig/gcc/config/i386/xtestintrin.h 2013-01-11 07:38:27.000000000 +1100
++++ gcc-4.8.0/gcc/config/i386/xtestintrin.h 2013-03-25 21:25:26.389241134 +1100
+@@ -32,6 +32,10 @@
+ #ifndef _XTESTINTRIN_H_INCLUDED
+ #define _XTESTINTRIN_H_INCLUDED
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Return non-zero if the instruction executes inside an RTM or HLE code
+ region. Return zero otherwise. */
+ extern __inline int
+@@ -41,4 +45,8 @@
+ return __builtin_ia32_xtest ();
+ }
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif /* _XTESTINTRIN_H_INCLUDED */
diff --git a/src/gcc.mk b/src/gcc.mk
index 70c3310..b881c7d 100644
--- a/src/gcc.mk
+++ b/src/gcc.mk
@@ -8,7 +8,7 @@ $(PKG)_SUBDIR := gcc-$($(PKG)_VERSION)
$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2
$(PKG)_URL := ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_URL_2 := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
-$(PKG)_DEPS := mingwrt w32api binutils gcc-gmp gcc-mpc gcc-mpfr
+$(PKG)_DEPS := mingwrt w32api mingw-w64 binutils gcc-gmp gcc-mpc gcc-mpfr
define $(PKG)_UPDATE
$(WGET) -q -O- 'http://ftp.gnu.org/gnu/gcc/?C=M;O=D' | \
@@ -17,7 +17,7 @@ define $(PKG)_UPDATE
tail -1
endef
-define $(PKG)_BUILD
+define $(PKG)_PRE_CONFIGURE
# unpack support libraries
cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,gcc-gmp)
mv '$(1)/$(gcc-gmp_SUBDIR)' '$(1)/gmp'
@@ -25,8 +25,10 @@ define $(PKG)_BUILD
mv '$(1)/$(gcc-mpc_SUBDIR)' '$(1)/mpc'
cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,gcc-mpfr)
mv '$(1)/$(gcc-mpfr_SUBDIR)' '$(1)/mpfr'
+endef
- # build GCC and support libraries
+define $(PKG)_CONFIGURE
+ # configure gcc and support libraries
mkdir '$(1).build'
cd '$(1).build' && '$(1)/configure' \
--target='$(TARGET)' \
@@ -40,7 +42,7 @@ define $(PKG)_BUILD
--with-gnu-as \
--disable-nls \
--disable-shared \
- --disable-sjlj-exceptions \
+ --disable-multilib \
--without-x \
--disable-win32-registry \
--enable-threads=win32 \
@@ -49,9 +51,9 @@ define $(PKG)_BUILD
--with-mpfr-include='$(1)/mpfr/src' \
--with-mpfr-lib='$(1).build/mpfr/src/.libs' \
$(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'")
- $(MAKE) -C '$(1).build' -j '$(JOBS)'
- $(MAKE) -C '$(1).build' -j 1 install
+endef
+define $(PKG)_POST_BUILD
# create pkg-config script
(echo '#!/bin/sh'; \
echo 'PKG_CONFIG_PATH="$$PKG_CONFIG_PATH_$(subst -,_,$(TARGET))" PKG_CONFIG_LIBDIR='\''$(PREFIX)/$(TARGET)/lib/pkgconfig'\'' exec pkg-config --static "$$@"') \
@@ -78,3 +80,59 @@ define $(PKG)_BUILD
echo 'set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug|Release|RelWithDebInfo|MinSizeRel")') \
> '$(CMAKE_TOOLCHAIN_FILE)'
endef
+
+define $(PKG)_POST_BUILD_mingw32
+ # create pkg-config files
+ $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig'
+ (echo 'Name: gl'; \
+ echo 'Version: 0'; \
+ echo 'Description: OpenGL'; \
+ echo 'Libs: -lopengl32';) \
+ > '$(PREFIX)/$(TARGET)/lib/pkgconfig/gl.pc'
+
+ (echo 'Name: glu'; \
+ echo 'Version: 0'; \
+ echo 'Description: OpenGL'; \
+ echo 'Libs: -lglu32';) \
+ > '$(PREFIX)/$(TARGET)/lib/pkgconfig/glu.pc'
+endef
+
+define $(PKG)_BUILD_i686-pc-mingw32
+ # build full cross gcc
+ $($(PKG)_PRE_CONFIGURE) \
+ $($(PKG)_CONFIGURE) \
+ --disable-sjlj-exceptions
+ $(MAKE) -C '$(1).build' -j '$(JOBS)'
+ $(MAKE) -C '$(1).build' -j 1 install
+ $($(PKG)_POST_BUILD)
+ $($(PKG)_POST_BUILD_mingw32)
+endef
+
+define $(PKG)_BUILD_mingw-w64
+ # build standalone gcc
+ $($(PKG)_PRE_CONFIGURE) \
+ $($(PKG)_CONFIGURE)
+ $(MAKE) -C '$(1).build' -j '$(JOBS)' all-gcc
+ $(MAKE) -C '$(1).build' -j 1 install-gcc
+
+ # build mingw-w64-crt
+ cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,mingw-w64)
+ mkdir '$(1).crt-build'
+ cd '$(1).crt-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \
+ --host='$(TARGET)' \
+ --prefix='$(PREFIX)/$(TARGET)' \
+ mxe-config-opts
+ $(MAKE) -C '$(1).crt-build' -j '$(JOBS)'
+ $(MAKE) -C '$(1).crt-build' -j 1 install
+
+ # build rest of gcc
+ cd '$(1).build'
+ $(MAKE) -C '$(1).build' -j '$(JOBS)'
+ $(MAKE) -C '$(1).build' -j 1 install
+
+ $($(PKG)_POST_BUILD)
+ $($(PKG)_POST_BUILD_mingw32)
+endef
+
+$(PKG)_BUILD_x86_64-w64-mingw32 = $(subst mxe-config-opts,--disable-lib32,$($(PKG)_BUILD_mingw-w64))
+$(PKG)_BUILD_i686-w64-mingw32 = $(subst mxe-config-opts,--disable-lib64,$($(PKG)_BUILD_mingw-w64))
diff --git a/src/mingw-utils.mk b/src/mingw-utils.mk
index eaa0300..b3648a2 100644
--- a/src/mingw-utils.mk
+++ b/src/mingw-utils.mk
@@ -15,7 +15,7 @@ define $(PKG)_UPDATE
head -1
endef
-define $(PKG)_BUILD
+define $(PKG)_BUILD_i686-pc-mingw32
# native build
cp -Rp '$(1)' '$(1).native'
cd '$(1).native' && ./configure \
diff --git a/src/mingw-w64.mk b/src/mingw-w64.mk
new file mode 100644
index 0000000..bccc557
--- /dev/null
+++ b/src/mingw-w64.mk
@@ -0,0 +1,29 @@
+# This file is part of mingw-cross-env.
+# See doc/index.html for further information.
+
+# Mingw-w64
+PKG := mingw-w64
+$(PKG)_IGNORE :=
+$(PKG)_CHECKSUM := bc48803ff15a777adad8890519bd3ebec90acab9
+$(PKG)_SUBDIR := mirror-$(PKG)-$($(PKG)_VERSION)/trunk
+$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz
+$(PKG)_URL := https://github.com/mirror/$(PKG)/tarball/$($(PKG)_VERSION)/$($(PKG)_FILE)
+$(PKG)_DEPS :=
+
+define $(PKG)_UPDATE
+ $(WGET) -q -O- 'https://github.com/mirror/$(PKG)/commits/master' | \
+ $(SED) -n 's#.*<span class="sha">\([^<]\{7\}\)[^<]\{3\}<.*#\1#p' | \
+ head -1
+endef
+
+define $(PKG)_BUILD_mingw-w64
+ mkdir '$(1).headers-build'
+ cd '$(1).headers-build' && '$(1)/mingw-w64-headers/configure' \
+ --host='$(TARGET)' \
+ --prefix='$(PREFIX)/$(TARGET)' \
+ --enable-sdk=all
+ $(MAKE) -C '$(1).headers-build' install
+endef
+
+$(PKG)_BUILD_x86_64-w64-mingw32 = $($(PKG)_BUILD_mingw-w64)
+$(PKG)_BUILD_i686-w64-mingw32 = $($(PKG)_BUILD_mingw-w64)
diff --git a/src/mingwrt.mk b/src/mingwrt.mk
index 8288e3e..331583f 100644
--- a/src/mingwrt.mk
+++ b/src/mingwrt.mk
@@ -15,7 +15,7 @@ define $(PKG)_UPDATE
head -1
endef
-define $(PKG)_BUILD
+define $(PKG)_BUILD_i686-pc-mingw32
$(INSTALL) -d '$(PREFIX)/$(TARGET)'
cd '$(1)' && \
cp -rpv include lib '$(PREFIX)/$(TARGET)'
diff --git a/src/pthreads-1-fixes.patch b/src/pthreads-w32-1-fixes.patch
index ef99e5b..ef99e5b 100644
--- a/src/pthreads-1-fixes.patch
+++ b/src/pthreads-w32-1-fixes.patch
diff --git a/src/pthreads-w32.mk b/src/pthreads-w32.mk
new file mode 100644
index 0000000..ff86137
--- /dev/null
+++ b/src/pthreads-w32.mk
@@ -0,0 +1,27 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG := pthreads-w32
+$(PKG)_IGNORE :=
+$(PKG)_CHECKSUM := 24d40e89c2e66a765733e8c98d6f94500343da86
+$(PKG)_SUBDIR := pthreads-w32-$($(PKG)_VERSION)-release
+$(PKG)_FILE := pthreads-w32-$($(PKG)_VERSION)-release.tar.gz
+$(PKG)_URL := ftp://sourceware.org/pub/pthreads-win32/$($(PKG)_FILE)
+$(PKG)_DEPS := gcc
+
+define $(PKG)_UPDATE
+ $(WGET) -q -O- 'ftp://sourceware.org/pub/pthreads-win32/dll-latest/include/pthread.h' | \
+ $(SED) -n 's/^#define PTW32_VERSION \([^,]*\),\([^,]*\),\([^,]*\),.*/\1-\2-\3/p;'
+endef
+
+define $(PKG)_BUILD_i686-pc-mingw32
+ $(MAKE) -C '$(1)' -j 1 GC-static CROSS='$(TARGET)-'
+ $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib'
+ $(INSTALL) -m644 '$(1)/libpthreadGC2.a' '$(PREFIX)/$(TARGET)/lib/libpthread.a'
+ $(INSTALL) -d '$(PREFIX)/$(TARGET)/include'
+ $(INSTALL) -m644 '$(1)/pthread.h' '$(PREFIX)/$(TARGET)/include/'
+ $(INSTALL) -m644 '$(1)/sched.h' '$(PREFIX)/$(TARGET)/include/'
+ $(INSTALL) -m644 '$(1)/semaphore.h' '$(PREFIX)/$(TARGET)/include/'
+
+ $(PTHREADS_TEST)
+endef
diff --git a/src/pthreads.mk b/src/pthreads.mk
index d887c65..023a984 100644
--- a/src/pthreads.mk
+++ b/src/pthreads.mk
@@ -1,30 +1,17 @@
# This file is part of MXE.
# See index.html for further information.
+# runtimes can/will have different implementations
+# but the pre-requisite package and test are the same
PKG := pthreads
-$(PKG)_IGNORE :=
-$(PKG)_CHECKSUM := 24d40e89c2e66a765733e8c98d6f94500343da86
-$(PKG)_SUBDIR := pthreads-w32-$($(PKG)_VERSION)-release
-$(PKG)_FILE := pthreads-w32-$($(PKG)_VERSION)-release.tar.gz
-$(PKG)_URL := ftp://sourceware.org/pub/pthreads-win32/$($(PKG)_FILE)
-$(PKG)_DEPS := gcc
+$(PKG)_DEPS := pthreads-w32 winpthreads
define $(PKG)_UPDATE
- $(WGET) -q -O- 'ftp://sourceware.org/pub/pthreads-win32/dll-latest/include/pthread.h' | \
- $(SED) -n 's/^#define PTW32_VERSION \([^,]*\),\([^,]*\),\([^,]*\),.*/\1-\2-\3/p;'
+ echo $(pthreads_VERSION)
endef
-define $(PKG)_BUILD
- $(MAKE) -C '$(1)' -j 1 GC-static CROSS='$(TARGET)-'
- $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib'
- $(INSTALL) -m644 '$(1)/libpthreadGC2.a' '$(PREFIX)/$(TARGET)/lib/libpthread.a'
- $(INSTALL) -d '$(PREFIX)/$(TARGET)/include'
- $(INSTALL) -m644 '$(1)/pthread.h' '$(PREFIX)/$(TARGET)/include/'
- $(INSTALL) -m644 '$(1)/sched.h' '$(PREFIX)/$(TARGET)/include/'
- $(INSTALL) -m644 '$(1)/semaphore.h' '$(PREFIX)/$(TARGET)/include/'
-
+PTHREADS_TEST = \
'$(TARGET)-gcc' \
-W -Wall -Werror -ansi -pedantic \
- '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-pthreads.exe' \
+ '$(TOP_DIR)/src/pthreads-test.c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
-lpthread -lws2_32
-endef
diff --git a/src/w32api.mk b/src/w32api.mk
index 831e2bf..57894c4 100644
--- a/src/w32api.mk
+++ b/src/w32api.mk
@@ -15,20 +15,7 @@ define $(PKG)_UPDATE
head -1
endef
-define $(PKG)_BUILD
+define $(PKG)_BUILD_i686-pc-mingw32
$(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig'
cp -rpv '$(1)/include' '$(1)/lib' '$(PREFIX)/$(TARGET)'
-
- # create pkg-config files
- (echo 'Name: gl'; \
- echo 'Version: 0'; \
- echo 'Description: OpenGL'; \
- echo 'Libs: -lopengl32';) \
- > '$(PREFIX)/$(TARGET)/lib/pkgconfig/gl.pc'
-
- (echo 'Name: glu'; \
- echo 'Version: 0'; \
- echo 'Description: OpenGL'; \
- echo 'Libs: -lglu32';) \
- > '$(PREFIX)/$(TARGET)/lib/pkgconfig/glu.pc'
endef
diff --git a/src/winpthreads.mk b/src/winpthreads.mk
new file mode 100644
index 0000000..ba2d132
--- /dev/null
+++ b/src/winpthreads.mk
@@ -0,0 +1,28 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG := winpthreads
+$(PKG)_IGNORE = $(mingw-w64_IGNORE)
+$(PKG)_CHECKSUM = $(mingw-w64_CHECKSUM)
+$(PKG)_SUBDIR = $(mingw-w64_SUBDIR)
+$(PKG)_FILE = $(mingw-w64_FILE)
+$(PKG)_URL = $(mingw-w64_URL)
+$(PKG)_DEPS := gcc mingw-w64
+
+define $(PKG)_UPDATE
+ echo $(mingw-w64_VERSION)
+endef
+
+define $(PKG)_BUILD_mingw-w64
+ cd '$(1)/mingw-w64-libraries/winpthreads' && ./configure \
+ --host='$(TARGET)' \
+ --prefix='$(PREFIX)/$(TARGET)' \
+ --enable-static \
+ --disable-shared
+ $(MAKE) -C '$(1)/mingw-w64-libraries/winpthreads' -j '$(JOBS)' install
+
+ $(PTHREADS_TEST)
+endef
+
+$(PKG)_BUILD_x86_64-w64-mingw32 = $($(PKG)_BUILD_mingw-w64)
+$(PKG)_BUILD_i686-w64-mingw32 = $($(PKG)_BUILD_mingw-w64)