]> git.saurik.com Git - apt.git/blame - debian/rules
deprecate confusing Pkg.CandVersion() method
[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
e23ee4c2 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)
90986d4d 32 export LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS)
9a61bb21 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
084faf6a
HG
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.
66export ac_cv_header_gtest_gtest_h=yes
67
b2e465d6 68# APT Programs in apt-utils
9c30a078 69APT_UTILS=ftparchive sortpkgs extracttemplates
b2e465d6 70
2d18d44e
AL
71# Uncomment this to turn on verbose mode.
72#export DH_VERBOSE=1
73
d153f53f 74# Find the libapt-pkg major version for use in other control files
23d84658 75include buildlib/libversion.mak
a5b7cd82 76
7eee083a
MV
77# Determine which library package names to use
78LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR)
79LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
80
149daa16
DK
81# do not fail as we are just experimenting with symbol files for now
82export DPKG_GENSYMBOLS_CHECK_LEVEL=0
201eaabd 83
ee7ddf12 84build-binary: build/build-binary-stamp
a034d852 85build-docbook: build/build-docbook-stamp
e4bc41c7 86build-manpages: build/build-manpages-stamp
b2e465d6
AL
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.
91build/environment.mak: build/configure-stamp
92 @true
201eaabd 93
ed9ba607 94configure: configure.ac
e941cc69 95build/configure-stamp: configure buildlib/config.sub buildlib/config.guess
2d18d44e 96 dh_testdir
520624d5 97 mkdir -p build
9b2e67eb 98 cp COPYING debian/copyright
e5379452 99 cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
b2e465d6 100 touch $@
0b5c85b5 101
ee7ddf12 102build/build-binary-stamp: build/configure-stamp
2d18d44e 103 # Add here commands to compile the package.
16c76dd2 104 $(MAKE) binary
84736cfa
MV
105 # compat symlink for the locale split
106 mkdir -p build/usr/share
107 cd build/usr/share && ln -f -s ../../locale .
afd7b358 108 # compile and run tests
224bdefc 109ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
6e08a00f 110 $(MAKE) test
224bdefc
DK
111else
112 @echo "Tests DISABLED"
113endif
16c76dd2
AL
114 touch $@
115
a034d852 116build/build-docbook-stamp: build/configure-stamp
16c76dd2 117 # Add here commands to compile the package.
a034d852 118 $(MAKE) docbook
cf58a7e1 119 touch $@
2d18d44e 120
e4bc41c7
DK
121build/build-manpages-stamp: build/configure-stamp
122 # Add here commands to compile the package.
123 $(MAKE) manpages
124 touch $@
125
2d18d44e
AL
126clean:
127 dh_testdir
8bb62daf 128 dh_clean
e184b9df 129
70371bc8 130 [ ! -f Makefile ] || $(MAKE) clean distclean
2d18d44e 131 rm -rf build
cb1a690c 132 rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
a7737ad3 133 debian/libapt-pkg-dev.install debian/apt.install
e941cc69
DK
134 test ! -L buildlib/config.guess || rm -f buildlib/config.guess
135 test ! -L buildlib/config.sub || rm -f buildlib/config.sub
201eaabd 136
cb1a690c
MV
137debian/%.install: debian/%.install.in
138 sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
139
2d18d44e 140# Build architecture-independent files here.
a034d852 141libapt-pkg-doc: build-docbook
c64bcd92
AL
142 dh_testdir -p$@
143 dh_testroot -p$@
af7a92c3 144 dh_prep -p$@
c64bcd92 145 dh_installdirs -p$@
3a42cc3c
AL
146#
147# libapt-pkg-doc install
70371bc8 148#
c7a72718 149 rm -f $(BLD)/doc/doxygen/html/*.map $(BLD)/doc/doxygen/html/*.md5
70371bc8
DK
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 \
d1aa9162 155 doc/style.txt \
dc1e2a06 156 $(BLD)/doc/doxygen/html
c64bcd92 157 dh_installexamples -p$@
c64bcd92 158
c64bcd92
AL
159 dh_installchangelogs -p$@
160 dh_strip -p$@
c7a72718 161 dh_compress -p$@ -X.xhtml
c64bcd92 162 dh_fixperms -p$@
c64bcd92 163 dh_installdeb -p$@
782486e8 164 dh_gencontrol -p$@
c64bcd92
AL
165 dh_md5sums -p$@
166 dh_builddeb -p$@
2d18d44e 167
a034d852 168apt-doc: build-docbook
16c76dd2
AL
169 dh_testdir -p$@
170 dh_testroot -p$@
af7a92c3 171 dh_prep -p$@
16c76dd2
AL
172#
173# apt-doc install
174#
175 # Copy the guides
70371bc8
DK
176 dh_installdocs -p$@ $(BLD)/docs/guide*.text \
177 $(BLD)/docs/guide*.html \
178 $(BLD)/docs/offline*.text \
179 $(BLD)/docs/offline*.html
16c76dd2
AL
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
2d18d44e 189
3a42cc3c 190# Build architecture-dependent files here.
3a42cc3c 191
0425a56b 192apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
a7737ad3 193apt: build-binary build-manpages debian/apt.install
c64bcd92
AL
194 dh_testdir -p$@
195 dh_testroot -p$@
af7a92c3 196 dh_prep -p$@
503a2291 197 dh_installdirs -p$@
3a42cc3c
AL
198#
199# apt install
200#
9d2938d4 201 cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
a86f8516
SL
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
c1b3d189
DK
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
2d18d44e 206
be2d3759
MV
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
2cf8c58b
DK
212 dh_install -p$@ --sourcedir=$(BLD)
213
214 # Remove the bits that are in apt-utils
9c30a078 215 rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver)
2cf8c58b
DK
216
217 # https has its own package
218 rm debian/$@/usr/lib/apt/methods/https
219
3f599bb7 220 # move the mirror failure script in place
23c5897c
MV
221 #mv debian/$@/usr/bin/apt-report-mirror-failure \
222 # debian/$@/usr/lib/apt/apt-report-mirror-failure \
3f599bb7 223
e43a426e 224 # move the apt-helper in place
14669d4b
MV
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/
e43a426e 228
304c041b 229 dh_bugfiles -p$@
063a17d7 230 dh_lintian -p$@
3fb71b27 231 dh_installexamples -p$@ $(BLD)/docs/examples/*
ac62eb38 232 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
14669d4b
MV
233 dh_installcron -p$@ --name=apt-compat
234 dh_systemd_enable -p$@ apt-daily.timer
235 dh_systemd_start -p$@ apt-daily.timer
9e980be8 236 dh_installdocs -p$@
c64bcd92 237 dh_installchangelogs -p$@
2cf8c58b 238 dh_installlogrotate -p$@
c64bcd92
AL
239 dh_strip -p$@
240 dh_compress -p$@
241 dh_fixperms -p$@
e093518c 242 dh_makeshlibs -p$@
c64bcd92 243 dh_installdeb -p$@
bd5e34e8 244 dh_shlibdeps -p$@
0005fa07 245 dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)"
c64bcd92
AL
246 dh_md5sums -p$@
247 dh_builddeb -p$@
248
ee7ddf12 249libapt-pkg-dev: build-binary debian/libapt-pkg-dev.install
c64bcd92
AL
250 dh_testdir -p$@
251 dh_testroot -p$@
af7a92c3 252 dh_prep -p$@
c64bcd92
AL
253 dh_installdirs -p$@
254#
255# libapt-pkg-dev install
256#
2cf8c58b 257 dh_install -p$@ --sourcedir=$(BLD)
c64bcd92 258 dh_installdocs -p$@
c64bcd92
AL
259 dh_installchangelogs -p$@
260 dh_strip -p$@
261 dh_compress -p$@
262 dh_fixperms -p$@
c64bcd92 263 dh_installdeb -p$@
ceab242d 264 dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
b2e465d6
AL
265 dh_md5sums -p$@
266 dh_builddeb -p$@
267
2a52e8c5 268apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
ee7ddf12 269apt-utils: build-binary build-manpages
b2e465d6
AL
270 dh_testdir -p$@
271 dh_testroot -p$@
af7a92c3 272 dh_prep -p$@
b2e465d6
AL
273 dh_installdirs -p$@
274
b2e465d6 275 cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
66b6fe05 276 cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
9c30a078 277 cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt
2cf8c58b
DK
278
279 dh_install -p$@ --sourcedir=$(BLD)
66b6fe05 280 dh_link -p$@
b2e465d6 281 dh_installdocs -p$@
53cd7e2b 282 dh_installexamples -p$@
201eaabd 283
b2e465d6 284 # Install the man pages..
ac62eb38 285 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
90ebe30c 286
b2e465d6
AL
287 dh_installchangelogs -p$@
288 dh_strip -p$@
289 dh_compress -p$@
290 dh_fixperms -p$@
149daa16 291 dh_makeshlibs -p$@
b2e465d6 292 dh_installdeb -p$@
bd5e34e8 293 dh_shlibdeps -p$@
782486e8
MV
294 dh_gencontrol -p$@
295 dh_md5sums -p$@
296 dh_builddeb -p$@
297
ee7ddf12 298$(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install
782486e8
MV
299 dh_testdir -p$@
300 dh_testroot -p$@
301 dh_prep -p$@
302 dh_installdirs -p$@
303
304 dh_install -p$@ --sourcedir=$(BLD)
08c9b191 305 dh_installdocs -p$@
782486e8
MV
306 dh_installchangelogs -p$@
307 dh_strip -p$@
308 dh_compress -p$@
309 dh_fixperms -p$@
f521559b 310 dh_makeshlibs -p$@
08c9b191 311 dh_installdeb -p$@
782486e8
MV
312 dh_shlibdeps -p$@
313 dh_gencontrol -p$@
314 dh_md5sums -p$@
315 dh_builddeb -p$@
316
ee7ddf12 317$(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install
782486e8
MV
318 dh_testdir -p$@
319 dh_testroot -p$@
320 dh_prep -p$@
321 dh_installdirs -p$@
322
323 dh_install -p$@ --sourcedir=$(BLD)
08c9b191 324 dh_installdocs -p$@
782486e8
MV
325 dh_installchangelogs -p$@
326 dh_strip -p$@
327 dh_compress -p$@
328 dh_fixperms -p$@
f521559b 329 dh_makeshlibs -p$@
08c9b191 330 dh_installdeb -p$@
bd5e34e8 331 dh_shlibdeps -p$@
782486e8 332 dh_gencontrol -p$@
c64bcd92
AL
333 dh_md5sums -p$@
334 dh_builddeb -p$@
2d18d44e 335
ee7ddf12 336apt-transport-https: build-binary libapt-pkg-dev
d546f98d
MV
337 dh_testdir -p$@
338 dh_testroot -p$@
af7a92c3 339 dh_prep -p$@
d546f98d
MV
340 dh_installdirs -p$@
341
2cf8c58b 342 dh_install -p$@ --sourcedir=$(BLD)
370ad5e1 343 dh_installdocs -p$@ debian/apt-transport-https.README
d546f98d
MV
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$@
bd5e34e8 354 dh_shlibdeps -p$@
d546f98d
MV
355 dh_gencontrol -p$@
356 dh_md5sums -p$@
357 dh_builddeb -p$@
358
e941cc69
DK
359buildlib/config.guess buildlib/config.sub:
360 $(MAKE) "$@"
361
2d18d44e 362configure:
1d9fd7a2 363 $(MAKE) configure
2d18d44e 364
ee7ddf12
DK
365# translate targets to targets required by debian-policy
366binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
367binary-indep: apt-doc libapt-pkg-doc
2d18d44e 368binary: binary-indep binary-arch
ee7ddf12 369build-arch: build-binary
a034d852 370build-indep: build-manpages build-docbook
ee7ddf12
DK
371build: build-indep build-arch
372
149daa16 373.PHONY: build clean binary-indep binary-arch binary