#!/usr/bin/make -f # verbose mode export DH_VERBOSE=1 SURICATA_DESTDIR = $(CURDIR)/debian/suricata 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 ifneq (,$(findstring $(DEB_HOST_ARCH),$(EXTRA_ATOMIC_ARCHS))) DEB_LDFLAGS_MAINT_APPEND += -latomic 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 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 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) 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 rm -rf $(SURICATA_DESTDIR)/usr/lib/python*;\ (cd python &&\ python3 -B setup.py install --install-layout=deb --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_strip: dh_strip --dbgsym-migration='suricata-dbg (<< 1:4.0.0-2~)' 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