summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 28cdeaecb3c4186741a40feefe9fa15c55e3304e (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/make -f

ifeq ($(DEB_HOST_ARCH_OS), kfreebsd)
# Avoid the /sbin/route wrapper which doesn't provide FreeBSD CLI as expected
ENV_VARS	:= IFCONFIG=/sbin/ifconfig ROUTE=/lib/freebsd/route
EXTRA_ARGS	:=
else
ENV_VARS	:= SYSTEMD_ASK_PASSWORD=/bin/systemd-ask-password IFCONFIG=/sbin/ifconfig ROUTE=/sbin/route IPROUTE=/sbin/ip SYSTEMD_UNIT_DIR=/lib/systemd/system TMPFILES_DIR=/usr/lib/tmpfiles.d
EXTRA_ARGS	:= --enable-systemd --enable-iproute2
endif

#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_configure:
	-test -f tests/t_client.sh.not || mv tests/t_client.sh tests/t_client.sh.not
	$(ENV_VARS) dh_auto_configure -- $(shell dpkg-buildflags --export=configure) --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --includedir=\$${prefix}/include/openvpn --enable-pkcs11 --enable-x509-alt-username $(EXTRA_ARGS)


override_dh_auto_build:
	dh_auto_build
	# The one shipped in the tarball gets rebuild (chaging /bin/sh in some cases)
	#sed -i -e '1s%.*%#!/bin/sh%' tests/t_client.sh
	# make plugins
	# $(MAKE) -C plugin/auth-pam/ $(shell dpkg-buildflags --export=configure)
	# $(MAKE) -C plugin/down-root/ $(shell dpkg-buildflags --export=configure)

# we may not want to run dh_auto_test
#override_dh_auto_test:

override_dh_auto_clean:
	# These two get deleted on "make clean", but come in the tarball
	# hack to keep them around after "make clean"
	-test -f distro/rpm/openvpn.spec.not || mv distro/rpm/openvpn.spec distro/rpm/openvpn.spec.not
	-test -f tests/t_client.sh.not || mv tests/t_client.sh tests/t_client.sh.not
	dh_auto_clean
	-test -f distro/rpm/openvpn.spec.not && mv distro/rpm/openvpn.spec.not distro/rpm/openvpn.spec
	-test -f tests/t_client.sh.not && mv tests/t_client.sh.not tests/t_client.sh
	# clean plugins
	# $(MAKE) -C plugin/auth-pam/ clean
	# $(MAKE) -C plugin/down-root/ clean

override_dh_clean:
	dh_clean -X win/openvpn.nsi.orig

override_dh_auto_install:
	dh_auto_install
	install -m 755 sample/sample-scripts/verify-cn $(CURDIR)/debian/openvpn/usr/share/openvpn
	install -m 755 debian/openvpn.if-up.d $(CURDIR)/debian/openvpn/etc/network/if-up.d/openvpn
	install -m 755 debian/openvpn.if-down.d $(CURDIR)/debian/openvpn/etc/network/if-down.d/openvpn
	# remove unwanted plugin files
	$(RM) $(CURDIR)/debian/openvpn/usr/lib/$(DEB_HOST_GNU_TYPE)/openvpn/plugins/*.la
	# resolvconf script
	install -m 755 debian/update-resolv-conf $(CURDIR)/debian/openvpn/etc/openvpn/update-resolv-conf
	# bash completion
	install -m 644 debian/openvpn.bash_completion $(CURDIR)/debian/openvpn/usr/share/bash-completion/completions/openvpn
	# append Debian's tmpfiles conf to upstream's on Linux (systemd)
ifeq ($(DEB_HOST_ARCH_OS), linux)
	cat debian/openvpn.conf >> $(CURDIR)/debian/openvpn/usr/lib/tmpfiles.d/openvpn.conf
endif
	$(RM) $(CURDIR)/debian/openvpn/usr/share/doc/openvpn/COPYING

override_dh_link:
	dh_link usr/lib/$(DEB_HOST_MULTIARCH)/openvpn/plugins/openvpn-plugin-auth-pam.so  usr/lib/openvpn/openvpn-plugin-auth-pam.so
	dh_link usr/lib/$(DEB_HOST_MULTIARCH)/openvpn/plugins/openvpn-plugin-down-root.so usr/lib/openvpn/openvpn-plugin-down-root.so
	dh_link

override_dh_installexamples:
	dh_installexamples
	## remove windoze stuff
	$(RM) -r $(CURDIR)/debian/openvpn/usr/share/doc/openvpn/examples/easy-rsa/Windows
	$(RM) -r $(CURDIR)/debian/openvpn/usr/share/doc/openvpn/sample
	# remove gitignore file from samples
	$(RM) $(CURDIR)/debian/openvpn/usr/share/doc/openvpn/examples/sample-keys/.gitignore

override_dh_installinit:
	dh_installinit --no-start -- defaults 16 80

override_dh_compress:
	dh_compress --exclude=.cnf --exclude=pkitool

override_dh_installsystemd:
	dh_installsystemd --restart-after-upgrade