]> git.proxmox.com Git - rustc.git/blame - debian/rules
Fix mdbook patch to not generate broken links
[rustc.git] / debian / rules
CommitLineData
be771b38
LB
1#!/usr/bin/make -f
2# -*- makefile -*-
3
b59979d9 4include /usr/share/dpkg/pkg-info.mk
6472c211 5include /usr/share/dpkg/vendor.mk
d75d48d6 6include /usr/share/dpkg/architecture.mk
b5dfb68c
XL
7SED_VERSION_SHORT := sed -re 's/([^.]+)\.([^.]+)\..*/\1.\2/'
8RUST_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | $(SED_VERSION_SHORT))
9RUST_LONG_VERSION := $(shell echo '$(DEB_VERSION_UPSTREAM)' | sed -re 's/([^+]+).*/\1/')
10LIBSTD_PKG := libstd-rust-$(RUST_VERSION)
11# Sed expression that matches the "rustc" we have in our Build-Depends field
12SED_RUSTC_BUILDDEP := sed -ne "/^Build-Depends:/,/^[^[:space:]\#]/{/^ *rustc:native .*,/p}" debian/control
2da5f2f9
XL
13# Version of /usr/bin/rustc
14LOCAL_RUST_VERSION := $(shell rustc --version --verbose | sed -ne 's/^release: //p')
b5dfb68c 15
7d40d3e1 16include /usr/share/dpkg/buildflags.mk
4888e768 17# TODO: more correct to use `[build] rustflags = []` list syntax in Cargo.toml
9197bf09 18RUSTFLAGS = $(addprefix -C link-args=,$(LDFLAGS))
7d40d3e1 19export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS RUSTFLAGS
08170615 20RUSTFLAGS += --remap-path-prefix=$(CURDIR)=/usr/src/rustc-$(RUST_LONG_VERSION)
ca38e697 21export CARGO_HOME = $(CURDIR)/debian/cargo
ab330327
XL
22ifneq (,$(filter $(DEB_BUILD_ARCH), sparc64))
23export CARGO_INCREMENTAL = 0
24endif
b59979d9 25
525ff0f9
AL
26# Defines DEB_*_RUST_TYPE triples
27include debian/architecture.mk
693daed7 28export DEB_HOST_RUST_TYPE
525ff0f9 29
be771b38
LB
30# Uncomment this to turn on verbose mode.
31#export DH_VERBOSE=1
32
8354de7a 33DEB_DESTDIR := $(CURDIR)/debian/tmp
525ff0f9 34
525ff0f9 35# Use system LLVM (comment out to use vendored LLVM)
1581c3a3
XL
36LLVM_VERSION = 8
37OLD_LLVM_VERSION = 7
2b7c35b5
XL
38# Make it easier to test against a custom LLVM
39ifneq (,$(LLVM_DESTDIR))
56548b60
XL
40LLVM_LIBRARY_PATH := $(LLVM_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH):$(LLVM_DESTDIR)/usr/lib
41LD_LIBRARY_PATH := $(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):$(LLVM_LIBRARY_PATH),$(LLVM_LIBRARY_PATH))
2b7c35b5
XL
42export LD_LIBRARY_PATH
43endif
2b7c35b5 44
8e396fda 45RUSTBUILD = RUST_BACKTRACE=1 ./x.py
33416cd4 46RUSTBUILD_FLAGS = --config debian/config.toml -vvv --on-fail env
f1b4ffd3
XL
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.
53RUSTBUILD_TEST = ./x.py test
0d3674eb
XL
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.
58RUSTBUILD_TEST_FLAGS =
1c8ac2b0 59
25f1c2fe
XL
60update-version:
61 oldver=$(shell $(SED_RUSTC_BUILDDEP) | sed -ne 's/.*(<= \(.*\)).*/\1/gp' | $(SED_VERSION_SHORT)); \
0bf22a45
XL
62 newver=$(RUST_VERSION); \
63 debian/update-version.sh $$oldver $$newver $(RUST_LONG_VERSION) $(CARGO_NEW)
25f1c2fe 64
427dce5b
XL
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#
427dce5b 68PRECONFIGURE_CHECK = :
75be2bb3 69HAVE_BINARY_TARBALL := $(shell ls -1 stage0/*/*$(DEB_HOST_RUST_TYPE)* 2>/dev/null | wc -l)
5861ebac 70DOWNLOAD_BOOTSTRAP := false
571f0d20
MK
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
75ifeq (0,$(HAVE_BINARY_TARBALL))
16dfb283
XL
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.
427dce5b
XL
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)))
56548b60
XL
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
427dce5b
XL
90 #
91 # Case A-2: the builder selected the "dlstage0" build profile.
75be2bb3 92 # In this case, the rust build scripts will download a stage0 into stage0/ and use that.
b9a40c91 93 # We don't need to do anything specific in this build file, so this case is empty.
5861ebac
XL
94 else
95 DOWNLOAD_BOOTSTRAP := true
96 endif
427dce5b 97else
16dfb283
XL
98 # Case B (Bootstrapping a new distro): the extracted source tree does
99 # include a bootstrapping tarball for the current architecture; see the
75be2bb3 100 # `source_orig-stage0` target below on how to build this.
427dce5b
XL
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
16dfb283 104 # that rustc isn't a Build-Depends for the current architecture.
25f1c2fe
XL
105 ifneq (,$(shell $(SED_RUSTC_BUILDDEP)))
106 ifeq (,$(shell $(SED_RUSTC_BUILDDEP) | grep '!$(DEB_HOST_ARCH)'))
75be2bb3 107 PRECONFIGURE_CHECK = $(error found matches for stage0/*/*$(DEB_HOST_RUST_TYPE)*, \
16dfb283
XL
108 but rustc might be a Build-Depends for $(DEB_HOST_ARCH))
109 endif
427dce5b 110 endif
1c8ac2b0
SL
111endif
112
5861ebac 113BUILD_DOCS := true
120b4d47 114ifneq (,$(findstring nodoc,$(DEB_BUILD_PROFILES)))
5861ebac 115 BUILD_DOCS := false
1c8ac2b0
SL
116endif
117
5861ebac 118MAKE_OPTIMISATIONS := true
1c8ac2b0 119ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
5861ebac 120 MAKE_OPTIMISATIONS := false
1c8ac2b0
SL
121endif
122
35329365 123# Build products or non-source files in src/, that shouldn't go in rust-src
9a2ab7ea 124SRC_CLEAN = src/bootstrap/bootstrap.pyc \
35329365 125 src/etc/__pycache__/
1c8ac2b0 126
170f9149
XL
127# Workaround for linux #865549
128ifeq (0,$(shell test $$(uname -s) = "Linux" -a $$(getconf PAGESIZE) -gt 4096; echo $$?))
129 SYSTEM_WORKAROUNDS += ulimit -s $$(expr $$(getconf PAGESIZE) / 1024 '*' 256 + 8192);
130endif
131
be771b38 132%:
170f9149 133 $(SYSTEM_WORKAROUNDS) dh $@ --parallel
be771b38 134
04c12273
XL
135.PHONY: build
136build:
170f9149 137 $(SYSTEM_WORKAROUNDS) dh $@ --parallel
04c12273 138
de1de54b 139override_dh_clean:
cf0b146d
XL
140 # Upstream contains a lot of these
141 dh_clean -XCargo.toml.orig
de1de54b 142
b49766ad
XL
143debian/config.toml: debian/config.toml.in debian/rules
144 u="$(DEB_VERSION_UPSTREAM)"; \
145 if [ "$$u" != "$${u%~beta.*+dfsg*}" ]; then channel="beta"; \
146 else channel="stable"; fi; echo $$channel; \
ec028c2e
XL
147 m4 -DRELEASE_CHANNEL="$$channel" \
148 -DDEB_BUILD_RUST_TYPE="$(DEB_BUILD_RUST_TYPE)" \
01dc6ef4
XL
149 -DDEB_HOST_RUST_TYPE="$(DEB_HOST_RUST_TYPE)" \
150 -DDEB_TARGET_RUST_TYPE="$(DEB_TARGET_RUST_TYPE)" \
ec028c2e
XL
151 -DDEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
152 -DDEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
153 -DDEB_TARGET_GNU_TYPE="$(DEB_TARGET_GNU_TYPE)" \
5861ebac 154 -DMAKE_OPTIMISATIONS="$(MAKE_OPTIMISATIONS)" \
2b7c35b5 155 -DLLVM_DESTDIR="$(LLVM_DESTDIR)" \
666f0397 156 -DLLVM_VERSION="$(LLVM_VERSION)" \
5861ebac 157 -DRUST_DESTDIR="$(RUST_DESTDIR)" \
01dc6ef4 158 "$<" > "$@"
7ee10b55
XL
159 if $(DOWNLOAD_BOOTSTRAP) || [ $(HAVE_BINARY_TARBALL) != 0 ]; \
160 then sed -i -e '/^rustc = /d' -e '/^cargo = /d' "$@"; fi
e8cad677 161# Work around low-memory (32-bit) architectures: https://github.com/rust-lang/rust/issues/45854
3997b412 162ifneq (,$(filter $(DEB_BUILD_ARCH), armhf armel mips mipsel powerpc powerpcspe))
04a8c198 163 sed -i -e 's/^debuginfo-level = /debuginfo-level = 0/g' "$@"
2e2d9bd1 164endif
01dc6ef4 165
b5dfb68c
XL
166debian/rust-src.%: debian/rust-src.%.in
167 m4 -DRUST_LONG_VERSION="$(RUST_LONG_VERSION)" \
168 "$<" > "$@"
169
3bdf427a 170debian/dh_auto_configure.stamp: debian/config.toml
5617e1bd 171 # fail the build if we have any instances of OLD_LLVM_VERSION in debian, except for debian/changelog
e67d3c13 172 ! grep --color=always -i 'll...\?$(subst .,\.,$(OLD_LLVM_VERSION))' --exclude=changelog --exclude='*.patch' -R debian
e133b084 173 # fail the build if our version contains ~exp and we are not releasing to experimental
b49766ad 174 v="$(DEB_VERSION)"; test "$$v" = "$${v%~exp*}" -o "$(DEB_DISTRIBUTION)" = "experimental" -o "$(DEB_DISTRIBUTION)" = "UNRELEASED"
427dce5b 175 $(PRECONFIGURE_CHECK)
75be2bb3 176 if [ -d stage0 ]; then mkdir -p build && ln -sfT ../stage0 build/cache; fi
3281855a
XL
177 # work around #842634
178 if test $$(grep "127.0.0.1\s*localhost" /etc/hosts | wc -l) -gt 1; then \
ed6f7eed 179 debian/ensure-patch -N debian/patches/d-host-duplicates.patch; fi
98955da7 180 # We patched some crates so have to rm the checksums
f56f18fe 181 find vendor -name .cargo-checksum.json -execdir "$(CURDIR)/debian/prune-checksums" "{}" ";"
6b0d97fc 182 # Link against system liblzma, see https://github.com/alexcrichton/xz2-rs/issues/16
f56f18fe 183 echo 'fn main() { println!("cargo:rustc-link-lib=lzma"); }' > vendor/lzma-sys/build.rs
5861ebac
XL
184 # We don't run ./configure because we use debian/config.toml directly
185 ln -sf debian/config.toml config.toml
3bdf427a
XL
186 touch "$@"
187
188override_dh_auto_configure-arch: debian/dh_auto_configure.stamp
189override_dh_auto_configure-indep: debian/dh_auto_configure.stamp
190ifeq (true,$(BUILD_DOCS))
191# Change config.toml now and not later, since that might trigger a rebuild
192 sed -i -e 's/^docs = false/docs = true/' debian/config.toml
193endif
1c8ac2b0 194
11c430be 195override_dh_auto_clean:
ca38e697 196 $(RM) -rf build tmp .cargo debian/cargo_home config.stamp config.mk Makefile
3bdf427a 197 $(RM) -rf $(TEST_LOG) debian/config.toml debian/rust-src.install debian/rust-src.links debian/*.stamp
5b2524c4 198 $(RM) -rf $(SRC_CLEAN) config.toml
11c430be 199
3bdf427a 200override_dh_auto_build-arch:
04c12273 201 $(RUSTBUILD) build $(RUSTBUILD_FLAGS)
ea192313 202
e408bc2c
XL
203# note: this is only for buildds that want to do a separate arch:all build;
204# there is no point running this yourself "to save time" since it implicitly
205# depends on build-arch anyways.
3bdf427a 206override_dh_auto_build-indep:
5861ebac 207ifeq (true,$(BUILD_DOCS))
04c12273
XL
208 $(RUSTBUILD) doc $(RUSTBUILD_FLAGS)
209endif
210
3a774f0f 211TEST_LOG = debian/rustc-tests.log
356c70ca
XL
212# This is advertised as "5 tests failed" in README.Debian because our counting
213# method is imprecise and in practise we count some failures twice.
0b9f599a 214FAILURES_ALLOWED = 8
be0ee34e 215ifneq (,$(filter $(DEB_BUILD_ARCH), ppc64 arm64 mips64el i386))
6404b712 216 FAILURES_ALLOWED = 12
fa6232de 217endif
e8cad677 218ifneq (,$(filter $(DEB_BUILD_ARCH), mips mipsel s390x))
15f51d41 219 FAILURES_ALLOWED = 24
ab330327 220endif
734d072d 221ifneq (,$(filter $(DEB_BUILD_ARCH), powerpc powerpcspe sparc64 x32))
617a87c6 222 FAILURES_ALLOWED = 180
734d072d 223endif
873d1fa5 224FAILED_TESTS = grep "FAILED\|^command did not execute successfully" $(TEST_LOG) | grep -v '^test result: FAILED'
7958f3db 225override_dh_auto_test-arch:
91d3be64 226 # ensure that rustc_llvm is actually dynamically linked to libLLVM
347f6206
XL
227 set -e; find build/*/stage2/lib/rustlib/* -name '*rustc_llvm*.so' | \
228 while read x; do \
229 stat -c '%s %n' "$$x"; \
230 objdump -p "$$x" | grep -q "NEEDED.*LLVM"; \
231 test "$$(stat -c %s "$$x")" -lt 6000000; \
232 done
68e7eb97 233ifeq (, $(filter nocheck,$(DEB_BUILD_PROFILES)))
7958f3db 234ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
2c22371f 235 { $(RUSTBUILD_TEST) --no-fail-fast $(RUSTBUILD_FLAGS) $(RUSTBUILD_TEST_FLAGS); echo $$?; } | tee -a $(TEST_LOG)
91d3be64 236 # test that the log has at least 1 pass, to prevent e.g. #57709
bbceb41b 237 grep -l "^test .* \.\.\. ok$$" $(TEST_LOG)
2c22371f
XL
238 echo "==== Debian rustc test report ===="; \
239 echo "Specific test failures:"; \
3a774f0f 240 $(FAILED_TESTS); \
873d1fa5 241 num_failures=$$($(FAILED_TESTS) | wc -l); \
2c22371f
XL
242 exit_code=$$(tail -n1 $(TEST_LOG)); \
243 echo "Summary: exit code $$exit_code, counted $$num_failures tests failed."; \
244 echo -n "$(FAILURES_ALLOWED) maximum allowed. "; \
245 if test "$$num_failures" -eq 0 -a "$$exit_code" -ne 0; then \
246 echo "Aborting just in case, because we missed counting some test failures."; \
6404b712 247 echo "This could happen if we failed to build the tests, or if the testsuite runner is buggy."; \
2c22371f
XL
248 false; \
249 elif test "$$num_failures" -le $(FAILURES_ALLOWED); then \
3a774f0f
XL
250 echo "Continuing..."; \
251 else \
252 echo "Aborting the build."; \
253 echo "Check the logs further above for details."; \
254 false; \
255 fi
0d3674eb
XL
256# don't continue if RUSTBUILD_TEST_FLAGS is non-empty
257 test -z "$(RUSTBUILD_TEST_FLAGS)"
e408bc2c 258endif
68e7eb97 259endif
becfe001 260
04c12273 261override_dh_auto_test-indep:
5861ebac 262ifeq (true,$(BUILD_DOCS))
68e7eb97 263ifeq (, $(filter nocheck,$(DEB_BUILD_PROFILES)))
7958f3db
XL
264ifeq (, $(filter nocheck,$(DEB_BUILD_OPTIONS)))
265 # Run all rules that test the docs, i.e. in step.rs that depend on default:doc
3a774f0f 266 $(RUSTBUILD_TEST) --no-fail-fast src/tools/linkchecker $(RUSTBUILD_FLAGS)
7958f3db
XL
267endif
268endif
68e7eb97 269endif
04c12273 270
bf52bd52
XL
271run_rustbuild:
272 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) $(X_CMD) $(RUSTBUILD_FLAGS) $(X_FLAGS)
273
3bdf427a 274debian/dh_auto_install.stamp:
6a9e99e9 275 DESTDIR=$(DEB_DESTDIR) $(RUSTBUILD) install $(RUSTBUILD_FLAGS)
525ff0f9
AL
276
277 mkdir -p $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
278 mv $(DEB_DESTDIR)/usr/lib/lib*.so $(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/
6fce0a99 279
1261b4b3 280 # Replace duplicated compile-time/run-time dylibs with symlinks
525ff0f9
AL
281 @set -e; \
282 for f in $(DEB_DESTDIR)/usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/lib*.so; do \
283 name=$${f##*/}; \
284 if [ -f "$(DEB_DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/$$name" ]; then \
285 echo "ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f"; \
286 ln -sf ../../../$(DEB_HOST_MULTIARCH)/$$name $$f; \
287 fi; \
1261b4b3
AL
288 done
289
3bdf427a
XL
290 touch "$@"
291
292override_dh_auto_install-arch: debian/dh_auto_install.stamp
293override_dh_auto_install-indep: debian/dh_auto_install.stamp
5861ebac 294ifeq (true,$(BUILD_DOCS))
6fce0a99
SL
295 # Brute force to remove privacy-breach-logo lintian warning.
296 # We could have updated the upstream sources but it would complexify
297 # the rebase
b556761e 298 @set -e; \
450ac6ae 299 find $(DEB_DESTDIR)/usr/share/doc/*/html -iname '*.html' | \
1add0b94 300 while read file; do \
b556761e 301 topdir=$$(echo "$$file" | sed 's,^$(DEB_DESTDIR)/usr/share/doc/rust/html/,,; s,/[^/]*$$,/,; s,^[^/]*$$,,; s,[^/]\+/,../,g'); \
450ac6ae
XL
302 sed -i \
303 -e "s,https://\(doc\|www\).rust-lang.org/\(favicon.ico\|logos/rust-logo-32x32-blk.png\),$${topdir}rust-logo-32x32-blk.png," \
304 -e 's,<img src="https://img.shields.io/[^"]*" alt="\([^"]*\)" />,<span class="deb-privacy-replace--shields-io">\1</span>,g' "$$file"; \
1add0b94 305 done
b125a683
MO
306 find $(DEB_DESTDIR) \( -iname '*.html' -empty -o -name .lock -o -name '*.inc' \) -delete;
307endif
308
cf9ecdde 309override_dh_install-arch:
6fce0a99 310 dh_install
525ff0f9 311 dh_install -p$(LIBSTD_PKG) usr/lib/$(DEB_HOST_MULTIARCH)/
cd17b70a 312 dh_install -plibstd-rust-dev usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/lib/
b4ca3996 313 dh_install -prustc usr/lib/rustlib/$(DEB_HOST_RUST_TYPE)/codegen-backends/
525ff0f9 314
b5dfb68c 315override_dh_install-indep: debian/rust-src.install debian/rust-src.links
a0022868 316 dh_install
525ff0f9
AL
317 chmod -x \
318 debian/rust-gdb/usr/share/rust-gdb/*.py \
319 debian/rust-lldb/usr/share/rust-lldb/*.py
b5dfb68c 320 $(RM) -rf $(SRC_CLEAN:%=debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION)/%)
f40dfcc0 321 # Get rid of lintian warnings
b5dfb68c 322 find debian/rust-src/usr/src/rustc-$(RUST_LONG_VERSION) \
f40dfcc0
XL
323 \( -name .gitignore \
324 -o -name 'LICENSE*' \
325 -o -name 'LICENCE' \
326 -o -name 'license' \
327 -o -name 'COPYING*' \
328 \) -delete
8d3e3cd2 329 # Remove files that autoload remote resources, caught by lintian
f56f18fe
XL
330 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/cssparser/docs/*.html
331 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/kuchiki/docs/*.html
332 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/url/docs/*.html
333 $(RM) -rf debian/rust-src/usr/src/rustc-*/vendor/xz2/.gitmodules
1c8ac2b0 334
bc0aa84e
AL
335override_dh_installchangelogs:
336 dh_installchangelogs RELEASES.md
337
338override_dh_installdocs:
339 dh_installdocs -X.tex -X.aux -X.log -X.out -X.toc
340
5c515547
XL
341override_dh_missing:
342 dh_missing --list-missing
343
eef1f4e3
AL
344override_dh_compress:
345 dh_compress -X.woff
346
d2456730
XL
347override_dh_strip:
348 # Work around #35733, #468333
349 find debian/libstd-rust-dev/ -name '*.rlib' -execdir mv '{}' '{}.a' \;
350 # This is expected to print out lots of "File format unrecognized" warnings about
351 # rust.metadata.bin and *.deflate but the .o files inside the rlibs should be stripped
352 # Some files are still omitted because of #875780 however.
353 dh_strip -v
354 find debian/libstd-rust-dev/ -name '*.rlib.a' -execdir sh -c 'mv "$$1" "$${1%.a}"' - '{}' \;
355
525ff0f9
AL
356override_dh_makeshlibs:
357 dh_makeshlibs -V
358
359 # dh_makeshlibs doesn't support our "libfoo-version.so" naming
360 # structure, so we have to do this ourselves.
361 install -o 0 -g 0 -d debian/$(LIBSTD_PKG)/DEBIAN
33766656 362 LC_ALL=C ls debian/$(LIBSTD_PKG)/usr/lib/$(DEB_HOST_MULTIARCH)/lib*.so | \
525ff0f9
AL
363 sed -n 's,^.*/\(lib.*\)-\(.\+\)\.so$$,\1 \2,p' | \
364 while read name version; do \
365 echo "$$name $$version $(LIBSTD_PKG) (>= $(DEB_VERSION_UPSTREAM))"; \
366 done > debian/$(LIBSTD_PKG)/DEBIAN/shlibs
367 chmod 644 debian/$(LIBSTD_PKG)/DEBIAN/shlibs
368 chown 0:0 debian/$(LIBSTD_PKG)/DEBIAN/shlibs
369
370override_dh_shlibdeps:
371 dh_shlibdeps -- -x$(LIBSTD_PKG)
427dce5b
XL
372
373QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE = x=$$?; if [ $$x = 2 ]; then exit 0; else exit $$x; fi
75be2bb3 374source_orig-stage0:
16dfb283
XL
375 QUILT_PATCHES=debian/patches quilt push -aq; $(QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE)
376 $(MAKE) -f debian/rules clean
75be2bb3 377 debian/make_orig-stage0_tarball.sh
16dfb283
XL
378 QUILT_PATCHES=debian/patches quilt pop -aq; $(QUILT_SPECIAL_SNOWFLAKE_RETURN_CODE)
379 rm -rf .pc
15ab0b38 380
0a1981fb
XL
381get_beta_version = \
382 u="$(DEB_VERSION_UPSTREAM)"; \
383 if [ "$$u" != "$${u%~beta.*+dfsg*}" ]; then \
384 newver=$(shell echo $(RUST_VERSION) | perl -lpe 's/(\d+)\.(\d+)/$$1 . "." . ($$2)/e'); \
385 else \
15ab0b38 386 newver=$(shell echo $(RUST_VERSION) | perl -lpe 's/(\d+)\.(\d+)/$$1 . "." . ($$2+1)/e'); \
0a1981fb
XL
387 fi
388
389debian/watch-beta: debian/watch-beta.in debian/rules
390 set -e; $(get_beta_version); \
15ab0b38
XL
391 m4 -DOLDVER="$$oldver" -DNEWVER="$$newver.0" "$<" > "$@"
392
393source_orig-beta: debian/watch-beta
d377cbf5 394 uscan $(USCAN_OPTS) $(if $(USCAN_DESTDIR),--destdir=$(USCAN_DESTDIR),) --verbose --watchfile "$<"
0a1981fb 395 set -e; $(get_beta_version); \
d377cbf5
XL
396 bd="$(if $(USCAN_DESTDIR),$(USCAN_DESTDIR),..)"; \
397 tar xf $$bd/rustc-$$newver.0-beta.999-src.tar.xz rustc-beta-src/version; \
0a1981fb 398 bv="$$(sed -re 's/[0-9]+.[0-9]+.[0-9]+-beta.([0-9]+) \(.*\)/\1/g' rustc-beta-src/version)"; \
d377cbf5 399 bash -c 'shopt -s nullglob; for i in '"$$bd"'/rustc*beta.999*; do mv $$i $${i/beta.999/beta.'"$$bv"'}; done'; \
3af75deb
XL
400 rm -f rustc-beta-src/version; \
401 rmdir -p rustc-beta-src; \
d377cbf5 402 echo "prepared rustc $$newver.0~beta.$$bv in $$bd"