syslog-ng.inc 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. DESCRIPTION = "Alternative system logger daemon"
  2. DEPENDS = "libol flex eventlog glib-2.0"
  3. LICENSE = "GPL LGPL"
  4. LIC_FILES_CHKSUM = "file://COPYING;md5=7ec1bcc46f28b11f4722e20d9b7dd4d5"
  5. # syslog initscript is handled explicitly because order of
  6. # update-rc.d and update-alternatives is important
  7. RDEPENDS_${PN} += " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
  8. INC_PR = "r12"
  9. inherit autotools systemd
  10. SRC_URI = "http://www.balabit.com/downloads/files/syslog-ng/sources/${PV}/source/${BPN}_${PV}.tar.gz"
  11. noipv6 = "${@base_contains('DISTRO_FEATURES', 'ipv6', '', '--disable-ipv6', d)}"
  12. EXTRA_OECONF = " \
  13. --with-libnet=${STAGING_BINDIR_CROSS} \
  14. --enable-dynamic-linking \
  15. ${noipv6} \
  16. --enable-ssl \
  17. --disable-sub-streams \
  18. --disable-pacct \
  19. --disable-linux-caps \
  20. --disable-pcre \
  21. --disable-sql \
  22. "
  23. EXTRA_OECONF += "${@base_contains('DISTRO_FEATURES', 'systemd', '--with-systemdsystemunitdir=${systemd_unitdir}/system/', '--without-systemdsystemunitdir', d)}"
  24. EXTRA_OECONF += "${@base_contains('DISTRO_FEATURES', 'systemd', '--enable-systemd', '--disable-systemd', d)}"
  25. do_configure_prepend() {
  26. eval "${@base_contains('DISTRO_FEATURES', 'largefile', '', 'sed -i -e "s/-D_LARGEFILE_SOURCE//" -e "s/-D_FILE_OFFSET_BITS=64//" ${S}/configure.in', d)}"
  27. }
  28. # rename modules.conf because it breaks update-modules
  29. # see http://lists.linuxtogo.org/pipermail/openembedded-devel/2011-October/035537.html
  30. do_install_append() {
  31. mv ${D}/${sysconfdir}/modules.conf ${D}/${sysconfdir}/scl-modules.conf
  32. sed -i "s#@include 'modules.conf'#@include 'scl-modules.conf'#g" ${D}/${sysconfdir}/scl.conf
  33. install -d ${D}/${sysconfdir}/${PN}
  34. install ${WORKDIR}/syslog-ng.conf ${D}${sysconfdir}/${PN}.conf
  35. install -d ${D}/${sysconfdir}/init.d
  36. install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
  37. }
  38. FILES_${PN} = "${bindir}/* ${sbindir}/* ${libexecdir}/* ${libdir}/lib*${SOLIBS} \
  39. ${sysconfdir} ${sharedstatedir} ${localstatedir} \
  40. ${base_bindir}/* ${base_sbindir}/* \
  41. ${base_libdir}/*${SOLIBS} \
  42. ${datadir}/${BPN} ${libdir}/${BPN}/*${SOLIBS} \
  43. ${datadir}/include/scl/ ${datadir}/xsd"
  44. FILES_${PN}-dev += "${libdir}/${BPN}/lib*.la ${libdir}/${BPN}/*${SOLIBSDEV}"
  45. CONFFILES_${PN} = "${sysconfdir}/${PN}.conf ${sysconfdir}/scl.conf ${sysconfdir}/scl-modules.conf"
  46. RPROVIDES_${PN} += "${PN}-systemd"
  47. RREPLACES_${PN} += "${PN}-systemd"
  48. RCONFLICTS_${PN} += "${PN}-systemd"
  49. SYSTEMD_SERVICE_${PN} = "${PN}.service"
  50. pkg_postinst_${PN} () {
  51. /etc/init.d/syslog stop
  52. update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 200
  53. if test "x$D" != "x"; then
  54. OPT="-r $D"
  55. else
  56. OPT="-s"
  57. fi
  58. # remove all rc.d-links potentially created from alternative
  59. # syslog packages before creating new ones
  60. update-rc.d $OPT -f syslog remove
  61. update-rc.d $OPT syslog start 20 2 3 4 5 . stop 90 0 1 6 .
  62. }
  63. pkg_prerm_${PN} () {
  64. if test "x$D" = "x"; then
  65. if test "$1" = "upgrade" -o "$1" = "remove"; then
  66. /etc/init.d/syslog stop
  67. fi
  68. fi
  69. update-alternatives --remove syslog-init syslog.${PN}
  70. }
  71. pkg_postrm_${PN} () {
  72. if test "x$D" != "x"; then
  73. OPT="-r $D"
  74. else
  75. OPT=""
  76. fi
  77. if test "$1" = "remove" -o "$1" = "purge"; then
  78. if ! test -e "/etc/init.d/syslog"; then
  79. update-rc.d $OPT syslog remove
  80. fi
  81. fi
  82. }