use a substvar to set the archive-keyring in debian/control
[ntk/apt.git] / debian / rules
1 #!/usr/bin/make -f
2 # Made with the aid of dh_make, by Craig Small
3 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
4 # Some lines taken from debmake, by Christoph Lameter.
5
6 # build in verbose mode by default to make it easy to diangose issues
7 export NOISY=1
8
9 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
11 export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
12
13 # FOR AUTOCONF 2.52 AND NEWER ONLY
14 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
15 confflags += --build $(DEB_HOST_GNU_TYPE)
16 else
17 confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
18 endif
19
20 # See below
21 -include build/environment.mak
22
23 ifneq (,$(shell which dpkg-buildflags))
24 export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
25 export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
26 export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
27 else
28 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
29 export CXXFLAGS = -O0 -g -Wall
30 else
31 export CXXFLAGS = -O2 -g -Wall
32 endif
33 endif
34
35 # Default rule
36 build:
37
38 PKG=apt
39 DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
40
41 # Determine the build directory to use
42 BASE=.
43 ifdef BUILD
44 BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
45 else
46 BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
47 endif
48 BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
49 BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
50 override BLD := $(BUILDX)
51
52 ifeq ($(words $(BLD)),0)
53 override BLD := ./build
54 endif
55
56 # APT Programs in apt-utils
57 APT_UTILS=ftparchive sortpkgs extracttemplates
58
59 # Uncomment this to turn on verbose mode.
60 #export DH_VERBOSE=1
61
62 # Find the libapt-pkg major version for use in other control files
63 include buildlib/libversion.mak
64
65 # Determine which library package names to use
66 LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR)
67 LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
68
69 # do not fail as we are just experimenting with symbol files for now
70 export DPKG_GENSYMBOLS_CHECK_LEVEL=0
71
72 build-binary: build/build-binary-stamp
73 build-debiandoc: build/build-debiandoc-stamp
74 build-manpages: build/build-manpages-stamp
75
76 # Note that this is unconditionally done first as part of loading environment.mak
77 # The true is needed to force make to reload environment.mak after running
78 # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
79 build/environment.mak: build/configure-stamp
80 @true
81
82 configure: configure.ac
83 build/configure-stamp: configure buildlib/config.sub buildlib/config.guess
84 dh_testdir
85 -mkdir build
86 cp COPYING debian/copyright
87 cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
88 touch $@
89
90 build/build-binary-stamp: build/configure-stamp
91 # Add here commands to compile the package.
92 $(MAKE) binary
93 # compat symlink for the locale split
94 mkdir -p build/usr/share
95 cd build/usr/share && ln -f -s ../../locale .
96 # compile and run tests
97 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
98 $(MAKE) test
99 else
100 @echo "Tests DISABLED"
101 endif
102 touch $@
103
104 build/build-debiandoc-stamp: build/configure-stamp
105 # Add here commands to compile the package.
106 $(MAKE) debiandoc
107 touch $@
108
109 build/build-manpages-stamp: build/configure-stamp
110 # Add here commands to compile the package.
111 $(MAKE) manpages
112 touch $@
113
114 clean:
115 dh_testdir
116 dh_clean
117
118 [ ! -f Makefile ] || $(MAKE) clean distclean
119 rm -rf build
120 rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
121 debian/libapt-pkg-dev.install debian/apt.install
122 test ! -L buildlib/config.guess || rm -f buildlib/config.guess
123 test ! -L buildlib/config.sub || rm -f buildlib/config.sub
124
125 debian/%.install: debian/%.install.in
126 sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
127
128 # Build architecture-independent files here.
129 libapt-pkg-doc: build-debiandoc
130 dh_testdir -p$@
131 dh_testroot -p$@
132 dh_prep -p$@
133 dh_installdirs -p$@
134 #
135 # libapt-pkg-doc install
136 #
137 dh_installdocs -p$@ $(BLD)/docs/design* \
138 $(BLD)/docs/dpkg-tech* \
139 $(BLD)/docs/files* \
140 $(BLD)/docs/method* \
141 doc/libapt-pkg2_to_3.txt \
142 doc/style.txt \
143 $(BLD)/doc/doxygen/html
144 dh_installexamples -p$@
145
146 dh_installchangelogs -p$@
147 dh_strip -p$@
148 dh_compress -p$@
149 dh_fixperms -p$@
150 dh_installdeb -p$@
151 dh_gencontrol -p$@
152 dh_md5sums -p$@
153 dh_builddeb -p$@
154
155 apt-doc: build-debiandoc
156 dh_testdir -p$@
157 dh_testroot -p$@
158 dh_prep -p$@
159 #
160 # apt-doc install
161 #
162 # Copy the guides
163 dh_installdocs -p$@ $(BLD)/docs/guide*.text \
164 $(BLD)/docs/guide*.html \
165 $(BLD)/docs/offline*.text \
166 $(BLD)/docs/offline*.html
167 dh_installchangelogs -p$@
168 dh_compress -p$@
169 dh_fixperms -p$@
170 dh_installdeb -p$@
171 dh_gencontrol -p$@
172 dh_md5sums -p$@
173 dh_builddeb -p$@
174
175
176
177 # Build architecture-dependent files here.
178
179 apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
180 apt: build-binary build-manpages debian/apt.install
181 dh_testdir -p$@
182 dh_testroot -p$@
183 dh_prep -p$@
184 dh_installdirs -p$@
185 #
186 # apt install
187 #
188 cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
189 cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal
190 chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal
191
192 # make rosetta happy and remove pot files in po/ (but leave stuff
193 # in po/domains/* untouched) and cp *.po into each domain dir
194 rm -f build/po/*.pot
195 rm -f po/*.pot
196
197 dh_install -p$@ --sourcedir=$(BLD)
198
199 # Remove the bits that are in apt-utils
200 rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver)
201
202 # https has its own package
203 rm debian/$@/usr/lib/apt/methods/https
204
205 # move the mirror failure script in place
206 #mv debian/$@/usr/bin/apt-report-mirror-failure \
207 # debian/$@/usr/lib/apt/apt-report-mirror-failure \
208
209 dh_bugfiles -p$@
210 dh_lintian -p$@
211 dh_installexamples -p$@ $(BLD)/docs/examples/*
212 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
213 dh_installcron -p$@
214 dh_installdocs -p$@
215 dh_installchangelogs -p$@
216 dh_installlogrotate -p$@
217 dh_strip -p$@
218 dh_compress -p$@
219 dh_fixperms -p$@
220 dh_installdeb -p$@
221 dh_shlibdeps -p$@
222 dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)"
223 dh_md5sums -p$@
224 dh_builddeb -p$@
225
226 libapt-pkg-dev: build-binary debian/libapt-pkg-dev.install
227 dh_testdir -p$@
228 dh_testroot -p$@
229 dh_prep -p$@
230 dh_installdirs -p$@
231 #
232 # libapt-pkg-dev install
233 #
234 dh_install -p$@ --sourcedir=$(BLD)
235 dh_installdocs -p$@
236 dh_installchangelogs -p$@
237 dh_strip -p$@
238 dh_compress -p$@
239 dh_fixperms -p$@
240 dh_installdeb -p$@
241 dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
242 dh_md5sums -p$@
243 dh_builddeb -p$@
244
245 apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
246 apt-utils: build-binary build-manpages
247 dh_testdir -p$@
248 dh_testroot -p$@
249 dh_prep -p$@
250 dh_installdirs -p$@
251
252 cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
253 cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
254 cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt
255
256 dh_install -p$@ --sourcedir=$(BLD)
257 dh_link -p$@
258 dh_installdocs -p$@
259 dh_installexamples -p$@
260
261 # Install the man pages..
262 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
263
264 dh_installchangelogs -p$@
265 dh_strip -p$@
266 dh_compress -p$@
267 dh_fixperms -p$@
268 dh_makeshlibs -p$@
269 dh_installdeb -p$@
270 dh_shlibdeps -p$@
271 dh_gencontrol -p$@
272 dh_md5sums -p$@
273 dh_builddeb -p$@
274
275 $(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install
276 dh_testdir -p$@
277 dh_testroot -p$@
278 dh_prep -p$@
279 dh_installdirs -p$@
280
281 dh_install -p$@ --sourcedir=$(BLD)
282 dh_installdocs -p$@
283 dh_installchangelogs -p$@
284 dh_strip -p$@
285 dh_compress -p$@
286 dh_fixperms -p$@
287 dh_makeshlibs -p$@
288 dh_installdeb -p$@
289 dh_shlibdeps -p$@
290 dh_gencontrol -p$@
291 dh_md5sums -p$@
292 dh_builddeb -p$@
293
294 $(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install
295 dh_testdir -p$@
296 dh_testroot -p$@
297 dh_prep -p$@
298 dh_installdirs -p$@
299
300 dh_install -p$@ --sourcedir=$(BLD)
301 dh_installdocs -p$@
302 dh_installchangelogs -p$@
303 dh_strip -p$@
304 dh_compress -p$@
305 dh_fixperms -p$@
306 dh_makeshlibs -p$@
307 dh_installdeb -p$@
308 dh_shlibdeps -p$@
309 dh_gencontrol -p$@
310 dh_md5sums -p$@
311 dh_builddeb -p$@
312
313 apt-transport-https: build-binary libapt-pkg-dev
314 dh_testdir -p$@
315 dh_testroot -p$@
316 dh_prep -p$@
317 dh_installdirs -p$@
318
319 dh_install -p$@ --sourcedir=$(BLD)
320 dh_installdocs -p$@ debian/apt-transport-https.README
321 dh_installexamples -p$@
322
323 # Install the man pages..
324 dh_installman -p$@
325
326 dh_installchangelogs -p$@
327 dh_strip -p$@
328 dh_compress -p$@
329 dh_fixperms -p$@
330 dh_installdeb -p$@
331 dh_shlibdeps -p$@
332 dh_gencontrol -p$@
333 dh_md5sums -p$@
334 dh_builddeb -p$@
335
336 buildlib/config.guess buildlib/config.sub:
337 $(MAKE) "$@"
338
339 configure:
340 $(MAKE) configure
341
342 # translate targets to targets required by debian-policy
343 binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
344 binary-indep: apt-doc libapt-pkg-doc
345 binary: binary-indep binary-arch
346 build-arch: build-binary
347 build-indep: build-manpages build-debiandoc
348 build: build-indep build-arch
349
350 .PHONY: build clean binary-indep binary-arch binary