aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-extended/rsyslog/librelp_1.11.0.bb
blob: 9d949c63030e31cf02eb58c28347eb28e65e719f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
SUMMARY = "A reliable logging library"
HOMEPAGE = "https://github.com/rsyslog/librelp"

LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=1fb9c10ed9fd6826757615455ca893a9"

DEPENDS = "gmp libidn zlib"

SRC_URI = "git://github.com/rsyslog/librelp.git;protocol=https;branch=stable \
           file://0001-Fix-function-inline-errors-in-debug-optimization-Og.patch \
           file://0001-tests-Fix-callback-prototype.patch \
           file://0001-tcp-fix-some-compiler-warnings-with-enable-tls-opens.patch \
           file://0001-tests-Include-missing-sys-time.h.patch \
           file://run-ptest \
"

SRCREV = "b421f56d9ee31a966058d23bd23c966221c91396"

S = "${WORKDIR}/git"

inherit autotools pkgconfig ptest

PACKAGECONFIG ?= "tls-openssl valgrind"
# Valgrind is not available for RISCV yet
PACKAGECONFIG:remove:riscv64 = "valgrind"
PACKAGECONFIG:remove:riscv32 = "valgrind"

PACKAGECONFIG[tls] = "--enable-tls,--disable-tls,gnutls nettle"
PACKAGECONFIG[tls-openssl] = "--enable-tls-openssl,--disable-tls-openssl,openssl"
PACKAGECONFIG[valgrind] = "--enable-valgrind,--disable-valgrind,"

# For ptests, copy source tests/*.sh scripts, Makefile and 
# executables and run them with make on target.
TESTDIR = "tests"
do_compile_ptest() {
    echo 'buildtest-TESTS: $(check_PROGRAMS)' >> ${TESTDIR}/Makefile
    oe_runmake -C ${TESTDIR} buildtest-TESTS
}

do_install_ptest() {
    install -d ${D}${PTEST_PATH}/${TESTDIR}

    # copy source tests/*.sh and python scripts
    cp -f ${S}/${TESTDIR}/*.sh ${S}/${TESTDIR}/*.py ${D}${PTEST_PATH}/${TESTDIR}
    # install data files needed by the test scripts on the target
    cp -f ${S}/${TESTDIR}/*.supp ${D}${PTEST_PATH}/${TESTDIR}
    cp -rf ${S}/${TESTDIR}/tls-certs ${D}${PTEST_PATH}/${TESTDIR}

    # copy executables
    find ${B}/${TESTDIR} -type f -executable -exec cp {} ${D}${PTEST_PATH}/${TESTDIR} \;
    cp -rf ${B}/${TESTDIR}/.libs ${D}${PTEST_PATH}/${TESTDIR}
    # copy Makefile
    # run-ptest will run make which runs the executables
    cp -f ${B}/${TESTDIR}/Makefile ${D}${PTEST_PATH}/${TESTDIR}
    cp -f ${B}/${TESTDIR}/set-envvars ${D}${PTEST_PATH}/${TESTDIR}

    # give permissions to all users
    # some tests need to write to this directory
    chmod 777 -R ${D}${PTEST_PATH}/${TESTDIR}

    # do NOT need to rebuild Makefile or $(check_PROGRAMS)
    sed -i 's/^Makefile:.*$/Makefile:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
    sed -i 's/^check-TESTS:.*$/check-TESTS:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile

    # fix the srcdir, top_srcdir, abs_top_builddir
    sed -i 's,^\(srcdir = \).*,\1${PTEST_PATH}/${TESTDIR},' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
    sed -i 's,^\(top_srcdir = \).*,\1${PTEST_PATH}/${TESTDIR},' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
    sed -i 's,^\(abs_top_builddir = \).*,\1${PTEST_PATH}/,' ${D}${PTEST_PATH}/${TESTDIR}/Makefile

    # install test-driver
    install -m 644 ${S}/test-driver ${D}${PTEST_PATH}

    # fix the python3 path for tests/set-envar
    sed -i -e s:${HOSTTOOLS_DIR}:${bindir}:g ${D}${PTEST_PATH}/${TESTDIR}/set-envvars

    # these 2 scripts need help finding their /usr/lib/librelp/ptest/tests/.libs libraries
    sed -i 's:${B}/src:${PTEST_PATH}/${TESTDIR}:' ${D}${PTEST_PATH}/${TESTDIR}/send
    sed -i 's:${B}/src:${PTEST_PATH}/${TESTDIR}:' ${D}${PTEST_PATH}/${TESTDIR}/receive
}

RDEPENDS:${PN}-ptest += "\
  make bash coreutils libgcc util-linux gawk grep \
  python3-core python3-io \
"
RRECOMMENDS:${PN}-ptest += "${@bb.utils.filter('PACKAGECONFIG', 'valgrind', d)}"