]>
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 | |
f927c264 MV |
6 | # build in verbose mode by default to make it easy to diangose issues |
7 | export NOISY=1 | |
8 | ||
045ba613 AL |
9 | export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
10 | export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) | |
cb1a690c | 11 | export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
045ba613 AL |
12 | |
13 | # FOR AUTOCONF 2.52 AND NEWER ONLY | |
14 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) | |
15 | confflags += --build $(DEB_HOST_GNU_TYPE) | |
16 | else | |
17 | confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) | |
18 | endif | |
19 | ||
b2e465d6 | 20 | # See below |
0b3e8849 | 21 | -include build/environment.mak |
b2e465d6 | 22 | |
39151234 DK |
23 | ifneq (,$(shell which dpkg-buildflags)) |
24 | export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS) | |
e5379452 DK |
25 | export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS) |
26 | export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) | |
bab7c2cb | 27 | else |
39151234 DK |
28 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
29 | export CXXFLAGS = -O0 -g -Wall | |
30 | else | |
31 | export CXXFLAGS = -O2 -g -Wall | |
32 | endif | |
bab7c2cb AL |
33 | endif |
34 | ||
b2e465d6 AL |
35 | # Default rule |
36 | build: | |
37 | ||
4d745d64 | 38 | PKG=apt |
a789b983 | 39 | DEB_BUILD_PROG:=debuild --preserve-envvar PATH --preserve-envvar CCACHE_DIR -us -uc $(DEB_BUILD_PROG_OPTS) |
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 | # APT Programs in apt-utils |
9c30a078 | 57 | APT_UTILS=ftparchive sortpkgs extracttemplates |
b2e465d6 | 58 | |
2d18d44e AL |
59 | # Uncomment this to turn on verbose mode. |
60 | #export DH_VERBOSE=1 | |
61 | ||
d153f53f | 62 | # Find the libapt-pkg major version for use in other control files |
23d84658 | 63 | include buildlib/libversion.mak |
a5b7cd82 | 64 | |
7eee083a MV |
65 | # Determine which library package names to use |
66 | LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR) | |
67 | LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR) | |
a5b7cd82 | 68 | |
149daa16 DK |
69 | # do not fail as we are just experimenting with symbol files for now |
70 | export DPKG_GENSYMBOLS_CHECK_LEVEL=0 | |
201eaabd | 71 | |
70371bc8 | 72 | build: build/build-stamp |
1098ae37 | 73 | build-debiandoc: build/build-debiandoc-stamp |
e4bc41c7 | 74 | build-manpages: build/build-manpages-stamp |
b2e465d6 AL |
75 | |
76 | # Note that this is unconditionally done first as part of loading environment.mak | |
77 | # The true is needed to force make to reload environment.mak after running | |
78 | # configure-stamp. Otherwise we can get stale or invalid, or missing config data. | |
79 | build/environment.mak: build/configure-stamp | |
80 | @true | |
201eaabd | 81 | |
b2e465d6 AL |
82 | configure: configure.in |
83 | build/configure-stamp: configure | |
2d18d44e | 84 | dh_testdir |
2ee6f3cb | 85 | -mkdir build |
9b2e67eb | 86 | cp COPYING debian/copyright |
e5379452 | 87 | cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags) |
b2e465d6 | 88 | touch $@ |
0b5c85b5 | 89 | |
b2e465d6 | 90 | build/build-stamp: build/configure-stamp |
2d18d44e | 91 | # Add here commands to compile the package. |
16c76dd2 | 92 | $(MAKE) binary |
84736cfa MV |
93 | # compat symlink for the locale split |
94 | mkdir -p build/usr/share | |
95 | cd build/usr/share && ln -f -s ../../locale . | |
afd7b358 | 96 | # compile and run tests |
224bdefc | 97 | ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) |
6e08a00f | 98 | $(MAKE) test |
224bdefc DK |
99 | else |
100 | @echo "Tests DISABLED" | |
101 | endif | |
16c76dd2 AL |
102 | touch $@ |
103 | ||
1098ae37 | 104 | build/build-debiandoc-stamp: build/configure-stamp |
16c76dd2 | 105 | # Add here commands to compile the package. |
1098ae37 | 106 | $(MAKE) debiandoc |
cf58a7e1 | 107 | touch $@ |
2d18d44e | 108 | |
e4bc41c7 DK |
109 | build/build-manpages-stamp: build/configure-stamp |
110 | # Add here commands to compile the package. | |
111 | $(MAKE) manpages | |
112 | touch $@ | |
113 | ||
2d18d44e AL |
114 | clean: |
115 | dh_testdir | |
e184b9df | 116 | |
70371bc8 | 117 | [ ! -f Makefile ] || $(MAKE) clean distclean |
2d18d44e | 118 | rm -rf build |
cb1a690c MV |
119 | rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \ |
120 | debian/libapt-pkg-dev.install | |
201eaabd | 121 | |
cb1a690c MV |
122 | debian/%.install: debian/%.install.in |
123 | sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@ | |
124 | ||
386566e3 | 125 | binary-indep: apt-doc libapt-pkg-doc |
2d18d44e | 126 | # Build architecture-independent files here. |
1098ae37 | 127 | libapt-pkg-doc: build-debiandoc |
c64bcd92 AL |
128 | dh_testdir -p$@ |
129 | dh_testroot -p$@ | |
af7a92c3 | 130 | dh_prep -p$@ |
c64bcd92 | 131 | dh_installdirs -p$@ |
3a42cc3c AL |
132 | # |
133 | # libapt-pkg-doc install | |
70371bc8 DK |
134 | # |
135 | dh_installdocs -p$@ $(BLD)/docs/design* \ | |
136 | $(BLD)/docs/dpkg-tech* \ | |
137 | $(BLD)/docs/files* \ | |
138 | $(BLD)/docs/method* \ | |
139 | doc/libapt-pkg2_to_3.txt \ | |
d1aa9162 | 140 | doc/style.txt \ |
dc1e2a06 | 141 | $(BLD)/doc/doxygen/html |
c64bcd92 | 142 | dh_installexamples -p$@ |
c64bcd92 | 143 | |
c64bcd92 AL |
144 | dh_installchangelogs -p$@ |
145 | dh_strip -p$@ | |
146 | dh_compress -p$@ | |
147 | dh_fixperms -p$@ | |
c64bcd92 | 148 | dh_installdeb -p$@ |
782486e8 | 149 | dh_gencontrol -p$@ |
c64bcd92 AL |
150 | dh_md5sums -p$@ |
151 | dh_builddeb -p$@ | |
2d18d44e | 152 | |
1098ae37 | 153 | apt-doc: build-debiandoc |
16c76dd2 AL |
154 | dh_testdir -p$@ |
155 | dh_testroot -p$@ | |
af7a92c3 | 156 | dh_prep -p$@ |
16c76dd2 AL |
157 | # |
158 | # apt-doc install | |
159 | # | |
160 | # Copy the guides | |
70371bc8 DK |
161 | dh_installdocs -p$@ $(BLD)/docs/guide*.text \ |
162 | $(BLD)/docs/guide*.html \ | |
163 | $(BLD)/docs/offline*.text \ | |
164 | $(BLD)/docs/offline*.html | |
16c76dd2 AL |
165 | dh_installchangelogs -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 | ||
2d18d44e | 174 | |
3a42cc3c | 175 | # Build architecture-dependent files here. |
3a42cc3c | 176 | |
7eee083a | 177 | binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https |
2a52e8c5 | 178 | apt_MANPAGES = apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list |
e4bc41c7 | 179 | apt: build build-manpages |
c64bcd92 AL |
180 | dh_testdir -p$@ |
181 | dh_testroot -p$@ | |
af7a92c3 | 182 | dh_prep -p$@ |
503a2291 | 183 | dh_installdirs -p$@ |
3a42cc3c AL |
184 | # |
185 | # apt install | |
186 | # | |
9d2938d4 | 187 | cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove |
f229813f | 188 | cp debian/apt.conf.changelog debian/$@/etc/apt/apt.conf.d/20changelog |
39a07ec8 SL |
189 | cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal |
190 | chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal | |
86e2dc4d | 191 | cp share/ubuntu-archive.gpg debian/$@/usr/share/$@ |
acbd8c84 | 192 | |
be2d3759 MV |
193 | # make rosetta happy and remove pot files in po/ (but leave stuff |
194 | # in po/domains/* untouched) and cp *.po into each domain dir | |
195 | rm -f build/po/*.pot | |
196 | rm -f po/*.pot | |
197 | ||
2cf8c58b DK |
198 | dh_install -p$@ --sourcedir=$(BLD) |
199 | ||
200 | # Remove the bits that are in apt-utils | |
9c30a078 | 201 | rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver) |
2cf8c58b DK |
202 | |
203 | # https has its own package | |
204 | rm debian/$@/usr/lib/apt/methods/https | |
205 | ||
3f599bb7 | 206 | # move the mirror failure script in place |
23c5897c MV |
207 | #mv debian/$@/usr/bin/apt-report-mirror-failure \ |
208 | # debian/$@/usr/lib/apt/apt-report-mirror-failure \ | |
3f599bb7 | 209 | |
304c041b | 210 | dh_bugfiles -p$@ |
063a17d7 | 211 | dh_lintian -p$@ |
3fb71b27 | 212 | dh_installexamples -p$@ $(BLD)/docs/examples/* |
2a52e8c5 | 213 | dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) |
0c132682 | 214 | dh_installcron -p$@ |
9e980be8 | 215 | dh_installdocs -p$@ |
c64bcd92 | 216 | dh_installchangelogs -p$@ |
2cf8c58b | 217 | dh_installlogrotate -p$@ |
c64bcd92 AL |
218 | dh_strip -p$@ |
219 | dh_compress -p$@ | |
220 | dh_fixperms -p$@ | |
c64bcd92 | 221 | dh_installdeb -p$@ |
bd5e34e8 | 222 | dh_shlibdeps -p$@ |
782486e8 | 223 | dh_gencontrol -p$@ |
c64bcd92 AL |
224 | dh_md5sums -p$@ |
225 | dh_builddeb -p$@ | |
226 | ||
cb1a690c | 227 | libapt-pkg-dev: build debian/libapt-pkg-dev.install |
c64bcd92 AL |
228 | dh_testdir -p$@ |
229 | dh_testroot -p$@ | |
af7a92c3 | 230 | dh_prep -p$@ |
c64bcd92 AL |
231 | dh_installdirs -p$@ |
232 | # | |
233 | # libapt-pkg-dev install | |
234 | # | |
2cf8c58b | 235 | dh_install -p$@ --sourcedir=$(BLD) |
c64bcd92 | 236 | dh_installdocs -p$@ |
c64bcd92 AL |
237 | dh_installchangelogs -p$@ |
238 | dh_strip -p$@ | |
239 | dh_compress -p$@ | |
240 | dh_fixperms -p$@ | |
c64bcd92 | 241 | dh_installdeb -p$@ |
ceab242d | 242 | dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST) |
b2e465d6 AL |
243 | dh_md5sums -p$@ |
244 | dh_builddeb -p$@ | |
245 | ||
ac55c777 | 246 | apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates |
e4bc41c7 | 247 | apt-utils: build build-manpages |
b2e465d6 AL |
248 | dh_testdir -p$@ |
249 | dh_testroot -p$@ | |
af7a92c3 | 250 | dh_prep -p$@ |
b2e465d6 AL |
251 | dh_installdirs -p$@ |
252 | ||
b2e465d6 | 253 | cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/ |
66b6fe05 | 254 | cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump |
9c30a078 | 255 | cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt |
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 |