summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 32d554371cede3c581ebd9ec3277535b85c68bee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/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)

include /usr/share/debhelper/dh_package_notes/package-notes.mk

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),<salsa-pipeline@debian.org>)
	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