]> git.saurik.com Git - apt.git/blame - debian/rules
Break apt-file (<< 3.0~exp1~)
[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
MV
224 # move the apt-helper in place
225 mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper
226
304c041b 227 dh_bugfiles -p$@
063a17d7 228 dh_lintian -p$@
3fb71b27 229 dh_installexamples -p$@ $(BLD)/docs/examples/*
ac62eb38 230 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
0c132682 231 dh_installcron -p$@
9e980be8 232 dh_installdocs -p$@
c64bcd92 233 dh_installchangelogs -p$@
2cf8c58b 234 dh_installlogrotate -p$@
c64bcd92
AL
235 dh_strip -p$@
236 dh_compress -p$@
237 dh_fixperms -p$@
e093518c 238 dh_makeshlibs -p$@
c64bcd92 239 dh_installdeb -p$@
bd5e34e8 240 dh_shlibdeps -p$@
0005fa07 241 dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)"
c64bcd92
AL
242 dh_md5sums -p$@
243 dh_builddeb -p$@
244
ee7ddf12 245libapt-pkg-dev: build-binary debian/libapt-pkg-dev.install
c64bcd92
AL
246 dh_testdir -p$@
247 dh_testroot -p$@
af7a92c3 248 dh_prep -p$@
c64bcd92
AL
249 dh_installdirs -p$@
250#
251# libapt-pkg-dev install
252#
2cf8c58b 253 dh_install -p$@ --sourcedir=$(BLD)
c64bcd92 254 dh_installdocs -p$@
c64bcd92
AL
255 dh_installchangelogs -p$@
256 dh_strip -p$@
257 dh_compress -p$@
258 dh_fixperms -p$@
c64bcd92 259 dh_installdeb -p$@
ceab242d 260 dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
b2e465d6
AL
261 dh_md5sums -p$@
262 dh_builddeb -p$@
263
2a52e8c5 264apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
ee7ddf12 265apt-utils: build-binary build-manpages
b2e465d6
AL
266 dh_testdir -p$@
267 dh_testroot -p$@
af7a92c3 268 dh_prep -p$@
b2e465d6
AL
269 dh_installdirs -p$@
270
b2e465d6 271 cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
66b6fe05 272 cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
9c30a078 273 cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt
2cf8c58b
DK
274
275 dh_install -p$@ --sourcedir=$(BLD)
66b6fe05 276 dh_link -p$@
b2e465d6 277 dh_installdocs -p$@
53cd7e2b 278 dh_installexamples -p$@
201eaabd 279
b2e465d6 280 # Install the man pages..
ac62eb38 281 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
90ebe30c 282
b2e465d6
AL
283 dh_installchangelogs -p$@
284 dh_strip -p$@
285 dh_compress -p$@
286 dh_fixperms -p$@
149daa16 287 dh_makeshlibs -p$@
b2e465d6 288 dh_installdeb -p$@
bd5e34e8 289 dh_shlibdeps -p$@
782486e8
MV
290 dh_gencontrol -p$@
291 dh_md5sums -p$@
292 dh_builddeb -p$@
293
ee7ddf12 294$(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install
782486e8
MV
295 dh_testdir -p$@
296 dh_testroot -p$@
297 dh_prep -p$@
298 dh_installdirs -p$@
299
300 dh_install -p$@ --sourcedir=$(BLD)
08c9b191 301 dh_installdocs -p$@
782486e8
MV
302 dh_installchangelogs -p$@
303 dh_strip -p$@
304 dh_compress -p$@
305 dh_fixperms -p$@
f521559b 306 dh_makeshlibs -p$@
08c9b191 307 dh_installdeb -p$@
782486e8
MV
308 dh_shlibdeps -p$@
309 dh_gencontrol -p$@
310 dh_md5sums -p$@
311 dh_builddeb -p$@
312
ee7ddf12 313$(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install
782486e8
MV
314 dh_testdir -p$@
315 dh_testroot -p$@
316 dh_prep -p$@
317 dh_installdirs -p$@
318
319 dh_install -p$@ --sourcedir=$(BLD)
08c9b191 320 dh_installdocs -p$@
782486e8
MV
321 dh_installchangelogs -p$@
322 dh_strip -p$@
323 dh_compress -p$@
324 dh_fixperms -p$@
f521559b 325 dh_makeshlibs -p$@
08c9b191 326 dh_installdeb -p$@
bd5e34e8 327 dh_shlibdeps -p$@
782486e8 328 dh_gencontrol -p$@
c64bcd92
AL
329 dh_md5sums -p$@
330 dh_builddeb -p$@
2d18d44e 331
ee7ddf12 332apt-transport-https: build-binary libapt-pkg-dev
d546f98d
MV
333 dh_testdir -p$@
334 dh_testroot -p$@
af7a92c3 335 dh_prep -p$@
d546f98d
MV
336 dh_installdirs -p$@
337
2cf8c58b 338 dh_install -p$@ --sourcedir=$(BLD)
370ad5e1 339 dh_installdocs -p$@ debian/apt-transport-https.README
d546f98d
MV
340 dh_installexamples -p$@
341
342 # Install the man pages..
343 dh_installman -p$@
344
345 dh_installchangelogs -p$@
346 dh_strip -p$@
347 dh_compress -p$@
348 dh_fixperms -p$@
349 dh_installdeb -p$@
bd5e34e8 350 dh_shlibdeps -p$@
d546f98d
MV
351 dh_gencontrol -p$@
352 dh_md5sums -p$@
353 dh_builddeb -p$@
354
e941cc69
DK
355buildlib/config.guess buildlib/config.sub:
356 $(MAKE) "$@"
357
2d18d44e 358configure:
1d9fd7a2 359 $(MAKE) configure
2d18d44e 360
ee7ddf12
DK
361# translate targets to targets required by debian-policy
362binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
363binary-indep: apt-doc libapt-pkg-doc
2d18d44e 364binary: binary-indep binary-arch
ee7ddf12 365build-arch: build-binary
a034d852 366build-indep: build-manpages build-docbook
ee7ddf12
DK
367build: build-indep build-arch
368
149daa16 369.PHONY: build clean binary-indep binary-arch binary