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