1DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
2objects. It only requires the standard C library, works on a range of computing \
3platforms (including embedded) and with different compilers."
4HOMEPAGE = "https://cmocka.org/"
5
6LICENSE = "Apache-2.0"
7LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
8
9SRCREV = "a01cc69ee9536f90e57c61a198f2d1944d3d4313"
10PV .= "+git"
11SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git;protocol=https;branch=stable-1.1 \
12           file://0001-include-Check-for-previous-declaration-of-uintptr_t.patch \
13           file://run-ptest \
14          "
15
16S = "${WORKDIR}/git"
17
18inherit cmake ptest
19
20EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
21# Use -Wl,wrap linker flag, which does not work with LTO
22LTO = ""
23
24do_install:append () {
25    install -d ${D}${libdir}/${BPN}/example
26    install -d ${D}${libdir}/${BPN}/example/mock/chef_wrap
27    install -d ${D}${libdir}/${BPN}/example/mock/uptime
28
29    install -m 0755 ${B}/example/*_test ${D}/${libdir}/${BPN}/example
30    install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${libdir}/${BPN}/example/mock/chef_wrap
31    install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${libdir}/${BPN}/example/mock/uptime
32    install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${libdir}/${BPN}/example/mock/uptime
33    install -m 0644 ${B}/example/mock/uptime/libproc_uptime.so ${D}/${libdir}/${BPN}/example/mock/libproc_uptime.so
34}
35
36do_install_ptest () {
37    install -d ${D}${PTEST_PATH}/tests
38    install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
39}
40
41PACKAGE_BEFORE_PN += "${PN}-examples"
42
43FILES:${PN}-examples = "${libdir}/${BPN}/example"
44