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