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