add std-wasm and other stuff for rust

This commit is contained in:
its-pointless 2018-12-01 08:46:37 +11:00 committed by Fredrik Fornwall
parent 50b0630a8c
commit 218104970d
2 changed files with 27 additions and 11 deletions

View File

@ -2,33 +2,41 @@ TERMUX_PKG_HOMEPAGE=https://www.rust-lang.org/
TERMUX_PKG_DESCRIPTION="Systems programming language focused on safety, speed and concurrency" TERMUX_PKG_DESCRIPTION="Systems programming language focused on safety, speed and concurrency"
TERMUX_PKG_MAINTAINER="Kevin Cotugno @kcotugno" TERMUX_PKG_MAINTAINER="Kevin Cotugno @kcotugno"
TERMUX_PKG_VERSION=1.30.1 TERMUX_PKG_VERSION=1.30.1
TERMUX_PKG_SRCURL=https://static.rust-lang.org/dist/rustc-$TERMUX_PKG_VERSION-src.tar.gz TERMUX_PKG_SRCURL=https://static.rust-lang.org/dist/rustc-$TERMUX_PKG_VERSION-src.tar.xz
TERMUX_PKG_SHA256=36a38902dbd9a3e1240d46ab0f2ca40d2fd07c2ab6508ed7970c6c4c036b5b29 TERMUX_PKG_SHA256=76c824e26b6a554cd48f45993e42001816c2f515dd1b252e3c8315fe200155ae
TERMUX_PKG_DEPENDS="clang, openssl" TERMUX_PKG_DEPENDS="clang, openssl, lld"
#TERMUX_PKG_BLACKLISTED_ARCHES="i686, arm"
termux_step_configure () { termux_step_configure () {
termux_setup_cmake termux_setup_cmake
termux_setup_rust
local triple=`printf $TERMUX_HOST_PLATFORM | sed s/arm/armv7/` # it breaks building rust tools without doing this because it tries to find
# ../lib from bin location
export PATH=$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH
local RUSTC=$(which rustc)
local CARGO=$(which cargo)
sed "s%\\@TERMUX_PREFIX\\@%$TERMUX_PREFIX%g" \ sed "s%\\@TERMUX_PREFIX\\@%$TERMUX_PREFIX%g" \
$TERMUX_PKG_BUILDER_DIR/config.toml \ $TERMUX_PKG_BUILDER_DIR/config.toml \
| sed "s%\\@TERMUX_STANDALONE_TOOLCHAIN\\@%$TERMUX_STANDALONE_TOOLCHAIN%g" \ | sed "s%\\@TERMUX_STANDALONE_TOOLCHAIN\\@%$TERMUX_STANDALONE_TOOLCHAIN%g" \
| sed "s%\\@triple\\@%$triple%g" \ | sed "s%\\@triple\\@%$CARGO_TARGET_NAME%g" \
| sed "s%\\@RUSTC\\@%$RUSTC%g" \
| sed "s%\\@CARGO\\@%$CARGO%g" \
> config.toml > config.toml
local env_host=`printf $triple | tr a-z A-Z | sed s/-/_/g` local env_host=`printf $CARGO_TARGET_NAME | tr a-z A-Z | sed s/-/_/g`
export LD_LIBRARY_PATH=$TERMUX_PKG_BUILDDIR/build/x86_64-unknown-linux-gnu/llvm/lib export LD_LIBRARY_PATH=$TERMUX_PKG_BUILDDIR/build/x86_64-unknown-linux-gnu/llvm/lib
export ${env_host}_OPENSSL_DIR=$TERMUX_PREFIX export ${env_host}_OPENSSL_DIR=$TERMUX_PREFIX
export X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu export X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu
export X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include export X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include
unset CC CXX CPP LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS unset CC CXX CPP LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS PKG_CONFIG
} }
termux_step_make () { termux_step_make () {
$TERMUX_PKG_SRCDIR/x.py dist $TERMUX_PKG_SRCDIR/x.py dist --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME --target wasm32-unknown-unknown
} }
@ -37,5 +45,8 @@ termux_step_make_install () {
$TERMUX_PREFIX/lib/rustlib/manifest-rust-analysis-x86_64-unknown-linux-gnu \ $TERMUX_PREFIX/lib/rustlib/manifest-rust-analysis-x86_64-unknown-linux-gnu \
$TERMUX_PREFIX/lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu" $TERMUX_PREFIX/lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu"
$TERMUX_PKG_SRCDIR/x.py install && rm -rf $host_files_to_remove $TERMUX_PKG_SRCDIR/x.py install --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME --target wasm32-unknown-unknown && rm -rf $host_files_to_remove
cd "$TERMUX_PREFIX/lib"
ln -sf rustlib/$CARGO_TARGET_NAME/lib/*.so .
ln -sf $TERMUX_PREFIX/bin/lld $TERMUX_PREFIX/bin/rust-lld
} }

View File

@ -0,0 +1,5 @@
TERMUX_SUBPKG_DESCRIPTION="rust std for wasm32-unknown-unknown target"
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
TERMUX_SUBPKG_INCLUDE="lib/rustlib/wasm32-unknown-unknown"
TERMUX_SUBPKG_DEPENDS="rust"
TERMUX_SUBPKG_REVISION=$TERMUX_PKG_REVISION