]>
Commit | Line | Data |
---|---|---|
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: apt-doc libapt-pkg-doc | |
129 | # Build architecture-independent files here. | |
130 | libapt-pkg-doc: build-doc | |
131 | dh_testdir -p$@ | |
132 | dh_testroot -p$@ | |
133 | dh_prep -p$@ | |
134 | dh_installdirs -p$@ | |
135 | # | |
136 | # libapt-pkg-doc install | |
137 | # | |
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 \ | |
143 | doc/style.txt \ | |
144 | $(BLD)/doc/doxygen/html | |
145 | dh_installexamples -p$@ | |
146 | ||
147 | dh_installchangelogs -p$@ | |
148 | dh_strip -p$@ | |
149 | dh_compress -p$@ | |
150 | dh_fixperms -p$@ | |
151 | dh_installdeb -p$@ | |
152 | dh_gencontrol -p$@ | |
153 | dh_md5sums -p$@ | |
154 | dh_builddeb -p$@ | |
155 | ||
156 | apt-doc: build-doc | |
157 | dh_testdir -p$@ | |
158 | dh_testroot -p$@ | |
159 | dh_prep -p$@ | |
160 | # | |
161 | # apt-doc install | |
162 | # | |
163 | # Copy the guides | |
164 | dh_installdocs -p$@ $(BLD)/docs/guide*.text \ | |
165 | $(BLD)/docs/guide*.html \ | |
166 | $(BLD)/docs/offline*.text \ | |
167 | $(BLD)/docs/offline*.html | |
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 | ||
177 | ||
178 | # Build architecture-dependent files here. | |
179 | ||
180 | binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https | |
181 | apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list | |
182 | apt: build build-doc | |
183 | dh_testdir -p$@ | |
184 | dh_testroot -p$@ | |
185 | dh_prep -p$@ | |
186 | dh_installdirs -p$@ | |
187 | # | |
188 | # apt install | |
189 | # | |
190 | cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove | |
191 | ||
192 | # make rosetta happy and remove pot files in po/ (but leave stuff | |
193 | # in po/domains/* untouched) and cp *.po into each domain dir | |
194 | rm -f build/po/*.pot | |
195 | rm -f po/*.pot | |
196 | ||
197 | dh_install -p$@ --sourcedir=$(BLD) | |
198 | ||
199 | # Remove the bits that are in apt-utils | |
200 | rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver) | |
201 | ||
202 | # https has its own package | |
203 | rm debian/$@/usr/lib/apt/methods/https | |
204 | ||
205 | # move the mirror failure script in place | |
206 | #mv debian/$@/usr/bin/apt-report-mirror-failure \ | |
207 | # debian/$@/usr/lib/apt/apt-report-mirror-failure \ | |
208 | ||
209 | dh_bugfiles -p$@ | |
210 | dh_lintian -p$@ | |
211 | dh_installexamples -p$@ $(BLD)/docs/examples/* | |
212 | dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) | |
213 | dh_installcron -p$@ | |
214 | dh_installdocs -p$@ | |
215 | dh_installchangelogs -p$@ | |
216 | dh_installlogrotate -p$@ | |
217 | dh_strip -p$@ | |
218 | dh_compress -p$@ | |
219 | dh_fixperms -p$@ | |
220 | dh_installdeb -p$@ | |
221 | dh_shlibdeps -p$@ | |
222 | dh_gencontrol -p$@ | |
223 | dh_md5sums -p$@ | |
224 | dh_builddeb -p$@ | |
225 | ||
226 | libapt-pkg-dev: build debian/libapt-pkg-dev.install | |
227 | dh_testdir -p$@ | |
228 | dh_testroot -p$@ | |
229 | dh_prep -p$@ | |
230 | dh_installdirs -p$@ | |
231 | # | |
232 | # libapt-pkg-dev install | |
233 | # | |
234 | dh_install -p$@ --sourcedir=$(BLD) | |
235 | dh_installdocs -p$@ | |
236 | dh_installchangelogs -p$@ | |
237 | dh_strip -p$@ | |
238 | dh_compress -p$@ | |
239 | dh_fixperms -p$@ | |
240 | dh_installdeb -p$@ | |
241 | dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST) | |
242 | dh_md5sums -p$@ | |
243 | dh_builddeb -p$@ | |
244 | ||
245 | apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates | |
246 | apt-utils: build | |
247 | dh_testdir -p$@ | |
248 | dh_testroot -p$@ | |
249 | dh_prep -p$@ | |
250 | dh_installdirs -p$@ | |
251 | ||
252 | cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/ | |
253 | cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump | |
254 | ||
255 | dh_install -p$@ --sourcedir=$(BLD) | |
256 | dh_link -p$@ | |
257 | dh_installdocs -p$@ | |
258 | dh_installexamples -p$@ | |
259 | ||
260 | # Install the man pages.. | |
261 | dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES))) | |
262 | ||
263 | dh_installchangelogs -p$@ | |
264 | dh_strip -p$@ | |
265 | dh_compress -p$@ | |
266 | dh_fixperms -p$@ | |
267 | dh_makeshlibs -p$@ | |
268 | dh_installdeb -p$@ | |
269 | dh_shlibdeps -p$@ | |
270 | dh_gencontrol -p$@ | |
271 | dh_md5sums -p$@ | |
272 | dh_builddeb -p$@ | |
273 | ||
274 | $(LIBAPT_PKG): build debian/$(LIBAPT_PKG).install | |
275 | dh_testdir -p$@ | |
276 | dh_testroot -p$@ | |
277 | dh_prep -p$@ | |
278 | dh_installdirs -p$@ | |
279 | ||
280 | dh_install -p$@ --sourcedir=$(BLD) | |
281 | dh_installdocs -p$@ | |
282 | dh_installchangelogs -p$@ | |
283 | dh_strip -p$@ | |
284 | dh_compress -p$@ | |
285 | dh_fixperms -p$@ | |
286 | dh_makeshlibs -p$@ | |
287 | dh_installdeb -p$@ | |
288 | dh_shlibdeps -p$@ | |
289 | dh_gencontrol -p$@ | |
290 | dh_md5sums -p$@ | |
291 | dh_builddeb -p$@ | |
292 | ||
293 | $(LIBAPT_INST): build debian/$(LIBAPT_INST).install | |
294 | dh_testdir -p$@ | |
295 | dh_testroot -p$@ | |
296 | dh_prep -p$@ | |
297 | dh_installdirs -p$@ | |
298 | ||
299 | dh_install -p$@ --sourcedir=$(BLD) | |
300 | dh_installdocs -p$@ | |
301 | dh_installchangelogs -p$@ | |
302 | dh_strip -p$@ | |
303 | dh_compress -p$@ | |
304 | dh_fixperms -p$@ | |
305 | dh_makeshlibs -p$@ | |
306 | dh_installdeb -p$@ | |
307 | dh_shlibdeps -p$@ | |
308 | dh_gencontrol -p$@ | |
309 | dh_md5sums -p$@ | |
310 | dh_builddeb -p$@ | |
311 | ||
312 | apt-transport-https: build libapt-pkg-dev | |
313 | dh_testdir -p$@ | |
314 | dh_testroot -p$@ | |
315 | dh_prep -p$@ | |
316 | dh_installdirs -p$@ | |
317 | ||
318 | dh_install -p$@ --sourcedir=$(BLD) | |
319 | dh_installdocs -p$@ debian/apt-transport-https.README | |
320 | dh_installexamples -p$@ | |
321 | ||
322 | # Install the man pages.. | |
323 | dh_installman -p$@ | |
324 | ||
325 | dh_installchangelogs -p$@ | |
326 | dh_strip -p$@ | |
327 | dh_compress -p$@ | |
328 | dh_fixperms -p$@ | |
329 | dh_installdeb -p$@ | |
330 | dh_shlibdeps -p$@ | |
331 | dh_gencontrol -p$@ | |
332 | dh_md5sums -p$@ | |
333 | dh_builddeb -p$@ | |
334 | ||
335 | configure: | |
336 | $(MAKE) configure | |
337 | ||
338 | really-clean: clean | |
339 | -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f | |
340 | find -name ChangeLog | xargs rm -f | |
341 | rm -f l33ch-stamp | |
342 | ||
343 | binary: binary-indep binary-arch | |
344 | .PHONY: build clean binary-indep binary-arch binary |