# poco.cygport NAME="poco" VERSION=1.6.0 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. # # - 1.6.0-unicode-converter-test.patch - Corrects a confusion between the # size of a std::basic_string and the size of the character it is # instantiated with. # # 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 1.6.0-unicode-converter-test.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 # 64-bit Cygwin doesn't have a full suite of packages yet. So test # for the header files that we need and exclude any POCO components # whose dependencies aren't present. local poco_omit="" if [ ! -f /usr/include/mysql/mysql.h ]; then poco_omit="${poco_omit},Data/MySQL" fi if [ ! -f /usr/include/iodbcunix.h ]; then poco_omit="${poco_omit},Data/ODBC" fi poco_omit=${poco_omit/%,/--omit=} lndirs cd ${B} ./configure --prefix=/usr ${poco_omit} --unbundled --no-samples cygmake CC="${CC}" CXX="${CXX}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" STRIP=/usr/bin/true } 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 # Rename library files. pushd ${D}/usr/lib for file in libPoco*.dll.a do mv "${file}" "${file/${LIBRARY_VERSION}./}" done popd # Delete the 'debug' versions of the libraries and executables. Note # that the release build is actually compiled with debugging # information enabled, and the libraries are 'strip'ped during # packaging. The debug versions can be found in the 'debuginfo' # package. find "${D}/usr/bin" -type f -name "*d.${LIBRARY_VERSION}.dll" -delete find "${D}/usr/bin" -type f -name "*d.exe" -delete find "${D}/usr/lib" -type f -name "*d.dll.a" -delete # 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. # # - 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 }