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