]> git.saurik.com Git - apt.git/blob - debian/rules
remove semi-support for different build-dirs
[apt.git] / debian / rules
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 # build in verbose mode by default to make it easy to diangose issues
7 export NOISY=1
8
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)
11 export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
12 export PARALLEL = $(or $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))),1)
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
21 # Set the number of procs to be run in parallel from the options.
22 confflags += --with-procs=$(PARALLEL)
23
24 # See below
25 -include build/environment.mak
26
27 ifneq (,$(shell which dpkg-buildflags))
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)
32 export LDFLAGS = $(shell $(dpkg_buildflags) --get LDFLAGS)
33 export CPPFLAGS = $(shell $(dpkg_buildflags) --get CPPFLAGS)
34 else
35 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
36 export CXXFLAGS = -O0 -g -Wall
37 else
38 export CXXFLAGS = -O2 -g -Wall
39 endif
40 endif
41
42 # Default rule
43 build:
44
45 # Determine the build directory to use
46 override BASE := .
47 override BLD := $(BASE)/build
48
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
54 # APT Programs in apt-utils
55 APT_UTILS=ftparchive sortpkgs extracttemplates
56
57 # Uncomment this to turn on verbose mode.
58 #export DH_VERBOSE=1
59
60 # Find the libapt-pkg major version for use in other control files
61 include buildlib/libversion.mak
62
63 # Determine which library package names to use
64 LIBAPT_PKG=libapt-pkg$(LIBAPTPKG_MAJOR)
65 LIBAPT_INST=libapt-inst$(LIBAPTINST_MAJOR)
66
67 # do not fail as we are just experimenting with symbol files for now
68 export DPKG_GENSYMBOLS_CHECK_LEVEL=0
69
70 build-binary: build/build-binary-stamp
71 build-docbook: build/build-docbook-stamp
72 build-manpages: build/build-manpages-stamp
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
79
80 configure: configure.ac
81 build/configure-stamp: configure buildlib/config.sub buildlib/config.guess
82 dh_testdir
83 mkdir -p build
84 cp COPYING debian/copyright
85 cd build && CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" ../configure $(confflags)
86 touch $@
87
88 build/build-binary-stamp: build/configure-stamp
89 # Add here commands to compile the package.
90 $(MAKE) binary
91 # compat symlink for the locale split
92 mkdir -p build/usr/share
93 cd build/usr/share && ln -f -s ../../locale .
94 # compile and run tests
95 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
96 $(MAKE) test
97 else
98 @echo "Tests DISABLED"
99 endif
100 touch $@
101
102 build/build-docbook-stamp: build/configure-stamp
103 # Add here commands to compile the package.
104 $(MAKE) docbook
105 touch $@
106
107 build/build-manpages-stamp: build/configure-stamp
108 # Add here commands to compile the package.
109 $(MAKE) manpages
110 touch $@
111
112 clean:
113 dh_testdir
114 dh_clean
115
116 [ ! -f Makefile ] || $(MAKE) clean distclean
117 rm -rf build
118 rm -f debian/$(LIBAPT_PKG).install debian/$(LIBAPT_INST).install \
119 debian/libapt-pkg-dev.install debian/apt.install
120 test ! -L buildlib/config.guess || rm -f buildlib/config.guess
121 test ! -L buildlib/config.sub || rm -f buildlib/config.sub
122
123 debian/%.install: debian/%.install.in
124 sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
125
126 # Build architecture-independent files here.
127 libapt-pkg-doc: build-docbook
128 dh_testdir -p$@
129 dh_testroot -p$@
130 dh_prep -p$@
131 dh_installdirs -p$@
132 #
133 # libapt-pkg-doc install
134 #
135 rm -f $(BLD)/doc/doxygen/html/*.map $(BLD)/doc/doxygen/html/*.md5
136 dh_installdocs -p$@ $(BLD)/docs/design* \
137 $(BLD)/docs/dpkg-tech* \
138 $(BLD)/docs/files* \
139 $(BLD)/docs/method* \
140 doc/libapt-pkg2_to_3.txt \
141 doc/style.txt \
142 $(BLD)/doc/doxygen/html
143 dh_installexamples -p$@
144 dh_lintian -p$@
145 dh_installchangelogs -p$@
146 dh_strip -p$@
147 dh_compress -p$@ -X.xhtml
148 dh_fixperms -p$@
149 dh_installdeb -p$@
150 dh_gencontrol -p$@
151 dh_md5sums -p$@
152 dh_builddeb -p$@
153
154 apt-doc: build-docbook
155 dh_testdir -p$@
156 dh_testroot -p$@
157 dh_prep -p$@
158 #
159 # apt-doc install
160 #
161 # Copy the guides
162 dh_installdocs -p$@ $(BLD)/docs/guide*.text \
163 $(BLD)/docs/guide*.html \
164 $(BLD)/docs/offline*.text \
165 $(BLD)/docs/offline*.html
166 dh_installchangelogs -p$@
167 dh_compress -p$@
168 dh_fixperms -p$@
169 dh_installdeb -p$@
170 dh_gencontrol -p$@
171 dh_md5sums -p$@
172 dh_builddeb -p$@
173
174
175
176 # Build architecture-dependent files here.
177
178 apt_MANPAGES = apt apt-cache apt-cdrom apt-config apt-get apt-key apt-mark apt-secure apt apt.conf apt_preferences sources.list
179 apt: build-binary build-manpages debian/apt.install
180 dh_testdir -p$@
181 dh_testroot -p$@
182 dh_prep -p$@
183 dh_installdirs -p$@
184 #
185 # apt install
186 #
187 cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove
188 cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal
189 chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal
190 # install vendor specific apt confs
191 find -L vendor/current -name 'apt.conf-*' | while read conf; do cp "$${conf}" "debian/$@/etc/apt/apt.conf.d/$${conf#*-}"; done
192
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
198 dh_install -p$@ --sourcedir=$(BLD)
199
200 # Remove the bits that are in apt-utils
201 rm $(addprefix debian/$@/usr/bin/apt-,$(APT_UTILS) dump-solver internal-solver)
202
203 # https has its own package
204 rm debian/$@/usr/lib/apt/methods/https
205
206 # move the mirror failure script in place
207 #mv debian/$@/usr/bin/apt-report-mirror-failure \
208 # debian/$@/usr/lib/apt/apt-report-mirror-failure \
209
210 # move the apt-helper in place
211 mv debian/$@/usr/bin/apt-helper debian/$@/usr/lib/apt/apt-helper
212 # install apt.systemd.daily helper in the right place
213 install -m755 debian/apt.systemd.daily debian/$@/usr/lib/apt/
214
215 dh_bugfiles -p$@
216 dh_lintian -p$@
217 dh_installexamples -p$@ $(BLD)/docs/examples/*
218 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES)))
219 dh_installcron -p$@ --name=apt-compat
220 dh_systemd_enable -p$@ apt-daily.timer
221 dh_systemd_start -p$@ apt-daily.timer
222 dh_installdocs -p$@
223 dh_installchangelogs -p$@
224 dh_installlogrotate -p$@
225 dh_strip -p$@
226 dh_compress -p$@
227 dh_fixperms -p$@
228 dh_makeshlibs -p$@
229 dh_installdeb -p$@
230 dh_shlibdeps -p$@
231 dh_gencontrol -p$@ -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)"
232 dh_md5sums -p$@
233 dh_builddeb -p$@
234
235 libapt-pkg-dev: build-binary debian/libapt-pkg-dev.install
236 dh_testdir -p$@
237 dh_testroot -p$@
238 dh_prep -p$@
239 dh_installdirs -p$@
240 #
241 # libapt-pkg-dev install
242 #
243 dh_install -p$@ --sourcedir=$(BLD)
244 dh_installdocs -p$@
245 dh_installchangelogs -p$@
246 dh_strip -p$@
247 dh_compress -p$@
248 dh_fixperms -p$@
249 dh_installdeb -p$@
250 dh_gencontrol -p$@ -- -Vlibapt-pkg-name=$(LIBAPT_PKG) -Vlibapt-inst-name=$(LIBAPT_INST)
251 dh_md5sums -p$@
252 dh_builddeb -p$@
253
254 apt-utils_MANPAGES = apt-sortpkgs apt-ftparchive apt-extracttemplates
255 apt-utils: build-binary build-manpages
256 dh_testdir -p$@
257 dh_testroot -p$@
258 dh_prep -p$@
259 dh_installdirs -p$@
260
261 cp $(addprefix $(BLD)/bin/apt-,$(APT_UTILS)) debian/$@/usr/bin/
262 cp $(BLD)/bin/apt-dump-solver debian/$@/usr/lib/apt/solvers/dump
263 cp $(BLD)/bin/apt-internal-solver debian/$@/usr/lib/apt/solvers/apt
264
265 dh_install -p$@ --sourcedir=$(BLD)
266 dh_link -p$@
267 dh_installdocs -p$@
268 dh_installexamples -p$@
269
270 # Install the man pages..
271 dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES)))
272
273 dh_installchangelogs -p$@
274 dh_strip -p$@
275 dh_compress -p$@
276 dh_fixperms -p$@
277 dh_makeshlibs -p$@
278 dh_installdeb -p$@
279 dh_shlibdeps -p$@
280 dh_gencontrol -p$@
281 dh_md5sums -p$@
282 dh_builddeb -p$@
283
284 $(LIBAPT_PKG): build-binary debian/$(LIBAPT_PKG).install
285 dh_testdir -p$@
286 dh_testroot -p$@
287 dh_prep -p$@
288 dh_installdirs -p$@
289
290 dh_install -p$@ --sourcedir=$(BLD)
291 dh_installdocs -p$@
292 dh_installchangelogs -p$@
293 dh_strip -p$@
294 dh_compress -p$@
295 dh_fixperms -p$@
296 dh_makeshlibs -p$@
297 dh_installdeb -p$@
298 dh_shlibdeps -p$@
299 dh_gencontrol -p$@
300 dh_md5sums -p$@
301 dh_builddeb -p$@
302
303 $(LIBAPT_INST): build-binary debian/$(LIBAPT_INST).install
304 dh_testdir -p$@
305 dh_testroot -p$@
306 dh_prep -p$@
307 dh_installdirs -p$@
308
309 dh_install -p$@ --sourcedir=$(BLD)
310 dh_installdocs -p$@
311 dh_installchangelogs -p$@
312 dh_strip -p$@
313 dh_compress -p$@
314 dh_fixperms -p$@
315 dh_makeshlibs -p$@
316 dh_installdeb -p$@
317 dh_shlibdeps -p$@
318 dh_gencontrol -p$@
319 dh_md5sums -p$@
320 dh_builddeb -p$@
321
322 apt-transport-https: build-binary libapt-pkg-dev
323 dh_testdir -p$@
324 dh_testroot -p$@
325 dh_prep -p$@
326 dh_installdirs -p$@
327
328 dh_install -p$@ --sourcedir=$(BLD)
329 dh_installdocs -p$@ debian/apt-transport-https.README
330 dh_installexamples -p$@
331
332 # Install the man pages..
333 dh_installman -p$@
334
335 dh_installchangelogs -p$@
336 dh_strip -p$@
337 dh_compress -p$@
338 dh_fixperms -p$@
339 dh_installdeb -p$@
340 dh_shlibdeps -p$@
341 dh_gencontrol -p$@
342 dh_md5sums -p$@
343 dh_builddeb -p$@
344
345 buildlib/config.guess buildlib/config.sub:
346 $(MAKE) "$@"
347
348 configure:
349 $(MAKE) configure
350
351 # translate targets to targets required by debian-policy
352 binary-arch: $(LIBAPT_PKG) $(LIBAPT_INST) apt libapt-pkg-dev apt-utils apt-transport-https
353 binary-indep: apt-doc libapt-pkg-doc
354 binary: binary-indep binary-arch
355 build-arch: build-binary
356 build-indep: build-manpages build-docbook
357 build: build-indep build-arch
358
359 .PHONY: build clean binary-indep binary-arch binary