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