summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 564f5b73b45db9caf70c4af75304c29479093f69 (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
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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

ifndef DEB_HOST_ARCH
DEB_BUILD_ARCH := $(shell dpkg --print-architecture)
endif
export arch = $(DEB_HOST_ARCH)

DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
DEBUG = -g
endif

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
OPT = 
else
OPT = -O2
endif

export CFLAGS=-fno-strict-aliasing -DDIG_SIGCHASE $(DEBUG) $(OPT)

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

configure: configure-stamp
configure-stamp:
	dh_testdir
	./configure --prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--sysconfdir=/etc/bind \
		--localstatedir=/var \
		--enable-threads \
		--enable-largefile \
		--with-libtool \
		--enable-shared \
		--enable-static \
		--with-openssl=/usr \
		--with-gssapi=/usr \
		--with-gnu-ld \
		--with-geoip=/usr \
		--with-atf=no \
		--enable-ipv6 \
		$(EXTRA_FEATURES)

	touch configure-stamp

build: configure-stamp build-stamp
build-stamp:
	dh_testdir
	LD_LIBRARY_PATH=$$(pwd)/lib/isc/.libs:$$(pwd)/lib/isccc/.libs:$$(pwd)/isccfg/.libs:$${LD_LIBRARY_PATH} $(MAKE)
	touch build-stamp

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
	-$(MAKE) distclean
	find . -name \*.o -exec rm {} \;
	rm -f build-stamp configure-stamp
	rm -f debian/substvars lib/bind/include/isc/platform.h
	rm -f contrib/dlz/bin/dlzbdb/Makefile contrib/dlz/drivers/rules
	rm -f doc/arm/Bv9ARM.pdf
	dh_clean

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

ETCBIND=debian/bind9/etc/bind
ETCAPP=debian/bind9/etc/apparmor.d
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs
	$(MAKE) install DESTDIR=`pwd`/debian/bind9
	rm -f debian/bind9/usr/lib/*.la
	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/
	cp doc/arm/*.html debian/bind9-doc/usr/share/doc/bind9-doc/arm
	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
	rmdir debian/bind9/var/run/named debian/lwresd/var/run/named || true

	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

# 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 bind9-resolvconf.service
	dh_systemd_enable -pbind9 bind9.service
	dh_systemd_enable -plwresd lwresd.service
	dh_installinit -a --no-start -- defaults 15 85
	# Ship the extra service file for resolvconf integration manually.
	cp debian/bind9-resolvconf.service debian/bind9/lib/systemd/system
	dh_installcron -a
	dh_installdebconf -pbind9
	dh_installinfo -a
	dh_installchangelogs -a # CHANGES # upstream changelog only in bind9-doc
	dh_install --sourcedir=debian/bind9 -a
	(cd debian/bind9/ && rm -rf $$(cat ../*.install) )
	rm -f debian/bind9/usr/share/man/man1/query-loc.1
	# 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_installdeb -a
	dh_shlibdeps -l"debian/libbind9-90/usr/lib:debian/libbind-dev/usr/lib:debian/libdns99/usr/lib:debian/libisc95/usr/lib:debian/libisccc90/usr/lib:debian/libisccfg90/usr/lib:debian/liblwres90/usr/lib:/usr/lib/libfakeroot" -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