summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 666610035f6d0490bd0f886ffd0507db6b4446c8 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1

export DEB_CFLAGS_MAINT_APPEND = -fno-strict-aliasing -fno-delete-null-pointer-checks -DNO_VERSION_DATE -DDIG_SIGCHASE

export DPKG_GENSYMBOLS_CHECK_LEVEL := 4

include /usr/share/dpkg/default.mk

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

COMMA = ,
ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
  NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
endif

export arch = $(DEB_HOST_ARCH)

ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
EXTRA_FEATURES=--disable-linux-caps
endif

SED_VERSION_EXTENSIONS := \
	sed -e 's,^EXTENSIONS=,EXTENSIONS="$$(dpkg-parsechangelog --file=../debian/changelog | sed -n '/^Version/s/[^-]*//p')-$$(dpkg-vendor --query Vendor)",'

%:
	dh $@ --with python3

prepare_version_extensions:
	if [ ! -f version.bak ]; then \
	  mv version version.bak; \
	  $(SED_VERSION_EXTENSIONS) < version.bak > version; \
	fi

clean_version_extensions:
	if [ -f version.bak ]; then \
	  mv version.bak version; \
	fi

override_dh_autoreconf: prepare_version_extensions
	dh_autoreconf

override_dh_auto_configure:
	dh_auto_configure -- \
		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
		--sysconfdir=/etc/bind \
		--with-python=python3 \
		--localstatedir=/ \
		--enable-threads \
		--enable-largefile \
		--with-libtool \
		--enable-shared \
		--enable-static \
		--with-gost=no \
		--with-openssl=/usr \
		--with-gssapi=/usr \
		--with-libidn2 \
		--with-json-c \
		--with-lmdb=/usr \
		--with-gnu-ld \
		--with-maxminddb \
		--with-atf=no \
		--enable-ipv6 \
		--enable-rrl \
		--enable-filter-aaaa \
		--disable-native-pkcs11 \
		--enable-dnstap \
		$(EXTRA_FEATURES)

override_dh_auto_build:
	dh_auto_build -- all doc

override_dh_auto_clean: clean_version_extensions
	dh_auto_clean

override_dh_auto_install:
	dh_auto_install --destdir=$(CURDIR)/debian/tmp

override_dh_auto_test:
	:

override_dh_installinit:
	dh_installinit -pbind9 --name=named
	dh_installinit --remaining

override_dh_installsystemd:
	dh_installsystemd -pbind9 --no-enable --name=named-resolvconf named-resolvconf.service
	dh_installsystemd -pbind9 --name=named named.service
	dh_installsystemd --remaining

override_dh_install:
	dh_install
	# Install apparmor profile
	dh_apparmor -pbind9 --profile-name=usr.sbin.named

	# update-alternatives: dig
	if [ -e debian/bind9-dnsutils/usr/bin/dig ]; \
	then \
		mv debian/bind9-dnsutils/usr/bin/dig debian/bind9-dnsutils/usr/bin/dig.bind9; \
		mv debian/bind9-dnsutils/usr/share/man/man1/dig.1 debian/bind9-dnsutils/usr/share/man/man1/dig.bind9.1; \
	fi

	# update-alternatives: nsupdate
	if [ -e debian/bind9-dnsutils/usr/bin/nsupdate ]; \
	then \
		mv debian/bind9-dnsutils/usr/bin/nsupdate debian/bind9-dnsutils/usr/bin/nsupdate.bind9; \
		mv debian/bind9-dnsutils/usr/share/man/man1/nsupdate.1 debian/bind9-dnsutils/usr/share/man/man1/nsupdate.bind9.1; \
	fi

override_dh_missing:
	dh_missing --exclude=.la --exclude=lwresd --exclude=__pycache_ --fail-missing

.PHONY: prepare_version_extensions clean_version_extensions