xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-oe/recipes-extended/rsyslog/rsyslog_8.2206.0.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1SUMMARY = "Rsyslog is an enhanced multi-threaded syslogd"
2DESCRIPTION = "\
3Rsyslog is an enhanced syslogd supporting, among others, MySQL,\
4 PostgreSQL, failover log destinations, syslog/tcp, fine grain\
5 output format control, high precision timestamps, queued operations\
6 and the ability to filter on any message part. It is quite\
7 compatible to stock sysklogd and can be used as a drop-in replacement.\
8 Its advanced features make it suitable for enterprise-class,\
9 encryption protected syslog relay chains while at the same time being\
10 very easy to setup for the novice user."
11
12DEPENDS = "zlib libestr libfastjson bison-native flex-native liblogging"
13HOMEPAGE = "http://www.rsyslog.com/"
14LICENSE = "GPL-3.0-only & LGPL-3.0-only & Apache-2.0"
15LIC_FILES_CHKSUM = "file://COPYING;md5=51d9635e646fb75e1b74c074f788e973 \
16                    file://COPYING.LESSER;md5=cb7903f1e5c39ae838209e130dca270a \
17                    file://COPYING.ASL20;md5=052f8a09206615ab07326ff8ce2d9d32\
18"
19
20SRC_URI = "http://www.rsyslog.com/download/files/download/rsyslog/${BPN}-${PV}.tar.gz \
21           file://initscript \
22           file://rsyslog.conf \
23           file://rsyslog.logrotate \
24           file://rsyslog.service \
25           file://use-pkgconfig-to-check-libgcrypt.patch \
26           file://run-ptest \
27           file://0001-tests-disable-the-check-for-inotify.patch \
28"
29
30SRC_URI:append:libc-musl = " \
31    file://0001-Include-sys-time-h.patch \
32"
33
34SRC_URI[sha256sum] = "a1377218b26c0767a7a3f67d166d5338af7c24b455d35ec99974e18e6845ba27"
35
36UPSTREAM_CHECK_URI = "https://github.com/rsyslog/rsyslog/releases"
37UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)"
38
39inherit autotools pkgconfig systemd update-rc.d ptest
40
41EXTRA_OECONF += "--disable-generate-man-pages ap_cv_atomic_builtins=yes"
42EXTRA_OECONF += "--enable-imfile-tests"
43EXTRA_OECONF:remove:mipsarch = "ap_cv_atomic_builtins=yes"
44EXTRA_OECONF:remove:powerpc = "ap_cv_atomic_builtins=yes"
45EXTRA_OECONF:remove:riscv32 = "ap_cv_atomic_builtins=yes"
46
47# first line is default yes in configure
48PACKAGECONFIG ??= " \
49    rsyslogd rsyslogrt klog inet regexp uuid libgcrypt \
50    fmhttp imdiag gnutls imfile \
51    ${@bb.utils.filter('DISTRO_FEATURES', 'snmp systemd', d)} \
52    ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'testbench relp ${VALGRIND}', '', d)} \
53"
54
55# default yes in configure
56PACKAGECONFIG[relp] = "--enable-relp,--disable-relp,librelp,"
57PACKAGECONFIG[rsyslogd] = "--enable-rsyslogd,--disable-rsyslogd,,"
58PACKAGECONFIG[rsyslogrt] = "--enable-rsyslogrt,--disable-rsyslogrt,,"
59PACKAGECONFIG[fmhttp] = "--enable-fmhttp,--disable-fmhttp,curl,"
60PACKAGECONFIG[inet] = "--enable-inet,--disable-inet,,"
61PACKAGECONFIG[klog] = "--enable-klog,--disable-klog,,"
62PACKAGECONFIG[regexp] = "--enable-regexp,--disable-regexp,,"
63PACKAGECONFIG[uuid] = "--enable-uuid,--disable-uuid,util-linux,"
64PACKAGECONFIG[libgcrypt] = "--enable-libgcrypt,--disable-libgcrypt,libgcrypt,"
65PACKAGECONFIG[testbench] = "--enable-testbench --enable-omstdout,--disable-testbench --disable-omstdout,,"
66
67# default no in configure
68PACKAGECONFIG[debug] = "--enable-debug,--disable-debug,,"
69PACKAGECONFIG[imdiag] = "--enable-imdiag,--disable-imdiag,,"
70PACKAGECONFIG[imfile] = "--enable-imfile,--disable-imfile,,"
71PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp,"
72PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
73PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd,"
74PACKAGECONFIG[imjournal] = "--enable-imjournal,--disable-imjournal,"
75PACKAGECONFIG[mmjsonparse] = "--enable-mmjsonparse,--disable-mmjsonparse,"
76PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,"
77PACKAGECONFIG[postgresql] = "--enable-pgsql,--disable-pgsql,postgresql,"
78PACKAGECONFIG[libdbi] = "--enable-libdbi,--disable-libdbi,libdbi,"
79PACKAGECONFIG[mail] = "--enable-mail,--disable-mail,,"
80PACKAGECONFIG[valgrind] = ",--without-valgrind-testbench,valgrind,"
81PACKAGECONFIG[imhttp] = "--enable-imhttp,--disable-imhttp,civetweb,"
82
83
84TESTDIR = "tests"
85do_compile_ptest() {
86    echo 'buildtest-TESTS: $(check_PROGRAMS)' >> ${TESTDIR}/Makefile
87    oe_runmake -C ${TESTDIR} buildtest-TESTS
88}
89
90do_install_ptest() {
91    # install the tests
92    cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}
93    cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH}
94
95    # give permissions to all users
96    # some tests need to write to this directory as user 'daemon'
97    chmod 777 -R ${D}${PTEST_PATH}/tests
98
99    # do NOT need to rebuild Makefile itself
100    sed -i 's/^Makefile:.*$/Makefile:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
101    # do NOT need to rebuild $(check_PROGRAMS)
102    sed -i 's/^check-TESTS:.*$/check-TESTS:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
103
104    # fix the srcdir, top_srcdir
105    sed -i 's,^\(srcdir = \).*,\1${PTEST_PATH}/tests,' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
106    sed -i 's,^\(top_srcdir = \).*,\1${PTEST_PATH}/tests,' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
107    # fix the abs_top_builddir
108    sed -i 's,^\(abs_top_builddir = \).*,\1${PTEST_PATH}/,' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
109
110    # install test-driver
111    install -m 644 ${S}/test-driver ${D}${PTEST_PATH}
112
113    # install necessary links
114    install -d ${D}${PTEST_PATH}/tools
115    ln -sf ${sbindir}/rsyslogd ${D}${PTEST_PATH}/tools/rsyslogd
116
117    install -d ${D}${PTEST_PATH}/runtime
118    install -d ${D}${PTEST_PATH}/runtime/.libs
119    (
120        cd ${D}/${libdir}/rsyslog
121        allso="*.so"
122        for i in $allso; do
123            ln -sf ${libdir}/rsyslog/$i ${D}${PTEST_PATH}/runtime/.libs/$i
124        done
125    )
126
127    # fix the module load path with runtime/.libs
128    find ${D}${PTEST_PATH}/${TESTDIR} -name "*.conf" -o -name "*.sh" -o -name "*.c" | xargs \
129        sed -i -e 's:../plugins/.*/.libs/:../runtime/.libs/:g'
130    # fix the python3 path for tests/set-envar
131    sed -i -e s:${HOSTTOOLS_DIR}:${bindir}:g ${D}${PTEST_PATH}/tests/set-envvars
132}
133
134do_install:append() {
135    install -d "${D}${sysconfdir}/init.d"
136    install -d "${D}${sysconfdir}/logrotate.d"
137    install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog
138    install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
139    install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
140    sed -i -e "s#@BINDIR@#${bindir}#g" ${D}${sysconfdir}/logrotate.d/logrotate.rsyslog
141
142    if ${@bb.utils.contains('PACKAGECONFIG', 'imjournal', 'true', 'false', d)}; then
143        install -d 0755 ${D}${sysconfdir}/rsyslog.d
144        echo '$ModLoad imjournal' >> ${D}${sysconfdir}/rsyslog.d/imjournal.conf
145    fi
146    if ${@bb.utils.contains('PACKAGECONFIG', 'mmjsonparse', 'true', 'false', d)}; then
147        install -d 0755 ${D}${sysconfdir}/rsyslog.d
148        echo '$ModLoad mmjsonparse' >> ${D}${sysconfdir}/rsyslog.d/mmjsonparse.conf
149    fi
150    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
151        install -d ${D}${systemd_system_unitdir}
152        install -m 644 ${WORKDIR}/rsyslog.service ${D}${systemd_system_unitdir}
153        sed -i -e "s,@sbindir@,${sbindir},g" ${D}${systemd_system_unitdir}/rsyslog.service
154    fi
155}
156
157FILES:${PN} += "${bindir}"
158
159INITSCRIPT_NAME = "syslog"
160INITSCRIPT_PARAMS = "defaults"
161
162CONFFILES:${PN} = "${sysconfdir}/rsyslog.conf"
163
164RCONFLICTS:${PN} = "busybox-syslog sysklogd syslog-ng"
165
166RPROVIDES:${PN} += "${PN}-systemd"
167RREPLACES:${PN} += "${PN}-systemd"
168RCONFLICTS:${PN} += "${PN}-systemd"
169SYSTEMD_SERVICE:${PN} = "${BPN}.service"
170
171RDEPENDS:${PN} += "logrotate"
172
173# for rsyslog-ptest
174VALGRIND = "valgrind"
175
176# valgrind supports armv7 and above
177VALGRIND:armv4 = ''
178VALGRIND:armv5 = ''
179VALGRIND:armv6 = ''
180
181# X32 isn't supported by valgrind at this time
182VALGRIND:linux-gnux32 = ''
183VALGRIND:linux-muslx32 = ''
184
185# Disable for some MIPS variants
186VALGRIND:mipsarchr6 = ''
187VALGRIND:linux-gnun32 = ''
188
189# Disable for powerpc64 with musl
190VALGRIND:libc-musl:powerpc64 = ''
191VALGRIND:libc-musl:powerpc64le = ''
192
193# RISC-V support for valgrind is not there yet
194VALGRIND:riscv64 = ""
195VALGRIND:riscv32 = ""
196
197# util-linux: logger needs the -d option
198RDEPENDS:${PN}-ptest += "\
199  make diffutils gzip bash gawk coreutils procps \
200  libgcc python3-core python3-io python3-json \
201  curl util-linux shadow \
202  "
203
204RRECOMMENDS:${PN}-ptest += "${TCLIBC}-dbg ${VALGRIND}"
205