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