blob: c1d923c75e5fb12570bad8ba3e28b7f0bd76e158 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "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 json-c bison-native flex-native liblogging"
13HOMEPAGE = "http://www.rsyslog.com/"
14LICENSE = "GPLv3 & LGPLv3 & 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://use-pkgconfig-to-check-libgcrypt.patch \
25 file://run-ptest \
26 file://rsyslog-fix-ptest-not-finish.patch \
27 file://json-0.12-fix.patch \
28 file://replace_deprecated_GnuTLS_functions.patch \
29 file://use_gnutls_certificate_type_set_priority_only_if_available.patch \
30 file://enable_tls_ptests.patch \
31"
32
33SRC_URI[md5sum] = "093c462a5245012bd9e7b82dd8aedffb"
34SRC_URI[sha256sum] = "357f089d866c351d5fe5b7139fa85b010223d77b3c21f29b2a1baa8688926111"
35
36inherit autotools pkgconfig systemd update-rc.d update-alternatives ptest
37
38EXTRA_OECONF += "--enable-cached-man-pages"
39
40# first line is default yes in configure
41PACKAGECONFIG ??= " \
42 zlib rsyslogd rsyslogrt klog inet regexp uuid libgcrypt \
43 imdiag gnutls imfile \
44 ${@bb.utils.contains('DISTRO_FEATURES', 'snmp', 'snmp', '', d)} \
45 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
46 ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'testbench ${VALGRIND}', '', d)} \
47"
48
49# default yes in configure
50PACKAGECONFIG[zlib] = "--enable-zlib,--disable-zlib,zlib,"
51PACKAGECONFIG[rsyslogd] = "--enable-rsyslogd,--disable-rsyslogd,,"
52PACKAGECONFIG[rsyslogrt] = "--enable-rsyslogrt,--disable-rsyslogrt,,"
53PACKAGECONFIG[inet] = "--enable-inet,--disable-inet,,"
54PACKAGECONFIG[klog] = "--enable-klog,--disable-klog,,"
55PACKAGECONFIG[regexp] = "--enable-regexp,--disable-regexp,,"
56PACKAGECONFIG[uuid] = "--enable-uuid,--disable-uuid,util-linux,"
57PACKAGECONFIG[libgcrypt] = "--enable-libgcrypt,--disable-libgcrypt,libgcrypt,"
58PACKAGECONFIG[testbench] = "--enable-testbench,--disable-testbench,,"
59
60# default no in configure
61PACKAGECONFIG[debug] = "--enable-debug,--disable-debug,,"
62PACKAGECONFIG[imdiag] = "--enable-imdiag,--disable-imdiag,,"
63PACKAGECONFIG[imfile] = "--enable-imfile,--disable-imfile,,"
64PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp,"
65PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls,"
66PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd,"
67PACKAGECONFIG[mysql] = "--enable-mysql,--disable-mysql,mysql5,"
68PACKAGECONFIG[postgresql] = "--enable-pgsql,--disable-pgsql,postgresql,"
69PACKAGECONFIG[libdbi] = "--enable-libdbi,--disable-libdbi,libdbi,"
70PACKAGECONFIG[mail] = "--enable-mail,--disable-mail,,"
71PACKAGECONFIG[gui] = "--enable-gui,--disable-gui,,"
72PACKAGECONFIG[valgrind] = "--enable-valgrind,--disable-valgrind,valgrind,"
73
74TESTDIR = "tests"
75do_compile_ptest() {
76 echo 'buildtest-TESTS: $(check_PROGRAMS)' >> ${TESTDIR}/Makefile
77 oe_runmake -C ${TESTDIR} buildtest-TESTS
78}
79
80do_install_ptest() {
81 # install the tests
82 cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}
83 cp -rf ${B}/${TESTDIR} ${D}${PTEST_PATH}
84
85 # do NOT need to rebuild Makefile itself
86 sed -i 's/^Makefile:.*$/Makefile:/' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
87
88 # fix the srcdir, top_srcdir
89 sed -i 's,^\(srcdir = \).*,\1${PTEST_PATH}/tests,' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
90 sed -i 's,^\(top_srcdir = \).*,\1${PTEST_PATH}/tests,' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
91
92 # valgrind is not compatible with arm and mips,
93 # so remove related test cases if there is no valgrind.
94 if [ x${VALGRIND} = x ]; then
95 sed -i '/udp-msgreduc-/d' ${D}${PTEST_PATH}/${TESTDIR}/Makefile
96 fi
97
98 # install test-driver
99 install -m 644 ${S}/test-driver ${D}${PTEST_PATH}/${TESTDIR}
100
101 # install necessary links
102 install -d ${D}${PTEST_PATH}/tools
103 ln -sf ${sbindir}/rsyslogd ${D}${PTEST_PATH}/tools/rsyslogd
104
105 install -d ${D}${PTEST_PATH}/runtime
106 install -d ${D}${PTEST_PATH}/runtime/.libs
107 (
108 cd ${D}/${libdir}/rsyslog
109 allso="*.so"
110 for i in $allso; do
111 ln -sf ${libdir}/rsyslog/$i ${D}${PTEST_PATH}/runtime/.libs/$i
112 done
113 )
114
115 # fix the module load path with runtime/.libs
116 find ${D}${PTEST_PATH}/${TESTDIR} -name \*.conf -exec \
117 sed -i -e 's:../plugins/.*/.libs/:../runtime/.libs/:' \
118 '{}' \;
119}
120
121do_install_append() {
122 install -d "${D}${sysconfdir}/init.d"
123 install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog.${BPN}
124 install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
125 install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.rsyslog
126}
127
128FILES_${PN} += "${bindir}"
129
130INITSCRIPT_NAME = "syslog"
131INITSCRIPT_PARAMS = "defaults"
132
133# higher than sysklogd's 100
134ALTERNATIVE_PRIORITY = "110"
135
136ALTERNATIVE_${PN} = "syslogd syslog-conf syslog-logrotate"
137
138ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
139ALTERNATIVE_TARGET[syslogd] = "${sbindir}/rsyslogd"
140ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf"
141ALTERNATIVE_TARGET[syslog-conf] = "${sysconfdir}/rsyslog.conf"
142ALTERNATIVE_LINK_NAME[syslog-logrotate] = "${sysconfdir}/logrotate.d/syslog"
143ALTERNATIVE_TARGET[syslog-logrotate] = "${sysconfdir}/logrotate.rsyslog"
144
145CONFFILES_${PN} = "${sysconfdir}/rsyslog.conf"
146
147RPROVIDES_${PN} += "${PN}-systemd"
148RREPLACES_${PN} += "${PN}-systemd"
149RCONFLICTS_${PN} += "${PN}-systemd"
150SYSTEMD_SERVICE_${PN} = "${BPN}.service"
151
152RDEPENDS_${PN} += "logrotate"
153
154# for rsyslog-ptest
155VALGRIND = "valgrind"
156VALGRIND_mips = ""
157VALGRIND_mips64 = ""
158VALGRIND_mips64n32 = ""
159VALGRIND_arm = ""
160VALGRIND_aarch64 = ""
161RDEPENDS_${PN}-ptest += "make diffutils gzip"
162RRECOMMENDS_${PN}-ptest += "${TCLIBC}-dbg ${VALGRIND}"
163
164# no syslog-init for systemd
165python () {
166 if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
167 pn = d.getVar('PN', True)
168 sysconfdir = d.getVar('sysconfdir', True)
169 d.appendVar('ALTERNATIVE_%s' % (pn), ' syslog-init')
170 d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (sysconfdir))
171 d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
172
173 if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
174 pn = d.getVar('PN', True)
175 d.appendVar('ALTERNATIVE_%s' % (pn), ' syslog-service')
176 d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-service', '%s/systemd/system/syslog.service' % (d.getVar('sysconfdir', True)))
177 d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-service', '%s/system/rsyslog.service' % (d.getVar('systemd_unitdir', True)))
178}