From b974ef08d8b4fc555259eb49c9e34ef69c411948 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 24 May 2013 00:35:29 +1000 Subject: add mingw-w64 runtime and pthreads implementation, update related toolchain files --- index.html | 19 +- src/binutils.mk | 1 + src/gcc-3-intrinsics.patch | 813 +++++++++++++++++++++++++++++++++++++++++ src/gcc.mk | 70 +++- src/mingw-utils.mk | 2 +- src/mingw-w64.mk | 29 ++ src/mingwrt.mk | 2 +- src/pthreads-1-fixes.patch | 62 ---- src/pthreads-w32-1-fixes.patch | 62 ++++ src/pthreads-w32.mk | 27 ++ src/pthreads.mk | 25 +- src/w32api.mk | 15 +- src/winpthreads.mk | 28 ++ 13 files changed, 1050 insertions(+), 105 deletions(-) create mode 100644 src/gcc-3-intrinsics.patch create mode 100644 src/mingw-w64.mk delete mode 100644 src/pthreads-1-fixes.patch create mode 100644 src/pthreads-w32-1-fixes.patch create mode 100644 src/pthreads-w32.mk create mode 100644 src/winpthreads.mk 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 MinGW Utilities + mingw-w64 + c28722c + MinGW-w64 Runtime + + mingwrt 3.20-2 MinGW Runtime @@ -1980,8 +1985,13 @@ aptitude -t squeeze-backports install cmake yasm pthreads - 2-9-1 - Pthreads-w32 + POSIX 1003.1-2001 + POSIX Threads + + + pthreads-w32 + 2-9-1 + Pthreads-w32 qdbm @@ -2244,6 +2254,11 @@ aptitude -t squeeze-backports install cmake yasm WinPcap + winpthreads + c28722c + MinGW w64 pthreads + + wt 3.3.0 Wt 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 + ++#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 directly; include 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 directly; include 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 @@ + * . + */ + ++#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 + ++#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 + ++#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 + #include + ++#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 directly; include 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 + #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 + #include + ++#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 + ++#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 + ++#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 + ++#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 + ++#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 -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 + ++#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#.*\([^<]\{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-1-fixes.patch deleted file mode 100644 index ef99e5b..0000000 --- a/src/pthreads-1-fixes.patch +++ /dev/null @@ -1,62 +0,0 @@ -This file is part of MXE. -See index.html for further information. - -From e951f784c852f4cd8298864190936fded1efceba Mon Sep 17 00:00:00 2001 -From: Mark Brand -Date: Sun, 27 May 2012 22:00:19 +0200 -Subject: [PATCH] force static for convenience - ---- - pthread.h | 4 ++++ - sched.h | 4 ++++ - semaphore.h | 4 ++++ - 3 files changed, 12 insertions(+) - -diff --git a/pthread.h b/pthread.h -index b4072f7..c88c886 100755 ---- a/pthread.h -+++ b/pthread.h -@@ -547,6 +547,10 @@ extern "C" - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -+ -+// MXE: Set this for convenience here since MXE only does static. -+#define PTW32_STATIC_LIB -+ - #if !defined(PTW32_STATIC_LIB) - # if defined(PTW32_BUILD) - # define PTW32_DLLPORT __declspec (dllexport) -diff --git a/sched.h b/sched.h -index f36a97a..1f4f401 100755 ---- a/sched.h -+++ b/sched.h -@@ -76,6 +76,10 @@ - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -+ -+// MXE: Set this for convenience here since MXE only does static. -+#define PTW32_STATIC_LIB -+ - #if !defined(PTW32_STATIC_LIB) - # if defined(PTW32_BUILD) - # define PTW32_DLLPORT __declspec (dllexport) -diff --git a/semaphore.h b/semaphore.h -index c6e9407..2b64173 100755 ---- a/semaphore.h -+++ b/semaphore.h -@@ -75,6 +75,10 @@ - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -+ -+// MXE: Set this for convenience here since MXE only does static. -+#define PTW32_STATIC_LIB -+ - #if !defined(PTW32_STATIC_LIB) - # if defined(PTW32_BUILD) - # define PTW32_DLLPORT __declspec (dllexport) --- -1.7.9.2 - diff --git a/src/pthreads-w32-1-fixes.patch b/src/pthreads-w32-1-fixes.patch new file mode 100644 index 0000000..ef99e5b --- /dev/null +++ b/src/pthreads-w32-1-fixes.patch @@ -0,0 +1,62 @@ +This file is part of MXE. +See index.html for further information. + +From e951f784c852f4cd8298864190936fded1efceba Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Sun, 27 May 2012 22:00:19 +0200 +Subject: [PATCH] force static for convenience + +--- + pthread.h | 4 ++++ + sched.h | 4 ++++ + semaphore.h | 4 ++++ + 3 files changed, 12 insertions(+) + +diff --git a/pthread.h b/pthread.h +index b4072f7..c88c886 100755 +--- a/pthread.h ++++ b/pthread.h +@@ -547,6 +547,10 @@ extern "C" + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ ++ ++// MXE: Set this for convenience here since MXE only does static. ++#define PTW32_STATIC_LIB ++ + #if !defined(PTW32_STATIC_LIB) + # if defined(PTW32_BUILD) + # define PTW32_DLLPORT __declspec (dllexport) +diff --git a/sched.h b/sched.h +index f36a97a..1f4f401 100755 +--- a/sched.h ++++ b/sched.h +@@ -76,6 +76,10 @@ + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ ++ ++// MXE: Set this for convenience here since MXE only does static. ++#define PTW32_STATIC_LIB ++ + #if !defined(PTW32_STATIC_LIB) + # if defined(PTW32_BUILD) + # define PTW32_DLLPORT __declspec (dllexport) +diff --git a/semaphore.h b/semaphore.h +index c6e9407..2b64173 100755 +--- a/semaphore.h ++++ b/semaphore.h +@@ -75,6 +75,10 @@ + * do NOT define PTW32_BUILD, and then the variables/functions will + * be imported correctly. + */ ++ ++// MXE: Set this for convenience here since MXE only does static. ++#define PTW32_STATIC_LIB ++ + #if !defined(PTW32_STATIC_LIB) + # if defined(PTW32_BUILD) + # define PTW32_DLLPORT __declspec (dllexport) +-- +1.7.9.2 + 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) -- cgit v0.12