Support cross-compiling to wasm32

This commit is contained in:
Ximin Luo 2019-08-29 00:14:45 -07:00
parent a5f68c9495
commit 809d6012e0
7 changed files with 41 additions and 10 deletions

0
debian/cargo/.package-cache vendored Normal file
View File

8
debian/changelog vendored
View File

@ -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 <infinity0@debian.org> Thu, 29 Aug 2019 00:13:26 -0700
rustc (1.37.0+dfsg1-1~exp1) experimental; urgency=medium
* New upstream release.

View File

@ -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

22
debian/control vendored
View File

@ -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}

View File

@ -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

15
debian/rules vendored
View File

@ -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

1
debian/rustc.links vendored Normal file
View File

@ -0,0 +1 @@
usr/bin/lld-8 usr/bin/rust-lld