Skip to content

Commit

Permalink
rust 1.48.0 (termux#6162)
Browse files Browse the repository at this point in the history
  • Loading branch information
its-pointless authored Dec 24, 2020
1 parent 04fa738 commit e74ab56
Showing 4 changed files with 25 additions and 17 deletions.
37 changes: 22 additions & 15 deletions packages/rust/build.sh
Original file line number Diff line number Diff line change
@@ -2,11 +2,10 @@ TERMUX_PKG_HOMEPAGE=https://www.rust-lang.org/
TERMUX_PKG_DESCRIPTION="Systems programming language focused on safety, speed and concurrency"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="Kevin Cotugno @kcotugno"
TERMUX_PKG_VERSION=1.46.0
TERMUX_PKG_VERSION=1.48.0
TERMUX_PKG_SRCURL=https://static.rust-lang.org/dist/rustc-$TERMUX_PKG_VERSION-src.tar.xz
TERMUX_PKG_SHA256=865dae1290a205f16ded8818c6a0254cc32862985fc250a602a70285b7d92b82
TERMUX_PKG_SHA256=ff0a242392a1865d7b2d08eb5ca6c1b3fd0820741d4c13a51a4b2d5d2bb53908
TERMUX_PKG_DEPENDS="libc++, clang, openssl, lld, zlib, libllvm"
TERMUX_PKG_REVISION=2

termux_step_configure() {
termux_setup_cmake
@@ -19,7 +18,7 @@ termux_step_configure() {
# like 30 to 40 + minutes ... so lets get it right

# upstream only tests build ver one version behind $TERMUX_PKG_VERSION
local BOOTSTRAP_VERSION=1.45.2
local BOOTSTRAP_VERSION=1.47.0
rustup install $BOOTSTRAP_VERSION
rustup default $BOOTSTRAP_VERSION-x86_64-unknown-linux-gnu
export PATH=$HOME/.rustup/toolchains/$BOOTSTRAP_VERSION-x86_64-unknown-linux-gnu/bin:$PATH
@@ -42,31 +41,35 @@ termux_step_configure() {
# for backtrace-sys
export CC_x86_64_unknown_linux_gnu=gcc
export CFLAGS_x86_64_unknown_linux_gnu="-O2"
export LLVM_VERSION=$(grep ^TERMUX_PKG_VERSION= $TERMUX_PKG_BUILDER_DIR/../libllvm/build.sh | cut -f2 -d=)
unset CC CXX CPP LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS PKG_CONFIG AR RANLIB
# we can't use -L$PREFIX/lib since it breaks things but we need to link against libLLVM-9.so
ln -sf $PREFIX/lib/libLLVM-10.0.1.so $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/
ln -sf $PREFIX/lib/libLLVM-$LLVM_VERSION.so $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/

# rust checks libs in PREFIX/lib because both host and target are x86_64. It then can't find libc.so and libdl.so because rust program doesn't
# rust checks libs in PREFIX/lib because both host and target are x86_64. It then can't find libc.so and libdl.so because rust program doesn't
# know where those are. Putting them temporarly in $PREFIX/lib prevents that failure

if [ $TERMUX_ARCH = "x86_64" ]; then
mv $TERMUX_PREFIX/lib/libtinfo.so.6 $TERMUX_PREFIX/lib/libtinfo.so.6.tmp
mv $TERMUX_PREFIX/lib/libz.so.1 $TERMUX_PREFIX/lib/libz.so.1.tmp
mv $TERMUX_PREFIX/lib/libz.so $TERMUX_PREFIX/lib/libz.so.tmp
fi
}

termux_step_make() {
return 0;
}
termux_step_make_install() {
if [ $TERMUX_ARCH = "x86_64" ]; then
if [ $TERMUX_ARCH = "x86_64" ]; then
mv $TERMUX_PREFIX ${TERMUX_PREFIX}a
$TERMUX_PKG_SRCDIR/x.py build --stage 1 cargo || $TERMUX_PKG_SRCDIR/x.py build --stage 1 rls || $TERMUX_PKG_SRCDIR/x.py --stage 1 build miri || $TERMUX_PKG_SRCDIR/x.py build --stage 1 cargo-miri || $TERMUX_PKG_SRCDIR/x.py build --stage 1 rustfmt || $TERMUX_PKG_SRCDIR/x.py --stage 1 build rustdoc || $TERMUX_PKG_SRCDIR/x.py --stage 1 build error_index_generator || true
$TERMUX_PKG_SRCDIR/x.py build --host x86_64-unknown-linux-gnu --stage 1 cargo || $TERMUX_PKG_SRCDIR/x.py build --host x86_64-unknown-linux-gnu --stage 1 rls || $TERMUX_PKG_SRCDIR/x.py build --host x86_64-unknown-linux-gnu --stage 1 rustfmt || $TERMUX_PKG_SRCDIR/x.py --stage 1 --host x86_64-unknown-linux-gnu build rustdoc || $TERMUX_PKG_SRCDIR/x.py --stage 1 --host x86_64-unknown-linux-gnu build error_index_generator || true
mv ${TERMUX_PREFIX}a ${TERMUX_PREFIX}
else
$TERMUX_PKG_SRCDIR/x.py build cargo || $TERMUX_PKG_SRCDIR/x.py build rls || $TERMUX_PKG_SRCDIR/x.py build miri || $TERMUX_PKG_SRCDIR/x.py build cargo-miri || $TERMUX_PKG_SRCDIR/x.py build rustfmt || true
fi
# $TERMUX_PKG_SRCDIR/x.py dist --stage 2 --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME --target wasm32-unknown-unknown || bash
$TERMUX_PKG_SRCDIR/x.py install --stage 1 --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME --target wasm32-unknown-unknown || bash

fi

#$TERMUX_PKG_SRCDIR/x.py dist --stage 1 --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME || bash
$TERMUX_PKG_SRCDIR/x.py install --stage 1 --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME || bash
$TERMUX_PKG_SRCDIR/x.py install --stage 1 std --target wasm32-unknown-unknown || bash
$TERMUX_PKG_SRCDIR/x.py dist rustc-dev --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME --target wasm32-unknown-unknown || bash
tar xvf build/dist/rustc-dev-$TERMUX_PKG_VERSION-$CARGO_TARGET_NAME.tar.gz
./rustc-dev-$TERMUX_PKG_VERSION-$CARGO_TARGET_NAME/install.sh --prefix=$TERMUX_PREFIX
@@ -75,6 +78,8 @@ termux_step_make_install() {
rm -f libc.so libdl.so
if [ $TERMUX_ARCH = "x86_64" ]; then
mv $TERMUX_PREFIX/lib/libtinfo.so.6.tmp $TERMUX_PREFIX/lib/libtinfo.so.6
mv $TERMUX_PREFIX/lib/libz.so.1.tmp $TERMUX_PREFIX/lib/libz.so.1
mv $TERMUX_PREFIX/lib/libz.so.tmp $TERMUX_PREFIX/lib/libz.so
fi

ln -sf rustlib/$CARGO_TARGET_NAME/lib/*.so .
@@ -87,12 +92,14 @@ termux_step_make_install() {
rust-installer-version \
manifest-* \
x86_64-unknown-linux-gnu
rm $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/libLLVM-10.0.1.so
rm $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/libLLVM-$LLVM_VERSION.so

}
termux_step_post_massage() {
if [ $TERMUX_ARCH = "x86_64" ]; then
rm lib/libtinfo.so.6
rm -f lib/libtinfo.so.6
rm -f lib/libz.so
rm -f lib/libz.so.1
fi
}

1 change: 1 addition & 0 deletions packages/rust/config.toml
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ extended = true
sanitizers = false

#tools = ["cargo", "analysis", "clippy-driver" ]
tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"]

[install]
prefix = "@TERMUX_PREFIX@"
2 changes: 1 addition & 1 deletion packages/rust/os-tmpdir.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- ../rustc-1.29.2-src/src/libstd/sys/unix/os.rs 2018-10-19 14:12:31.000000000 -0700
+++ ./src/libstd/sys/unix/os.rs 2018-10-19 14:11:20.000000000 -0700
+++ ./library/std/src/sys/unix/os.rs 2018-10-19 14:11:20.000000000 -0700
@@ -488,7 +488,7 @@
pub fn temp_dir() -> PathBuf {
::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
2 changes: 1 addition & 1 deletion packages/rust/src-librustc_llvm-build.rs.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -u -r ../rustc-1.34.1-src/src/librustc_llvm/build.rs ./src/librustc_llvm/build.rs
--- ../rustc-1.34.1-src/src/librustc_llvm/build.rs 2019-04-24 21:07:08.000000000 +0000
+++ ./src/librustc_llvm/build.rs 2019-05-05 20:56:34.090330174 +0000
+++ ./compiler/rustc_llvm/build.rs 2019-05-05 20:56:34.090330174 +0000
@@ -244,6 +244,8 @@
"c++"
} else if target.contains("darwin") {

0 comments on commit e74ab56

Please sign in to comment.