]>
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 | |
a40310a5 DK |
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) |
1476c59e | 12 | export PARALLEL = $(or $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))),1) |
045ba613 AL |
13 | |
14 | # FOR AUTOCONF 2.52 AND NEWER ONLY | |
15 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) | |
16 | confflags += --build $(DEB_HOST_GNU_TYPE) | |
17 | else | |
18 | confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) | |
19 | endif | |
20 | ||
1476c59e JAK |
21 | # Set the number of procs to be run in parallel from the options. |
22 | confflags += --with-procs=$(PARALLEL) | |
23 | ||
b2e465d6 | 24 | # See below |
0b3e8849 | 25 | -include build/environment.mak |
b2e465d6 | 26 | |
e23ee4c2 | 27 | ifneq (,$(shell which dpkg-buildflags)) |
9a61bb21 MV |
28 | # make does not export to $(shell) so we need to workaround |
29 | # (http://savannah.gnu.org/bugs/?10593) | |
30 | dpkg_buildflags = DEB_BUILD_MAINT_OPTIONS=hardening=+all dpkg-buildflags | |
31 | export CXXFLAGS = $(shell $(dpkg_buildflags) --get CXXFLAGS) | |
90986d4d | 32 | export LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS) |
9a61bb21 | 33 | export CPPFLAGS = $(shell $(dpkg_buildflags) --get CPPFLAGS) |
bab7c2cb | 34 | else |
39151234 DK |
35 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
36 | export CXXFLAGS = -O0 -g -Wall | |
37 | else | |
38 | export CXXFLAGS = -O2 -g -Wall | |
39 | endif | |
bab7c2cb AL |
40 | endif |
41 | ||
b2e465d6 AL |
42 | # Default rule |
43 | build: | |
44 | ||
cf6371d0 | 45 | # Determine the build directory to use |
a97127c3 DK |
46 | override BASE := . |
47 | override BLD := $(BASE)/build | |
b024fa25 | 48 | |
084faf6a HG |
49 | # When building without <nocheck>, the header is available and thus the test is |
50 | # successful. When building with <nocheck>, the header is missing, but we still | |
51 | # pretend it to be available, because configure would fail otherwise. | |
52 | export ac_cv_header_gtest_gtest_h=yes | |
53 | ||
b2e465d6 | 54 | # APT Programs in apt-utils |
9c30a078 | 55 | APT_UTILS=ftparchive sortpkgs extracttemplates |
b2e465d6 | 56 | |
2d18d44e AL |
57 | # Uncomment this to turn on verbose mode. |
58 | #export DH_VERBOSE=1 | |
59 | ||
d153f53f | 60 | # Find the libapt-pkg major version for use in other control files |
23d84658 | 61 | include buildlib/libversion.mak |
a5b7cd82 | 62 | |
7eee083a MV |
63 | # Determine which library package names to use |
64 | LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR) | |
65 | LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR) | |
66 | ||
149daa16 DK |
67 | # do not fail as we are just experimenting with symbol files for now |
68 | export DPKG_GENSYMBOLS_CHECK_LEVEL=0 | |
201eaabd | 69 | |
ee7ddf12 | 70 | build-binary: build/build-binary-stamp |
a034d852 | 71 | build-docbook: build/build-docbook-stamp |
e4bc41c7 | 72 | build-manpages: build/build-manpages-stamp |
b2e465d6 AL |
73 | |
74 | # Note that this is unconditionally done first as part of loading environment.mak | |
75 | # The true is needed to force make to reload environment.mak after running | |
76 | # configure-stamp. Otherwise we can get stale or invalid, or missing config data. | |
77 | build/environment.mak: build/configure-stamp | |
78 | @true | |
201eaabd | 79 | |
ed9ba607 | 80 | configure: configure.ac |
e941cc69 | 81 | build/configure-stamp: configure buildlib/config.sub buildlib/config.guess |
2d18d44e | 82 | dh_testdir |
520624d5 | 83 | mkdir -p build |
9b2e67eb | 84 | cp COPYING debian/copyright |
e5379452 | 85 | cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags) |
b2e465d6 | 86 | touch $@ |
0b5c85b5 | 87 | |
ee7ddf12 | 88 | build/build-binary-stamp: build/configure-stamp |
2d18d44e | 89 | # Add here commands to compile the package. |
16c76dd2 | 90 | $(MAKE) binary |
84736cfa MV |
91 | # compat symlink for the locale split |
92 | mkdir -p build/usr/share | |
93 | cd build/usr/share && ln -f -s ../../locale . | |
afd7b358 | 94 | # compile and run tests |
224bdefc | 95 | ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) |
6e08a00f | 96 | $(MAKE) test |
224bdefc DK |
97 | else |
98 | @echo "Tests DISABLED" | |
99 | endif | |
16c76dd2 AL |
100 | touch $@ |
101 | ||
a034d852 | 102 | build/build-docbook-stamp: build/configure-stamp |
16c76dd2 | 103 | # Add here commands to compile the package. |
a034d852 | 104 | $(MAKE) docbook |
cf58a7e1 | 105 | touch $@ |
2d18d44e | 106 | |
e4bc41c7 DK |
107 | build/build-manpages-stamp: build/configure-stamp |
108 | # Add here commands to compile the package. | |
109 | $(MAKE) manpages | |
110 | touch $@ | |
111 | ||
2d18d44e AL |
112 | clean: |
113 | dh_testdir | |
8bb62daf | 114 | dh_clean |
e184b9df | 115 | |
70371bc8 | 116 | [ ! -f Makefile ] || $(MAKE) clean distclean |
2d18d44e | 117 | rm -rf build |
cb1a690c | 118 | rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \ |
a7737ad3 | 119 | debian/libapt-pkg-dev.install debian/apt.install |
e941cc69 DK |
120 | test ! -L buildlib/config.guess || rm -f buildlib/config.guess |
121 | test ! -L buildlib/config.sub || rm -f buildlib/config.sub | |
201eaabd | 122 | |
cb1a690c MV |
123 | debian/%.install: debian/%.install.in |
124 | sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@ | |
125 | ||
2d18d44e | 126 | # Build architecture-independent files here. |
a034d852 | 127 | libapt-pkg-doc: build-docbook |
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 | 134 | # |
c7a72718 | 135 | rm -f $(BLD)/doc/doxygen/html/*.map $(BLD)/doc/doxygen/html/*.md5 |
cb6020cd | 136 | dh_installdocs -p$@ |
c64bcd92 | 137 | dh_installexamples -p$@ |
83defe87 | 138 | dh_lintian -p$@ |
c64bcd92 AL |
139 | dh_installchangelogs -p$@ |
140 | dh_strip -p$@ | |
c7a72718 | 141 | dh_compress -p$@ -X.xhtml |
c64bcd92 | 142 | dh_fixperms -p$@ |
c64bcd92 | 143 | dh_installdeb -p$@ |
782486e8 | 144 | dh_gencontrol -p$@ |
c64bcd92 AL |
145 | dh_md5sums -p$@ |
146 | dh_builddeb -p$@ | |
2d18d44e | 147 | |
a034d852 | 148 | apt-doc: build-docbook |
16c76dd2 AL |
149 | dh_testdir -p$@ |
150 | dh_testroot -p$@ | |
af7a92c3 | 151 | dh_prep -p$@ |
16c76dd2 AL |
152 | # |
153 | # apt-doc install | |
154 | # | |
155 | # Copy the guides | |
cb6020cd | 156 | dh_installdocs -p$@ |
16c76dd2 AL |
157 | dh_installchangelogs -p$@ |
158 | dh_compress -p$@ | |
159 | dh_fixperms -p$@ | |
160 | dh_installdeb -p$@ | |
161 | dh_gencontrol -p$@ | |
162 | dh_md5sums -p$@ | |
163 | dh_builddeb -p$@ | |
164 | ||
165 | ||
2d18d44e | 166 | |
3a42cc3c | 167 | # Build architecture-dependent files here. |
3a42cc3c | 168 | |
0425a56b | 169 | apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list |
a7737ad3 | 170 | apt: build-binary build-manpages debian/apt.install |
c64bcd92 AL |
171 | dh_testdir -p$@ |
172 | dh_testroot -p$@ | |
af7a92c3 | 173 | dh_prep -p$@ |
503a2291 | 174 | dh_installdirs -p$@ |
3a42cc3c AL |
175 | # |
176 | # apt install | |
177 | # | |
9d2938d4 | 178 | cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove |
a86f8516 SL |
179 | cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal |
180 | chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal | |
c1b3d189 DK |
181 | # install vendor specific apt confs |
182 | find -L vendor/current -name 'apt.conf-*' | while read conf; do cp "$${conf}" "debian/$@/etc/apt/apt.conf.d/$${conf#*-}"; done | |
2d18d44e | 183 | |
be2d3759 MV |
184 | # make rosetta happy and remove pot files in po/ (but leave stuff |
185 | # in po/domains/* untouched) and cp *.po into each domain dir | |
186 | rm -f build/po/*.pot | |
187 | rm -f po/*.pot | |
188 | ||
2cf8c58b DK |
189 | dh_install -p$@ --sourcedir=$(BLD) |
190 | ||
191 | # Remove the bits that are in apt-utils | |
8e99b22c | 192 | rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver internal-planner) |
ab07af70 | 193 | cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump |
8e99b22c | 194 | ln -s ../solvers/dump debian/$@/usr/lib/apt/planners/dump |
2cf8c58b DK |
195 | |
196 | # https has its own package | |
197 | rm debian/$@/usr/lib/apt/methods/https | |
198 | ||
3f599bb7 | 199 | # move the mirror failure script in place |
23c5897c MV |
200 | #mv debian/$@/usr/bin/apt-report-mirror-failure \ |
201 | # debian/$@/usr/lib/apt/apt-report-mirror-failure \ | |
3f599bb7 | 202 | |
e43a426e | 203 | # move the apt-helper in place |
14669d4b MV |
204 | mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper |
205 | # install apt.systemd.daily helper in the right place | |
206 | install -m755 debian/apt.systemd.daily debian/$@/usr/lib/apt/ | |
e43a426e | 207 | |
304c041b | 208 | dh_bugfiles -p$@ |
063a17d7 | 209 | dh_lintian -p$@ |
cb6020cd | 210 | dh_installexamples -p$@ |
ac62eb38 | 211 | dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) |
14669d4b MV |
212 | dh_installcron -p$@ --name=apt-compat |
213 | dh_systemd_enable -p$@ apt-daily.timer | |
214 | dh_systemd_start -p$@ apt-daily.timer | |
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$@ | |
e093518c | 221 | dh_makeshlibs -p$@ |
c64bcd92 | 222 | dh_installdeb -p$@ |
bd5e34e8 | 223 | dh_shlibdeps -p$@ |
0005fa07 | 224 | dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)" |
c64bcd92 AL |
225 | dh_md5sums -p$@ |
226 | dh_builddeb -p$@ | |
227 | ||
ee7ddf12 | 228 | libapt-pkg-dev: build-binary 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 |
ee7ddf12 | 248 | apt-utils: build-binary build-manpages |
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/ |
9c30a078 | 255 | cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt |
8e99b22c | 256 | cp $(BLD)/bin/apt-internal-planner debian/$@/usr/lib/apt/planners/apt |
2cf8c58b DK |
257 | |
258 | dh_install -p$@ --sourcedir=$(BLD) | |
66b6fe05 | 259 | dh_link -p$@ |
b2e465d6 | 260 | dh_installdocs -p$@ |
53cd7e2b | 261 | dh_installexamples -p$@ |
201eaabd | 262 | |
b2e465d6 | 263 | # Install the man pages.. |
ac62eb38 | 264 | dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES))) |
90ebe30c | 265 | |
b2e465d6 AL |
266 | dh_installchangelogs -p$@ |
267 | dh_strip -p$@ | |
268 | dh_compress -p$@ | |
269 | dh_fixperms -p$@ | |
149daa16 | 270 | dh_makeshlibs -p$@ |
b2e465d6 | 271 | dh_installdeb -p$@ |
bd5e34e8 | 272 | dh_shlibdeps -p$@ |
782486e8 MV |
273 | dh_gencontrol -p$@ |
274 | dh_md5sums -p$@ | |
275 | dh_builddeb -p$@ | |
276 | ||
ee7ddf12 | 277 | $(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install |
782486e8 MV |
278 | dh_testdir -p$@ |
279 | dh_testroot -p$@ | |
280 | dh_prep -p$@ | |
281 | dh_installdirs -p$@ | |
282 | ||
283 | dh_install -p$@ --sourcedir=$(BLD) | |
08c9b191 | 284 | dh_installdocs -p$@ |
782486e8 MV |
285 | dh_installchangelogs -p$@ |
286 | dh_strip -p$@ | |
287 | dh_compress -p$@ | |
288 | dh_fixperms -p$@ | |
f521559b | 289 | dh_makeshlibs -p$@ |
08c9b191 | 290 | dh_installdeb -p$@ |
782486e8 MV |
291 | dh_shlibdeps -p$@ |
292 | dh_gencontrol -p$@ | |
293 | dh_md5sums -p$@ | |
294 | dh_builddeb -p$@ | |
295 | ||
ee7ddf12 | 296 | $(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install |
782486e8 MV |
297 | dh_testdir -p$@ |
298 | dh_testroot -p$@ | |
299 | dh_prep -p$@ | |
300 | dh_installdirs -p$@ | |
301 | ||
302 | dh_install -p$@ --sourcedir=$(BLD) | |
08c9b191 | 303 | dh_installdocs -p$@ |
782486e8 MV |
304 | dh_installchangelogs -p$@ |
305 | dh_strip -p$@ | |
306 | dh_compress -p$@ | |
307 | dh_fixperms -p$@ | |
f521559b | 308 | dh_makeshlibs -p$@ |
08c9b191 | 309 | dh_installdeb -p$@ |
cb6020cd | 310 | dh_shlibdeps -p$@ |
782486e8 | 311 | dh_gencontrol -p$@ |
c64bcd92 AL |
312 | dh_md5sums -p$@ |
313 | dh_builddeb -p$@ | |
2d18d44e | 314 | |
ee7ddf12 | 315 | apt-transport-https: build-binary libapt-pkg-dev |
d546f98d MV |
316 | dh_testdir -p$@ |
317 | dh_testroot -p$@ | |
af7a92c3 | 318 | dh_prep -p$@ |
d546f98d MV |
319 | dh_installdirs -p$@ |
320 | ||
2cf8c58b | 321 | dh_install -p$@ --sourcedir=$(BLD) |
cb6020cd | 322 | dh_installdocs -p$@ |
d546f98d MV |
323 | dh_installexamples -p$@ |
324 | ||
325 | # Install the man pages.. | |
326 | dh_installman -p$@ | |
327 | ||
328 | dh_installchangelogs -p$@ | |
329 | dh_strip -p$@ | |
330 | dh_compress -p$@ | |
331 | dh_fixperms -p$@ | |
332 | dh_installdeb -p$@ | |
cb6020cd | 333 | dh_shlibdeps -p$@ |
d546f98d MV |
334 | dh_gencontrol -p$@ |
335 | dh_md5sums -p$@ | |
336 | dh_builddeb -p$@ | |
337 | ||
e941cc69 DK |
338 | buildlib/config.guess buildlib/config.sub: |
339 | $(MAKE) "$@" | |
340 | ||
2d18d44e | 341 | configure: |
1d9fd7a2 | 342 | $(MAKE) configure |
2d18d44e | 343 | |
ee7ddf12 DK |
344 | # translate targets to targets required by debian-policy |
345 | binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https | |
346 | binary-indep: apt-doc libapt-pkg-doc | |
2d18d44e | 347 | binary: binary-indep binary-arch |
ee7ddf12 | 348 | build-arch: build-binary |
a034d852 | 349 | build-indep: build-manpages build-docbook |
ee7ddf12 DK |
350 | build: build-indep build-arch |
351 | ||
149daa16 | 352 | .PHONY: build clean binary-indep binary-arch binary |