summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 6fb850d2fa5d5d92550c96f8bb2eac2c02e2faab (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/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

DEB_VERSION_REVISION := $(call dpkg_late_eval,DEB_VERSION_REVISION,echo '$(DEB_VERSION_UPSTREAM_REVISION)' | sed -e 's/^[^-]*//')

SED_VERSION_EXTENSIONS := \
	sed -e 's/\[bind_VERSION_EXTRA\], .*)/[bind_VERSION_EXTRA], $(DEB_VERSION_REVISION)-$(DEB_VENDOR))/'

EXCLUDE_FILES :=			\
	--exclude=.la			\
	--exclude=lwresd		\
	--exclude=__pycache_		\
	--exclude=sample.so		\
	--exclude=dlzexternal.so	\
	--exclude=test-async.so		\
	--exclude=libbind9.la		\
	--exclude=libdns.la		\
	--exclude=libirs.la		\
	--exclude=libisccc.la		\
	--exclude=libisccfg.la		\
	--exclude=libisc.la		\
	--exclude=libns.la

%:
	dh $@

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

clean_version_extensions:
	if [ -f configure.ac.bak ]; then \
	  mv configure.ac.bak configure.ac; \
	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 \
		--disable-static \
		--with-gost=no \
		--with-openssl=/usr \
		--with-gssapi=yes \
		--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:
	sed -i 's/:gl:`\([#!][^`]*\)`/[GL \1]/g' doc/notes/*.rst
	dh_auto_build -- all html

override_dh_auto_clean: clean_version_extensions
	sed -i 's/\[GL \([#!][^]]*\)]/:gl:`\1`/g' doc/notes/*.rst
	dh_auto_clean

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

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 $(EXCLUDE_FILES)
	# 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

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

override_dh_missing:
	dh_missing $(EXCLUDE_FILES)  --fail-missing

.PHONY: prepare_version_extensions clean_version_extensions