From 809d6012e0173965e291cb4b790ec26bbab1ff5f Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Thu, 29 Aug 2019 00:14:45 -0700 Subject: [PATCH] Support cross-compiling to wasm32 --- debian/cargo/.package-cache | 0 debian/changelog | 8 +++++++ debian/config.toml.in | 2 +- debian/control | 22 ++++++++++++++++++- ...td-rust-dev-wasm32-cross.lintian-overrides | 3 +++ debian/rules | 15 ++++++------- debian/rustc.links | 1 + 7 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 debian/cargo/.package-cache create mode 100644 debian/libstd-rust-dev-wasm32-cross.lintian-overrides create mode 100644 debian/rustc.links diff --git a/debian/cargo/.package-cache b/debian/cargo/.package-cache new file mode 100644 index 0000000000..e69de29bb2 diff --git a/debian/changelog b/debian/changelog index 8cfe6bd636..a559e50630 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +rustc (1.37.0+dfsg1-1~exp2) UNRELEASED; urgency=medium + + * Support cross-compiling to wasm32. (Closes: #903110) + To do that, install the libstd-rust-dev-wasm32-cross package and give + --target wasm32-unknown-unknown. + + -- Ximin Luo Thu, 29 Aug 2019 00:13:26 -0700 + rustc (1.37.0+dfsg1-1~exp1) experimental; urgency=medium * New upstream release. diff --git a/debian/config.toml.in b/debian/config.toml.in index 144eee0141..20b60c6fe6 100644 --- a/debian/config.toml.in +++ b/debian/config.toml.in @@ -9,7 +9,7 @@ cargo = "RUST_DESTDIR/usr/bin/cargo" build = "DEB_BUILD_RUST_TYPE" host = ["DEB_HOST_RUST_TYPE"] -target = ["DEB_TARGET_RUST_TYPE"] +target = ["wasm32-unknown-unknown", "DEB_TARGET_RUST_TYPE"] #full-bootstrap = true # originally needed to work around #45317 but no longer necessary diff --git a/debian/control b/debian/control index 88f03e7245..16788fe8e4 100644 --- a/debian/control +++ b/debian/control @@ -52,7 +52,7 @@ Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends}, libstd-rust-dev (= ${binary:Version}), gcc, libc-dev, binutils (>= 2.26) Recommends: cargo (>= 0.38.0~~), cargo (<< 0.39.0~~), rust-gdb | rust-lldb -Suggests: rust-doc, rust-src +Suggests: rust-doc, rust-src, lld-8 Replaces: libstd-rust-dev (<< 1.25.0+dfsg1-2~~) Breaks: libstd-rust-dev (<< 1.25.0+dfsg1-2~~) Description: Rust systems programming language @@ -110,6 +110,26 @@ Description: Rust standard libraries - development files This package contains development files necessary to use the standard Rust libraries. +Package: libstd-rust-dev-wasm32-cross +Section: libdevel +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, lld-8 +Description: Rust standard libraries - development files + Rust is a curly-brace, block-structured expression language. It + visually resembles the C language family, but differs significantly + in syntactic and semantic details. Its design is oriented toward + concerns of "programming in the large", that is, of creating and + maintaining boundaries - both abstract and operational - that + preserve large-system integrity, availability and concurrency. + . + It supports a mixture of imperative procedural, concurrent actor, + object-oriented and pure functional styles. Rust also supports + generic programming and meta-programming, in both static and dynamic + styles. + . + This package contains development files necessary to use the standard + Rust libraries, for cross-compiling to the wasm32-unknown-unknown target. + Package: rust-gdb Architecture: all Depends: gdb, ${misc:Depends} diff --git a/debian/libstd-rust-dev-wasm32-cross.lintian-overrides b/debian/libstd-rust-dev-wasm32-cross.lintian-overrides new file mode 100644 index 0000000000..6bdc88758c --- /dev/null +++ b/debian/libstd-rust-dev-wasm32-cross.lintian-overrides @@ -0,0 +1,3 @@ +# wasm object files count as arch-independent for now, +# at least until we starting offering Debian in wasm +libstd-rust-dev-wasm32-cross binary: arch-independent-package-contains-binary-or-object usr/lib/rustlib/wasm32-unknown-unknown/lib/lib*.rlib diff --git a/debian/rules b/debian/rules index 762ae11e5f..1c310abfa4 100755 --- a/debian/rules +++ b/debian/rules @@ -173,7 +173,7 @@ debian/rust-src.%: debian/rust-src.%.in debian/dh_auto_configure.stamp: debian/config.toml # fail the build if we have any instances of OLD_LLVM_VERSION in debian, except for debian/changelog - ! grep --color=always -i 'll...\?$(subst .,\.,$(OLD_LLVM_VERSION))' --exclude=changelog --exclude='*.patch' -R debian + ! grep --color=always -i 'll\(..\|d\)-\?$(subst .,\.,$(OLD_LLVM_VERSION))' --exclude=changelog --exclude='*.patch' -R debian # fail the build if our version contains ~exp and we are not releasing to experimental v="$(DEB_VERSION)"; test "$$v" = "$${v%~exp*}" -o "$(DEB_DISTRIBUTION)" = "experimental" -o "$(DEB_DISTRIBUTION)" = "UNRELEASED" $(PRECONFIGURE_CHECK) @@ -201,13 +201,11 @@ override_dh_auto_clean: $(RM) -rf $(TEST_LOG) debian/config.toml debian/rust-src.install debian/rust-src.links debian/*.stamp $(RM) -rf $(SRC_CLEAN) config.toml -override_dh_auto_build-arch: +debian/dh_auto_build.stamp: $(RUSTBUILD) build $(RUSTBUILD_FLAGS) -# note: this is only for buildds that want to do a separate arch:all build; -# there is no point running this yourself "to save time" since it implicitly -# depends on build-arch anyways. -override_dh_auto_build-indep: +override_dh_auto_build-arch: debian/dh_auto_build.stamp +override_dh_auto_build-indep: debian/dh_auto_build.stamp ifeq (true,$(BUILD_DOCS)) $(RUSTBUILD) doc $(RUSTBUILD_FLAGS) endif @@ -318,6 +316,7 @@ override_dh_install-arch: override_dh_install-indep: debian/rust-src.install debian/rust-src.links dh_install + dh_install -plibstd-rust-dev-wasm32-cross usr/lib/rustlib/wasm32-*/lib/ chmod -x \ debian/rust-gdb/usr/share/rust-gdb/*.py \ debian/rust-lldb/usr/share/rust-lldb/*.py @@ -350,12 +349,12 @@ override_dh_compress: override_dh_strip: # Work around #35733, #468333 - find debian/libstd-rust-dev/ -name '*.rlib' -execdir mv '{}' '{}.a' \; + find debian/libstd-rust-dev*/ -name '*.rlib' -execdir mv '{}' '{}.a' \; # This is expected to print out lots of "File format unrecognized" warnings about # rust.metadata.bin and *.deflate but the .o files inside the rlibs should be stripped # Some files are still omitted because of #875780 however. dh_strip -v - find debian/libstd-rust-dev/ -name '*.rlib.a' -execdir sh -c 'mv "$$1" "$${1%.a}"' - '{}' \; + find debian/libstd-rust-dev*/ -name '*.rlib.a' -execdir sh -c 'mv "$$1" "$${1%.a}"' - '{}' \; override_dh_makeshlibs: dh_makeshlibs -V diff --git a/debian/rustc.links b/debian/rustc.links new file mode 100644 index 0000000000..ba8e8ead9f --- /dev/null +++ b/debian/rustc.links @@ -0,0 +1 @@ +usr/bin/lld-8 usr/bin/rust-lld