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