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