]>
Commit | Line | Data |
---|---|---|
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 | |
045ba613 AL |
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) | |
cb1a690c | 8 | export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
045ba613 AL |
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 | ||
b2e465d6 | 17 | # See below |
0b3e8849 | 18 | -include build/environment.mak |
b2e465d6 | 19 | |
39151234 DK |
20 | ifneq (,$(shell which dpkg-buildflags)) |
21 | export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) | |
e5379452 DK |
22 | export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) |
23 | export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) | |
bab7c2cb | 24 | else |
39151234 DK |
25 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
26 | export CXXFLAGS = -O0 -g -Wall | |
27 | else | |
28 | export CXXFLAGS = -O2 -g -Wall | |
29 | endif | |
bab7c2cb AL |
30 | endif |
31 | ||
b2e465d6 AL |
32 | # Default rule |
33 | build: | |
34 | ||
4d745d64 | 35 | PKG=apt |
a789b983 | 36 | DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS) |
da78c57f | 37 | APT_DEBVER=$(shell dpkg-parsechangelog |sed -n -e '/^Version:/s/^Version: //p' | sed -e 's/\+.*$$//') |
9179f697 | 38 | APT_CONFVER=$(shell sed -n -e 's/^AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"\(.*\)")/\1/p' configure.in) |
c6baaffe | 39 | APT_CVSTAG=$(shell echo "$(APT_DEBVER)" | sed -e 's/^/v/' -e 's/\./_/g') |
3a42cc3c | 40 | |
cf6371d0 AL |
41 | # Determine the build directory to use |
42 | BASE=. | |
43 | ifdef BUILD | |
44 | BUILD_POSSIBLE := $(BUILD) $(BASE)/$(BUILD) | |
45 | else | |
70371bc8 | 46 | BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname --machine) $(BASE)/build |
cf6371d0 AL |
47 | endif |
48 | BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*)) | |
49 | BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX)))) | |
50 | override BLD := $(BUILDX) | |
51 | ||
b024fa25 AL |
52 | ifeq ($(words $(BLD)),0) |
53 | override BLD := ./build | |
54 | endif | |
55 | ||
b2e465d6 | 56 | # Rebuild configure.in to have the correct version from the change log |
3a42cc3c | 57 | ifneq ($(APT_DEBVER),$(APT_CONFVER)) |
3d851670 | 58 | ifneq ($(APT_DEBVER),) |
3a42cc3c AL |
59 | .PHONY: configure.in |
60 | configure.in: | |
eef77d37 | 61 | sed -e 's/$(APT_CONFVER)/$(APT_DEBVER)/' $@ > $@.$$$$ && mv $@.$$$$ $@ |
9daf15d6 | 62 | endif |
3a42cc3c AL |
63 | else |
64 | configure.in: | |
65 | endif | |
2d18d44e | 66 | |
b2e465d6 | 67 | # APT Programs in apt-utils |
ff859c7f | 68 | APT_UTILS=ftparchive sortpkgs extracttemplates internal-solver |
b2e465d6 | 69 | |
2d18d44e AL |
70 | # Uncomment this to turn on verbose mode. |
71 | #export DH_VERBOSE=1 | |
72 | ||
d153f53f | 73 | # Find the libapt-pkg major version for use in other control files |
23d84658 | 74 | include buildlib/libversion.mak |
a5b7cd82 | 75 | |
7eee083a MV |
76 | # Determine which library package names to use |
77 | LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR) | |
78 | LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR) | |
79 | ||
149daa16 DK |
80 | # do not fail as we are just experimenting with symbol files for now |
81 | export DPKG_GENSYMBOLS_CHECK_LEVEL=0 | |
201eaabd | 82 | |
70371bc8 DK |
83 | build: build/build-stamp |
84 | build-doc: build/build-doc-stamp | |
b2e465d6 AL |
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 | |
201eaabd | 91 | |
b2e465d6 AL |
92 | configure: configure.in |
93 | build/configure-stamp: configure | |
2d18d44e | 94 | dh_testdir |
2ee6f3cb | 95 | -mkdir build |
9b2e67eb | 96 | cp COPYING debian/copyright |
e5379452 | 97 | cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags) |
b2e465d6 | 98 | touch $@ |
0b5c85b5 | 99 | |
b2e465d6 | 100 | build/build-stamp: build/configure-stamp |
2d18d44e | 101 | # Add here commands to compile the package. |
16c76dd2 | 102 | $(MAKE) binary |
84736cfa MV |
103 | # compat symlink for the locale split |
104 | mkdir -p build/usr/share | |
105 | cd build/usr/share && ln -f -s ../../locale . | |
afd7b358 | 106 | # compile and run tests |
224bdefc | 107 | ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) |
6e08a00f | 108 | $(MAKE) test |
224bdefc DK |
109 | else |
110 | @echo "Tests DISABLED" | |
111 | endif | |
16c76dd2 AL |
112 | touch $@ |
113 | ||
114 | build/build-doc-stamp: build/configure-stamp | |
115 | # Add here commands to compile the package. | |
116 | $(MAKE) doc | |
cf58a7e1 | 117 | touch $@ |
2d18d44e AL |
118 | |
119 | clean: | |
120 | dh_testdir | |
e184b9df | 121 | |
70371bc8 | 122 | [ ! -f Makefile ] || $(MAKE) clean distclean |
2d18d44e | 123 | rm -rf build |
cb1a690c MV |
124 | rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \ |
125 | debian/libapt-pkg-dev.install | |
201eaabd | 126 | |
cb1a690c MV |
127 | debian/%.install: debian/%.install.in |
128 | sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@ | |
129 | ||
386566e3 | 130 | binary-indep: apt-doc libapt-pkg-doc |
2d18d44e | 131 | # Build architecture-independent files here. |
149daa16 | 132 | libapt-pkg-doc: build-doc |
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 DK |
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 \ | |
d1aa9162 | 145 | doc/style.txt \ |
dc1e2a06 | 146 | $(BLD)/doc/doxygen/html |
c64bcd92 | 147 | dh_installexamples -p$@ |
c64bcd92 | 148 | |
c64bcd92 AL |
149 | dh_installchangelogs -p$@ |
150 | dh_strip -p$@ | |
151 | dh_compress -p$@ | |
152 | dh_fixperms -p$@ | |
c64bcd92 | 153 | dh_installdeb -p$@ |
782486e8 | 154 | dh_gencontrol -p$@ |
c64bcd92 AL |
155 | dh_md5sums -p$@ |
156 | dh_builddeb -p$@ | |
2d18d44e | 157 | |
16c76dd2 AL |
158 | apt-doc: build-doc |
159 | dh_testdir -p$@ | |
160 | dh_testroot -p$@ | |
af7a92c3 | 161 | dh_prep -p$@ |
16c76dd2 AL |
162 | # |
163 | # apt-doc install | |
164 | # | |
165 | # Copy the guides | |
70371bc8 DK |
166 | dh_installdocs -p$@ $(BLD)/docs/guide*.text \ |
167 | $(BLD)/docs/guide*.html \ | |
168 | $(BLD)/docs/offline*.text \ | |
169 | $(BLD)/docs/offline*.html | |
16c76dd2 AL |
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 | ||
2d18d44e | 179 | |
3a42cc3c | 180 | # Build architecture-dependent files here. |
3a42cc3c | 181 | |
7eee083a | 182 | binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https |
2a52e8c5 | 183 | apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list |
149daa16 | 184 | apt: build build-doc |
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 |
2d18d44e | 193 | |
be2d3759 MV |
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 | ||
2cf8c58b DK |
199 | dh_install -p$@ --sourcedir=$(BLD) |
200 | ||
201 | # Remove the bits that are in apt-utils | |
7f471354 | 202 | rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver) |
2cf8c58b DK |
203 | |
204 | # https has its own package | |
205 | rm debian/$@/usr/lib/apt/methods/https | |
206 | ||
3f599bb7 | 207 | # move the mirror failure script in place |
23c5897c MV |
208 | #mv debian/$@/usr/bin/apt-report-mirror-failure \ |
209 | # debian/$@/usr/lib/apt/apt-report-mirror-failure \ | |
3f599bb7 | 210 | |
304c041b | 211 | dh_bugfiles -p$@ |
063a17d7 | 212 | dh_lintian -p$@ |
3fb71b27 | 213 | dh_installexamples -p$@ $(BLD)/docs/examples/* |
2a52e8c5 | 214 | dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) |
0c132682 | 215 | dh_installcron -p$@ |
9e980be8 | 216 | dh_installdocs -p$@ |
c64bcd92 | 217 | dh_installchangelogs -p$@ |
2cf8c58b | 218 | dh_installlogrotate -p$@ |
c64bcd92 AL |
219 | dh_strip -p$@ |
220 | dh_compress -p$@ | |
221 | dh_fixperms -p$@ | |
c64bcd92 | 222 | dh_installdeb -p$@ |
bd5e34e8 | 223 | dh_shlibdeps -p$@ |
782486e8 | 224 | dh_gencontrol -p$@ |
c64bcd92 AL |
225 | dh_md5sums -p$@ |
226 | dh_builddeb -p$@ | |
227 | ||
cb1a690c | 228 | libapt-pkg-dev: build debian/libapt-pkg-dev.install |
c64bcd92 AL |
229 | dh_testdir -p$@ |
230 | dh_testroot -p$@ | |
af7a92c3 | 231 | dh_prep -p$@ |
c64bcd92 AL |
232 | dh_installdirs -p$@ |
233 | # | |
234 | # libapt-pkg-dev install | |
235 | # | |
2cf8c58b | 236 | dh_install -p$@ --sourcedir=$(BLD) |
c64bcd92 | 237 | dh_installdocs -p$@ |
c64bcd92 AL |
238 | dh_installchangelogs -p$@ |
239 | dh_strip -p$@ | |
240 | dh_compress -p$@ | |
241 | dh_fixperms -p$@ | |
c64bcd92 | 242 | dh_installdeb -p$@ |
ceab242d | 243 | dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST) |
b2e465d6 AL |
244 | dh_md5sums -p$@ |
245 | dh_builddeb -p$@ | |
246 | ||
2a52e8c5 | 247 | apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates |
149daa16 | 248 | apt-utils: build |
b2e465d6 AL |
249 | dh_testdir -p$@ |
250 | dh_testroot -p$@ | |
af7a92c3 | 251 | dh_prep -p$@ |
b2e465d6 AL |
252 | dh_installdirs -p$@ |
253 | ||
b2e465d6 | 254 | cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/ |
66b6fe05 | 255 | cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump |
2cf8c58b DK |
256 | |
257 | dh_install -p$@ --sourcedir=$(BLD) | |
66b6fe05 | 258 | dh_link -p$@ |
b2e465d6 | 259 | dh_installdocs -p$@ |
53cd7e2b | 260 | dh_installexamples -p$@ |
201eaabd | 261 | |
b2e465d6 | 262 | # Install the man pages.. |
2a52e8c5 | 263 | dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES))) |
90ebe30c | 264 | |
b2e465d6 AL |
265 | dh_installchangelogs -p$@ |
266 | dh_strip -p$@ | |
267 | dh_compress -p$@ | |
268 | dh_fixperms -p$@ | |
149daa16 | 269 | dh_makeshlibs -p$@ |
b2e465d6 | 270 | dh_installdeb -p$@ |
bd5e34e8 | 271 | dh_shlibdeps -p$@ |
782486e8 MV |
272 | dh_gencontrol -p$@ |
273 | dh_md5sums -p$@ | |
274 | dh_builddeb -p$@ | |
275 | ||
cb1a690c | 276 | $(LIBAPT_PKG): build debian/$(LIBAPT_PKG).install |
782486e8 MV |
277 | dh_testdir -p$@ |
278 | dh_testroot -p$@ | |
279 | dh_prep -p$@ | |
280 | dh_installdirs -p$@ | |
281 | ||
282 | dh_install -p$@ --sourcedir=$(BLD) | |
08c9b191 | 283 | dh_installdocs -p$@ |
782486e8 MV |
284 | dh_installchangelogs -p$@ |
285 | dh_strip -p$@ | |
286 | dh_compress -p$@ | |
287 | dh_fixperms -p$@ | |
f521559b | 288 | dh_makeshlibs -p$@ |
08c9b191 | 289 | dh_installdeb -p$@ |
782486e8 MV |
290 | dh_shlibdeps -p$@ |
291 | dh_gencontrol -p$@ | |
292 | dh_md5sums -p$@ | |
293 | dh_builddeb -p$@ | |
294 | ||
cb1a690c | 295 | $(LIBAPT_INST): build debian/$(LIBAPT_INST).install |
782486e8 MV |
296 | dh_testdir -p$@ |
297 | dh_testroot -p$@ | |
298 | dh_prep -p$@ | |
299 | dh_installdirs -p$@ | |
300 | ||
301 | dh_install -p$@ --sourcedir=$(BLD) | |
08c9b191 | 302 | dh_installdocs -p$@ |
782486e8 MV |
303 | dh_installchangelogs -p$@ |
304 | dh_strip -p$@ | |
305 | dh_compress -p$@ | |
306 | dh_fixperms -p$@ | |
f521559b | 307 | dh_makeshlibs -p$@ |
08c9b191 | 308 | dh_installdeb -p$@ |
bd5e34e8 | 309 | dh_shlibdeps -p$@ |
782486e8 | 310 | dh_gencontrol -p$@ |
c64bcd92 AL |
311 | dh_md5sums -p$@ |
312 | dh_builddeb -p$@ | |
2d18d44e | 313 | |
149daa16 | 314 | apt-transport-https: build libapt-pkg-dev |
d546f98d MV |
315 | dh_testdir -p$@ |
316 | dh_testroot -p$@ | |
af7a92c3 | 317 | dh_prep -p$@ |
d546f98d MV |
318 | dh_installdirs -p$@ |
319 | ||
2cf8c58b | 320 | dh_install -p$@ --sourcedir=$(BLD) |
370ad5e1 | 321 | dh_installdocs -p$@ debian/apt-transport-https.README |
d546f98d MV |
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$@ | |
bd5e34e8 | 332 | dh_shlibdeps -p$@ |
d546f98d MV |
333 | dh_gencontrol -p$@ |
334 | dh_md5sums -p$@ | |
335 | dh_builddeb -p$@ | |
336 | ||
2d18d44e | 337 | configure: |
1d9fd7a2 | 338 | $(MAKE) configure |
2d18d44e | 339 | |
2d18d44e | 340 | really-clean: clean |
70371bc8 | 341 | -find . -name Makefile.in -print0 | xargs --null --no-run-if-empty -- rm -f |
2d18d44e AL |
342 | find -name ChangeLog | xargs rm -f |
343 | rm -f l33ch-stamp | |
344 | ||
345 | binary: binary-indep binary-arch | |
149daa16 | 346 | .PHONY: build clean binary-indep binary-arch binary |