1SUMMARY = "Modern, powerful open source cross-platform C++ class libraries"
2DESCRIPTION = "Modern, powerful open source C++ class libraries and frameworks for building network- and internet-based applications that run on desktop, server, mobile and embedded systems."
3HOMEPAGE = "http://pocoproject.org/"
4SECTION = "libs"
5LICENSE = "BSL-1.0"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=4267f48fc738f50380cbeeb76f95cebc"
7
8# These dependencies are required by Foundation
9DEPENDS = "libpcre2 zlib"
10
11SRC_URI = "git://github.com/pocoproject/poco.git;branch=master;protocol=https \
12           file://0001-Use-std-atomic-int-instead-of-std-atomic-bool.patch \
13           file://0001-cppignore.lnx-Ignore-PKCS12-and-testLaunch-test.patch \
14           file://run-ptest \
15           file://0002-fix-build-Install-cmake-files-with-resolved-ENABLE_J.patch \
16           "
17SRCREV = "1d6fb3e1383e559cacbada5e3f861c0dafaf5d30"
18
19UPSTREAM_CHECK_GITTAGREGEX = "poco-(?P<pver>\d+(\.\d+)+)"
20
21S = "${WORKDIR}/git"
22
23inherit cmake ptest
24
25# By default the most commonly used poco components are built
26# Foundation is built anyway and doesn't need to be listed explicitly
27# these don't have dependencies outside oe-core
28PACKAGECONFIG ??= "XML JSON PDF Util Net NetSSL Crypto JWT Data DataSQLite Zip Encodings Redis Prometheus"
29# MongoDB does not build for all architectures yet keep in sync with COMPATIBLE_HOST list in mongodb recipe
30# and mongodb needs meta-python enabled as well
31PACKAGECONFIG:remove:riscv32 = "MongoDB"
32PACKAGECONFIG:remove:riscv64 = "MongoDB"
33PACKAGECONFIG:remove:mipsarch = "MongoDB"
34PACKAGECONFIG:remove:powerpc = "MongoDB"
35
36PACKAGECONFIG[XML] = "-DENABLE_XML=ON,-DENABLE_XML=OFF,expat"
37PACKAGECONFIG[JSON] = "-DENABLE_JSON=ON,-DENABLE_JSON=OFF"
38PACKAGECONFIG[MongoDB] = "-DENABLE_MONGODB=ON,-DENABLE_MONGODB=OFF"
39PACKAGECONFIG[PDF] = "-DENABLE_PDF=ON,-DENABLE_PDF=OFF,zlib"
40PACKAGECONFIG[Util] = "-DENABLE_UTIL=ON,-DENABLE_UTIL=OFF"
41PACKAGECONFIG[Net] = "-DENABLE_NET=ON,-DENABLE_NET=OFF"
42PACKAGECONFIG[NetSSL] = "-DENABLE_NETSSL=ON,-DENABLE_NETSSL=OFF,openssl"
43PACKAGECONFIG[Crypto] = "-DENABLE_CRYPTO=ON,-DENABLE_CRYPTO=OFF,openssl"
44PACKAGECONFIG[JWT] = "-DENABLE_JWT=ON,-DENABLE_JWT=OFF,openssl"
45PACKAGECONFIG[Data] = "-DENABLE_DATA=ON,-DENABLE_DATA=OFF"
46PACKAGECONFIG[DataSQLite] = "-DENABLE_DATA_SQLITE=ON -DSQLITE3_LIBRARY:STRING=sqlite3,-DENABLE_DATA_SQLITE=OFF,sqlite3"
47PACKAGECONFIG[Zip] = "-DENABLE_ZIP=ON,-DENABLE_ZIP=OFF"
48PACKAGECONFIG[Encodings] = "-DENABLE_ENCODINGS=ON,-DENABLE_ENCODINGS=OFF"
49PACKAGECONFIG[Redis] = "-DENABLE_REDIS=ON,-DENABLE_REDIS=OFF"
50PACKAGECONFIG[Prometheus] = "-DENABLE_PROMETHEUS=ON,-DENABLE_PROMETHEUS=OFF"
51
52# Additional components not build by default,
53# they might have dependencies not included in oe-core
54# or they don't work on all architectures
55PACKAGECONFIG[mod_poco] = "-DENABLE_APACHECONNECTOR=ON,-DENABLE_APACHECONNECTOR=OFF,apr apache2"
56PACKAGECONFIG[CppParser] = "-DENABLE_CPPPARSER=ON,-DENABLE_CPPPARSER=OFF"
57PACKAGECONFIG[DataMySQL] = "-DENABLE_DATA_MYSQL=ON -DMYSQL_LIB:STRING=mysqlclient_r,-DENABLE_DATA_MYSQL=OFF,mariadb"
58PACKAGECONFIG[DataODBC] = "-DENABLE_DATA_ODBC=ON,-DENABLE_DATA_ODBC=OFF,libiodbc"
59PACKAGECONFIG[ActiveRecord] = "-DENABLE_ACTIVERECORD=ON,-DENABLE_ACTIVERECORD=OFF"
60PACKAGECONFIG[ActiveRecordCompiler] = "-DENABLE_ACTIVERECORD_COMPILER=ON,-DENABLE_ACTIVERECORD_COMPILER=OFF"
61PACKAGECONFIG[PageCompiler] = "-DENABLE_PAGECOMPILER=ON,-DENABLE_PAGECOMPILER=OFF"
62PACKAGECONFIG[PageCompilerFile2Page] = "-DENABLE_PAGECOMPILER_FILE2PAGE=ON,-DENABLE_PAGECOMPILER_FILE2PAGE=OFF"
63PACKAGECONFIG[SevenZip] = "-DENABLE_SEVENZIP=ON,-DENABLE_SEVENZIP=OFF"
64
65EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=RelWithDebInfo -DPOCO_UNBUNDLED=ON \
66                  -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
67                 ${@bb.utils.contains('PTEST_ENABLED', '1', '-DENABLE_TESTS=ON ', '', d)}"
68
69# For the native build we want to use the bundled version
70EXTRA_OECMAKE:append:class-native = " -DPOCO_UNBUNDLED=OFF"
71
72# do not use rpath
73EXTRA_OECMAKE:append = " -DCMAKE_SKIP_RPATH=ON"
74
75LDFLAGS:append:riscv32 = "${@bb.utils.contains('PACKAGECONFIG', 'Prometheus', ' -Wl,--no-as-needed -latomic -Wl,--as-needed', '', d)}"
76LDFLAGS:append:mips = "${@bb.utils.contains('PACKAGECONFIG', 'Prometheus', ' -Wl,--no-as-needed -latomic -Wl,--as-needed', '', d)}"
77LDFLAGS:append:powerpc = "${@bb.utils.contains('PACKAGECONFIG', 'Prometheus', ' -Wl,--no-as-needed -latomic -Wl,--as-needed', '', d)}"
78
79python populate_packages:prepend () {
80    poco_libdir = d.expand('${libdir}')
81    pn = d.getVar("PN")
82    packages = []
83
84    def hook(f, pkg, file_regex, output_pattern, modulename):
85        packages.append(pkg)
86
87    do_split_packages(d, poco_libdir, r'^libPoco(.*)\.so\..*$',
88                    'poco-%s', 'Poco %s component', extra_depends='', prepend=True, hook=hook)
89
90    d.setVar("RRECOMMENDS:%s" % pn, " ".join(packages))
91}
92
93do_install_ptest () {
94       cp -rf ${B}/bin/ ${D}${PTEST_PATH}
95       cp -f ${B}/lib/libCppUnit.so* ${D}${libdir}
96       cp -rf ${B}/*/testsuite/data ${D}${PTEST_PATH}/bin/
97       find "${D}${PTEST_PATH}" -executable -exec chrpath -d {} \;
98       rm -f ${D}${PTEST_PATH}/testrunners
99       for f in ${D}${PTEST_PATH}/bin/*-testrunner; do
100            echo `basename $f` >> ${D}${PTEST_PATH}/testrunners
101       done
102       install -Dm 0644 ${S}/cppignore.lnx ${D}${PTEST_PATH}/cppignore.lnx
103}
104
105PACKAGES_DYNAMIC = "poco-.*"
106
107# "poco" is a metapackage which pulls in all Poco components
108ALLOW_EMPTY:${PN} = "1"
109
110# cppunit is only built if tests are enabled
111PACKAGES =+ "${PN}-cppunit"
112FILES:${PN}-cppunit += "${libdir}/libCppUnit.so*"
113ALLOW_EMPTY:${PN}-cppunit = "1"
114
115RDEPENDS:${PN}-ptest += "${PN}-cppunit"
116RDEPENDS:${PN}-ptest += "${@bb.utils.contains('PACKAGECONFIG', 'MongoDB', 'mongodb', '', d)}"
117RDEPENDS:${PN}-ptest += "${@bb.utils.contains('PACKAGECONFIG', 'Redis', 'redis', '', d)}"
118
119BBCLASSEXTEND = "native"
120