File: rules

package info (click to toggle)
unbound 1.13.1-1%2Bdeb11u2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 27,604 kB
  • sloc: ansic: 110,494; sh: 6,028; yacc: 3,391; python: 1,945; makefile: 1,689; awk: 161; perl: 158; xml: 36
file content (147 lines) | stat: -rwxr-xr-x 4,330 bytes parent folder | download
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
#!/usr/bin/make -f
#export DH_VERBOSE=1

include /usr/share/dpkg/architecture.mk

ifneq ($(DEB_HOST_ARCH), amd64)
CONFIGURE_ARGS = --disable-flto
endif

ifneq ($(DEB_HOST_ARCH_OS), linux)
CONFIGURE_ARGS = --with-libbsd
endif

LIBRARY = libunbound8
DOPACKAGES = $(shell dh_listpackages)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

clean:
	dh_autoreconf_clean
	dh clean

build:
build-arch:
build-indep:

binary-arch: build
	dh_testdir
	dh_autoreconf

ifneq (,$(filter unbound unbound-anchor unbound-host,$(DOPACKAGES)))
	# first build -- build unbound daemon
	PYTHON_VERSION="$(shell py3versions -vd)" \
	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="-Wl,--as-needed $(LDFLAGS)" \
		dh_auto_configure -- \
		--disable-rpath \
		--with-pidfile=/run/unbound.pid \
		--with-rootkey-file=/var/lib/unbound/root.key \
		--with-libevent \
		--with-pythonmodule \
		--enable-subnet \
		--enable-dnstap \
		--enable-systemd \
		--with-chroot-dir="" \
		--with-dnstap-socket-path=/run/dnstap.sock \
		--libdir=/usr/lib \
		$(CONFIGURE_ARGS)
	$(MAKE)
	$(MAKE) install DESTDIR="$(CURDIR)/debian/tmp"
	$(MAKE) clean
endif

	# second build -- build libunbound only, against nettle
	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="-Wl,--as-needed $(LDFLAGS)" \
		dh_auto_configure -- \
		--disable-rpath \
		--with-libunbound-only \
		--with-nettle \
		--with-rootkey-file=/var/lib/unbound/root.key \
		--with-libevent \
		--without-pythonmodule \
		--without-pyunbound \
		--enable-event-api \
		$(CONFIGURE_ARGS)
	$(MAKE)
	$(MAKE) install DESTDIR="$(CURDIR)/debian/tmp-lib"
	install -D -m 0644 contrib/libunbound.pc \
		$(CURDIR)/debian/libunbound-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/libunbound.pc
	$(MAKE) clean

ifneq (,$(filter python3-unbound,$(DOPACKAGES)))
	# third build -- pyunbound for Python 3
	PYTHON_VERSION="$(shell py3versions -vd)" \
	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="-Wl,--as-needed $(LDFLAGS)" \
		dh_auto_configure -- \
		--disable-rpath \
		--with-pythonmodule \
		--with-pyunbound \
		$(CONFIGURE_ARGS)
	$(MAKE) _unbound.la
	install -D -m 0644 .libs/_unbound.so \
		debian/python3-unbound/usr/lib/$(shell py3versions -d)/dist-packages/_unbound.so
	install -m 0644 \
		pythonmod/unboundmodule.py \
		libunbound/python/unbound.py \
		debian/python3-unbound/usr/lib/$(shell py3versions -d)/dist-packages
	$(MAKE) clean
endif

	dh_installdirs

ifneq (,$(filter unbound unbound-anchor unbound-host,$(DOPACKAGES)))
	mkdir -p debian/unbound/etc/apparmor.d
	cp debian/apparmor-profile debian/unbound/etc/apparmor.d/usr.sbin.unbound
	dh_apparmor --profile-name=usr.sbin.unbound -punbound

	dh_systemd_enable -p unbound
	dh_systemd_enable -p unbound --name=unbound-resolvconf
	dh_systemd_start -p unbound unbound.service

	dh_installinit --error-handler=true --restart-after-upgrade

	echo '$$named unbound' > debian/unbound/etc/insserv.conf.d/unbound
	install -m 0644 debian/resolvconf debian/unbound/etc/resolvconf/update.d/unbound
	install -m 0755 debian/resolvconf-package debian/unbound/usr/lib/resolvconf/dpkg-event.d/unbound
	install -m 0644 doc/example.conf debian/unbound/usr/share/doc/unbound/examples/unbound.conf
	install -m 0644 contrib/update-anchor.sh debian/unbound/usr/share/doc/unbound/contrib
	install -D -m 0755 contrib/unbound_munin_ debian/unbound/usr/share/munin/plugins/unbound_munin_
endif

	mkdir -p debian/libunbound-dev/usr/lib/$(DEB_HOST_MULTIARCH)
	mv \
		debian/tmp-lib/usr/lib/$(DEB_HOST_MULTIARCH)/libunbound.a \
		debian/tmp-lib/usr/lib/$(DEB_HOST_MULTIARCH)/libunbound.so \
		debian/libunbound-dev/usr/lib/$(DEB_HOST_MULTIARCH)

	mkdir -p debian/$(LIBRARY)/usr/lib/$(DEB_HOST_MULTIARCH)
	mv \
		debian/tmp-lib/usr/lib/$(DEB_HOST_MULTIARCH)/*.so.* \
		debian/$(LIBRARY)/usr/lib/$(DEB_HOST_MULTIARCH)
	chmod 0644 debian/$(LIBRARY)/usr/lib/$(DEB_HOST_MULTIARCH)/*

	dh_install
	dh_installchangelogs
	dh_installdocs
	dh_installman
ifneq (,$(filter python-unbound,$(DOPACKAGES)))
	dh_python2 --no-guessing-versions
endif
ifneq (,$(filter python3-unbound,$(DOPACKAGES)))
	dh_python3
endif
	dh_strip
	dh_compress -Xusr/share/doc/unbound/examples/unbound.conf

	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-indep:
binary: binary-arch binary-indep