summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules102
1 files changed, 102 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..286dcf1
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,102 @@
+#!/usr/bin/make -f
+
+# verbose mode
+export DH_VERBOSE=1
+
+SURICATA_DESTDIR = $(CURDIR)/debian/tmp
+export DEB_BUILD_MAINT_OPTIONS = hardening=+pie,+bindnow
+export CARGO_HOME = $(CURDIR)/debian/cargohome
+
+include /usr/share/dpkg/architecture.mk
+
+# workaround for linking issue on some archs
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--allow-multiple-definition
+EXTRA_ATOMIC_ARCHS = armel mipsel powerpc
+ifneq (,$(findstring $(DEB_HOST_ARCH),$(EXTRA_ATOMIC_ARCHS)))
+ DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -Wl,-latomic -Wl,--as-needed
+ export DEB_LDFLAGS_MAINT_APPEND
+endif
+
+LUAJIT_ARCHS = i386 amd64 powerpc mips mipsel armel armhf
+HYPERSCAN_ARCHS = i386 amd64 hurd-i386 kfreebsd-amd64 x32
+RUST_ARCHS = i386 amd64
+EBPF_ARCHS = amd64 arm64 armel armhf i386 ppc64el s390x ppc64 sparc64 x32
+DPDK_ARCHS = amd64x arm64x riscv64x ppc64elx
+
+LIBHTP_PKG_VERSION=$(shell apt-cache policy libhtp2 | grep Installed | cut -f2- -d: | cut -c2-)
+
+ifneq (,$(findstring $(DEB_HOST_ARCH),$(LUAJIT_ARCHS)))
+ ENABLE_LUAJIT="--enable-luajit"
+endif
+
+ifneq (,$(findstring $(DEB_HOST_ARCH),$(HYPERSCAN_ARCHS)))
+ ENABLE_HYPERSCAN="--enable-libhs"
+endif
+
+ifneq (,$(findstring $(DEB_HOST_ARCH),$(RUST_ARCHS)))
+ ENABLE_HYPERSCAN="--enable-rust"
+endif
+
+ifneq (,$(findstring $(DEB_HOST_ARCH)x,$(DPDK_ARCHS)))
+ ENABLE_DPDK="--enable-dpdk"
+endif
+
+CI ?= $(shell $(CURDIR)/debian/building-in-ci.sh)
+ifeq ($(CI),true)
+ ENABLE_UNITTESTS="--enable-unittests"
+endif
+
+ifneq (,$(findstring $(DEB_HOST_ARCH),$(EBPF_ARCHS)))
+ ENABLE_EBPF=--enable-ebpf --enable-ebpf-build \
+ --with-ebpf-includes=/usr/include/$(DEB_HOST_MULTIARCH)
+endif
+
+CONFIGURE_ARGS = --enable-af-packet --enable-nfqueue --enable-nflog \
+ --enable-gccprotect --disable-gccmarch-native \
+ --with-libnss-includes=/usr/include/nss --with-libnss-libraries=/usr/lib/$(DEB_HOST_MULTIARCH) \
+ --with-libnspr-includes=/usr/include/nspr --with-libnspr-libraries=/usr/lib/$(DEB_HOST_MULTIARCH) \
+ --with-libevent-includes=/usr/include --with-libevent-libraries=/usr/lib/$(DEB_HOST_MULTIARCH) \
+ --disable-coccinelle \
+ --enable-geoip --enable-hiredis \
+ --enable-non-bundled-htp \
+ --disable-suricata-update \
+ $(ENABLE_LUAJIT) \
+ $(ENABLE_HYPERSCAN) \
+ $(ENABLE_UNITTESTS) \
+ $(ENABLE_EBPF) \
+ $(ENABLE_DPDK)
+
+override_dh_auto_configure:
+ dh_auto_configure -- $(CONFIGURE_ARGS)
+
+override_dh_auto_build:
+ uname -a
+ mkdir -p $(CARGO_HOME)
+ dh_auto_build
+
+override_dh_auto_clean:
+ rm -rf $(CARGO_HOME)
+ rm -f debian/suricata.substvars
+
+override_dh_auto_install:
+ dh_auto_install --destdir=$(SURICATA_DESTDIR)
+ rm -rf $(SURICATA_DESTDIR)/usr/lib/python*;\
+ (cd python && make prefix=$(SURICATA_DESTDIR)/usr)
+ # clean upstream install documentation
+ rm -rf $(SURICATA_DESTDIR)/usr/share/doc/suricata/*
+ $(foreach file, $(wildcard ebpf/*bpf), \
+ install -D -t $(SURICATA_DESTDIR)/usr/lib/suricata/ebpf $(file) ;\
+ )
+
+override_dh_auto_test:
+ # do nothing
+
+override_dh_missing:
+ dh_missing --list-missing
+
+override_dh_gencontrol:
+ echo "libhtp:Version=$(LIBHTP_PKG_VERSION)" >> debian/suricata.substvars
+ dh_gencontrol
+
+%:
+ dh $@ --with python3