1SUMMARY = "YANG data modeling language library"
2DESCRIPTION = "libyang is a YANG data modelling language parser and toolkit written (and providing API) in C."
3HOMEPAGE = "https://github.com/CESNET/libyang"
4SECTION = "libs"
5LICENSE = "BSD-3-Clause"
6
7LIC_FILES_CHKSUM = "file://LICENSE;md5=f3916d7d8d42a6508d0ea418cfff10ad"
8
9SRCREV = "fc4dbd923e044006c93df020590a1e5a8656c09e"
10
11SRC_URI = "git://github.com/CESNET/libyang.git;branch=master;protocol=https \
12           file://0001-test_context-skip-test-case-test_searchdirs.patch \
13           file://run-ptest \
14           "
15
16S = "${WORKDIR}/git"
17
18# Main dependencies
19inherit cmake pkgconfig lib_package ptest multilib_header
20DEPENDS = "libpcre2"
21DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'cmocka', '', d)}"
22
23EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release"
24EXTRA_OECMAKE += " ${@bb.utils.contains('PTEST_ENABLED', '1', '-DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF', '', d)}"
25
26do_compile:prepend () {
27    if [ ${PTEST_ENABLED} = "1" ]; then
28        sed -i -e 's|${S}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
29        sed -i -e 's|${B}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
30    fi
31}
32
33do_install:append () {
34        oe_multilib_header  libyang/config.h
35}
36
37do_install_ptest () {
38    install -d ${D}${PTEST_PATH}/tests
39    cp -f ${B}/tests/utest_* ${D}${PTEST_PATH}/tests/
40    cp -fR ${S}/tests/modules ${D}${PTEST_PATH}/tests/
41    install -d ${D}${PTEST_PATH}/tests/plugins
42    cp -f ${B}/tests/plugins/plugin_*.so ${D}${PTEST_PATH}/tests/plugins/
43}
44
45FILES:${PN} += "${datadir}/yang/*"
46