File: rules

package info (click to toggle)
bind9 1:9.10.3.dfsg.P4-12.3+deb9u4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 53,956 kB
  • sloc: ansic: 353,048; sh: 62,796; xml: 20,538; cpp: 19,241; perl: 8,054; makefile: 5,050; tcl: 842; awk: 236; python: 110
file content (261 lines) | stat: -rwxr-xr-x 8,299 bytes parent folder | download | duplicates (2)
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/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

include /usr/share/dpkg/buildflags.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

DEB_BUILD_ARCH		?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_ARCH		?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export arch = $(DEB_HOST_ARCH)

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

stamps/prepare:
	dh_testdir
	if [ ! -d autoreconf-bck ]; then \
	    mkdir autoreconf-bck; \
	    cp -pr config.h.in configure libtool.m4 ltmain.sh autoreconf-bck; \
	fi
	cp -r bin/named bin/named-pkcs11
	cp -r bin/dnssec bin/dnssec-pkcs11
	cp -r lib/isc lib/isc-pkcs11
	cp -r lib/dns lib/dns-pkcs11
	patch -p1 < debian/patches/extra-add_native_pkcs11.diff
	# disable GOST, can't use openssl with native pkcs11 anyway
	sed -i 's/HAVE_OPENSSL_GOST/GOSTBUSTERS/' lib/dns-pkcs11/*.[ch]
	dh_autotools-dev_updateconfig
	dh_autoreconf
	@mkdir -p stamps
	touch $@

stamps/configure: stamps/prepare
	dh_testdir
	rm -rf build
	mkdir -p build
	cd build && ../configure --prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
		--infodir=\$${prefix}/share/info \
		--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-gnu-ld \
		--with-geoip=/usr \
		--with-atf=no \
		--enable-ipv6 \
		--enable-rrl \
		--enable-filter-aaaa \
		--enable-native-pkcs11 \
		--with-pkcs11=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/softhsm/libsofthsm2.so \
		--with-randomdev=/dev/urandom \
		$(EXTRA_FEATURES)

	touch $@

stamps/configure-udeb: stamps/prepare
	dh_testdir
	rm -rf build-udeb
	mkdir -p build-udeb
	cd build-udeb && ../configure \
		--prefix=/usr \
		--sysconfdir=/etc/bind \
		--with-python=python3 \
		--localstatedir=/ \
		--disable-epoll \
		--disable-kqueue \
		--disable-devpoll \
		--disable-threads \
		--disable-linux-caps \
		--without-openssl \
		--without-libxml2 \
		--enable-ipv6 \
		--enable-shared \
		--with-libtool \
		--with-gssapi=no \
		--libdir=/lib/$(DEB_HOST_MULTIARCH) \
		--includedir=/usr/include/bind-export
	sh debian/apply-export-patch

	# no need to build these targets here
	sed -i 's/dnssec-pkcs11//;s/named-pkcs11//' build-udeb/bin/Makefile
	sed -i 's/dns-pkcs11//;s/isc-pkcs11//' build-udeb/lib/Makefile
	touch $@

build-arch: build
build-indep: build
build: stamps/build
stamps/build: stamps/configure stamps/configure-udeb
	dh_testdir
	LD_LIBRARY_PATH=$(CURDIR)/build/lib/isc/.libs:$(CURDIR)/build/lib/isccc/.libs:$(CURDIR)/build/isccfg/.libs:$${LD_LIBRARY_PATH} \
	  $(MAKE) -C build $(NJOBS)
	touch $@

stamps/build-udeb: stamps/configure-udeb
	dh_testdir
	$(MAKE) -C build-udeb $(NJOBS)
	touch $@

autofiles:
	libtoolize --automake --copy --force
	aclocal
	#automake
	autoheader
	autoconf
	rm -rf autom4te.cache
	cp config.guess config.sub contrib/idn/idnkit-1.0-src/

clean:
	dh_testdir
	dh_testroot
	rm -rf bin/dnssec-pkcs11 bin/named-pkcs11 lib/isc-pkcs11 lib/dns-pkcs11
	rm -rf build build-udeb stamps debian/tmp-udeb
	rm -f debian/substvars
	rm -f doc/arm/Bv9ARM.pdf
	dh_autoreconf_clean
	dh_autotools-dev_restoreconfig
	dh_clean
	if [ -d autoreconf-bck ]; then \
	    mv autoreconf-bck/* .; rmdir autoreconf-bck; \
	fi

newtemplate:
	debconf-updatepo

msgstats:
	@cd debian/po && for i in *.po; do x=$$(msgfmt --statistics $$i 2>&1); echo $$i $$x; done; rm -f messages.mo *.po~

msg-email:
	@podebconf-report-po

INSTDIR=debian/tmp
ETCBIND=debian/bind9/etc/bind
ETCAPP=debian/bind9/etc/apparmor.d
install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	: # regular install
	$(MAKE) -C build install DESTDIR=$(CURDIR)/${INSTDIR}
	rm -rf ${INSTDIR}/usr/etc
	find ${INSTDIR} -name \*.la -execdir rm -f {} \;
	install -c -o bin -g bin -m 444 debian/db.0 ${ETCBIND}/db.0
	install -c -o bin -g bin -m 444 debian/db.0 ${ETCBIND}/db.255
	install -c -o bin -g bin -m 444 debian/db.empty ${ETCBIND}
	install -c -o bin -g bin -m 444 debian/zones.rfc1918 ${ETCBIND}
	install -c -o bin -g bin -m 444 debian/db.127 ${ETCBIND}
	install -c -o bin -g bin -m 444 debian/db.local ${ETCBIND}
	install -c -o bin -g bin -m 444 debian/db.root ${ETCBIND}
	install -c -o bin -g bin -m 440 debian/named.conf ${ETCBIND}
	install -c -o bin -g bin -m 440 debian/named.conf.local ${ETCBIND}
	install -c -o bin -g bin -m 440 debian/named.conf.default-zones ${ETCBIND}
	install -c -o bin -g bin -m 440 bind.keys ${ETCBIND}
	install -c -o bin -g bin -m 440 debian/named.conf.options debian/bind9/usr/share/bind9/
	install -m 644 -o root -g root debian/apparmor-profile ${ETCAPP}/usr.sbin.named
	install -m 644 -o root -g root debian/apparmor-profile.local ${ETCAPP}/local/usr.sbin.named

	install debian/ip-up.d debian/bind9/etc/ppp/ip-up.d/bind9
	install debian/ip-down.d debian/bind9/etc/ppp/ip-down.d/bind9
	install debian/ip-up.d debian/bind9/etc/network/if-up.d/bind9
	install debian/ip-down.d debian/bind9/etc/network/if-down.d/bind9
	install -m644 debian/bind9.ufw.profile debian/bind9/etc/ufw/applications.d/bind9

	cp doc/arm/*.html debian/bind9-doc/usr/share/doc/bind9-doc/arm

	: # udeb install
	$(MAKE) -C build-udeb install DESTDIR=$(CURDIR)/debian/tmp-udeb

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installexamples -i
	dh_installmenu -i
	dh_installcron -i
	dh_installinfo -i
	dh_installchangelogs -i # CHANGES # upstream changelog only in bind9-doc
	dh_installchangelogs -pbind9-doc CHANGES
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	for i in $$(sed -n '/^Package:/s/^.* //p' debian/control); do cat debian/vars.in >> debian/$$i.substvars; done
	cat debian/vars.in >> debian/substvars
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installexamples -a
	dh_installmenu -a
	dh_systemd_enable -pbind9 --no-enable --name=bind9-resolvconf bind9-resolvconf.service
	dh_systemd_enable -pbind9 --no-enable --name=bind9-pkcs11 bind9-pkcs11.service
	dh_systemd_enable -pbind9 bind9.service
	dh_systemd_enable -plwresd lwresd.service
	dh_installinit -a --no-start -- defaults 15 85
	dh_installcron -a
	dh_installdebconf -pbind9
	dh_installinfo -a
	dh_installchangelogs -a # CHANGES # upstream changelog only in bind9-doc
	dh_install --sourcedir=debian/tmp -a --fail-missing
	for lib in `find debian/tmp-udeb/lib/$(DEB_HOST_MULTIARCH)/ -type l -name 'lib*-export.so.*'`; do \
	  lib=$$(basename $$lib); \
	  dev=$$(echo $$lib | sed 's/\.so\..*/.so/'); \
	  dh_link -plibbind-export-dev /lib/$(DEB_HOST_MULTIARCH)/$$lib \
	    /usr/lib/$(DEB_HOST_MULTIARCH)/$$dev; \
	done
	# install apport hook on Ubuntu
	if dpkg-vendor --is ubuntu; then \
	    install -m 644 -D debian/bind9.apport debian/bind9/usr/share/apport/package-hooks/bind9.py; \
	fi
	dh_link -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a
	dh_makeshlibs -plibirs-export141 --add-udeb=libirs-export141-udeb
	dh_makeshlibs -plibisc-export160 --add-udeb=libisc-export160-udeb
	dh_makeshlibs -plibdns-export162 --add-udeb=libdns-export162-udeb
	dh_makeshlibs -plibisccc-export140 --add-udeb=libisccc-export140-udeb
	dh_makeshlibs -plibisccfg-export140 --add-udeb=libisccfg-export140-udeb
	dh_installdeb -a
	dh_shlibdeps -a
	for i in $$(sed -n '/^Package:/s/^.* //p' debian/control); do cat debian/vars.in >> debian/$$i.substvars; done
	cat debian/vars.in >> debian/substvars
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure