void-packages/srcpkgs/suricata/template

61 lines
2.0 KiB
Bash

# Template file for 'suricata'
pkgname=suricata
version=7.0.3
revision=1
build_style=gnu-configure
build_helper=rust
configure_args="--disable-gccmarch-native $(vopt_enable lua) $(vopt_enable hiredis)
--disable-suricata-update --disable-static --enable-non-bundled-htp"
hostmakedepends="pkg-config cargo"
makedepends="libnet-devel libpcap-devel pcre2-devel libyaml-devel libcap-ng-devel
liblz4-devel liblzma-devel file-devel jansson-devel nss-devel libhtp-devel
libunwind-devel 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=ea0742d7a98783f1af4a57661af6068bc2d850ac3eca04b3204d28ce165e35ff
build_options="lua hiredis"
build_options_default="hiredis"
desc_option_hiredis="Enable hiredis support"
if [ -z "$CROSS_BUILD" ]; then
build_options_default+=" lua"
fi
system_accounts="suricata"
conf_files="/etc/${pkgname}/*.* /etc/${pkgname}/rules/*"
CFLAGS="-fcommon"
pre_configure() {
if [ ! -z "$CROSS_BUILD" ]; then
mkdir -p rust/target/${XBPS_CROSS_RUST_TARGET}
ln -fs ${XBPS_CROSS_RUST_TARGET} rust/target/${XBPS_CROSS_RUST_TARGET/-unknown}
ln -fs ${XBPS_CROSS_RUST_TARGET} rust/target/${XBPS_CROSS_TRIPLET/-unknown}
fi
}
post_configure() {
vsed -i rust/Makefile -e 's/.*RUST_TARGET[[:space:]]*=.*/RUST_TARGET =/'
}
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 suricata.yaml 644 etc/suricata
vinstall etc/classification.config 644 etc/suricata
vinstall etc/reference.config 644 etc/suricata
vinstall threshold.config 644 etc/suricata
vmkdir etc/suricata/rules
vcopy rules/*.rules etc/suricata/rules
}