From def90185aa129af4e25a6ee3aa4062738d68d083 Mon Sep 17 00:00:00 2001 From: Chris Johnson Date: Thu, 21 Feb 2008 09:08:44 +0000 Subject: [PATCH] Added build support for stock MinGW/MSYS build of POCO. Components now supported by default: Foundation {including internal PCRE lib} Util Net XML SQL SQL/ODBC SQL/SQLite samples/{all components supported} Components supported with additional 3rd party MinGW/MSYS libs: NetSSL w/OpenSSH Components unsupported at this time: testsuite: Fails to build due to TupleTest - needs slight code change MinGW can't deal with currently. Only thing causing failure. CppUnit: Unable to support this due to WIN32 version of this functionality relying on MFC which does not ship with MinGW/MSYS. --no-wstring support due libstdc++ - will require STLPort {support coming soon} :build/config/MinGW +Fixed compiler environment flags and switches +Linkage build supports: SHARED, STATIC, or BOTH +Fixed duplicate symbol/unresolved symbol during compile +Added PCRE build flag for internal library build/eliminate link errors +Disable support of UTF-8 by default, MinGW will require STLPort +Corrected system link libs for MinGW "dumb" linker :build/rules/global +Added MinGW environment deduction logic :configure +Fine tuned environment deduction recognizing MinGW as valid :Data/ODBC/Makefile +Fixed correct ODBC libs to link :Foundation/Makefile +Added logic for building correct subsystem dependency :Util/Makefile +Added logic for building correct subsystem dependency --- Data/ODBC/Makefile | 4 ++++ Foundation/Makefile | 8 +++++++- Util/Makefile | 4 ++++ build/config/MinGW | 20 +++++++++++--------- build/rules/global | 6 +++++- configure | 9 ++++++++- 6 files changed, 39 insertions(+), 12 deletions(-) diff --git a/Data/ODBC/Makefile b/Data/ODBC/Makefile index cc6b3af38..38d4f3670 100644 --- a/Data/ODBC/Makefile +++ b/Data/ODBC/Makefile @@ -14,6 +14,9 @@ include $(POCO_BASE)/build/rules/global +ifeq ($(POCO_CONFIG),MinGW) +SYSLIBS += -lodbc32 +else ifeq (0, $(shell test -e /usr/lib/libodbc$(SHAREDLIBLINKEXT); echo $$?)) SYSLIBS += -lodbc -lodbcinst COMMONFLAGS += -DPOCO_UNIXODBC @@ -25,6 +28,7 @@ else $(error No ODBC library found. Please install unixODBC or iODBC and try again) endif endif +endif objects = Binder ConnectionHandle Connector EnvironmentHandle \ Extractor ODBCMetaColumn ODBCException ODBCStatementImpl \ diff --git a/Foundation/Makefile b/Foundation/Makefile index 3d1473c73..5dc0a844e 100644 --- a/Foundation/Makefile +++ b/Foundation/Makefile @@ -23,7 +23,7 @@ objects = ArchiveStrategy ASCIIEncoding AsyncChannel Base64Decoder Base64Encoder RegularExpression RefCountedObject Runnable RotateStrategy Condition \ SHA1Engine Semaphore SharedLibrary SimpleFileChannel \ SignalHandler SplitterChannel Stopwatch StreamChannel StreamConverter StreamCopier \ - StreamTokenizer String StringTokenizer SynchronizedObject SyslogChannel \ + StreamTokenizer String StringTokenizer SynchronizedObject \ Task TaskManager TaskNotification TeeStream Hash HashStatistic \ TemporaryFile TextConverter TextEncoding TextIterator Thread ThreadLocal \ ThreadPool ActiveDispatcher Timer Timespan Timestamp Timezone Token URI \ @@ -38,6 +38,12 @@ objects = ArchiveStrategy ASCIIEncoding AsyncChannel Base64Decoder Base64Encoder pcre_tables pcre_try_flipped pcre_ucp_searchfuncs pcre_valid_utf8 \ pcre_exec pcre_ord2utf8 pcre_newline pcre_fullinfo pcre_xclass +ifeq ($(POCO_CONFIG),MinGW) + objects += EventLogChannel WindowsConsoleChannel +else + objects += SyslogChannel +endif + target = PocoFoundation target_version = $(LIBVERSION) target_libs = diff --git a/Util/Makefile b/Util/Makefile index f3de4e9db..9bc28f61b 100644 --- a/Util/Makefile +++ b/Util/Makefile @@ -16,6 +16,10 @@ objects = AbstractConfiguration Application ConfigurationMapper \ XMLConfiguration FilesystemConfiguration ServerApplication \ Validator IntValidator RegExpValidator OptionCallback +ifeq ($(POCO_CONFIG),MinGW) + objects += WinService +endif + target = PocoUtil target_version = $(LIBVERSION) target_libs = PocoFoundation PocoXML diff --git a/build/config/MinGW b/build/config/MinGW index 5d9bd3757..d3dd9d962 100644 --- a/build/config/MinGW +++ b/build/config/MinGW @@ -9,7 +9,7 @@ # # General Settings # -LINKMODE = SHARED +LINKMODE = BOTH POCO_TARGET_OSNAME = MinGW POCO_TARGET_OSARCH = ia32 @@ -36,24 +36,26 @@ MKDIR = mkdir -p SHAREDLIBEXT = .dll SHAREDLIBLINKEXT = .dll +BINEXT = .exe + # # Compiler and Linker Flags # -CFLAGS = +CFLAGS = CFLAGS32 = CFLAGS64 = -CXXFLAGS = +CXXFLAGS = CXXFLAGS32 = CXXFLAGS64 = -LINKFLAGS = +LINKFLAGS = -Wl,--allow-multiple-definition LINKFLAGS32 = LINKFLAGS64 = STATICOPT_CC = STATICOPT_CXX = STATICOPT_LINK = -static -SHAREDOPT_CC = -SHAREDOPT_CXX = -SHAREDOPT_LINK = +SHAREDOPT_CC = +SHAREDOPT_CXX = +SHAREDOPT_LINK = -shared DEBUGOPT_CC = -g -D_DEBUG DEBUGOPT_CXX = -g -D_DEBUG DEBUGOPT_LINK = -g @@ -64,9 +66,9 @@ RELEASEOPT_LINK = -O2 # # System Specific Flags # -SYSFLAGS = -mno-cygwin -D_WIN32 -DPOCO_NO_FPENVIRONMENT +SYSFLAGS = -mno-cygwin -D_WIN32 -DPOCO_NO_FPENVIRONMENT -DPCRE_STATIC -DFoundation_Config_INCLUDED # # System Specific Libraries # -SYSLIBS = -liphlpapi +SYSLIBS = -liphlpapi -lws2_32 -lssl -lcrypto -lws2_32 -lgdi32 diff --git a/build/rules/global b/build/rules/global index a4bc4ace0..1949cdc57 100644 --- a/build/rules/global +++ b/build/rules/global @@ -51,6 +51,10 @@ ifeq ($(findstring CYGWIN,$(POCO_HOST_OSNAME)),CYGWIN) POCO_HOST_OSNAME = CYGWIN endif +ifeq ($(findstring MINGW,$(POCO_HOST_OSNAME)),MINGW) +POCO_HOST_OSNAME = MinGW +endif + # # If POCO_CONFIG is not set, use the OS name as configuration name # @@ -189,7 +193,7 @@ LIBRARY = -L$(LIBPATH) $(POCO_LIBRARY) ifeq ($(strip $(STRIP)),) STRIPCMD = else -STRIPCMD = $(STRIP) $@ +STRIPCMD = $(STRIP) $@* endif # diff --git a/configure b/configure index a93a6f90c..d9751e1c9 100755 --- a/configure +++ b/configure @@ -72,12 +72,19 @@ while [ "$1" != "" ] ; do shift done +# autodetect build environment +# ...special cases for CYGWIN or MinGW if [ "$config" = "" ] ; then config=`uname` cyg=`expr $config : '\(CYGWIN\).*'` if [ "$cyg" = "CYGWIN" ] ; then config=CYGWIN - fi + else + ming=`expr $config : '\(MINGW\).*'` + if [ "$ming" = "MINGW" ] ; then + config=MinGW + fi + fi fi if [ ! -f "$base/build/config/$config" ] ; then