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