diff --git a/Foundation/testsuite/src/SharedMemoryTest.cpp b/Foundation/testsuite/src/SharedMemoryTest.cpp index 1172239e1..83dc02dfb 100644 --- a/Foundation/testsuite/src/SharedMemoryTest.cpp +++ b/Foundation/testsuite/src/SharedMemoryTest.cpp @@ -9,7 +9,6 @@ // SPDX-License-Identifier: BSL-1.0 // - #include "SharedMemoryTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" @@ -35,7 +34,7 @@ SharedMemoryTest::~SharedMemoryTest() void SharedMemoryTest::testCreate() { SharedMemory mem("hi", 4096, SharedMemory::AM_WRITE); - assert (mem.end()-mem.begin() == 4096); + assert (mem.end()- mem.begin() == 4096); mem.begin()[0] = 'A'; mem.end()[-1] = 'Z'; } @@ -89,8 +88,9 @@ CppUnit::Test* SharedMemoryTest::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("SharedMemoryTest"); +#if !defined(POCO_NO_SHAREDMEMORY) CppUnit_addTest(pSuite, SharedMemoryTest, testCreate); CppUnit_addTest(pSuite, SharedMemoryTest, testCreateFromFile); - +#endif return pSuite; } diff --git a/Foundation/testsuite/src/TimedNotificationQueueTest.cpp b/Foundation/testsuite/src/TimedNotificationQueueTest.cpp index 7204c9830..78356da96 100644 --- a/Foundation/testsuite/src/TimedNotificationQueueTest.cpp +++ b/Foundation/testsuite/src/TimedNotificationQueueTest.cpp @@ -16,11 +16,13 @@ #include "Poco/TimedNotificationQueue.h" #include "Poco/Notification.h" #include "Poco/Timestamp.h" +#include "Poco/Clock.h" using Poco::TimedNotificationQueue; using Poco::Notification; using Poco::Timestamp; +using Poco::Clock; namespace @@ -71,13 +73,13 @@ void TimedNotificationQueueTest::testDequeue() assert (queue.size() == 0); pNf->release(); - Poco::Timestamp ts1; + Poco::Clock ts1; ts1 += 100000; - Poco::Timestamp ts2; + Poco::Clock ts2; ts2 += 200000; - Poco::Timestamp ts3; + Poco::Clock ts3; ts3 += 300000; - Poco::Timestamp ts4; + Poco::Clock ts4; ts4 += 400000; queue.enqueueNotification(new QTestNotification("first"), ts1); diff --git a/Makefile b/Makefile index 51b2c17a1..0fbf2be11 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,36 @@ endif LIBPREFIX ?= lib +# +# Determine OS +# +POCO_HOST_OSNAME = $(shell uname) +ifeq ($(findstring CYGWIN,$(POCO_HOST_OSNAME)),CYGWIN) +ifeq ($(findstring x86_64,$(POCO_HOST_OSNAME)),x86_64) +OSARCH_64BITS = 1 +endif +POCO_HOST_OSNAME = Cygwin +endif + +ifeq ($(findstring MINGW,$(POCO_HOST_OSNAME)),MINGW) +POCO_HOST_OSNAME = MinGW +endif +POCO_HOST_OSARCH ?= $(subst /,-,$(shell uname -m | tr ' ' _)) + +# +# Determine operating system +# +ifndef POCO_TARGET_OSNAME +OSNAME := $(POCO_HOST_OSNAME) +else +OSNAME := $(POCO_TARGET_OSNAME) +endif +ifndef POCO_TARGET_OSARCH +OSARCH := $(POCO_HOST_OSARCH) +else +OSARCH := $(POCO_TARGET_OSARCH) +endif + .PHONY: poco all libexecs cppunit tests samples cleans clean distclean install # TESTS and SAMPLES are set in config.make @@ -49,8 +79,12 @@ install: libexecs find $(POCO_BUILD)/$$comp/bin -perm -700 -type f -exec cp -f {} $(INSTALLDIR)/bin \; ; \ fi ; \ done - find $(POCO_BUILD)/lib -name "$(LIBPREFIX)Poco*" -type f -exec cp -f {} $(INSTALLDIR)/lib \; - find $(POCO_BUILD)/lib -name "$(LIBPREFIX)Poco*" -type l -exec cp -Rf {} $(INSTALLDIR)/lib \; +ifeq ($(OSNAME), Cygwin) + find $(POCO_BUILD)/lib/$(OSNAME)/$(OSARCH) -name "cygPoco*" -type f -exec cp -f {} $(INSTALLDIR)/bin \; + find $(POCO_BUILD)/lib/$(OSNAME)/$(OSARCH) -name "cygPoco*" -type l -exec cp -Rf {} $(INSTALLDIR)/bin \; +endif + find $(POCO_BUILD)/lib/$(OSNAME)/$(OSARCH) -name "libPoco*" -type f -exec cp -f {} $(INSTALLDIR)/lib \; + find $(POCO_BUILD)/lib/$(OSNAME)/$(OSARCH) -name "libPoco*" -type l -exec cp -Rf {} $(INSTALLDIR)/lib \; libexecs = Foundation-libexec XML-libexec JSON-libexec Util-libexec Net-libexec Crypto-libexec NetSSL_OpenSSL-libexec Data-libexec Data/SQLite-libexec Data/ODBC-libexec Data/MySQL-libexec MongoDB-libexec Zip-libexec PageCompiler-libexec PageCompiler/File2Page-libexec CppParser-libexec PDF-libexec tests = Foundation-tests XML-tests JSON-tests Util-tests Net-tests Crypto-tests NetSSL_OpenSSL-tests Data-tests Data/SQLite-tests Data/ODBC-tests Data/MySQL-tests MongoDB-tests Zip-tests CppParser-tests PDF-tests diff --git a/PocoDoc/cfg/mkdoc-poco.xml b/PocoDoc/cfg/mkdoc-poco.xml index c9c7df9d7..3ae5021a8 100644 --- a/PocoDoc/cfg/mkdoc-poco.xml +++ b/PocoDoc/cfg/mkdoc-poco.xml @@ -32,6 +32,7 @@ ${Includes}, -I/usr/local/mysql/include, + -I/usr/include/mysql, -D_DEBUG, -E, -C, diff --git a/PocoDoc/cfg/mkdocumentation.xml b/PocoDoc/cfg/mkdocumentation.xml index 3fef56b23..235009294 100644 --- a/PocoDoc/cfg/mkdocumentation.xml +++ b/PocoDoc/cfg/mkdocumentation.xml @@ -33,6 +33,7 @@ ${Includes}, -I/usr/local/mysql/include, + -I/usr/include/mysql, -D_DEBUG, -E, -C, diff --git a/build/config/CYGWIN b/build/config/CYGWIN index afd1abd39..7bb8db07c 100644 --- a/build/config/CYGWIN +++ b/build/config/CYGWIN @@ -3,7 +3,7 @@ # # CYGWIN # -# Make settings for Cygwin on WinXP/gcc 3.4 +# Make settings for Cygwin # # @@ -36,15 +36,19 @@ LIBPREFIX = cyg SHAREDLIBEXT = .$(target_version).dll SHAREDLIBLINKEXT = .dll +IMPPREFIX = lib +IMPLIBEXT = -$(target_version).dll.a +IMPLIBLINKEXT = .dll.a + # # Compiler and Linker Flags # CFLAGS = -CFLAGS32 = -CFLAGS64 = -CXXFLAGS = -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY +CFLAGS32 = -O2 -pipe -Wimplicit-function-declaration +CFLAGS64 = -Wa,-mbig-obj +CXXFLAGS = -O2 -pipe -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_SHAREDMEMORY CXXFLAGS32 = -CXXFLAGS64 = +CXXFLAGS64 = -Wa,-mbig-obj LINKFLAGS = LINKFLAGS32 = LINKFLAGS64 = @@ -52,8 +56,8 @@ STATICOPT_CC = STATICOPT_CXX = STATICOPT_LINK = -static SHAREDOPT_CC = -SHAREDOPT_CXX = -SHAREDOPT_LINK = +SHAREDOPT_CXX = -frepo +SHAREDOPT_LINK = -frepo DEBUGOPT_CC = -g -D_DEBUG DEBUGOPT_CXX = -g -D_DEBUG DEBUGOPT_LINK = -g @@ -66,6 +70,11 @@ RELEASEOPT_LINK = # SYSFLAGS = -D_XOPEN_SOURCE=500 +# give visibility of old BSD typedef like u_short, u_int, u_long... +# used in some networking system includes, need when using PocoNet +SYSFLAGS += -D__BSD_VISIBLE + + # # System Specific Libraries # diff --git a/build/rules/compile b/build/rules/compile index 1945e3ca2..80d160b57 100644 --- a/build/rules/compile +++ b/build/rules/compile @@ -33,35 +33,35 @@ $(OBJPATH_RELEASE_STATIC) $(OBJPATH_DEBUG_STATIC) $(OBJPATH_RELEASE_SHARED) $(OB # # Rules for compiling # -$(OBJPATH_DEBUG_STATIC)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d +$(OBJPATH_DEBUG_STATIC)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(debug, static)" $(CXX) $(INCLUDE) $(CXXFLAGS) $(DEBUGOPT_CXX) $(STATICOPT_CXX) -c $< -o $@ -$(OBJPATH_RELEASE_STATIC)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d +$(OBJPATH_RELEASE_STATIC)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(release, static)" $(CXX) $(INCLUDE) $(CXXFLAGS) $(RELEASEOPT_CXX) $(STATICOPT_CXX) -c $< -o $@ -$(OBJPATH_DEBUG_STATIC)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d +$(OBJPATH_DEBUG_STATIC)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(debug, static)" $(CC) $(INCLUDE) $(CFLAGS) $(DEBUGOPT_CC) $(STATICOPT_CC) -c $< -o $@ -$(OBJPATH_RELEASE_STATIC)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d +$(OBJPATH_RELEASE_STATIC)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(release, static)" $(CC) $(INCLUDE) $(CFLAGS) $(RELEASEOPT_CC) $(STATICOPT_CC) -c $< -o $@ -$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d +$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(debug, shared)" $(CXX) $(INCLUDE) $(CXXFLAGS) $(DEBUGOPT_CXX) $(SHAREDOPT_CXX) -c $< -o $@ -$(OBJPATH_RELEASE_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d +$(OBJPATH_RELEASE_SHARED)/%.o: $(SRCDIR)/%.cpp $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(release, shared)" $(CXX) $(INCLUDE) $(CXXFLAGS) $(RELEASEOPT_CXX) $(SHAREDOPT_CXX) -c $< -o $@ -$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d +$(OBJPATH_DEBUG_SHARED)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(debug, shared)" $(CC) $(INCLUDE) $(CFLAGS) $(DEBUGOPT_CC) $(SHAREDOPT_CC) -c $< -o $@ -$(OBJPATH_RELEASE_SHARED)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d +$(OBJPATH_RELEASE_SHARED)/%.o: $(SRCDIR)/%.c $(DEPPATH)/%.d $(POCO_BASE)/build/config/$(POCO_CONFIG) @echo "** Compiling" $< "(release, shared)" $(CC) $(INCLUDE) $(CFLAGS) $(RELEASEOPT_CC) $(SHAREDOPT_CC) -c $< -o $@ diff --git a/build/rules/lib b/build/rules/lib index 8126f4af3..a49bf4d99 100644 --- a/build/rules/lib +++ b/build/rules/lib @@ -11,8 +11,10 @@ # ifdef target_version SHL_EXT = $(SHAREDLIBEXT) +IMP_EXT = $(IMPLIBEXT) else SHL_EXT = $(SHAREDLIBLINKEXT) +IMP_EXT = $(IMPLIBLINKEXT) endif LIB_RELEASE_STATIC = $(LIBPATH)/$(LIBPREFIX)$(target)$(OSARCH_POSTFIX).a @@ -22,6 +24,11 @@ LIB_DEBUG_SHARED = $(LIBPATH)/$(LIBPREFIX)$(target)d$(OSARCH_POSTFIX)$(SH LIB_RELEASE_SHARED_LINK = $(LIBPATH)/$(LIBPREFIX)$(target)$(OSARCH_POSTFIX)$(SHAREDLIBLINKEXT) LIB_DEBUG_SHARED_LINK = $(LIBPATH)/$(LIBPREFIX)$(target)d$(OSARCH_POSTFIX)$(SHAREDLIBLINKEXT) +IMP_RELEASE_SHARED = $(LIBPATH)/$(IMPPREFIX)$(target)$(OSARCH_POSTFIX)$(IMP_EXT) +IMP_DEBUG_SHARED = $(LIBPATH)/$(IMPPREFIX)$(target)d$(OSARCH_POSTFIX)$(IMP_EXT) +IMP_RELEASE_SHARED_LINK = $(LIBPATH)/$(IMPPREFIX)$(target)$(OSARCH_POSTFIX)$(IMPLIBLINKEXT) +IMP_DEBUG_SHARED_LINK = $(LIBPATH)/$(IMPPREFIX)$(target)d$(OSARCH_POSTFIX)$(IMPLIBLINKEXT) + TARGET_LIBS_DEBUG = $(foreach l,$(target_libs),-l$(l)d$(OSARCH_POSTFIX)) TARGET_LIBS_RELEASE = $(foreach l,$(target_libs),-l$(l)$(OSARCH_POSTFIX)) @@ -62,12 +69,18 @@ $(LIB_RELEASE_STATIC): $(foreach o,$(objects),$(OBJPATH_RELEASE_STATIC)/$(o).o) $(LIB_DEBUG_SHARED): $(foreach o,$(objects),$(OBJPATH_DEBUG_SHARED)/$(o).o) @echo "** Building shared library (debug)" $@ $(SHLIB) $(SHLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_DEBUG) $(SYSLIBS) +ifeq ($(OSNAME), CYGWIN) + $(SHLIBLN) $(IMP_DEBUG_SHARED) $(IMP_DEBUG_SHARED_LINK) +endif $(SHLIBLN) $(LIB_DEBUG_SHARED) $(LIB_DEBUG_SHARED_LINK) $(postbuild) $(LIB_RELEASE_SHARED): $(foreach o,$(objects),$(OBJPATH_RELEASE_SHARED)/$(o).o) @echo "** Building shared library (release)" $@ $(SHLIB) $(SHLIBFLAGS) $^ $(LIBRARY) $(TARGET_LIBS_RELEASE) $(SYSLIBS) +ifeq ($(OSNAME), CYGWIN) + $(SHLIBLN) $(IMP_RELEASE_SHARED) $(IMP_RELEASE_SHARED_LINK) +endif $(SHLIBLN) $(LIB_RELEASE_SHARED) $(LIB_RELEASE_SHARED_LINK) $(STRIPCMD) $(postbuild) diff --git a/build/script/runtests.sh b/build/script/runtests.sh index f541cda49..12cf6de4b 100755 --- a/build/script/runtests.sh +++ b/build/script/runtests.sh @@ -4,24 +4,59 @@ # # A script for running the POCO testsuites. # -# usage: runtests +# usage: runtests [component [test] ] # # If the environment variable EXCLUDE_TESTS is set, containing # a space-separated list of project names (as found in the # components file), these tests will be skipped. # +# Cygwin specific setup. +# ---------------------- +# On Cygwin, Unix IPC are provided by a separate process daemon +# named cygserver, which should be started once before running any +# test from Foundation. +# 1/ Open a separate Cygwin terminal with Administrator privilege +# 2/ run the command: cygserver-configure +# 3/ Start the cygserver: nohup /usr/sbin/cygserver & +# 4/ close the separate terminal +# 5/ run the Foundation tests: build/script/runtests.sh Foundation +# + +if [ "$POCO_BASE" = "" ] ; then + POCO_BASE=`pwd` +fi TESTRUNNER=./testrunner -TESTRUNNERARGS=-all -components=`cat $POCO_BASE/components` - -if [ "$OSNAME" = "" ] ; then - OSNAME=`uname` +if [ "$1" = "" ] ; then + components=`cat $POCO_BASE/components` +else + components=$1 fi + +if [ "$2" = "" ] ; then + TESTRUNNERARGS=-all +else + TESTRUNNERARGS=$2 +fi + if [ "$OSARCH" = "" ] ; then OSARCH=`uname -m | tr ' /' _-` fi + +if [ "$OSNAME" = "" ] ; then + OSNAME=`uname` + case $OSNAME in + CYGWIN*) + OSNAME=CYGWIN + TESTRUNNER=$TESTRUNNER.exe + PATH=$POCO_BASE/lib/$OSNAME/$OSARCH:$PATH + ;; + MINGW*) + OSNAME=MinGW ;; + esac +fi + BINDIR="bin/$OSNAME/$OSARCH/" runs=0 @@ -44,14 +79,14 @@ do echo "" echo "" echo "****************************************" - echo "*** $comp" + echo "*** $OSNAME $OSARCH $comp" echo "****************************************" echo "" runs=`expr $runs + 1` - sh -c "cd $POCO_BASE/$comp/testsuite/$BINDIR && $TESTRUNNER $TESTRUNNERARGS" + sh -c "cd $POCO_BASE/$comp/testsuite/$BINDIR && LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH $TESTRUNNER $TESTRUNNERARGS" if [ $? -ne 0 ] ; then - failues=`expr $failures + 1` + failures=`expr $failures + 1` failedTests="$failedTests $comp" status=1 fi diff --git a/cmake/DefinePlatformSpecifc.cmake b/cmake/DefinePlatformSpecifc.cmake index dec45e5d6..033cc902b 100644 --- a/cmake/DefinePlatformSpecifc.cmake +++ b/cmake/DefinePlatformSpecifc.cmake @@ -48,19 +48,23 @@ if(MSVC) else(MSVC) # Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment set(STATIC_POSTFIX "" CACHE STRING "Set static library postfix" FORCE) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") endif(MSVC) + + # Add a d postfix to the debug libraries if(POCO_STATIC) set(CMAKE_DEBUG_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set Debug library postfix" FORCE) set(CMAKE_RELEASE_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set Release library postfix" FORCE) set(CMAKE_MINSIZEREL_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set MinSizeRel library postfix" FORCE) - set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) + set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) else(POCO_STATIC) set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set Debug library postfix" FORCE) set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set Release library postfix" FORCE) set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "Set MinSizeRel library postfix" FORCE) - set(CMAKE_RELWITHDEBINFO_POSTFIX "d" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) + set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) endif() @@ -72,23 +76,28 @@ if(WIN32) add_definitions( -DPOCO_OS_FAMILY_WINDOWS -DUNICODE -D_UNICODE -D__LCC__) #__LCC__ define used by MySQL.h endif(WIN32) -if (UNIX AND NOT ANDROID ) - add_definitions( -DPOCO_OS_FAMILY_UNIX ) - # Standard 'must be' defines - if (APPLE) - add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64) - set(SYSLIBS dl) - else (APPLE) - add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ) - if (QNX) - add_definitions( -DPOCO_HAVE_FD_POLL) - set(SYSLIBS m socket) - else (QNX) - add_definitions( -D_XOPEN_SOURCE=500 -DPOCO_HAVE_FD_EPOLL) - set(SYSLIBS pthread dl rt) - endif (QNX) - endif (APPLE) -endif(UNIX AND NOT ANDROID ) +if (CYGWIN) + add_definitions(-DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING) + add_definitions(-D_XOPEN_SOURCE=500 -D__BSD_VISIBLE) +else (CYGWIN) + if (UNIX AND NOT ANDROID ) + add_definitions( -DPOCO_OS_FAMILY_UNIX ) + # Standard 'must be' defines + if (APPLE) + add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64) + set(SYSLIBS dl) + else (APPLE) + add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ) + if (QNX) + add_definitions( -DPOCO_HAVE_FD_POLL) + set(SYSLIBS m socket) + else (QNX) + add_definitions( -D_XOPEN_SOURCE=500 -DPOCO_HAVE_FD_EPOLL) + set(SYSLIBS pthread dl rt) + endif (QNX) + endif (APPLE) + endif(UNIX AND NOT ANDROID ) +endif (CYGWIN) if (CMAKE_SYSTEM MATCHES "SunOS") add_definitions( -DPOCO_OS_FAMILY_UNIX ) @@ -102,10 +111,6 @@ if (CMAKE_COMPILER_IS_MINGW) add_definitions(-D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE) endif (CMAKE_COMPILER_IS_MINGW) -if (CYGWIN) -# add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8) -endif (CYGWIN) - # SunPro C++ if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") add_definitions( -D_BSD_SOURCE -library=stlport4) diff --git a/poco.cygport.txt b/poco.cygport.txt new file mode 100644 index 000000000..7ca8fb650 --- /dev/null +++ b/poco.cygport.txt @@ -0,0 +1,284 @@ +# poco.cygport +NAME="poco" +VERSION=1.6.1 +RELEASE=1 +SUMMARY="A set of C++ class libraries for network-centric applications." +DESCRIPTION="The POCO C++ Libraries (POCO stands for POrtable COmponents) are open source C++ class libraries that simplify and accelerate the development of network-centric, portable applications in C++. The POCO C++ Libraries are built strictly on standard ANSI/ISO C++, including the standard library." +CATEGORY="Devel" + +MAJOR_VERSION="${VERSION/p[0-9]*/}" + +HOMEPAGE="http://pocoproject.org/" +SRC_URI="http://pocoproject.org/releases/poco-${MAJOR_VERSION}/poco-${VERSION}-all.tar.bz2 +http://pocoproject.org/releases/poco-${MAJOR_VERSION}/poco-${VERSION}-all-doc.tar.gz" +SRC_DIR="poco-${VERSION}-all" + + +############################################################################# +# Determine the POCO library version. This is contained in the 'libversion' +# file in the sources - but we might not have downloaded those yet. So get +# the library version number direct from github. +LIBRARY_VERSION=$(wget --quiet --no-check-certificate --output-document=- https://raw.github.com/pocoproject/poco/poco-${VERSION}-release/libversion) +############################################################################# + + +############################################################################# +# This cygport file produces four packages: the main 'libpoco' package +# contains the binaries necessary to run applications built with the POCO +# library; 'libpoco-devel' contains the header files and libs necessary to +# build applications that use the POCO library; 'libpoco-doc' contains the +# documentation for the POCO API in HTML format; 'poco' contains the +# PageCompiler component. +PKG_NAMES="poco libpoco${LIBRARY_VERSION} libpoco-devel libpoco-doc" +############################################################################# + + +############################################################################# +# Details for the 'poco' package. +poco_CONTENTS="--exclude=html usr/bin/*.exe usr/share" +poco_SUMMARY="The PageCompiler POCO component." +poco_DESCRIPTION="${DESCRIPTION} This package contains the PageCompiler component of POCO." +poco_CATEGORY="Devel" +############################################################################# + + +############################################################################# +# Details for the main 'libpoco' package. +declare libpoco${LIBRARY_VERSION}_SUMMARY="A set of C++ class libraries for network-centric applications." +declare libpoco${LIBRARY_VERSION}_DESCRIPTION="${DESCRIPTION}" +declare libpoco${LIBRARY_VERSION}_CATEGORY="Devel" +declare libpoco${LIBRARY_VERSION}_CONTENTS="usr/bin/*.dll" +############################################################################# + + +############################################################################# +# Details for the 'libpoco-devel' package. Note that POCO provides versions +# of expat, zlib, sqlite3 and pcre, but we delete these and use the +# equivalent Cygwin libraries. Hence the 'libpoco-devel' package has a +# couple of extra '-devel' dependencies. +libpoco_devel_SUMMARY="Headers for developing programs that will use POCO." +libpoco_devel_DESCRIPTION="${DESCRIPTION} This package contains the header files needed for developing POCO applications." +libpoco_devel_CATEGORY="Devel" +libpoco_devel_REQUIRES="libexpat-devel zlib-devel" +libpoco_devel_CONTENTS="usr/include usr/lib" +############################################################################# + + +############################################################################# +# Details for the 'libpoco-doc' package. This contains the documentation from +# the 'doc' source package. This is unaltered, and will contain documentation +# for any POCO libraries that aren't built due to missing dependencies. +libpoco_doc_SUMMARY="The POCO API reference documentation." +libpoco_doc_DESCRIPTION="${DESCRIPTION} This is the complete POCO class library reference documentation in HTML format." +libpoco_doc_CATEGORY="Devel" +libpoco_doc_CONTENTS="usr/share/doc/poco/html" +############################################################################# + + +############################################################################# +# Remove the versions of expat, zlib, sqlite3 and pcre that come bundled with +# POCO. We compile and link against the corresponding Cygwin packages +# instead. +DISTCLEANFILES=" + Foundation/include/Poco/zconf.h + Foundation/include/Poco/zlib.h + Foundation/src/adler32.c + Foundation/src/compress.c + Foundation/src/crc32.c + Foundation/src/crc32.h + Foundation/src/deflate.c + Foundation/src/deflate.h + Foundation/src/gzguts.h + Foundation/src/infback.c + Foundation/src/inffast.c + Foundation/src/inffast.h + Foundation/src/inffixed.h + Foundation/src/inflate.c + Foundation/src/inflate.h + Foundation/src/inftrees.c + Foundation/src/inftrees.h + Foundation/src/MSG00001.bin + Foundation/src/pcre_*.c + Foundation/src/trees.c + Foundation/src/trees.h + Foundation/src/zconf.h + Foundation/src/zlib.h + Foundation/src/zutil.c + Foundation/src/zutil.h + Data/SQLite/src/sqlite3.c + Data/SQLite/src/sqlite3.h + XML/include/Poco/XML/expat.h + XML/include/Poco/XML/expat_external.h + XML/src/ascii.h + XML/src/asciitab.h + XML/src/expat_config.h + XML/src/iasciitab.h + XML/src/internal.h + XML/src/latin1tab.h + XML/src/nametab.h + XML/src/utf8tab.h + XML/src/xmlparse.cpp + XML/src/xmlrole.c + XML/src/xmlrole.h + XML/src/xmltok.c + XML/src/xmltok.h + XML/src/xmltok_impl.c + XML/src/xmltok_impl.h + XML/src/xmltok_ns.c +" +############################################################################# + + +############################################################################# +# Patches. These are as follows: +# +# - 1.4.6p1-unbundled.patch - This forces POCO to use the expat, pcre, +# sqlite3 and zlib libraries that come with Cygwin, rather than the +# versions that are bundled with the POCO source code. +# +# - 1.4.7-test-dequeue.patch - Ensures that 'testDequeue' uses a consistent +# time source for all its computations. +# +# - 1.5.3-data-odbc.patch - This builds the Data/ODBC component of POCO +# with the iODBC library. +# +# - 1.6.0-pcre-unbundled.patch - POCO comes bundled with its own version +# of pcre.h, which is slightly different from the one in libpcre-devel, +# even though they are the same version. Hence, when POCO is built in +# unbundled form, these differences result in compilation errors +# concerning conflicting types. This patch corrects those problems. +# +# The 'unbundled' patch comes from the Fedora port of poco-1.4.2; the other +# patches are specific to Cygwin. +PATCH_URI=" + 1.4.6p1-unbundled.patch + 1.4.7-test-dequeue.patch + 1.5.3-data-odbc.patch + 1.6.0-pcre-unbundled.patch +" +############################################################################# + + +src_compile() { + # In the declaration of LIBRARY_VERSION above, we guessed a value + # based on a file fetched from github. We need to check that the + # value we guessed is correct, and abort if it isn't. + local libversion=$(cat "${S}/libversion") + if [ "${LIBRARY_VERSION}" != "${libversion}" ]; then + error "Library version determined from github is '${LIBRARY_VERSION}', but version number in the local sources is '${libversion}'." + fi + + lndirs + cd ${B} + ./configure --prefix=/usr --unbundled --no-samples + cygmake CC="${CC}" CXX="${CXX}" AR="${AR}" RANLIB="${RANLIB}" \ + STRIP=/usr/bin/true CFLAGS="${CFLAGS}" \ + CXXFLAGS="${CXXFLAGS} -DSQLITE_THREADSAFE=1 -frepo" \ + LINKMODE=SHARED DEFAULT_TARGET=shared_release +} + +src_install() { + # Invoke 'make install'. Note that the runtime libraries are not + # installed by default, so we copy those in using the 'dobin' + # command. + cd ${B} + dobin lib/CYGWIN/$(uname -m)/*.${LIBRARY_VERSION}.dll + cyginstall LINKMODE=SHARED DEFAULT_TARGET=shared_release + + # Rename library files. + pushd ${D}/usr/lib + for file in libPoco*.dll.a + do + mv "${file}" "${file/${LIBRARY_VERSION}./}" + done + popd + + # Install POCO documentation. + local doc_dir=${D}/usr/share/doc/poco + mkdir -p "${doc_dir}" + cp -pr "${S}/../poco-${VERSION}-all-doc" "${doc_dir}" + mv "${doc_dir}/poco-${VERSION}-all-doc" "${doc_dir}/html" +} + +src_test() { + # The code for some of Poco's events uses semaphores, which requires + # cygserver. Ensure that the 'cygserver' service exists. + if [ "0" == "$(cygrunsrv --list | grep -i cygserver | wc -l)" ]; then + cygserver-config --yes + fi + + # Get the name of the 'cygserver' service. By default, this will be + # 'cygserver', but there is some debate about postfixing this with + # '-32' or '-64' for the different architectures. The line below + # should work it out. + local cygserver=$(cygrunsrv --list | grep -i cygserver | head --lines=1) + + # If the 'cygserver' service isn't running then start it now. + local cygsvrstate=$(cygrunsrv -Q "${cygserver}" | grep -i 'current state' | sed 's/\s//g' | cut -d ':' -f 2) + if [ "${cygsvrstate}" != "Running" ]; then + cygrunsrv -S "${cygserver}" + fi + + # Most of these test harnesses run cleanly. However, please note the + # following: + # + # - Foundation: Test 'testFileAttributes3' accesses '/dev/console', + # which fails if the test is run from mintty. The test passes if + # you start Cygwin from the 'cygwin.bat' batch file. + # + # - Data/MySQL: Requires a MySQL server to be running locally: + # + # mysql_install_db + # pushd /usr + # /usr/bin/mysqld_safe & + # popd + # + # You will need to create a user 'test' with password 'test': + # + # mysql --host=localhost --user=root --password= -e \ + # "CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';" + # + # Then all the MySQL tests will pass. + # + # - Net: 'testHostByName' fails, but this also fails when POCO is + # built for Win32 using MSVC++ 2008. So this is probably a + # malformed test rather than a Cygwin problem. + # + # - NetSSL_OpenSSL: There are two tests called 'testProxy', and + # both fail. However, these tests also fail when POCO is built + # for Fedora 18, so this is probably a malformed test rather than + # a Cygwin problem. + # + # - Crypto: 'testCertificate' fails when built against newer + # versions of OpenSSL. However, this test also fails when POCO is + # built for Fedora 21, so it is unlikely to be a Cygwin problem. + # + # - Data/ODBC: This testsuite requires a number of ODBC drivers, + # some of which are available for Cygwin. Sadly, I have been + # unable to get iodbc working under Cygwin, either through the + # 'myodbc-installer' or by creating an 'odbc.ini' file and using + # 'iodbctest'. Hence I have been unable to run this testsuite. + # + # All other tests pass. + local arch=$(uname -m) + export PATH="${B}/lib/CYGWIN/${arch}:${PATH}" + export POCO_BASE="${B}" + # export CYGWIN="${CYGWIN} error_start=gdb -nw %1 %2" + + local components=$(cat "${S}/components" | xargs) + for component in ${components}; do + if [ -d "${B}/${component}/testsuite/bin/CYGWIN/${arch}" ]; then + pushd "${B}/${component}/testsuite/bin/CYGWIN/${arch}" + if [ -f testrunner.exe ]; then + inform "Running ${component} tests..." + ./testrunner -all || /usr/bin/true + fi + popd + fi + done + + # If we started the 'cygserver' service above then stop it now. + if [ "${cygsvrstate}" != "Running" ]; then + cygrunsrv -E "${cygserver}" + fi +} diff --git a/release/script/mkdoc b/release/script/mkdoc index 40f5b0b11..cb8a95e8f 100755 --- a/release/script/mkdoc +++ b/release/script/mkdoc @@ -14,6 +14,13 @@ # usage: mkdoc [-l ] [] # +osname=`uname -s | tr ' ' '_'` +osarch=`uname -m | tr ' ' '_'` + +if [ ${osname:0:6} = "CYGWIN" ] ; then + osname="CYGWIN" +fi + if [ "$POCO_BASE" = "" ] ; then echo "Error: POCO_BASE not set." exit 1 @@ -59,6 +66,14 @@ if [ "$version" = "" ] ; then fi release=$version$tag +if [ ! -f libversion ] ; then + echo "Error: No libversion file found." + exit 2 +fi +if [ "$libversion" = "" ] ; then + read libversion <$POCO_BASE/libversion +fi + # # Build release # @@ -74,16 +89,25 @@ cd $tools ./configure --no-tests --no-samples make -s -j8 -cd $POCO_BASE +if [ $osname = "CYGWIN" ] ; then + find $tools -type f -name "*.$libversion.dll" > $TMP/dlls + rebase -O -T $TMP/dlls + rm $TMP/dlls +fi -osname=`uname -s | tr ' ' '_'` -osarch=`uname -m | tr ' ' '_'` +cd $POCO_BASE if [ $osname = "Darwin" ] ; then archpath=`dirname stage/tools/PocoDoc/bin/Darwin/*/PocoDoc` osarch=`basename $archpath` fi +if [ $osname = "CYGWIN" ] ; then +# Poco dlls must be on PATH for Cygwin + export PATH=$tools/lib/$osname/$osarch:$PATH +fi + + export PATH=$tools/PocoDoc/bin/$osname/$osarch:$PATH echo PATH=$PATH diff --git a/release/script/mkdocumentation b/release/script/mkdocumentation index cd5bb4725..5e143b556 100755 --- a/release/script/mkdocumentation +++ b/release/script/mkdocumentation @@ -123,6 +123,7 @@ echo "PocoDoc.output=$docPath" >>$build/PocoDoc.ini echo "PocoDoc.version=$docVersion" >> $build/PocoDoc.ini echo "Includes=$includes" >> $build/PocoDoc.ini +echo "PocoDoc --config=$docConfig --config=$build/PocoDoc.ini" PocoDoc --config=$docConfig --config=$build/PocoDoc.ini cd $dist