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