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