merged from lp:~donkult/apt/experimental
[ntk/apt.git] / debian / rules
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.
5
6 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
7 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
8 export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
9
10 # FOR AUTOCONF 2.52 AND NEWER ONLY
11 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
12 confflags += --build $(DEB_HOST_GNU_TYPE)
13 else
14 confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
15 endif
16
17 # See below
18 -include build/environment.mak
19
20 ifneq (,$(shell which dpkg-buildflags))
21 export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
22 else
23 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
24 export CXXFLAGS = -O0 -g -Wall
25 else
26 export CXXFLAGS = -O2 -g -Wall
27 endif
28 endif
29
30 # Default rule
31 build:
32
33 PKG=apt
34 DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS)
35 APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed -e 's/\+.*$$//')
36 APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(VERSION,"\(.*\)")/\1/p' configure.in)
37 APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g')
38
39 # Determine the build directory to use
40 BASE=.
41 ifdef BUILD
42 BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD)
43 else
44 BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build
45 endif
46 BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
47 BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
48 override BLD := $(BUILDX)
49
50 ifeq ($(words $(BLD)),0)
51 override BLD := ./build
52 endif
53
54 # Rebuild configure.in to have the correct version from the change log
55 ifneq ($(APT_DEBVER),$(APT_CONFVER))
56 ifneq ($(APT_DEBVER),)
57 .PHONY: configure.in
58 configure.in:
59 sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@
60 endif
61 else
62 configure.in:
63 endif
64
65 # APT Programs in apt-utils
66 APT_UTILS=ftparchive sortpkgs extracttemplates internal-solver
67
68 # Uncomment this to turn on verbose mode.
69 #export DH_VERBOSE=1
70
71 # Find the libapt-pkg major version for use in other control files
72 include buildlib/libversion.mak
73
74 # Determine which library package names to use
75 LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR)
76 LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
77
78 # do not fail as we are just experimenting with symbol files for now
79 export DPKG_GENSYMBOLS_CHECK_LEVEL=0
80
81 build: build/build-stamp
82 build-doc: build/build-doc-stamp
83
84 # Note that this is unconditionally done first as part of loading environment.mak
85 # The true is needed to force make to reload environment.mak after running
86 # configure-stamp. Otherwise we can get stale or invalid, or missing config data.
87 build/environment.mak: build/configure-stamp
88 @true
89
90 configure: configure.in
91 build/configure-stamp: configure
92 dh_testdir
93 -mkdir build
94 cp COPYING debian/copyright
95 cd build && CXXFLAGS="$(CXXFLAGS)" ../configure $(confflags)
96 touch $@
97
98 build/build-stamp: build/configure-stamp
99 # Add here commands to compile the package.
100 $(MAKE) binary
101 # compat symlink for the locale split
102 mkdir -p build/usr/share
103 cd build/usr/share && ln -f -s ../../locale .
104 # compile and run tests
105 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
106 $(MAKE) test
107 else
108 @echo "Tests DISABLED"
109 endif
110 touch $@
111
112 build/build-doc-stamp: build/configure-stamp
113 # Add here commands to compile the package.
114 $(MAKE) doc
115 touch $@
116
117 clean:
118 dh_testdir
119
120 [ ! -f Makefile ] || $(MAKE) clean distclean
121 rm -rf build
122 rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
123 debian/libapt-pkg-dev.install
124
125 debian/%.install: debian/%.install.in
126 sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
127
128 binary-indep: libapt-common apt-doc libapt-pkg-doc
129 # Build architecture-independent files here.
130 libapt-common: build
131 dh_testdir -p$@
132 dh_testroot -p$@
133 dh_prep -p$@
134 dh_installdirs -p$@
135
136 dh_install -p$@ --sourcedir=$(BLD)
137 dh_installdocs -p$@
138 dh_installchangelogs -p$@
139 dh_strip -p$@
140 dh_compress -p$@
141 dh_fixperms -p$@
142 dh_installdeb -p$@
143 dh_gencontrol -p$@
144 dh_md5sums -p$@
145 dh_builddeb -p$@
146
147 libapt-pkg-doc: build-doc
148 dh_testdir -p$@
149 dh_testroot -p$@
150 dh_prep -p$@
151 dh_installdirs -p$@
152 #
153 # libapt-pkg-doc install
154 #
155 dh_installdocs -p$@ $(BLD)/docs/design* \
156 $(BLD)/docs/dpkg-tech* \
157 $(BLD)/docs/files* \
158 $(BLD)/docs/method* \
159 doc/libapt-pkg2_to_3.txt \
160 doc/style.txt \
161 $(BLD)/doc/doxygen/html
162 dh_installexamples -p$@
163
164 dh_installchangelogs -p$@
165 dh_strip -p$@
166 dh_compress -p$@
167 dh_fixperms -p$@
168 dh_installdeb -p$@
169 dh_gencontrol -p$@
170 dh_md5sums -p$@
171 dh_builddeb -p$@
172
173 apt-doc: build-doc
174 dh_testdir -p$@
175 dh_testroot -p$@
176 dh_prep -p$@
177 #
178 # apt-doc install
179 #
180 # Copy the guides
181 dh_installdocs -p$@ $(BLD)/docs/guide*.text \
182 $(BLD)/docs/guide*.html \
183 $(BLD)/docs/offline*.text \
184 $(BLD)/docs/offline*.html
185 dh_installchangelogs -p$@
186 dh_compress -p$@
187 dh_fixperms -p$@
188 dh_installdeb -p$@
189 dh_gencontrol -p$@
190 dh_md5sums -p$@
191 dh_builddeb -p$@
192
193
194
195 # Build architecture-dependent files here.
196
197 binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
198 apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
199 apt: build build-doc
200 dh_testdir -p$@
201 dh_testroot -p$@
202 dh_prep -p$@
203 dh_installdirs -p$@
204 #
205 # apt install
206 #
207 cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
208
209 # make rosetta happy and remove pot files in po/ (but leave stuff
210 # in po/domains/* untouched) and cp *.po into each domain dir
211 rm -f build/po/*.pot
212 rm -f po/*.pot
213
214 dh_install -p$@ --sourcedir=$(BLD)
215
216 # Remove the bits that are in apt-utils
217 rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver)
218
219 # https has its own package
220 rm debian/$@/usr/lib/apt/methods/https
221
222 # move the mirror failure script in place
223 #mv debian/$@/usr/bin/apt-report-mirror-failure \
224 # debian/$@/usr/lib/apt/apt-report-mirror-failure \
225
226 dh_bugfiles -p$@
227 dh_lintian -p$@
228 dh_installexamples -p$@ $(BLD)/docs/examples/*
229 dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
230 dh_installcron -p$@
231 dh_installdocs -p$@
232 dh_installchangelogs -p$@
233 dh_installlogrotate -p$@
234 dh_strip -p$@
235 dh_compress -p$@
236 dh_fixperms -p$@
237 dh_installdeb -p$@
238 dh_shlibdeps -p$@
239 dh_gencontrol -p$@
240 dh_md5sums -p$@
241 dh_builddeb -p$@
242
243 libapt-pkg-dev: build debian/libapt-pkg-dev.install
244 dh_testdir -p$@
245 dh_testroot -p$@
246 dh_prep -p$@
247 dh_installdirs -p$@
248 #
249 # libapt-pkg-dev install
250 #
251 dh_install -p$@ --sourcedir=$(BLD)
252 dh_installdocs -p$@
253 dh_installchangelogs -p$@
254 dh_strip -p$@
255 dh_compress -p$@
256 dh_fixperms -p$@
257 dh_installdeb -p$@
258 dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
259 dh_md5sums -p$@
260 dh_builddeb -p$@
261
262 apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
263 apt-utils: build
264 dh_testdir -p$@
265 dh_testroot -p$@
266 dh_prep -p$@
267 dh_installdirs -p$@
268
269 cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
270 cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
271
272 dh_install -p$@ --sourcedir=$(BLD)
273 dh_link -p$@
274 dh_installdocs -p$@
275 dh_installexamples -p$@
276
277 # Install the man pages..
278 dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
279
280 dh_installchangelogs -p$@
281 dh_strip -p$@
282 dh_compress -p$@
283 dh_fixperms -p$@
284 dh_makeshlibs -p$@
285 dh_installdeb -p$@
286 dh_shlibdeps -p$@
287 dh_gencontrol -p$@
288 dh_md5sums -p$@
289 dh_builddeb -p$@
290
291 $(LIBAPT_PKG): build debian/$(LIBAPT_PKG).install
292 dh_testdir -p$@
293 dh_testroot -p$@
294 dh_prep -p$@
295 dh_installdirs -p$@
296
297 dh_install -p$@ --sourcedir=$(BLD)
298 dh_installdocs -p$@
299 dh_installchangelogs -p$@
300 dh_strip -p$@
301 dh_compress -p$@
302 dh_fixperms -p$@
303 dh_makeshlibs -p$@
304 dh_installdeb -p$@
305 dh_shlibdeps -p$@
306 dh_gencontrol -p$@
307 dh_md5sums -p$@
308 dh_builddeb -p$@
309
310 $(LIBAPT_INST): build debian/$(LIBAPT_INST).install
311 dh_testdir -p$@
312 dh_testroot -p$@
313 dh_prep -p$@
314 dh_installdirs -p$@
315
316 dh_install -p$@ --sourcedir=$(BLD)
317 dh_installdocs -p$@
318 dh_installchangelogs -p$@
319 dh_strip -p$@
320 dh_compress -p$@
321 dh_fixperms -p$@
322 dh_makeshlibs -p$@
323 dh_installdeb -p$@
324 dh_shlibdeps -p$@
325 dh_gencontrol -p$@
326 dh_md5sums -p$@
327 dh_builddeb -p$@
328
329 apt-transport-https: build libapt-pkg-dev
330 dh_testdir -p$@
331 dh_testroot -p$@
332 dh_prep -p$@
333 dh_installdirs -p$@
334
335 dh_install -p$@ --sourcedir=$(BLD)
336 dh_installdocs -p$@ debian/apt-transport-https.README
337 dh_installexamples -p$@
338
339 # Install the man pages..
340 dh_installman -p$@
341
342 dh_installchangelogs -p$@
343 dh_strip -p$@
344 dh_compress -p$@
345 dh_fixperms -p$@
346 dh_installdeb -p$@
347 dh_shlibdeps -p$@
348 dh_gencontrol -p$@
349 dh_md5sums -p$@
350 dh_builddeb -p$@
351
352 configure:
353 $(MAKE) configure
354
355 really-clean: clean
356 -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f
357 find -name ChangeLog | xargs rm -f
358 rm -f l33ch-stamp
359
360 binary: binary-indep binary-arch
361 .PHONY: build clean binary-indep binary-arch binary