From 5da81682638fb00f9250c442ecc413b2984dce4e Mon Sep 17 00:00:00 2001
From: Tony Theodore
Date: Sat, 4 Feb 2017 21:33:53 +1100
Subject: allow non-default exception handling targets
---
Makefile | 20 +++++++++++++++++++-
README.md | 7 +++++++
docs/index.html | 4 ++++
src/gcc.mk | 4 +++-
4 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 68b0fb6..ed91454 100644
--- a/Makefile
+++ b/Makefile
@@ -87,8 +87,26 @@ MXE_CONFIGURE_OPTS = \
--disable-static --enable-shared ) \
$(MXE_DISABLE_DOC_OPTS)
+# GCC threads and exceptions
MXE_GCC_THREADS = \
- $(if $(findstring posix,$(TARGET)),posix,win32)
+ $(if $(findstring posix,$(or $(TARGET),$(1))),posix,win32)
+
+# allowed exception handling for targets
+# default (first item) and alternate, revisit if gcc/mingw-w64 change defaults
+i686-w64-mingw32_EH := sjlj dw2
+x86_64-w64-mingw32_EH := seh sjlj
+
+# functions to determine exception handling from user-specified target
+# $(or $(TARGET),$(1)) allows use as both function and inline snippet
+TARGET_EH_LIST = $($(firstword $(call split,.,$(or $(TARGET),$(1))))_EH)
+DEFAULT_EH = $(firstword $(TARGET_EH_LIST))
+GCC_EXCEPTIONS = \
+ $(lastword $(DEFAULT_EH) \
+ $(filter $(TARGET_EH_LIST),$(call split,.,$(or $(TARGET),$(1)))))
+MXE_GCC_EXCEPTION_OPTS = \
+ $(if $(call seq,sjlj,$(GCC_EXCEPTIONS)),--enable-sjlj-exceptions) \
+ $(if $(call seq,dw2,$(GCC_EXCEPTIONS)),--disable-sjlj-exceptions)
+
# Append these to the "make" and "make install" steps of autotools packages
# in order to neither build nor install unwanted binaries, manpages,
diff --git a/README.md b/README.md
index 16b4d45..37c4a20 100644
--- a/README.md
+++ b/README.md
@@ -33,5 +33,12 @@ various target platforms, which:
* GCC Threading Libraries (`winpthreads` is always available):
- win32
- [posix (experimental)](https://github.com/mxe/mxe/pull/958)
+ * GCC Exception Handling:
+ - Default
+ - i686: sjlj
+ - x86_64: seh
+ - [Alternatives (experimental)](https://github.com/mxe/mxe/pull/1664)
+ - i686: dw2
+ - x86_64: sjlj
Please see [mxe.cc](http://mxe.cc/) for further information and package support matrix.
diff --git a/docs/index.html b/docs/index.html
index 6b298ba..b2961d3 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -163,6 +163,10 @@
Experimental support for GCC with posix threads was
added in November 2015.
+
+ Experimental support for alternate GCC Exception Handling was
+ added in February 2017.
+
diff --git a/src/gcc.mk b/src/gcc.mk
index 31e8d28..5186555 100644
--- a/src/gcc.mk
+++ b/src/gcc.mk
@@ -37,6 +37,7 @@ define $(PKG)_CONFIGURE
--without-x \
--disable-win32-registry \
--enable-threads=$(MXE_GCC_THREADS) \
+ $(MXE_GCC_EXCEPTION_OPTS) \
--enable-libgomp \
--with-gmp='$(PREFIX)/$(BUILD)' \
--with-isl='$(PREFIX)/$(BUILD)' \
@@ -45,7 +46,8 @@ define $(PKG)_CONFIGURE
--with-as='$(PREFIX)/bin/$(TARGET)-as' \
--with-ld='$(PREFIX)/bin/$(TARGET)-ld' \
--with-nm='$(PREFIX)/bin/$(TARGET)-nm' \
- $(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'")
+ $(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'") \
+ $($(PKG)_CONFIGURE_OPTS)
endef
define $(PKG)_BUILD_mingw-w64
--
cgit v0.12
From b8850b2bd0dcedf15c1982b320e4b90139e86492 Mon Sep 17 00:00:00 2001
From: Tony Theodore
Date: Tue, 7 Feb 2017 14:36:23 +1100
Subject: Makefile: add [POSIX | WIN32]_THREADS variable
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index ed91454..6fb880e 100644
--- a/Makefile
+++ b/Makefile
@@ -570,6 +570,7 @@ build-only-$(1)_$(3): PKG = $(1)
build-only-$(1)_$(3): TARGET = $(3)
build-only-$(1)_$(3): BUILD_$(if $(findstring shared,$(3)),SHARED,STATIC) = TRUE
build-only-$(1)_$(3): BUILD_$(if $(call seq,$(TARGET),$(BUILD)),NATIVE,CROSS) = TRUE
+build-only-$(1)_$(3): $(if $(findstring posix,$(TARGET)),POSIX,WIN32)_THREADS = TRUE
build-only-$(1)_$(3): LIB_SUFFIX = $(if $(findstring shared,$(3)),dll,a)
build-only-$(1)_$(3): BITS = $(if $(findstring x86_64,$(3)),64,32)
build-only-$(1)_$(3): BUILD_TYPE = $(if $(findstring debug,$(3) $($(1)_CONFIGURE_OPTS)),debug,release)
--
cgit v0.12
From 1020d040db43dc10ee1f37a8377030c4a124beaf Mon Sep 17 00:00:00 2001
From: Tony Theodore
Date: Tue, 7 Feb 2017 14:37:04 +1100
Subject: apr: fix posix build and use SOURCE_DIR etc.
---
src/apr.mk | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/apr.mk b/src/apr.mk
index d2d845b..08b9bf2 100644
--- a/src/apr.mk
+++ b/src/apr.mk
@@ -19,18 +19,23 @@ define $(PKG)_UPDATE
endef
define $(PKG)_BUILD
- cp -Rp '$(1)' '$(1).native'
- cd '$(1).native' && ./configure
- cd '$(1).native' && $(MAKE) tools/gen_test_char \
- CFLAGS='-DNEED_ENHANCED_ESCAPES'
- cd '$(1)' && ./configure \
+ # native build for gen_test_char
+ mkdir '$(BUILD_DIR).native'
+ cd '$(BUILD_DIR).native' && '$(SOURCE_DIR)/configure'
+ $(MAKE) -C '$(BUILD_DIR).native' tools/gen_test_char \
+ CFLAGS='-DNEED_ENHANCED_ESCAPES' -j '$(JOBS)'
+
+ # cross build
+ cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
$(MXE_CONFIGURE_OPTS) \
ac_cv_sizeof_off_t=4 \
ac_cv_sizeof_pid_t=4 \
ac_cv_sizeof_size_t=4 \
ac_cv_sizeof_ssize_t=4 \
+ $(if $(POSIX_THREADS),apr_cv_mutex_robust_shared=yes) \
CFLAGS=-D_WIN32_WINNT=0x0500
- $(MAKE) -C '$(1)' -j 1 install GEN_TEST_CHAR='$(1).native/tools/gen_test_char'
+ $(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)' GEN_TEST_CHAR='$(BUILD_DIR).native/tools/gen_test_char'
+ $(MAKE) -C '$(BUILD_DIR)' -j 1 install
ln -sf '$(PREFIX)/$(TARGET)/bin/apr-1-config' '$(PREFIX)/bin/$(TARGET)-apr-1-config'
endef
--
cgit v0.12
From bf6a78224b8d6a4958e2221d3ccc97056d87feeb Mon Sep 17 00:00:00 2001
From: Tony Theodore
Date: Wed, 8 Feb 2017 12:38:20 +1100
Subject: libmysqlclient: fix redefinition of pthreads functions
---
src/libmysqlclient-1-fixes.patch | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/libmysqlclient-1-fixes.patch b/src/libmysqlclient-1-fixes.patch
index 6b83ceb..121de67 100644
--- a/src/libmysqlclient-1-fixes.patch
+++ b/src/libmysqlclient-1-fixes.patch
@@ -450,3 +450,23 @@ index 1111111..2222222 100644
#include "mysys_priv.h"
#include
#include
+
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Tony Theodore
+Date: Wed, 8 Feb 2017 11:51:42 +1100
+Subject: [PATCH] only define localtime_r and gmtime_r when pthreads isn't used
+
+
+diff --git a/include/my_global.h b/include/my_global.h
+index 1111111..2222222 100644
+--- a/include/my_global.h
++++ b/include/my_global.h
+@@ -629,7 +629,7 @@ enum loglevel {
+ };
+
+
+-#ifdef _WIN32
++#if defined(_WIN32) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS)
+ /****************************************************************************
+ ** Replacements for localtime_r and gmtime_r
+ ****************************************************************************/
--
cgit v0.12