From 82c62879da67b2399d41bf729041cf3f05eeb944 Mon Sep 17 00:00:00 2001 From: Tony Theodore Date: Fri, 4 Jan 2013 18:34:04 +1100 Subject: [PATCH] add mingw-w64 runtime (32 & 64 bit targets) --- Makefile | 4 +- index.html | 19 ++++- src/gcc.mk | 71 +++++++++++++++++-- src/mingw-w64.mk | 32 +++++++++ src/mingwrt.mk | 2 +- ...fixes.patch => pthreads-w32-1-fixes.patch} | 0 src/pthreads-w32.mk | 27 +++++++ src/pthreads.mk | 25 ++----- src/w32api.mk | 15 +--- src/winpthreads.mk | 30 ++++++++ 10 files changed, 181 insertions(+), 44 deletions(-) create mode 100644 src/mingw-w64.mk rename src/{pthreads-1-fixes.patch => pthreads-w32-1-fixes.patch} (100%) create mode 100644 src/pthreads-w32.mk create mode 100644 src/winpthreads.mk diff --git a/Makefile b/Makefile index 497df249a6..c59adc41cc 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # See index.html for further information. JOBS := 1 -TARGET := i686-pc-mingw32 +MXE_TARGET := i686-pc-mingw32 SOURCEFORGE_MIRROR := freefr.dl.sourceforge.net PKG_MIRROR := s3.amazonaws.com/mxe-pkg PKG_CDN := d1yihgixbnrglp.cloudfront.net @@ -217,7 +217,7 @@ build-only-$(1)_$(3): [ -d '$(PREFIX)/$(3)/installed' ] || mkdir -p '$(PREFIX)/$(3)/installed' touch '$(PREFIX)/$(3)/installed/$(1)' endef -$(foreach PKG,$(PKGS),$(eval $(call PKG_RULE,$(PKG),$(call TMP_DIR,$(PKG)),$(TARGET)))) +$(foreach PKG,$(PKGS),$(eval $(call PKG_RULE,$(PKG),$(call TMP_DIR,$(PKG)),$(MXE_TARGET)))) .PHONY: clean clean: diff --git a/index.html b/index.html index 96363d89dd..9ee31ca176 100644 --- a/index.html +++ b/index.html @@ -1636,6 +1636,11 @@

List of Packages

0.4-1 MinGW Utilities + + mingw-w64 + 2.0.7 + MinGW-w64 Runtime + mingwrt 3.20-2 @@ -1873,8 +1878,13 @@

List of Packages

pthreads - 2-9-1 - Pthreads-w32 + POSIX 1003.1-2001 + POSIX Threads + + + pthreads-w32 + 2-9-1 + Pthreads-w32 qdbm @@ -2106,6 +2116,11 @@

List of Packages

4_1_2 WinPcap + + winpthreads + ff38d21 + MinGW w64 pthreads + wt 3.2.3 diff --git a/src/gcc.mk b/src/gcc.mk index eb33404611..c15a54d05a 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 head -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,60 @@ 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) \ + --enable-sjlj-exceptions + $(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)' \ + 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-w64.mk b/src/mingw-w64.mk new file mode 100644 index 0000000000..c3ea751eb9 --- /dev/null +++ b/src/mingw-w64.mk @@ -0,0 +1,32 @@ +# This file is part of mingw-cross-env. +# See doc/index.html for further information. + +# Mingw-w64 +PKG := mingw-w64 +$(PKG)_IGNORE := +$(PKG)_CHECKSUM := 55f74b8b87c9b081844a1ba46e97b1db696f6e00 +$(PKG)_SUBDIR := $(PKG)-v$($(PKG)_VERSION) +$(PKG)_FILE := $(PKG)-v$($(PKG)_VERSION).tar.gz +$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/$(PKG)/$(PKG)/$(PKG)-release/$($(PKG)_FILE) +$(PKG)_URL_2 := http://downloads.sourceforge.net/project/$(PKG)/$(PKG)/$(PKG)-release/$($(PKG)_FILE) +$(PKG)_DEPS := + +define $(PKG)_UPDATE + wget -q -O- 'http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/' | \ + $(SED) -n 's,.*mingw-w64-v\([0-9][^>]*\)\.tar.*,\1,p' | \ + grep -v [a-zA-Z] | \ + sort | \ + tail -1 +endef + +define $(PKG)_BUILD_mingw-w64 + mkdir '$(1).headers-build' + cd '$(1).headers-build' && '$(1)/mingw-w64-headers/configure' \ + --host='$(TARGET)' \ + --prefix='$(PREFIX)' \ + --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 db712a8529..eb4d5645b6 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 similarity index 100% rename from src/pthreads-1-fixes.patch rename to src/pthreads-w32-1-fixes.patch diff --git a/src/pthreads-w32.mk b/src/pthreads-w32.mk new file mode 100644 index 0000000000..ff8613775c --- /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 d887c65f34..023a98499f 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 8df0fe6751..1017a3c21f 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 0000000000..4cc5c55c14 --- /dev/null +++ b/src/winpthreads.mk @@ -0,0 +1,30 @@ +# This file is part of MXE. +# See index.html for further information. + +PKG := winpthreads +$(PKG)_IGNORE := +$(PKG)_CHECKSUM := d86e21b33eea05ff2c27b428eaab679d7ab3b08e +$(PKG)_SUBDIR := tonytheodore-$(PKG)-$($(PKG)_VERSION) +$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz +$(PKG)_URL := https://github.com/tonytheodore/$(PKG)/tarball/$($(PKG)_VERSION)/$(PKG)_FILE +$(PKG)_DEPS := gcc + +define $(PKG)_UPDATE + echo 'info: sync latest winpthreads with git svn rebase; git push origin master' >&2; + $(WGET) -q -O- 'https://github.com/tonytheodore/$(PKG)/commits/master' | \ + $(SED) -n 's#.*\([^<]\{7\}\)[^<]\{3\}<.*#\1#p' | \ + head -1 +endef + +define $(PKG)_BUILD_mingw-w64 + cd '$(1)' && ./configure \ + $(LINK_STYLE) \ + --host='$(TARGET)' \ + --prefix='$(PREFIX)/$(TARGET)' + $(MAKE) -C '$(1)' -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)