#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS=hardening=+all include /usr/share/dpkg/default.mk export CFLAGS += $(shell getconf LFS_CFLAGS) export LDFLAGS += $(shell getconf LFS_LDFLAGS) PREFIX_IPV4 = $(CURDIR)/debian/ucspi-tcp PREFIX_IPV6 = $(CURDIR)/debian/ucspi-tcp-ipv6 ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) export V=1 endif %: dh $@ # The upstream Makefile does not have a 'clean' target, so simulate one. override_dh_auto_clean: sed -nre '/^[a-z0-9@_.-]+:/ { s/:.*//; p; }' Makefile | grep -Fxve it -e default | xargs -r rm -f override_dh_auto_configure: echo '/usr' > conf-home echo '$(CC) $(CFLAGS) $(CPPFLAGS)' > conf-cc echo '$(CC) $(LDFLAGS)' > conf-ld ifeq ($(DEBEMAIL),) echo 'int main () { return 0; }' > chkshsgr.c endif mkdir ipv6 xargs install -t ipv6 < FILES cd ipv6 && patch -p1 < ../debian/ipv6-support.patch override_dh_auto_build: $(MAKE) DESTDIR=$(PREFIX_IPV4) $(MAKE) -C ipv6 DESTDIR=$(PREFIX_IPV6) override_dh_auto_install: mkdir -p $(PREFIX_IPV4)/usr $(PREFIX_IPV6)/usr ./install ./instcheck cd ipv6 && ./install && ./instcheck # ./install incorrectly install manpages under /usr/man, not # /usr/share/man. rm -r $(PREFIX_IPV6)/usr/man # Upstream does strange thing -- its test suite assumes that programs # are already installed. Normally, checks are performed between `build' # and `install'. # # So automatic invocation of tests is inhibited, and they are invoked # manually at `install' stage. # # We run our own test suite instead, one that will also be used in # the autopkgtest later. override_dh_auto_test: env PYTHONPATH='$(CURDIR)/debian/tests/python' python3 -B -u -m ucspi_tcp_test -d '$(CURDIR)' -p tcp env PYTHONPATH='$(CURDIR)/debian/tests/python' python3 -B -u -m ucspi_tcp_test -d '$(CURDIR)/ipv6' -p tcp -i 4 env PYTHONPATH='$(CURDIR)/debian/tests/python' python3 -B -u -m ucspi_tcp_test -d '$(CURDIR)/ipv6' -p tcp -i 6