Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | SUMMARY = "The Suricata Engine is an Open Source Next Generation Intrusion Detection and Prevention Engine" |
| 2 | |
| 3 | require suricata.inc |
| 4 | |
| 5 | LIC_FILES_CHKSUM = "file://LICENSE;beginline=1;endline=2;md5=c70d8d3310941dcdfcd1e02800a1f548" |
| 6 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | SRC_URI += " \ |
Brad Bishop | 1fdf4aa | 2019-09-09 14:56:41 -0400 | [diff] [blame] | 8 | file://volatiles.03_suricata \ |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 9 | file://tmpfiles.suricata \ |
Brad Bishop | 1fdf4aa | 2019-09-09 14:56:41 -0400 | [diff] [blame] | 10 | file://suricata.yaml \ |
| 11 | file://suricata.service \ |
| 12 | file://run-ptest \ |
Brad Bishop | 1fdf4aa | 2019-09-09 14:56:41 -0400 | [diff] [blame] | 13 | " |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 14 | |
William A. Kennington III | ee32beb | 2021-06-02 12:48:35 -0700 | [diff] [blame] | 15 | UPSTREAM_CHECK_URI = "www.openinfosecfoundation.org/download" |
| 16 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 17 | inherit autotools-brokensep pkgconfig python3-dir systemd ptest |
| 18 | |
Andrew Geissler | d1d22e6 | 2020-10-16 10:14:32 -0500 | [diff] [blame] | 19 | CFLAGS += "-D_DEFAULT_SOURCE -fcommon" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 20 | |
| 21 | CACHED_CONFIGUREVARS = "ac_cv_header_htp_htp_h=yes ac_cv_lib_htp_htp_conn_create=yes \ |
| 22 | ac_cv_path_HAVE_WGET=no ac_cv_path_HAVE_CURL=no " |
| 23 | |
| 24 | EXTRA_OECONF += " --disable-debug \ |
| 25 | --enable-non-bundled-htp \ |
| 26 | --disable-gccmarch-native \ |
| 27 | --disable-suricata-update \ |
| 28 | " |
| 29 | |
| 30 | PACKAGECONFIG ??= "htp jansson file pcre yaml pcap cap-ng net nfnetlink nss nspr" |
| 31 | PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'unittests', '', d)}" |
| 32 | |
| 33 | PACKAGECONFIG[htp] = "--with-libhtp-includes=${STAGING_INCDIR} --with-libhtp-libraries=${STAGING_LIBDIR}, ,libhtp," |
| 34 | PACKAGECONFIG[pcre] = "--with-libpcre-includes=${STAGING_INCDIR} --with-libpcre-libraries=${STAGING_LIBDIR}, ,libpcre ," |
| 35 | PACKAGECONFIG[yaml] = "--with-libyaml-includes=${STAGING_INCDIR} --with-libyaml-libraries=${STAGING_LIBDIR}, ,libyaml ," |
| 36 | PACKAGECONFIG[pcap] = "--with-libpcap-includes=${STAGING_INCDIR} --with-libpcap-libraries=${STAGING_LIBDIR}, ,libpcap ," |
| 37 | PACKAGECONFIG[cap-ng] = "--with-libcap_ng-includes=${STAGING_INCDIR} --with-libcap_ng-libraries=${STAGING_LIBDIR}, ,libcap-ng , " |
| 38 | PACKAGECONFIG[net] = "--with-libnet-includes=${STAGING_INCDIR} --with-libnet-libraries=${STAGING_LIBDIR}, , libnet," |
| 39 | PACKAGECONFIG[nfnetlink] = "--with-libnfnetlink-includes=${STAGING_INCDIR} --with-libnfnetlink-libraries=${STAGING_LIBDIR}, ,libnfnetlink ," |
| 40 | PACKAGECONFIG[nfq] = "--enable-nfqueue, --disable-nfqueue,libnetfilter-queue," |
| 41 | |
| 42 | PACKAGECONFIG[jansson] = "--with-libjansson-includes=${STAGING_INCDIR} --with-libjansson-libraries=${STAGING_LIBDIR},,jansson, jansson" |
| 43 | PACKAGECONFIG[file] = ",,file, file" |
| 44 | PACKAGECONFIG[nss] = "--with-libnss-includes=${STAGING_INCDIR} --with-libnss-libraries=${STAGING_LIBDIR}, nss, nss," |
| 45 | PACKAGECONFIG[nspr] = "--with-libnspr-includes=${STAGING_INCDIR} --with-libnspr-libraries=${STAGING_LIBDIR}, nspr, nspr," |
| 46 | PACKAGECONFIG[python] = "--enable-python, --disable-python, python3, python3" |
| 47 | PACKAGECONFIG[unittests] = "--enable-unittests, --disable-unittests," |
| 48 | |
| 49 | export logdir = "${localstatedir}/log" |
| 50 | |
| 51 | do_install_append () { |
| 52 | |
| 53 | install -d ${D}${sysconfdir}/suricata |
| 54 | |
| 55 | oe_runmake install-conf DESTDIR=${D} |
| 56 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 57 | oe_runmake install-rules DESTDIR=${D} |
| 58 | |
| 59 | install -d ${D}${sysconfdir}/suricata ${D}${sysconfdir}/default/volatiles |
Andrew Geissler | f31b8bd | 2020-11-30 19:54:56 -0600 | [diff] [blame] | 60 | install -m 0644 ${WORKDIR}/volatiles.03_suricata ${D}${sysconfdir}/default/volatiles/03_suricata |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 61 | |
| 62 | install -m 0644 ${S}/threshold.config ${D}${sysconfdir}/suricata |
| 63 | |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 64 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 65 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 66 | install -m 0644 ${WORKDIR}/tmpfiles.suricata ${D}${sysconfdir}/tmpfiles.d/suricata.conf |
| 67 | |
| 68 | install -d ${D}${systemd_unitdir}/system |
| 69 | sed -e s:/etc:${sysconfdir}:g \ |
| 70 | -e s:/var/run:/run:g \ |
| 71 | -e s:/var:${localstatedir}:g \ |
| 72 | -e s:/usr/bin:${bindir}:g \ |
| 73 | -e s:/bin/kill:${base_bindir}/kill:g \ |
| 74 | -e s:/usr/lib:${libdir}:g \ |
| 75 | ${WORKDIR}/suricata.service > ${D}${systemd_unitdir}/system/suricata.service |
| 76 | fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 77 | |
| 78 | # Remove /var/run as it is created on startup |
| 79 | rm -rf ${D}${localstatedir}/run |
| 80 | |
| 81 | } |
| 82 | |
| 83 | pkg_postinst_ontarget_${PN} () { |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 84 | if command -v systemd-tmpfiles >/dev/null; then |
| 85 | systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/suricata.conf |
| 86 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 87 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 88 | fi |
| 89 | } |
| 90 | |
| 91 | SYSTEMD_PACKAGES = "${PN}" |
| 92 | |
| 93 | PACKAGES =+ "${PN}-socketcontrol" |
Brad Bishop | 95dbbac | 2019-12-02 13:55:25 -0500 | [diff] [blame] | 94 | FILES_${PN} += "${systemd_unitdir} ${sysconfdir}/tmpfiles.d" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 95 | FILES_${PN}-socketcontrol = "${bindir}/suricatasc ${PYTHON_SITEPACKAGES_DIR}" |
| 96 | |
| 97 | CONFFILES_${PN} = "${sysconfdir}/suricata/suricata.yaml" |
| 98 | |
| 99 | RDEPENDS_${PN}-python = "python" |