blob: 913e64e0bb09bb51b6fc26b6fd0c572def6731db [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001SUMMARY = "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
7SRC_URI = "http://www.openinfosecfoundation.org/download/suricata-${PV}.tar.gz"
Andrew Geisslerd5838332022-05-27 11:33:10 -05008SRC_URI[sha256sum] = "0d4197047c84ba070dfc6b1d9f9ee92f52a71403bfac0e29b2554bb21fe00754"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00009
10DEPENDS = "lz4 libhtp"
11
12SRC_URI += " \
13 file://volatiles.03_suricata \
14 file://tmpfiles.suricata \
15 file://suricata.yaml \
16 file://suricata.service \
17 file://run-ptest \
18 file://fixup.patch \
19 "
20
21SRC_URI += " \
22 crate://crates.io/autocfg/1.0.1 \
23 crate://crates.io/semver-parser/0.7.0 \
24 crate://crates.io/arrayvec/0.4.12 \
25 crate://crates.io/ryu/1.0.5 \
26 crate://crates.io/libc/0.2.86 \
27 crate://crates.io/bitflags/1.2.1 \
28 crate://crates.io/version_check/0.9.2 \
29 crate://crates.io/memchr/2.3.4 \
30 crate://crates.io/nodrop/0.1.14 \
31 crate://crates.io/cfg-if/0.1.9 \
32 crate://crates.io/static_assertions/0.3.4 \
33 crate://crates.io/getrandom/0.1.16 \
34 crate://crates.io/cfg-if/1.0.0 \
35 crate://crates.io/siphasher/0.3.3 \
36 crate://crates.io/ppv-lite86/0.2.10 \
37 crate://crates.io/proc-macro-hack/0.5.19 \
38 crate://crates.io/proc-macro2/0.4.30 \
39 crate://crates.io/unicode-xid/0.1.0 \
40 crate://crates.io/syn/0.15.44 \
41 crate://crates.io/build_const/0.2.1 \
42 crate://crates.io/num-derive/0.2.5 \
43 crate://crates.io/base64/0.11.0 \
44 crate://crates.io/widestring/0.4.3 \
45 crate://crates.io/md5/0.7.0 \
46 crate://crates.io/uuid/0.8.2 \
47 crate://crates.io/byteorder/1.4.2 \
48 crate://crates.io/semver/0.9.0 \
49 crate://crates.io/nom/5.1.1 \
50 crate://crates.io/num-traits/0.2.14 \
51 crate://crates.io/num-integer/0.1.44 \
52 crate://crates.io/num-bigint/0.2.6 \
53 crate://crates.io/num-bigint/0.3.1 \
54 crate://crates.io/num-rational/0.2.4 \
55 crate://crates.io/num-complex/0.2.4 \
56 crate://crates.io/num-iter/0.1.42 \
57 crate://crates.io/phf_shared/0.8.0 \
58 crate://crates.io/crc/1.8.1 \
59 crate://crates.io/rustc_version/0.2.3 \
60 crate://crates.io/phf/0.8.0 \
61 crate://crates.io/lexical-core/0.6.8 \
62 crate://crates.io/time/0.1.44 \
63 crate://crates.io/quote/0.6.13 \
64 crate://crates.io/rand_core/0.5.1 \
65 crate://crates.io/rand_chacha/0.2.2 \
66 crate://crates.io/rand_pcg/0.2.1 \
67 crate://crates.io/num-traits/0.1.43 \
68 crate://crates.io/rand/0.7.3 \
69 crate://crates.io/enum_primitive/0.1.1 \
70 crate://crates.io/phf_generator/0.8.0 \
71 crate://crates.io/phf_codegen/0.8.0 \
72 crate://crates.io/tls-parser/0.9.4 \
73 crate://crates.io/num/0.2.1 \
74 crate://crates.io/rusticata-macros/2.1.0 \
75 crate://crates.io/ntp-parser/0.4.0 \
76 crate://crates.io/der-oid-macro/0.2.0 \
77 crate://crates.io/der-parser/3.0.4 \
78 crate://crates.io/ipsec-parser/0.5.0 \
79 crate://crates.io/x509-parser/0.6.5 \
80 crate://crates.io/der-parser/4.1.0 \
81 crate://crates.io/snmp-parser/0.6.0 \
82 crate://crates.io/kerberos-parser/0.5.0 \
83 crate://crates.io/wasi/0.10.0+wasi-snapshot-preview1 \
84 crate://crates.io/winapi/0.3.9 \
85 crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 \
86 crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 \
87 crate://crates.io/log/0.4.0 \
88 crate://crates.io/rand_hc/0.2.0 \
89 crate://crates.io/wasi/0.9.0+wasi-snapshot-preview1 \
90 crate://crates.io/sawp/0.5.0 \
91 crate://crates.io/sawp-modbus/0.5.0 \
92 crate://crates.io/brotli/3.3.0 \
93 crate://crates.io/flate2/1.0.20 \
94 crate://crates.io/alloc-no-stdlib/2.0.1 \
95 crate://crates.io/alloc-stdlib/0.2.1 \
96 crate://crates.io/brotli-decompressor/2.3.1 \
97 crate://crates.io/crc32fast/1.2.1 \
98 crate://crates.io/miniz_oxide/0.4.4 \
99 crate://crates.io/adler/1.0.2 \
100 "
101
102# test case support
103SRC_URI += " \
104 crate://crates.io/test-case/1.0.1 \
105 crate://crates.io/proc-macro2/1.0.1 \
106 crate://crates.io/quote/1.0.1 \
107 crate://crates.io/syn/1.0.1 \
108 crate://crates.io/unicode-xid/0.2.0 \
109 "
110
111inherit autotools pkgconfig python3native systemd ptest cargo
112
113EXTRA_OECONF += " --disable-debug \
114 --disable-gccmarch-native \
115 --enable-non-bundled-htp \
116 --disable-suricata-update \
117 --with-libhtp-includes=${STAGING_INCDIR} --with-libhtp-libraries=${STAGING_LIBDIR} \
118 "
119
120CARGO_SRC_DIR = "rust"
121
122B = "${S}"
123
Andrew Geisslerd5838332022-05-27 11:33:10 -0500124# nfnetlink has a dependancy to meta-networking
125PACKAGECONFIG ??= "jansson file pcre yaml python pcap cap-ng net nss nspr "
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000126PACKAGECONFIG:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'unittests', '', d)}"
127
128PACKAGECONFIG[pcre] = "--with-libpcre-includes=${STAGING_INCDIR} --with-libpcre-libraries=${STAGING_LIBDIR}, ,libpcre ,"
129PACKAGECONFIG[yaml] = "--with-libyaml-includes=${STAGING_INCDIR} --with-libyaml-libraries=${STAGING_LIBDIR}, ,libyaml ,"
130PACKAGECONFIG[pcap] = "--with-libpcap-includes=${STAGING_INCDIR} --with-libpcap-libraries=${STAGING_LIBDIR}, ,libpcap"
131PACKAGECONFIG[cap-ng] = "--with-libcap_ng-includes=${STAGING_INCDIR} --with-libcap_ng-libraries=${STAGING_LIBDIR}, ,libcap-ng , "
132PACKAGECONFIG[net] = "--with-libnet-includes=${STAGING_INCDIR} --with-libnet-libraries=${STAGING_LIBDIR}, , libnet,"
133PACKAGECONFIG[nfnetlink] = "--with-libnfnetlink-includes=${STAGING_INCDIR} --with-libnfnetlink-libraries=${STAGING_LIBDIR}, ,libnfnetlink ,"
134PACKAGECONFIG[nfq] = "--enable-nfqueue, --disable-nfqueue,libnetfilter-queue,"
135
136PACKAGECONFIG[jansson] = "--with-libjansson-includes=${STAGING_INCDIR} --with-libjansson-libraries=${STAGING_LIBDIR},,jansson, jansson"
137PACKAGECONFIG[file] = ",,file, file"
138PACKAGECONFIG[nss] = "--with-libnss-includes=${STAGING_INCDIR} --with-libnss-libraries=${STAGING_LIBDIR}, nss, nss,"
139PACKAGECONFIG[nspr] = "--with-libnspr-includes=${STAGING_INCDIR} --with-libnspr-libraries=${STAGING_LIBDIR}, nspr, nspr,"
140PACKAGECONFIG[python] = "--enable-python, --disable-python, python3, python3-core"
141PACKAGECONFIG[unittests] = "--enable-unittests, --disable-unittests,"
142
143export logdir = "${localstatedir}/log"
144
145CACHED_CONFIGUREVARS = "ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes"
146
147do_configure:prepend () {
148 oe_runconf
149}
150
151do_compile () {
152 # we do this to bypass the make provided by this pkg
153 # patches Makefile to skip the subdir
154 cargo_do_compile
155
156 # Finish building
157 cd ${S}
158 make
159}
160
161do_install () {
162 install -d ${D}${sysconfdir}/suricata
163
164 oe_runmake install DESTDIR=${D}
165
166 install -d ${D}${sysconfdir}/suricata ${D}${sysconfdir}/default/volatiles
167 install -m 0644 ${WORKDIR}/volatiles.03_suricata ${D}${sysconfdir}/default/volatiles/03_suricata
168
169 install -m 0644 ${S}/threshold.config ${D}${sysconfdir}/suricata
170 install -m 0644 ${S}/suricata.yaml ${D}${sysconfdir}/suricata
171
172 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
173 install -d ${D}${sysconfdir}/tmpfiles.d
174 install -m 0644 ${WORKDIR}/tmpfiles.suricata ${D}${sysconfdir}/tmpfiles.d/suricata.conf
175
176 install -d ${D}${systemd_unitdir}/system
177 sed -e s:/etc:${sysconfdir}:g \
178 -e s:/var/run:/run:g \
179 -e s:/var:${localstatedir}:g \
180 -e s:/usr/bin:${bindir}:g \
181 -e s:/bin/kill:${base_bindir}/kill:g \
182 -e s:/usr/lib:${libdir}:g \
183 ${WORKDIR}/suricata.service > ${D}${systemd_unitdir}/system/suricata.service
184 fi
185
186 # Remove /var/run as it is created on startup
187 rm -rf ${D}${localstatedir}/run
188
189 sed -i -e "s:#!.*$:#!${USRBINPATH}/env ${PYTHON_PN}:g" ${D}${bindir}/suricatasc
190 sed -i -e "s:#!.*$:#!${USRBINPATH}/env ${PYTHON_PN}:g" ${D}${bindir}/suricatactl
191}
192
193pkg_postinst_ontarget:${PN} () {
194if command -v systemd-tmpfiles >/dev/null; then
195 systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/suricata.conf
196elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
197 ${sysconfdir}/init.d/populate-volatile.sh update
198fi
199}
200
201SYSTEMD_PACKAGES = "${PN}"
202
203PACKAGES =+ "${PN}-python"
204FILES:${PN} += "${systemd_unitdir} ${sysconfdir}/tmpfiles.d"
205FILES:${PN}-python = "${bindir}/suricatasc ${PYTHON_SITEPACKAGES_DIR}"
206
207CONFFILES:${PN} = "${sysconfdir}/suricata/suricata.yaml"