2018-10-21 02:05:12 +02:00
|
|
|
TERMUX_PKG_HOMEPAGE=https://www.rust-lang.org/
|
|
|
|
TERMUX_PKG_DESCRIPTION="Systems programming language focused on safety, speed and concurrency"
|
2019-01-21 13:53:58 +01:00
|
|
|
TERMUX_PKG_LICENSE="MIT"
|
2018-10-30 22:17:57 +01:00
|
|
|
TERMUX_PKG_MAINTAINER="Kevin Cotugno @kcotugno"
|
2019-03-21 05:42:58 +01:00
|
|
|
TERMUX_PKG_VERSION=1.33.0
|
2019-04-14 14:51:46 +02:00
|
|
|
TERMUX_PKG_REVISION=1
|
2019-03-21 05:42:58 +01:00
|
|
|
TERMUX_PKG_SHA256=f4b1a72f1a29b23dcc9d7be5f60878f0434560513273906aa93dcd5c0de39b71
|
2018-11-30 22:46:37 +01:00
|
|
|
TERMUX_PKG_SRCURL=https://static.rust-lang.org/dist/rustc-$TERMUX_PKG_VERSION-src.tar.xz
|
2019-04-14 14:51:46 +02:00
|
|
|
TERMUX_PKG_DEPENDS="clang, openssl, lld, zlib"
|
2018-10-21 02:05:12 +02:00
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_configure() {
|
2018-10-21 02:05:12 +02:00
|
|
|
termux_setup_cmake
|
2018-11-30 22:46:37 +01:00
|
|
|
termux_setup_rust
|
2018-12-10 01:18:07 +01:00
|
|
|
|
2018-11-30 22:46:37 +01:00
|
|
|
# it breaks building rust tools without doing this because it tries to find
|
2018-12-10 01:18:07 +01:00
|
|
|
# ../lib from bin location:
|
2019-03-24 05:44:34 +01:00
|
|
|
rustup update
|
2019-03-24 11:21:32 +01:00
|
|
|
# this is about to get ugly but i have to make sure a rustc in a proper bin lib
|
|
|
|
# configuration is used otherwise it fails a long time into the build...
|
|
|
|
# like 30 to 40 + minutes ... so lets get it right
|
|
|
|
|
|
|
|
export PATH=$HOME/.rustup/toolchains/1.32.0-x86_64-unknown-linux-gnu/bin:$HOME/.rustup/toolchains/1.33.0-x86_64-unknown-linux-gnu/bin:HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH
|
2018-11-30 22:46:37 +01:00
|
|
|
|
|
|
|
local RUSTC=$(which rustc)
|
2018-12-10 01:18:07 +01:00
|
|
|
local CARGO=$(which cargo)
|
2018-10-21 02:05:12 +02:00
|
|
|
|
|
|
|
sed "s%\\@TERMUX_PREFIX\\@%$TERMUX_PREFIX%g" \
|
|
|
|
$TERMUX_PKG_BUILDER_DIR/config.toml \
|
|
|
|
| sed "s%\\@TERMUX_STANDALONE_TOOLCHAIN\\@%$TERMUX_STANDALONE_TOOLCHAIN%g" \
|
2018-11-30 22:46:37 +01:00
|
|
|
| sed "s%\\@triple\\@%$CARGO_TARGET_NAME%g" \
|
|
|
|
| sed "s%\\@RUSTC\\@%$RUSTC%g" \
|
2018-12-10 01:18:07 +01:00
|
|
|
| sed "s%\\@CARGO\\@%$CARGO%g" \
|
2018-10-21 02:05:12 +02:00
|
|
|
> config.toml
|
|
|
|
|
2019-02-12 09:41:30 +01:00
|
|
|
local env_host=$(printf $CARGO_TARGET_NAME | tr a-z A-Z | sed s/-/_/g)
|
2018-10-30 16:19:19 +01:00
|
|
|
|
2018-10-21 02:05:12 +02:00
|
|
|
export LD_LIBRARY_PATH=$TERMUX_PKG_BUILDDIR/build/x86_64-unknown-linux-gnu/llvm/lib
|
2018-10-30 16:19:19 +01:00
|
|
|
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_INCLUDE_DIR=/usr/include
|
2019-03-21 05:42:58 +01:00
|
|
|
export PKG_CONFIG_ALLOW_CROSS=1
|
2019-01-01 02:37:08 +01:00
|
|
|
# for backtrace-sys
|
|
|
|
export CC_x86_64_unknown_linux_gnu=gcc
|
|
|
|
export CFLAGS_x86_64_unknown_linux_gnu="-O2"
|
2019-03-21 05:42:58 +01:00
|
|
|
unset CC CXX CPP LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS PKG_CONFIG AR
|
2018-10-21 02:05:12 +02:00
|
|
|
}
|
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_make() {
|
2018-12-10 01:18:07 +01:00
|
|
|
$TERMUX_PKG_SRCDIR/x.py dist \
|
|
|
|
--host $CARGO_TARGET_NAME \
|
|
|
|
--target $CARGO_TARGET_NAME \
|
2019-03-24 11:21:32 +01:00
|
|
|
--target wasm32-unknown-unknown || bash
|
2018-10-21 02:05:12 +02:00
|
|
|
}
|
|
|
|
|
2019-02-08 10:37:29 +01:00
|
|
|
termux_step_make_install() {
|
2018-10-30 16:19:19 +01:00
|
|
|
local host_files_to_remove="$TERMUX_PREFIX/lib/rustlib/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"
|
|
|
|
|
2018-12-10 01:18:07 +01:00
|
|
|
$TERMUX_PKG_SRCDIR/x.py install \
|
|
|
|
--host $CARGO_TARGET_NAME \
|
|
|
|
--target $CARGO_TARGET_NAME \
|
|
|
|
--target wasm32-unknown-unknown && \
|
|
|
|
rm -rf $host_files_to_remove
|
|
|
|
|
2018-11-30 22:46:37 +01:00
|
|
|
cd "$TERMUX_PREFIX/lib"
|
2018-12-10 01:18:07 +01:00
|
|
|
ln -sf rustlib/$CARGO_TARGET_NAME/lib/*.so .
|
2018-11-30 22:46:37 +01:00
|
|
|
ln -sf $TERMUX_PREFIX/bin/lld $TERMUX_PREFIX/bin/rust-lld
|
2018-10-21 02:05:12 +02:00
|
|
|
}
|