Commit 64c49c2f authored by alice's avatar alice 🗡 Committed by alice
Browse files

community/rust: add wasm target

parent 6f07567e
......@@ -8,7 +8,7 @@ pkgname=rust
pkgver=1.60.0
_llvmver=13
_bootver=1.59.0
pkgrel=0
pkgrel=1
pkgdesc="The Rust Programming Language"
url="https://www.rust-lang.org/"
arch="x86_64 armv7 armhf aarch64 x86 ppc64le"
......@@ -41,6 +41,7 @@ makedepends_build="
curl-dev
libssh2-dev
openssl1.1-compat-dev
wasi-libc
zlib-dev
"
makedepends_host="
......@@ -62,6 +63,7 @@ options="!archcheck !check"
subpackages="
$pkgname-dbg
$pkgname-stdlib
$pkgname-wasm
$pkgname-analysis
$pkgname-gdb::noarch
$pkgname-lldb::noarch
......@@ -126,6 +128,9 @@ prepare() {
# to dynamically link against musl
_clear_vendor_checksums libc
# this is hardcoded to rust-lld, but we use system llvm tools
sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs
}
build() {
......@@ -142,7 +147,7 @@ build() {
./configure \
--build="$_build" \
--host="$_target" \
--target="$_target" \
--target="$_target,wasm32-wasi,wasm32-unknown-unknown" \
--prefix="/usr" \
--release-channel="stable" \
--enable-local-rust \
......@@ -172,7 +177,13 @@ build() {
--set="target.$_build.cc=gcc" \
--set="target.$_build.cxx=c++" \
--set="target.$_build.ar=ar" \
--set="target.$_build.linker=gcc"
--set="target.$_build.linker=gcc" \
--set="target.wasm32-unknown-unknown.sanitizers=false" \
--set="target.wasm32-unknown-unknown.profiler=false" \
--set="target.wasm32-unknown-unknown.linker=lld" \
--set="target.wasm32-wasi.sanitizers=false" \
--set="target.wasm32-wasi.profiler=false" \
--set="target.wasm32-wasi.wasi-root=/usr/share/wasi-sysroot"
# Allow warnings instead of just aborting the build
sed 's/#deny-warnings = .*/deny-warnings = false/' -i config.toml
......@@ -228,6 +239,10 @@ package() {
# -C "$pkgdir/usr" --strip-components=2 --exclude=manifest.in --no-same-owner
tar xf "$builddir"/build/dist/rustfmt-$pkgver-$_target.tar.gz \
-C "$pkgdir/usr" --strip-components=2 --exclude=manifest.in --no-same-owner
tar xf "$builddir"/build/dist/rust-std-$pkgver-wasm32-unknown-unknown.tar.gz \
-C "$pkgdir/usr" --strip-components=2 --exclude=manifest.in --no-same-owner
tar xf "$builddir"/build/dist/rust-std-$pkgver-wasm32-wasi.tar.gz \
-C "$pkgdir/usr" --strip-components=2 --exclude=manifest.in --no-same-owner
# We don't want to include stuff like rust-llvm-* tools, as we will use the
# system tools.
......@@ -253,6 +268,13 @@ stdlib() {
_mv "$pkgdir"/$_rlibdir/*.rlib "$subpkgdir"/$_rlibdir/
}
wasm() {
pkgdesc="WebAssembly targets for rust"
depends="rust=$pkgver-r$pkgrel lld wasi-sdk"
amove usr/lib/rustlib/wasm32-*
}
analysis() {
pkgdesc="Compiler analysis data for the Rust standard library"
depends="$pkgname-stdlib=$pkgver-r$pkgrel"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment