]> git.proxmox.com Git - rustc.git/blob - debian/rules
Fix Makefile addition syntax
[rustc.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 include /usr/share/dpkg/pkg-info.mk
5 include /usr/share/dpkg/vendor.mk
6 include /usr/share/dpkg/architecture.mk
7 SED_VERSION_SHORT := sed -re 's/([^.]+)\.([^.]+)\..*/\1.\2/'
8 RUST_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | $(SED_VERSION_SHORT))
9 RUST_LONG_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -re 's/([^+]+).*/\1/')
10 LIBSTD_PKG := libstd-rust-$(RUST_VERSION)
11 # Sed expression that matches the "rustc" we have in our Build-Depends field
12 SED_RUSTC_BUILDDEP := sed -ne "/^Build-Depends:/,/^[^[:space:]\#]/{/^ *rustc:native .*,/p}" debian/control
13 # Version of /usr/bin/rustc
14 LOCAL_RUST_VERSION := $(shell rustc --version --verbose | sed -ne 's/^release: //p')
15
16 include /usr/share/dpkg/buildflags.mk
17 export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
18 export CARGO_HOME = $(CURDIR)/debian/cargo
19
20 # Defines DEB_*_RUST_TYPE triples
21 include debian/architecture.mk
22 export DEB_HOST_RUST_TYPE
23
24 # Uncomment this to turn on verbose mode.
25 #export DH_VERBOSE=1
26
27 DEB_DESTDIR := $(CURDIR)/debian/tmp
28
29 # Use system LLVM (comment out to use vendored LLVM)
30 LLVM_VERSION = 11
31 OLD_LLVM_VERSION = 10
32 # Make it easier to test against a custom LLVM
33 ifneq (,$(LLVM_DESTDIR))
34 LLVM_LIBRARY_PATH := $(LLVM_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH):$(LLVM_DESTDIR)/usr/lib
35 LD_LIBRARY_PATH := $(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):$(LLVM_LIBRARY_PATH),$(LLVM_LIBRARY_PATH))
36 export LD_LIBRARY_PATH
37 endif
38
39 RUSTBUILD = RUST_BACKTRACE=1 python3 src/bootstrap/bootstrap.py
40 RUSTBUILD_FLAGS = --stage 2 --config debian/config.toml -vvv --on-fail env
41 RUSTBUILD_TEST = $(RUSTBUILD) test --no-fail-fast
42 # To run a specific test, run something like:
43 # $ debian/rules override_dh_auto_test-arch \
44 # RUSTBUILD_TEST_FLAGS="src/test/run-make --test-args extern-fn-struct"
45 # See src/bootstrap/README.md for more options.
46 RUSTBUILD_TEST_FLAGS =
47
48 update-version:
49 oldver=$(shell $(SED_RUSTC_BUILDDEP) | sed -ne 's/.*(<= \(.*\)).*/\1/gp' | $(SED_VERSION_SHORT)); \
50 newver=$(RUST_VERSION); \
51 debian/update-version.sh $$oldver $$newver $(RUST_LONG_VERSION) $(CARGO_NEW)
52
53 # Below we detect how we're supposed to bootstrap the stage0 compiler. See
54 # README.Debian for more details of the cases described below.
55 #
56 PRECONFIGURE_CHECK = :
57 HAVE_BINARY_TARBALL := $(shell ls -1 stage0/*/*$(DEB_HOST_RUST_TYPE)* 2>/dev/null | wc -l)
58 DOWNLOAD_BOOTSTRAP := false
59 # allow not using the binary tarball although it exists
60 #ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armhf i386 powerpc ppc64el s390x))
61 # HAVE_BINARY_TARBALL := 0
62 #endif
63 ifeq (0,$(HAVE_BINARY_TARBALL))
64 # Case A (Building from source): the extracted source tree does not include
65 # a bootstrapping tarball for the current architecture e.g. because the
66 # distro already has a rustc for this arch, or the uploader expects that
67 # this requirement be fulfilled in some other way.
68 #
69 # Case A-1: the builder did not select the "pkg.rustc.dlstage0" build profile.
70 # In this case, we use the distro's rustc - either the previous or current version.
71 ifeq (,$(findstring pkg.rustc.dlstage0,$(DEB_BUILD_PROFILES)))
72 # Make it easier to test against a custom rustc
73 ifneq (,$(RUST_DESTDIR))
74 RUST_LIBRARY_PATH := $(RUST_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH):$(RUST_DESTDIR)/usr/lib
75 LD_LIBRARY_PATH := $(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):$(RUST_LIBRARY_PATH),$(RUST_LIBRARY_PATH))
76 export LD_LIBRARY_PATH
77 endif
78 #
79 # Case A-2: the builder selected the "dlstage0" build profile.
80 # In this case, the rust build scripts will download a stage0 into stage0/ and use that.
81 # We don't need to do anything specific in this build file, so this case is empty.
82 else
83 DOWNLOAD_BOOTSTRAP := true
84 endif
85 else
86 # Case B (Bootstrapping a new distro): the extracted source tree does
87 # include a bootstrapping tarball for the current architecture; see the
88 # `source_orig-stage0` target below on how to build this.
89 #
90 # In this case, we'll bootstrap from the stage0 given in that tarball.
91 # To ensure the uploader of the .dsc didn't make a mistake, we first check
92 # that rustc isn't a Build-Depends for the current architecture.
93 ifneq (,$(shell $(SED_RUSTC_BUILDDEP)))
94 ifeq (,$(shell $(SED_RUSTC_BUILDDEP) | grep '!$(DEB_HOST_ARCH)'))
95 PRECONFIGURE_CHECK = $(error found matches for stage0/*/*$(DEB_HOST_RUST_TYPE)*, \
96 but rustc might be a Build-Depends for $(DEB_HOST_ARCH))
97 endif
98 endif
99 endif
100
101 BUILD_DOCS := true
102 ifneq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
103 BUILD_DOCS := false
104 endif
105 ifneq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
106 BUILD_DOCS := false
107 endif
108
109 BUILD_WASM := true
110 ifneq (,$(findstring nowasm,$(DEB_BUILD_PROFILES)))
111 BUILD_WASM := false
112 endif
113
114 WINDOWS_SUPPORT := amd64 i386
115 BUILD_WINDOWS := true
116 ifneq (,$(findstring nowindows,$(DEB_BUILD_PROFILES)))
117 BUILD_WINDOWS := false
118 endif
119 ifeq (,$(filter $(DEB_HOST_ARCH), $(WINDOWS_SUPPORT)))
120 BUILD_WINDOWS := false
121 else
122 ifeq (,$(filter $(DEB_BUILD_ARCH), $(WINDOWS_SUPPORT)))
123 ifeq (true,$(BUILD_WINDOWS))
124 $(error cannot cross-compile from $(DEB_BUILD_ARCH) to $(DEB_HOST_ARCH), unless "nowindows" is in DEB_BUILD_PROFILES)
125 endif
126 endif
127 ifeq (i386,$(DEB_HOST_ARCH))
128 WINDOWS_ARCH := i686
129 else
130 WINDOWS_ARCH := x86_64
131 endif
132 endif
133
134 MAKE_OPTIMISATIONS := true
135 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
136 MAKE_OPTIMISATIONS := false
137 endif
138
139 # Build products or non-source files in src/, that shouldn't go in rust-src
140 SRC_CLEAN = src/bootstrap/bootstrap.pyc \
141 src/etc/__pycache__/
142
143 # Try to work around #933045
144 ifneq (,$(filter $(DEB_BUILD_ARCH), mips mipsel))
145 SYSTEM_WORKAROUNDS += export MALLOC_ARENA_MAX=1;
146 endif
147
148 %:
149 $(SYSTEM_WORKAROUNDS) dh $@ --parallel
150
151 .PHONY: .dbg-windows
152 .dbg-windows:
153 @echo host=$(DEB_BUILD_ARCH) target=$(DEB_HOST_ARCH) BUILD_WINDOWS=$(BUILD_WINDOWS) WINDOWS_ARCH=$(WINDOWS_ARCH)
154
155 .PHONY: build
156 build:
157 $(SYSTEM_WORKAROUNDS) dh $@ --parallel
158
159 override_dh_clean:
160 # Upstream contains a lot of these
161 dh_clean -XCargo.toml.orig
162
163 debian/config.toml: debian/config.toml.in debian/rules
164 u="$(DEB_VERSION_UPSTREAM)"; \
165 if [ "$$u" != "$${u%~beta.*+dfsg*}" ]; then channel="beta"; \
166 else channel="stable"; fi; echo $$channel; \
167 m4 -DRELEASE_CHANNEL="$$channel" \
168 -DDEB_BUILD_RUST_TYPE="$(DEB_BUILD_RUST_TYPE)" \
169 -DDEB_HOST_RUST_TYPE="$(DEB_HOST_RUST_TYPE)" \
170 -DDEB_TARGET_RUST_TYPE="$(DEB_TARGET_RUST_TYPE)" \
171 -DDEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
172 -DDEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
173 -DDEB_TARGET_GNU_TYPE="$(DEB_TARGET_GNU_TYPE)" \
174 -DMAKE_OPTIMISATIONS="$(MAKE_OPTIMISATIONS)" \
175 -DLLVM_DESTDIR="$(LLVM_DESTDIR)" \
176 -DLLVM_VERSION="$(LLVM_VERSION)" \
177 -DRUST_DESTDIR="$(RUST_DESTDIR)" \
178 "$<" > "$@"
179 if $(DOWNLOAD_BOOTSTRAP) || [ $(HAVE_BINARY_TARBALL) != 0 ]; \
180 then sed -i -e '/^rustc = /d' -e '/^cargo = /d' "$@"; fi
181 # Work around low-memory (32-bit) architectures: https://github.com/rust-lang/rust/issues/45854
182 ifneq (,$(filter $(DEB_BUILD_ARCH), armhf armel mips mipsel powerpc powerpcspe))
183 sed -i -e 's/^debuginfo-level = .*/debuginfo-level = 0/g' "$@"
184 endif
185
186 debian/rust-src.%: debian/rust-src.%.in
187 m4 -DRUST_LONG_VERSION="$(RUST_LONG_VERSION)" \
188 "$<" > "$@"
189
190 debian/dh_auto_configure.stamp: debian/config.toml
191 # fail the build if we have any instances of OLD_LLVM_VERSION in debian, except for debian/changelog
192 ! grep --color=always -i '\(clang\|ll\(..\|d\)\)-\?$(subst .,\.,$(OLD_LLVM_VERSION))' --exclude=changelog --exclude=copyright --exclude='*.patch' --exclude-dir='.debhelper' -R debian
193 # fail the build if we accidentally vendored openssl, indicates we pulled in unnecessary dependencies
194 test ! -e vendor/openssl
195 # fail the build if our version contains ~exp and we are not releasing to experimental
196 v="$(DEB_VERSION)"; test "$$v" = "$${v%~exp*}" -o "$(DEB_DISTRIBUTION)" = "experimental" -o "$(DEB_DISTRIBUTION)" = "UNRELEASED"
197 $(PRECONFIGURE_CHECK)
198 if [ -d stage0 ]; then mkdir -p build && ln -sfT ../stage0 build/cache; fi
199 # work around #842634
200 if test $$(grep "127.0.0.1\s*localhost" /etc/hosts | wc -l) -gt 1; then \
201 debian/ensure-patch -N debian/patches/d-host-duplicates.patch; fi
202 # allow beta builds
203 sed -i -e 's/dev: 1/#dev: 1/g' src/stage0.txt
204 # don't care about lock changes
205 rm -f Cargo.lock
206 # We patched some crates so have to rm the checksums
207 find vendor -name .cargo-checksum.json -execdir "$(CURDIR)/debian/prune-checksums" "{}" +
208 # Link against system liblzma, see https://github.com/alexcrichton/xz2-rs/issues/16
209 echo 'fn main() { println!("cargo:rustc-link-lib=lzma"); }' > vendor/lzma-sys/build.rs
210 # We don't run ./configure because we use debian/config.toml directly
211 ln -sf debian/config.toml config.toml
212 touch "$@"
213
214 override_dh_auto_configure-arch: debian/dh_auto_configure.stamp
215 override_dh_auto_configure-indep: debian/dh_auto_configure.stamp
216 ifeq (true,$(BUILD_DOCS))
217 # Change config.toml now and not later, since that might trigger a rebuild
218 sed -i -e 's/^docs = false/docs = true/' debian/config.toml
219 endif
220
221 override_dh_auto_clean:
222 $(RM) -rf build tmp .cargo debian/cargo_home config.stamp config.mk Makefile
223 $(RM) -rf $(TEST_LOG) debian/config.toml debian/rust-src.install debian/rust-src.links debian/*.stamp
224 $(RM) -rf $(SRC_CLEAN) config.toml
225
226 debian/dh_auto_build.stamp:
227 $(RUSTBUILD) build $(RUSTBUILD_FLAGS)
228
229 override_dh_auto_build-arch: debian/dh_auto_build.stamp
230 ifeq (true,$(BUILD_WINDOWS))
231 $(RUSTBUILD) build $(RUSTBUILD_FLAGS) \
232 --host $(DEB_BUILD_RUST_TYPE) \
233 --target $(WINDOWS_ARCH)-pc-windows-gnu \
234 library/std
235 endif
236
237 override_dh_auto_build-indep: debian/dh_auto_build.stamp
238 ifeq (true,$(BUILD_WASM))
239 $(RUSTBUILD) build $(RUSTBUILD_FLAGS) \
240 --host $(DEB_BUILD_RUST_TYPE) \
241 --target wasm32-unknown-unknown,wasm32-wasi \
242 library/std
243 endif
244 ifeq (true,$(BUILD_DOCS))
245 $(RUSTBUILD) doc $(RUSTBUILD_FLAGS)
246 endif
247
248 TEST_LOG = debian/rustc-tests.log
249 # This is advertised as "5 tests failed" in README.Debian because our counting
250 # method is imprecise and in practise we count some failures twice.
251 FAILURES_ALLOWED = 8
252 ifneq (,$(filter $(DEB_BUILD_ARCH), ppc64 arm64 mips64el i386))
253 FAILURES_ALLOWED = 12
254 endif
255 ifneq (,$(filter $(DEB_BUILD_ARCH), mips mipsel s390x powerpc))
256 FAILURES_ALLOWED = 24
257 endif
258 ifneq (,$(filter $(DEB_BUILD_ARCH), powerpcspe riscv64 sparc64 x32))
259 FAILURES_ALLOWED = 180
260 endif
261 FAILURES_ALLOWED := $(shell expr 2 + $(FAILURES_ALLOWED)) # FIXME: temp hack for 1.52.0~beta.3+dfsg1-1~exp2 to account for the fact that 1.51.0+dfsg1-1~exp3 did not install rust-llvm-dwp; remove in 1.52.0~beta.3+dfsg1-1~exp3 and 1.51.0+dfsg1-1
262 FAILED_TESTS = grep "FAILED\|^command did not execute successfully" $(TEST_LOG) | grep -v '^test result: FAILED' | grep -v 'FAILED (allowed)'
263 override_dh_auto_test-arch:
264 # ensure that rustc_llvm is actually dynamically linked to libLLVM
265 set -e; find build/*/stage2/lib/rustlib/* -name '*rustc_llvm*.so' | \
266 while read x; do \
267 stat -c '%s %n' "$$x"; \
268 objdump -p "$$x" | grep -q "NEEDED.*LLVM"; \
269 test "$$(stat -c %s "$$x")" -lt 6000000; \
270 done
271 ifeq (, $(filter nocheck,$(DEB_BUILD_PROFILES)))
272 ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
273 { $(RUSTBUILD_TEST) $(RUSTBUILD_FLAGS) $(RUSTBUILD_TEST_FLAGS); echo $$?; } | tee -a $(TEST_LOG)
274 # test that the log has at least 1 pass, to prevent e.g. #57709
275 grep -l "^test .* \.\.\. ok$$" $(TEST_LOG)
276 echo "==== Debian rustc test report ===="; \
277 echo "Specific test failures:"; \
278 $(FAILED_TESTS); \
279 num_failures=$$($(FAILED_TESTS) | wc -l); \
280 exit_code=$$(tail -n1 $(TEST_LOG)); \
281 echo "Summary: exit code $$exit_code, counted $$num_failures tests failed."; \
282 echo -n "$(FAILURES_ALLOWED) maximum allowed. "; \
283 if test "$$num_failures" -eq 0 -a "$$exit_code" -ne 0; then \
284 echo "Aborting just in case, because we missed counting some test failures."; \
285 echo "This could happen if we failed to build the tests, or if the testsuite runner is buggy."; \
286 false; \
287 elif test "$$num_failures" -le $(FAILURES_ALLOWED); then \
288 echo "Continuing..."; \
289 else \
290 echo "Aborting the build."; \
291 echo "Check the logs further above for details."; \
292 false; \
293 fi
294 # don't continue if RUSTBUILD_TEST_FLAGS is non-empty
295 test -z "$(RUSTBUILD_TEST_FLAGS)"
296 # don't run windows tests yet
297 endif
298 endif
299
300 override_dh_auto_test-indep:
301 ifeq (, $(filter nocheck,$(DEB_BUILD_PROFILES)))
302 ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
303 ifeq (true,$(BUILD_WASM))
304 # Ignore failures in these tests, but run them so we see what it's like
305 -PATH=$(CURDIR)/debian/bin:$(PATH) $(RUSTBUILD_TEST) $(RUSTBUILD_FLAGS) $(RUSTBUILD_TEST_FLAGS) \
306 --host $(DEB_BUILD_RUST_TYPE) \
307 --target wasm32-unknown-unknown,wasm32-wasi \
308 library/std
309 endif
310 ifeq (true,$(BUILD_DOCS))
311 # Run all rules that test the docs, i.e. that depend on default:doc
312 $(RUSTBUILD_TEST) $(RUSTBUILD_FLAGS) src/tools/linkchecker
313 endif
314 test -z "$(RUSTBUILD_TEST_FLAGS)"
315 endif
316 endif
317
318 run_rustbuild:
319 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) $(X_CMD) $(RUSTBUILD_FLAGS) $(X_FLAGS)
320
321 debian/dh_auto_install.stamp:
322 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) install $(RUSTBUILD_FLAGS)
323
324 mkdir -p $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
325 mv $(DEB_DESTDIR)/usr/lib/lib*.so $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
326
327 # Replace duplicated compile-time/run-time dylibs with symlinks
328 @set -e; \
329 for f in $(DEB_DESTDIR)/usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/lib*.so; do \
330 name=$${f##*/}; \
331 if [ -f "$(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/$$name" ]; then \
332 echo "ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f"; \
333 ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f; \
334 fi; \
335 done
336
337 touch "$@"
338
339 override_dh_auto_install-arch: debian/dh_auto_install.stamp
340 ifeq (true,$(BUILD_WINDOWS))
341 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) install $(RUSTBUILD_FLAGS) \
342 --host $(DEB_BUILD_RUST_TYPE) \
343 --target $(WINDOWS_ARCH)-pc-windows-gnu \
344 library/std
345 endif
346
347 override_dh_auto_install-indep: debian/dh_auto_install.stamp
348 ifeq (true,$(BUILD_WASM))
349 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) install $(RUSTBUILD_FLAGS) \
350 --host $(DEB_BUILD_RUST_TYPE) \
351 --target wasm32-unknown-unknown,wasm32-wasi \
352 library/std
353 endif
354 ifeq (true,$(BUILD_DOCS))
355 # Brute force to remove privacy-breach-logo lintian warning.
356 # We could have updated the upstream sources but it would complexify
357 # the rebase
358 @set -e; \
359 find $(DEB_DESTDIR)/usr/share/doc/*/html -iname '*.html' | \
360 while read file; do \
361 topdir=$$(echo "$$file" | sed 's,^$(DEB_DESTDIR)/usr/share/doc/rust/html/,,; s,/[^/]*$$,/,; s,^[^/]*$$,,; s,[^/]\+/,../,g'); \
362 sed -i \
363 -e "s,https://\(doc\|www\).rust-lang.org/\(favicon.ico\|logos/rust-logo-32x32-blk.png\),$${topdir}rust-logo-32x32-blk.png," \
364 -e 's,<img src="https://img.shields.io/[^"]*" alt="\([^"]*\)" />,<span class="deb-privacy-replace--shields-io">\1</span>,g' "$$file"; \
365 done
366 find $(DEB_DESTDIR) \( -iname '*.html' -empty -o -name .lock -o -name '*.inc' \) -delete;
367 endif
368
369 override_dh_install-arch:
370 dh_install
371 dh_install -p$(LIBSTD_PKG) usr/lib/$(DEB_HOST_MULTIARCH)/
372 dh_install -plibstd-rust-dev usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/
373 ifeq (true,$(BUILD_WINDOWS))
374 dh_install -plibstd-rust-dev-windows usr/lib/rustlib/*-pc-windows-gnu/lib/
375 endif
376
377 override_dh_install-indep: debian/rust-src.install debian/rust-src.links
378 dh_install
379 ifeq (true,$(BUILD_WASM))
380 dh_install -plibstd-rust-dev-wasm32 usr/lib/rustlib/wasm32-*/lib/
381 endif
382 $(RM) -rf $(SRC_CLEAN:%=debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION)/%)
383 # Get rid of lintian warnings
384 find debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION) \
385 \( -name .gitignore \
386 -o -name 'LICENSE*' \
387 -o -name 'LICENCE' \
388 -o -name 'license' \
389 -o -name 'COPYING*' \
390 \) -delete
391 # Remove files that autoload remote resources, caught by lintian
392 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/cssparser/docs/*.html
393 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/kuchiki/docs/*.html
394 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/url/docs/*.html
395 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/xz2/.gitmodules
396
397 override_dh_installchangelogs:
398 dh_installchangelogs RELEASES.md
399
400 override_dh_installdocs:
401 dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc
402
403 override_dh_missing:
404 dh_missing --fail-missing
405
406 override_dh_compress:
407 dh_compress -X.woff
408
409 # The below override is disabled on advice from #debian-devel, because:
410 # - only shared libs get the "split dbgsym package" treatment by dh_strip;
411 # static libs simply get their debuginfo discarded
412 # - strip(1) sometimes breaks wasm libs
413 #
414 #override_dh_strip:
415 # # Work around #35733, #468333
416 # find debian/libstd-rust-dev*/ -name '*.rlib' -execdir mv '{}' '{}.a' \;
417 # # This is expected to print out lots of "File format unrecognized" warnings about
418 # # rust.metadata.bin and *.deflate but the .o files inside the rlibs should be stripped
419 # # Some files are still omitted because of #875780 however.
420 # dh_strip -v
421 # find debian/libstd-rust-dev*/ -name '*.rlib.a' -execdir sh -c 'mv "$$1" "$${1%.a}"' - '{}' \;
422
423 override_dh_dwz:
424 # otherwise rustc gets an empty multifile which lintian errors on, causing
425 # FTP auto-reject. this is a work-around, the lintian bug is #955752
426 dh_dwz --no-dwz-multifile
427
428 override_dh_makeshlibs:
429 dh_makeshlibs -V
430
431 # dh_makeshlibs doesn't support our "libfoo-version.so" naming
432 # structure, so we have to do this ourselves.
433 mkdir -p debian/$(LIBSTD_PKG)/DEBIAN
434 LC_ALL=C ls debian/$(LIBSTD_PKG)/usr/lib/$(DEB_HOST_MULTIARCH)/lib*.so | \
435 sed -n 's,^.*/\(lib.*\)-\(.\+\)\.so$$,\1 \2,p' | \
436 while read name version; do \
437 echo "$$name $$version $(LIBSTD_PKG) (>= $(DEB_VERSION_UPSTREAM))"; \
438 done > debian/$(LIBSTD_PKG)/DEBIAN/shlibs
439
440 override_dh_shlibdeps:
441 dh_shlibdeps -- -x$(LIBSTD_PKG)
442
443 QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE = x=$$?; if [ $$x = 2 ]; then exit 0; else exit $$x; fi
444 source_orig-stage0:
445 QUILT_PATCHES=debian/patches quilt push -aq; $(QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE)
446 $(MAKE) -f debian/rules clean
447 debian/make_orig-stage0_tarball.sh
448 QUILT_PATCHES=debian/patches quilt pop -aq; $(QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE)
449 rm -rf .pc
450
451 get_beta_version = \
452 u="$(DEB_VERSION_UPSTREAM)"; \
453 if [ "$$u" != "$${u%~beta.*+dfsg*}" ]; then \
454 newver=$(shell echo $(RUST_VERSION) | perl -lpe 's/(\d+)\.(\d+)/$$1 . "." . ($$2)/e'); \
455 else \
456 newver=$(shell echo $(RUST_VERSION) | perl -lpe 's/(\d+)\.(\d+)/$$1 . "." . ($$2+1)/e'); \
457 fi
458
459 debian/watch-beta: debian/watch-beta.in debian/rules
460 set -e; $(get_beta_version); \
461 m4 -DOLDVER="$$oldver" -DNEWVER="$$newver.0" "$<" > "$@"
462
463 source_orig-beta: debian/watch-beta
464 uscan $(USCAN_OPTS) $(if $(USCAN_DESTDIR),--destdir=$(USCAN_DESTDIR),) --verbose --watchfile "$<"
465 set -e; $(get_beta_version); \
466 bd="$(if $(USCAN_DESTDIR),$(USCAN_DESTDIR),..)"; \
467 tar xf $$bd/rustc-$$newver.0-beta.999-src.tar.xz rustc-beta-src/version; \
468 bv="$$(sed -re 's/[0-9]+.[0-9]+.[0-9]+-beta.([0-9]+) \(.*\)/\1/g' rustc-beta-src/version)"; \
469 bash -c 'shopt -s nullglob; for i in '"$$bd"'/rustc*beta.999*; do mv $$i $${i/beta.999/beta.'"$$bv"'}; done'; \
470 rm -f rustc-beta-src/version; \
471 rmdir -p rustc-beta-src; \
472 echo "prepared rustc $$newver.0~beta.$$bv in $$bd"