void-packages/srcpkgs/suricata/template
2021-10-04 22:03:37 +02:00

59 lines
2 KiB
Bash

# Template file for 'suricata'
pkgname=suricata
version=4.1.8
revision=1
build_style=gnu-configure
build_helper="$(vopt_if rust rust)"
configure_args="--disable-gccmarch-native $(vopt_enable rust)
$(vopt_enable lua) $(vopt_enable hiredis) --disable-suricata-update
--disable-static --enable-non-bundled-htp"
hostmakedepends="pkg-config $(vopt_if rust cargo)"
makedepends="libnet-devel libpcap-devel pcre-devel libyaml-devel libcap-ng-devel
liblz4-devel liblzma-devel file-devel jansson-devel nss-devel libhtp-devel
$(vopt_if rust rust-std) $(vopt_if lua lua53-devel)
$(vopt_if hiredis hiredis-devel)"
short_desc="Suricata is a network IDS, IPS and NSM engine"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only"
homepage="https://suricata-ids.org/"
distfiles="https://www.openinfosecfoundation.org/download/${pkgname}-${version}.tar.gz"
checksum=c8a83a05f57cedc0ef81d833ddcfdbbfdcdb6f459a91b1b15dc2d5671f1aecbb
build_options="lua rust hiredis"
build_options_default="hiredis"
desc_option_hiredis="Enable hiredis support"
desc_option_lua="Enable lua support"
desc_option_rust="Enable rust protocol parsers"
if [ -z "$CROSS_BUILD" ]; then
build_options_default+=" rust lua"
fi
system_accounts="suricata"
conf_files="/etc/${pkgname}/*.* /etc/${pkgname}/rules/*"
CFLAGS="-fcommon"
post_configure() {
if [ "$build_option_rust" ]; then
vsed -i rust/Makefile \
-e 's/#RUST_TARGET[[:space:]]*=.*/RUST_TARGET = /'
fi
}
post_build() {
sed -i 's|#run-as:|run-as:|g' $pkgname.yaml
sed -i "s|# user: suri| user: $pkgname|g" $pkgname.yaml
sed -i "s|# group: suri| group: $pkgname|g" $pkgname.yaml
sed -i "s|#daemon-directory: \"/\"|daemon-directory: \"/var/lib/suricata\"|g" $pkgname.yaml
}
post_install() {
vsv $pkgname
vinstall $pkgname.yaml 644 etc/$pkgname
vinstall classification.config 644 etc/$pkgname
vinstall reference.config 644 etc/$pkgname
vinstall threshold.config 644 etc/$pkgname
vmkdir etc/$pkgname/rules
vcopy rules/*.rules etc/$pkgname/rules
}