]> git.proxmox.com Git - rustc.git/blob - debian/rules
Update upstream source from tag 'upstream/1.47.0+dfsg1'
[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 = 10
31 OLD_LLVM_VERSION = 9
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 # FIXME: 32-bit doesn't work yet, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=540782#64
115 #WINDOWS_SUPPORT := amd64 i386
116 WINDOWS_SUPPORT := amd64
117 BUILD_WINDOWS := true
118 ifneq (,$(findstring nowindows,$(DEB_BUILD_PROFILES)))
119 BUILD_WINDOWS := false
120 endif
121 ifeq (,$(filter $(DEB_HOST_ARCH), $(WINDOWS_SUPPORT)))
122 BUILD_WINDOWS := false
123 else
124 ifeq (,$(filter $(DEB_BUILD_ARCH), $(WINDOWS_SUPPORT)))
125 ifeq (true,$(BUILD_WINDOWS))
126 $(error cannot cross-compile from $(DEB_BUILD_ARCH) to $(DEB_HOST_ARCH), unless "nowindows" is in DEB_BUILD_PROFILES)
127 endif
128 endif
129 ifeq (i386,$(DEB_HOST_ARCH))
130 WINDOWS_ARCH := i686
131 else
132 WINDOWS_ARCH := x86_64
133 endif
134 endif
135
136 MAKE_OPTIMISATIONS := true
137 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
138 MAKE_OPTIMISATIONS := false
139 endif
140
141 # Build products or non-source files in src/, that shouldn't go in rust-src
142 SRC_CLEAN = src/bootstrap/bootstrap.pyc \
143 src/etc/__pycache__/
144
145 # Try to work around #933045
146 ifneq (,$(filter $(DEB_BUILD_ARCH), mips mipsel))
147 SYSTEM_WORKAROUNDS += export MALLOC_ARENA_MAX=1;
148 endif
149
150 %:
151 $(SYSTEM_WORKAROUNDS) dh $@ --parallel
152
153 .PHONY: .dbg-windows
154 .dbg-windows:
155 @echo host=$(DEB_BUILD_ARCH) target=$(DEB_HOST_ARCH) BUILD_WINDOWS=$(BUILD_WINDOWS) WINDOWS_ARCH=$(WINDOWS_ARCH)
156
157 .PHONY: build
158 build:
159 $(SYSTEM_WORKAROUNDS) dh $@ --parallel
160
161 override_dh_clean:
162 # Upstream contains a lot of these
163 dh_clean -XCargo.toml.orig
164
165 debian/config.toml: debian/config.toml.in debian/rules
166 u="$(DEB_VERSION_UPSTREAM)"; \
167 if [ "$$u" != "$${u%~beta.*+dfsg*}" ]; then channel="beta"; \
168 else channel="stable"; fi; echo $$channel; \
169 m4 -DRELEASE_CHANNEL="$$channel" \
170 -DDEB_BUILD_RUST_TYPE="$(DEB_BUILD_RUST_TYPE)" \
171 -DDEB_HOST_RUST_TYPE="$(DEB_HOST_RUST_TYPE)" \
172 -DDEB_TARGET_RUST_TYPE="$(DEB_TARGET_RUST_TYPE)" \
173 -DDEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
174 -DDEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
175 -DDEB_TARGET_GNU_TYPE="$(DEB_TARGET_GNU_TYPE)" \
176 -DMAKE_OPTIMISATIONS="$(MAKE_OPTIMISATIONS)" \
177 -DLLVM_DESTDIR="$(LLVM_DESTDIR)" \
178 -DLLVM_VERSION="$(LLVM_VERSION)" \
179 -DRUST_DESTDIR="$(RUST_DESTDIR)" \
180 "$<" > "$@"
181 if $(DOWNLOAD_BOOTSTRAP) || [ $(HAVE_BINARY_TARBALL) != 0 ]; \
182 then sed -i -e '/^rustc = /d' -e '/^cargo = /d' "$@"; fi
183 # Work around low-memory (32-bit) architectures: https://github.com/rust-lang/rust/issues/45854
184 ifneq (,$(filter $(DEB_BUILD_ARCH), armhf armel mips mipsel powerpc powerpcspe))
185 sed -i -e 's/^debuginfo-level = .*/debuginfo-level = 0/g' "$@"
186 endif
187
188 debian/rust-src.%: debian/rust-src.%.in
189 m4 -DRUST_LONG_VERSION="$(RUST_LONG_VERSION)" \
190 "$<" > "$@"
191
192 debian/dh_auto_configure.stamp: debian/config.toml
193 # fail the build if we have any instances of OLD_LLVM_VERSION in debian, except for debian/changelog
194 ! grep --color=always -i '\(clang\|ll\(..\|d\)\)-\?$(subst .,\.,$(OLD_LLVM_VERSION))' --exclude=changelog --exclude=copyright --exclude='*.patch' --exclude-dir='.debhelper' -R debian
195 # fail the build if we accidentally vendored openssl, indicates we pulled in unnecessary dependencies
196 test ! -e vendor/openssl
197 # fail the build if our version contains ~exp and we are not releasing to experimental
198 v="$(DEB_VERSION)"; test "$$v" = "$${v%~exp*}" -o "$(DEB_DISTRIBUTION)" = "experimental" -o "$(DEB_DISTRIBUTION)" = "UNRELEASED"
199 $(PRECONFIGURE_CHECK)
200 if [ -d stage0 ]; then mkdir -p build && ln -sfT ../stage0 build/cache; fi
201 # work around #842634
202 if test $$(grep "127.0.0.1\s*localhost" /etc/hosts | wc -l) -gt 1; then \
203 debian/ensure-patch -N debian/patches/d-host-duplicates.patch; fi
204 # allow beta builds
205 sed -i -e 's/dev: 1/#dev: 1/g' src/stage0.txt
206 # don't care about lock changes
207 rm -f Cargo.lock
208 # We patched some crates so have to rm the checksums
209 find vendor -name .cargo-checksum.json -execdir "$(CURDIR)/debian/prune-checksums" "{}" +
210 # Link against system liblzma, see https://github.com/alexcrichton/xz2-rs/issues/16
211 echo 'fn main() { println!("cargo:rustc-link-lib=lzma"); }' > vendor/lzma-sys/build.rs
212 # We don't run ./configure because we use debian/config.toml directly
213 ln -sf debian/config.toml config.toml
214 touch "$@"
215
216 override_dh_auto_configure-arch: debian/dh_auto_configure.stamp
217 override_dh_auto_configure-indep: debian/dh_auto_configure.stamp
218 ifeq (true,$(BUILD_DOCS))
219 # Change config.toml now and not later, since that might trigger a rebuild
220 sed -i -e 's/^docs = false/docs = true/' debian/config.toml
221 endif
222
223 override_dh_auto_clean:
224 $(RM) -rf build tmp .cargo debian/cargo_home config.stamp config.mk Makefile
225 $(RM) -rf $(TEST_LOG) debian/config.toml debian/rust-src.install debian/rust-src.links debian/*.stamp
226 $(RM) -rf $(SRC_CLEAN) config.toml
227
228 debian/dh_auto_build.stamp:
229 $(RUSTBUILD) build $(RUSTBUILD_FLAGS)
230
231 override_dh_auto_build-arch: debian/dh_auto_build.stamp
232 ifeq (true,$(BUILD_WINDOWS))
233 $(RUSTBUILD) build $(RUSTBUILD_FLAGS) \
234 --host $(DEB_BUILD_RUST_TYPE) \
235 --target $(WINDOWS_ARCH)-pc-windows-gnu \
236 library/std
237 endif
238
239 override_dh_auto_build-indep: debian/dh_auto_build.stamp
240 ifeq (true,$(BUILD_WASM))
241 $(RUSTBUILD) build $(RUSTBUILD_FLAGS) \
242 --host $(DEB_BUILD_RUST_TYPE) \
243 --target wasm32-unknown-unknown,wasm32-wasi \
244 library/std
245 endif
246 ifeq (true,$(BUILD_DOCS))
247 $(RUSTBUILD) doc $(RUSTBUILD_FLAGS)
248 endif
249
250 TEST_LOG = debian/rustc-tests.log
251 # This is advertised as "5 tests failed" in README.Debian because our counting
252 # method is imprecise and in practise we count some failures twice.
253 FAILURES_ALLOWED = 8
254 ifneq (,$(filter $(DEB_BUILD_ARCH), powerpc ppc64 arm64 mips64el i386))
255 FAILURES_ALLOWED = 12
256 endif
257 ifneq (,$(filter $(DEB_BUILD_ARCH), mips mipsel s390x))
258 FAILURES_ALLOWED = 24
259 endif
260 ifneq (,$(filter $(DEB_BUILD_ARCH), powerpcspe riscv64 sparc64 x32))
261 FAILURES_ALLOWED = 180
262 endif
263 FAILED_TESTS = grep "FAILED\|^command did not execute successfully" $(TEST_LOG) | grep -v '^test result: FAILED' | grep -v 'FAILED (allowed)'
264 override_dh_auto_test-arch:
265 # ensure that rustc_llvm is actually dynamically linked to libLLVM
266 set -e; find build/*/stage2/lib/rustlib/* -name '*rustc_llvm*.so' | \
267 while read x; do \
268 stat -c '%s %n' "$$x"; \
269 objdump -p "$$x" | grep -q "NEEDED.*LLVM"; \
270 test "$$(stat -c %s "$$x")" -lt 6000000; \
271 done
272 ifeq (, $(filter nocheck,$(DEB_BUILD_PROFILES)))
273 ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
274 { $(RUSTBUILD_TEST) $(RUSTBUILD_FLAGS) $(RUSTBUILD_TEST_FLAGS); echo $$?; } | tee -a $(TEST_LOG)
275 # test that the log has at least 1 pass, to prevent e.g. #57709
276 grep -l "^test .* \.\.\. ok$$" $(TEST_LOG)
277 echo "==== Debian rustc test report ===="; \
278 echo "Specific test failures:"; \
279 $(FAILED_TESTS); \
280 num_failures=$$($(FAILED_TESTS) | wc -l); \
281 exit_code=$$(tail -n1 $(TEST_LOG)); \
282 echo "Summary: exit code $$exit_code, counted $$num_failures tests failed."; \
283 echo -n "$(FAILURES_ALLOWED) maximum allowed. "; \
284 if test "$$num_failures" -eq 0 -a "$$exit_code" -ne 0; then \
285 echo "Aborting just in case, because we missed counting some test failures."; \
286 echo "This could happen if we failed to build the tests, or if the testsuite runner is buggy."; \
287 false; \
288 elif test "$$num_failures" -le $(FAILURES_ALLOWED); then \
289 echo "Continuing..."; \
290 else \
291 echo "Aborting the build."; \
292 echo "Check the logs further above for details."; \
293 false; \
294 fi
295 # don't continue if RUSTBUILD_TEST_FLAGS is non-empty
296 test -z "$(RUSTBUILD_TEST_FLAGS)"
297 # don't run windows tests yet
298 endif
299 endif
300
301 override_dh_auto_test-indep:
302 ifeq (, $(filter nocheck,$(DEB_BUILD_PROFILES)))
303 ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
304 ifeq (true,$(BUILD_WASM))
305 # Ignore failures in these tests, but run them so we see what it's like
306 -PATH=$(CURDIR)/debian/bin:$(PATH) $(RUSTBUILD_TEST) $(RUSTBUILD_FLAGS) $(RUSTBUILD_TEST_FLAGS) \
307 --host $(DEB_BUILD_RUST_TYPE) \
308 --target wasm32-unknown-unknown,wasm32-wasi \
309 library/std
310 endif
311 ifeq (true,$(BUILD_DOCS))
312 # Run all rules that test the docs, i.e. that depend on default:doc
313 $(RUSTBUILD_TEST) $(RUSTBUILD_FLAGS) src/tools/linkchecker
314 endif
315 test -z "$(RUSTBUILD_TEST_FLAGS)"
316 endif
317 endif
318
319 run_rustbuild:
320 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) $(X_CMD) $(RUSTBUILD_FLAGS) $(X_FLAGS)
321
322 debian/dh_auto_install.stamp:
323 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) install $(RUSTBUILD_FLAGS)
324
325 mkdir -p $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
326 mv $(DEB_DESTDIR)/usr/lib/lib*.so $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
327
328 # Replace duplicated compile-time/run-time dylibs with symlinks
329 @set -e; \
330 for f in $(DEB_DESTDIR)/usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/lib*.so; do \
331 name=$${f##*/}; \
332 if [ -f "$(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/$$name" ]; then \
333 echo "ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f"; \
334 ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f; \
335 fi; \
336 done
337
338 touch "$@"
339
340 override_dh_auto_install-arch: debian/dh_auto_install.stamp
341 ifeq (true,$(BUILD_WINDOWS))
342 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) install $(RUSTBUILD_FLAGS) \
343 --host $(DEB_BUILD_RUST_TYPE) \
344 --target $(WINDOWS_ARCH)-pc-windows-gnu \
345 library/std
346 endif
347
348 override_dh_auto_install-indep: debian/dh_auto_install.stamp
349 ifeq (true,$(BUILD_WASM))
350 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) install $(RUSTBUILD_FLAGS) \
351 --host $(DEB_BUILD_RUST_TYPE) \
352 --target wasm32-unknown-unknown,wasm32-wasi \
353 library/std
354 endif
355 ifeq (true,$(BUILD_DOCS))
356 # Brute force to remove privacy-breach-logo lintian warning.
357 # We could have updated the upstream sources but it would complexify
358 # the rebase
359 @set -e; \
360 find $(DEB_DESTDIR)/usr/share/doc/*/html -iname '*.html' | \
361 while read file; do \
362 topdir=$$(echo "$$file" | sed 's,^$(DEB_DESTDIR)/usr/share/doc/rust/html/,,; s,/[^/]*$$,/,; s,^[^/]*$$,,; s,[^/]\+/,../,g'); \
363 sed -i \
364 -e "s,https://\(doc\|www\).rust-lang.org/\(favicon.ico\|logos/rust-logo-32x32-blk.png\),$${topdir}rust-logo-32x32-blk.png," \
365 -e 's,<img src="https://img.shields.io/[^"]*" alt="\([^"]*\)" />,<span class="deb-privacy-replace--shields-io">\1</span>,g' "$$file"; \
366 done
367 find $(DEB_DESTDIR) \( -iname '*.html' -empty -o -name .lock -o -name '*.inc' \) -delete;
368 endif
369
370 override_dh_install-arch:
371 dh_install
372 dh_install -p$(LIBSTD_PKG) usr/lib/$(DEB_HOST_MULTIARCH)/
373 dh_install -plibstd-rust-dev usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/
374 ifeq (true,$(BUILD_WINDOWS))
375 dh_install -plibstd-rust-dev-windows usr/lib/rustlib/*-pc-windows-gnu/lib/
376 endif
377
378 override_dh_install-indep: debian/rust-src.install debian/rust-src.links
379 dh_install
380 ifeq (true,$(BUILD_WASM))
381 dh_install -plibstd-rust-dev-wasm32 usr/lib/rustlib/wasm32-*/lib/
382 endif
383 chmod -x \
384 debian/rust-gdb/usr/share/rust-gdb/*.py \
385 debian/rust-lldb/usr/share/rust-lldb/*.py
386 $(RM) -rf $(SRC_CLEAN:%=debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION)/%)
387 # Get rid of lintian warnings
388 find debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION) \
389 \( -name .gitignore \
390 -o -name 'LICENSE*' \
391 -o -name 'LICENCE' \
392 -o -name 'license' \
393 -o -name 'COPYING*' \
394 \) -delete
395 # Remove files that autoload remote resources, caught by lintian
396 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/cssparser/docs/*.html
397 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/kuchiki/docs/*.html
398 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/url/docs/*.html
399 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/xz2/.gitmodules
400
401 override_dh_installchangelogs:
402 dh_installchangelogs RELEASES.md
403
404 override_dh_installdocs:
405 dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc
406
407 override_dh_missing:
408 dh_missing --list-missing
409
410 override_dh_compress:
411 dh_compress -X.woff
412
413 # The below override is disabled on advice from #debian-devel, because:
414 # - only shared libs get the "split dbgsym package" treatment by dh_strip;
415 # static libs simply get their debuginfo discarded
416 # - strip(1) sometimes breaks wasm libs
417 #
418 #override_dh_strip:
419 # # Work around #35733, #468333
420 # find debian/libstd-rust-dev*/ -name '*.rlib' -execdir mv '{}' '{}.a' \;
421 # # This is expected to print out lots of "File format unrecognized" warnings about
422 # # rust.metadata.bin and *.deflate but the .o files inside the rlibs should be stripped
423 # # Some files are still omitted because of #875780 however.
424 # dh_strip -v
425 # find debian/libstd-rust-dev*/ -name '*.rlib.a' -execdir sh -c 'mv "$$1" "$${1%.a}"' - '{}' \;
426
427 override_dh_dwz:
428 # otherwise rustc gets an empty multifile which lintian errors on, causing
429 # FTP auto-reject. this is a work-around, the lintian bug is #955752
430 dh_dwz --no-dwz-multifile
431
432 override_dh_makeshlibs:
433 dh_makeshlibs -V
434
435 # dh_makeshlibs doesn't support our "libfoo-version.so" naming
436 # structure, so we have to do this ourselves.
437 install -o 0 -g 0 -d debian/$(LIBSTD_PKG)/DEBIAN
438 LC_ALL=C ls debian/$(LIBSTD_PKG)/usr/lib/$(DEB_HOST_MULTIARCH)/lib*.so | \
439 sed -n 's,^.*/\(lib.*\)-\(.\+\)\.so$$,\1 \2,p' | \
440 while read name version; do \
441 echo "$$name $$version $(LIBSTD_PKG) (>= $(DEB_VERSION_UPSTREAM))"; \
442 done > debian/$(LIBSTD_PKG)/DEBIAN/shlibs
443 chmod 644 debian/$(LIBSTD_PKG)/DEBIAN/shlibs
444 chown 0:0 debian/$(LIBSTD_PKG)/DEBIAN/shlibs
445
446 override_dh_shlibdeps:
447 dh_shlibdeps -- -x$(LIBSTD_PKG)
448
449 QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE = x=$$?; if [ $$x = 2 ]; then exit 0; else exit $$x; fi
450 source_orig-stage0:
451 QUILT_PATCHES=debian/patches quilt push -aq; $(QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE)
452 $(MAKE) -f debian/rules clean
453 debian/make_orig-stage0_tarball.sh
454 QUILT_PATCHES=debian/patches quilt pop -aq; $(QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE)
455 rm -rf .pc
456
457 get_beta_version = \
458 u="$(DEB_VERSION_UPSTREAM)"; \
459 if [ "$$u" != "$${u%~beta.*+dfsg*}" ]; then \
460 newver=$(shell echo $(RUST_VERSION) | perl -lpe 's/(\d+)\.(\d+)/$$1 . "." . ($$2)/e'); \
461 else \
462 newver=$(shell echo $(RUST_VERSION) | perl -lpe 's/(\d+)\.(\d+)/$$1 . "." . ($$2+1)/e'); \
463 fi
464
465 debian/watch-beta: debian/watch-beta.in debian/rules
466 set -e; $(get_beta_version); \
467 m4 -DOLDVER="$$oldver" -DNEWVER="$$newver.0" "$<" > "$@"
468
469 source_orig-beta: debian/watch-beta
470 uscan $(USCAN_OPTS) $(if $(USCAN_DESTDIR),--destdir=$(USCAN_DESTDIR),) --verbose --watchfile "$<"
471 set -e; $(get_beta_version); \
472 bd="$(if $(USCAN_DESTDIR),$(USCAN_DESTDIR),..)"; \
473 tar xf $$bd/rustc-$$newver.0-beta.999-src.tar.xz rustc-beta-src/version; \
474 bv="$$(sed -re 's/[0-9]+.[0-9]+.[0-9]+-beta.([0-9]+) \(.*\)/\1/g' rustc-beta-src/version)"; \
475 bash -c 'shopt -s nullglob; for i in '"$$bd"'/rustc*beta.999*; do mv $$i $${i/beta.999/beta.'"$$bv"'}; done'; \
476 rm -f rustc-beta-src/version; \
477 rmdir -p rustc-beta-src; \
478 echo "prepared rustc $$newver.0~beta.$$bv in $$bd"