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