]>
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 | |
9c30a078 | 192 | rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver) |
2cf8c58b DK |
193 | |
194 | # https has its own package | |
195 | rm debian/$@/usr/lib/apt/methods/https | |
196 | ||
3f599bb7 | 197 | # move the mirror failure script in place |
23c5897c MV |
198 | #mv debian/$@/usr/bin/apt-report-mirror-failure \ |
199 | # debian/$@/usr/lib/apt/apt-report-mirror-failure \ | |
3f599bb7 | 200 | |
e43a426e | 201 | # move the apt-helper in place |
14669d4b MV |
202 | mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper |
203 | # install apt.systemd.daily helper in the right place | |
204 | install -m755 debian/apt.systemd.daily debian/$@/usr/lib/apt/ | |
e43a426e | 205 | |
304c041b | 206 | dh_bugfiles -p$@ |
063a17d7 | 207 | dh_lintian -p$@ |
cb6020cd | 208 | dh_installexamples -p$@ |
ac62eb38 | 209 | dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) |
14669d4b MV |
210 | dh_installcron -p$@ --name=apt-compat |
211 | dh_systemd_enable -p$@ apt-daily.timer | |
212 | dh_systemd_start -p$@ apt-daily.timer | |
9e980be8 | 213 | dh_installdocs -p$@ |
c64bcd92 | 214 | dh_installchangelogs -p$@ |
2cf8c58b | 215 | dh_installlogrotate -p$@ |
c64bcd92 AL |
216 | dh_strip -p$@ |
217 | dh_compress -p$@ | |
218 | dh_fixperms -p$@ | |
e093518c | 219 | dh_makeshlibs -p$@ |
c64bcd92 | 220 | dh_installdeb -p$@ |
bd5e34e8 | 221 | dh_shlibdeps -p$@ |
0005fa07 | 222 | dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)" |
c64bcd92 AL |
223 | dh_md5sums -p$@ |
224 | dh_builddeb -p$@ | |
225 | ||
ee7ddf12 | 226 | libapt-pkg-dev: build-binary debian/libapt-pkg-dev.install |
c64bcd92 AL |
227 | dh_testdir -p$@ |
228 | dh_testroot -p$@ | |
af7a92c3 | 229 | dh_prep -p$@ |
c64bcd92 AL |
230 | dh_installdirs -p$@ |
231 | # | |
232 | # libapt-pkg-dev install | |
233 | # | |
2cf8c58b | 234 | dh_install -p$@ --sourcedir=$(BLD) |
c64bcd92 | 235 | dh_installdocs -p$@ |
c64bcd92 AL |
236 | dh_installchangelogs -p$@ |
237 | dh_strip -p$@ | |
238 | dh_compress -p$@ | |
239 | dh_fixperms -p$@ | |
c64bcd92 | 240 | dh_installdeb -p$@ |
ceab242d | 241 | dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST) |
b2e465d6 AL |
242 | dh_md5sums -p$@ |
243 | dh_builddeb -p$@ | |
244 | ||
2a52e8c5 | 245 | apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates |
ee7ddf12 | 246 | apt-utils: build-binary build-manpages |
b2e465d6 AL |
247 | dh_testdir -p$@ |
248 | dh_testroot -p$@ | |
af7a92c3 | 249 | dh_prep -p$@ |
b2e465d6 AL |
250 | dh_installdirs -p$@ |
251 | ||
b2e465d6 | 252 | cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/ |
66b6fe05 | 253 | cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump |
9c30a078 | 254 | cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt |
2cf8c58b DK |
255 | |
256 | dh_install -p$@ --sourcedir=$(BLD) | |
66b6fe05 | 257 | dh_link -p$@ |
b2e465d6 | 258 | dh_installdocs -p$@ |
53cd7e2b | 259 | dh_installexamples -p$@ |
201eaabd | 260 | |
b2e465d6 | 261 | # Install the man pages.. |
ac62eb38 | 262 | dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES))) |
90ebe30c | 263 | |
b2e465d6 AL |
264 | dh_installchangelogs -p$@ |
265 | dh_strip -p$@ | |
266 | dh_compress -p$@ | |
267 | dh_fixperms -p$@ | |
149daa16 | 268 | dh_makeshlibs -p$@ |
b2e465d6 | 269 | dh_installdeb -p$@ |
bd5e34e8 | 270 | dh_shlibdeps -p$@ |
782486e8 MV |
271 | dh_gencontrol -p$@ |
272 | dh_md5sums -p$@ | |
273 | dh_builddeb -p$@ | |
274 | ||
ee7ddf12 | 275 | $(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install |
782486e8 MV |
276 | dh_testdir -p$@ |
277 | dh_testroot -p$@ | |
278 | dh_prep -p$@ | |
279 | dh_installdirs -p$@ | |
280 | ||
281 | dh_install -p$@ --sourcedir=$(BLD) | |
08c9b191 | 282 | dh_installdocs -p$@ |
782486e8 MV |
283 | dh_installchangelogs -p$@ |
284 | dh_strip -p$@ | |
285 | dh_compress -p$@ | |
286 | dh_fixperms -p$@ | |
f521559b | 287 | dh_makeshlibs -p$@ |
08c9b191 | 288 | dh_installdeb -p$@ |
782486e8 MV |
289 | dh_shlibdeps -p$@ |
290 | dh_gencontrol -p$@ | |
291 | dh_md5sums -p$@ | |
292 | dh_builddeb -p$@ | |
293 | ||
ee7ddf12 | 294 | $(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install |
782486e8 MV |
295 | dh_testdir -p$@ |
296 | dh_testroot -p$@ | |
297 | dh_prep -p$@ | |
298 | dh_installdirs -p$@ | |
299 | ||
300 | dh_install -p$@ --sourcedir=$(BLD) | |
08c9b191 | 301 | dh_installdocs -p$@ |
782486e8 MV |
302 | dh_installchangelogs -p$@ |
303 | dh_strip -p$@ | |
304 | dh_compress -p$@ | |
305 | dh_fixperms -p$@ | |
f521559b | 306 | dh_makeshlibs -p$@ |
08c9b191 | 307 | dh_installdeb -p$@ |
cb6020cd | 308 | dh_shlibdeps -p$@ |
782486e8 | 309 | dh_gencontrol -p$@ |
c64bcd92 AL |
310 | dh_md5sums -p$@ |
311 | dh_builddeb -p$@ | |
2d18d44e | 312 | |
ee7ddf12 | 313 | apt-transport-https: build-binary libapt-pkg-dev |
d546f98d MV |
314 | dh_testdir -p$@ |
315 | dh_testroot -p$@ | |
af7a92c3 | 316 | dh_prep -p$@ |
d546f98d MV |
317 | dh_installdirs -p$@ |
318 | ||
2cf8c58b | 319 | dh_install -p$@ --sourcedir=$(BLD) |
cb6020cd | 320 | dh_installdocs -p$@ |
d546f98d MV |
321 | dh_installexamples -p$@ |
322 | ||
323 | # Install the man pages.. | |
324 | dh_installman -p$@ | |
325 | ||
326 | dh_installchangelogs -p$@ | |
327 | dh_strip -p$@ | |
328 | dh_compress -p$@ | |
329 | dh_fixperms -p$@ | |
330 | dh_installdeb -p$@ | |
cb6020cd | 331 | dh_shlibdeps -p$@ |
d546f98d MV |
332 | dh_gencontrol -p$@ |
333 | dh_md5sums -p$@ | |
334 | dh_builddeb -p$@ | |
335 | ||
e941cc69 DK |
336 | buildlib/config.guess buildlib/config.sub: |
337 | $(MAKE) "$@" | |
338 | ||
2d18d44e | 339 | configure: |
1d9fd7a2 | 340 | $(MAKE) configure |
2d18d44e | 341 | |
ee7ddf12 DK |
342 | # translate targets to targets required by debian-policy |
343 | binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https | |
344 | binary-indep: apt-doc libapt-pkg-doc | |
2d18d44e | 345 | binary: binary-indep binary-arch |
ee7ddf12 | 346 | build-arch: build-binary |
a034d852 | 347 | build-indep: build-manpages build-docbook |
ee7ddf12 DK |
348 | build: build-indep build-arch |
349 | ||
149daa16 | 350 | .PHONY: build clean binary-indep binary-arch binary |