This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Mon, 8 Sep 2014 16:52:55 -0700
Subject: [PATCH 1/6] configure: Define POCO_STATIC when --static is requested


diff --git a/configure b/configure
index 1111111..2222222 100755
--- a/configure
+++ b/configure
@@ -189,6 +189,7 @@ while [ "$1" != "" ] ; do
 
 	if [ "$1" = "--static" ] ; then
 		static=1
+		flags="$flags -DPOCO_STATIC"
 	fi
 	
 	if [ "$1" = "--shared" ] ; then

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Mon, 8 Sep 2014 17:09:19 -0700
Subject: [PATCH 2/6] Config.h: Add prototype for POCO_STATIC


diff --git a/Foundation/include/Poco/Config.h b/Foundation/include/Poco/Config.h
index 1111111..2222222 100644
--- a/Foundation/include/Poco/Config.h
+++ b/Foundation/include/Poco/Config.h
@@ -48,6 +48,10 @@
 // #define POCO_NO_AUTOMATIC_LIBS
 
 
+// Define on Windows for static linking
+// #define POCO_STATIC
+
+
 // Define to disable FPEnvironment support
 // #define POCO_NO_FPENVIRONMENT
 

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Mon, 8 Sep 2014 16:27:42 -0700
Subject: [PATCH 3/6] Types.h: Fix Win64 on MinGW


diff --git a/Foundation/include/Poco/Types.h b/Foundation/include/Poco/Types.h
index 1111111..2222222 100644
--- a/Foundation/include/Poco/Types.h
+++ b/Foundation/include/Poco/Types.h
@@ -77,16 +77,24 @@ namespace Poco {
 	typedef unsigned short         UInt16;
 	typedef signed int             Int32;
 	typedef unsigned int           UInt32;
-	typedef signed long            IntPtr;
-	typedef unsigned long          UIntPtr;
-	#if defined(__LP64__)
+	#if defined(_WIN64)
 		#define POCO_PTR_IS_64_BIT 1
-		#define POCO_LONG_IS_64_BIT 1
-		typedef signed long        Int64;
-		typedef unsigned long      UInt64;
-	#else
+		typedef signed long long   IntPtr;
+		typedef unsigned long long UIntPtr;
 		typedef signed long long   Int64;
 		typedef unsigned long long UInt64;
+	#else
+		typedef signed long        IntPtr;
+		typedef unsigned long      UIntPtr;
+		#if defined(__LP64__)
+			#define POCO_PTR_IS_64_BIT 1
+			#define POCO_LONG_IS_64_BIT 1
+			typedef signed long        Int64;
+			typedef unsigned long      UInt64;
+		#else
+			typedef signed long long   Int64;
+			typedef unsigned long long UInt64;
+		#endif
 	#endif
 	#define POCO_HAVE_INT64 1
 #elif defined(__DECCXX)

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Sun, 16 Nov 2014 09:14:22 -0800
Subject: [PATCH 4/6] Environment: Fix winsock2.h include

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

diff --git a/Foundation/src/Environment_WIN32.cpp b/Foundation/src/Environment_WIN32.cpp
index 1111111..2222222 100644
--- a/Foundation/src/Environment_WIN32.cpp
+++ b/Foundation/src/Environment_WIN32.cpp
@@ -39,6 +39,7 @@
 #include <sstream>
 #include <cstring>
 #include "Poco/UnWindows.h"
+#include <winsock2.h>
 #include <iphlpapi.h>
 
 

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 17 Sep 2018 16:56:11 +0200
Subject: [PATCH 5/6] build fix related to pcre


diff --git a/Foundation/include/Poco/RegularExpression.h b/Foundation/include/Poco/RegularExpression.h
index 1111111..2222222 100644
--- a/Foundation/include/Poco/RegularExpression.h
+++ b/Foundation/include/Poco/RegularExpression.h
@@ -47,6 +47,9 @@
 #include <vector>
 
 
+#if defined(POCO_UNBUNDLED)
+#include <pcre.h>
+#else
 //
 // Copy these definitions from pcre.h
 // to avoid pulling in the entire header file
@@ -57,7 +60,7 @@ extern "C"
 	typedef struct real_pcre pcre;
 	struct pcre_extra;
 }
-
+#endif
 
 namespace Poco {
 
diff --git a/Foundation/src/RegularExpression.cpp b/Foundation/src/RegularExpression.cpp
index 1111111..2222222 100644
--- a/Foundation/src/RegularExpression.cpp
+++ b/Foundation/src/RegularExpression.cpp
@@ -37,9 +37,7 @@
 #include "Poco/RegularExpression.h"
 #include "Poco/Exception.h"
 #include <sstream>
-#if defined(POCO_UNBUNDLED)
-#include <pcre.h>
-#else
+#ifndef POCO_UNBUNDLED
 #include "pcre.h"
 #endif
 

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 17 Sep 2018 17:05:03 +0200
Subject: [PATCH 6/6] drop obsolete -mno-cygwin


diff --git a/build/config/MinGW-CrossEnv b/build/config/MinGW-CrossEnv
index 1111111..2222222 100644
--- a/build/config/MinGW-CrossEnv
+++ b/build/config/MinGW-CrossEnv
@@ -23,7 +23,7 @@ CXX     = $(CROSSENV)-g++
 LINK    = $(CXX)
 LIB     = $(CROSSENV)-ar -cr
 RANLIB  = $(CROSSENV)-ranlib
-SHLIB   = $(CXX) -shared -mno-cygwin -o $@ -Wl,--out-implib=$(dir $@)$(subst cyg,lib,$(basename $(notdir $@))).a
+SHLIB   = $(CXX) -shared -o $@ -Wl,--out-implib=$(dir $@)$(subst cyg,lib,$(basename $(notdir $@))).a
 SHLIBLN = $(POCO_BASE)/build/script/shlibln
 STRIP   = 
 DEP     = $(POCO_BASE)/build/script/makedepend.gcc 
@@ -68,7 +68,7 @@ RELEASEOPT_LINK = -O2
 #
 # System Specific Flags
 #
-SYSFLAGS = -mno-cygwin -D_WIN32 -DMINGW32 -DWINVER=0x500 -DPOCO_NO_FPENVIRONMENT -DPCRE_STATIC -DPOCO_THREAD_STACK_SIZE -DFoundation_Config_INCLUDED
+SYSFLAGS = -D_WIN32 -DMINGW32 -DWINVER=0x500 -DPOCO_NO_FPENVIRONMENT -DPCRE_STATIC -DPOCO_THREAD_STACK_SIZE -DFoundation_Config_INCLUDED
 
 #
 # System Specific Libraries
