Add rustc and cargo
This commit is contained in:
parent
60767d4367
commit
429729e682
37
packages/rust/build.sh
Normal file
37
packages/rust/build.sh
Normal file
@ -0,0 +1,37 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://www.rust-lang.org/
|
||||
TERMUX_PKG_DESCRIPTION="Systems programming language focused on safety, speed and concurrency"
|
||||
TERMUX_PKG_VERSION=1.29.2
|
||||
TERMUX_PKG_SRCURL=https://static.rust-lang.org/dist/rustc-$TERMUX_PKG_VERSION-src.tar.gz
|
||||
TERMUX_PKG_SHA256=5088e796aa2e47478cdf41e7243fc5443fafab0a7c70a11423e57c80c04167c9
|
||||
TERMUX_PKG_DEPENDS="clang, openssl"
|
||||
|
||||
termux_step_configure () {
|
||||
termux_setup_cmake
|
||||
|
||||
if [ "$TERMUX_ARCH" = "arm" ]; then
|
||||
TRIPLE="armv7-linux-androideabi"
|
||||
else
|
||||
TRIPLE="$TERMUX_HOST_PLATFORM"
|
||||
fi
|
||||
|
||||
sed "s%\\@TERMUX_PREFIX\\@%$TERMUX_PREFIX%g" \
|
||||
$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" \
|
||||
> config.toml
|
||||
|
||||
export LD_LIBRARY_PATH=$TERMUX_PKG_BUILDDIR/build/x86_64-unknown-linux-gnu/llvm/lib
|
||||
export OPENSSL_DIR=$TERMUX_PREFIX
|
||||
|
||||
unset CC CXX CPP LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
|
||||
}
|
||||
|
||||
termux_step_make () {
|
||||
$TERMUX_PKG_SRCDIR/x.py dist
|
||||
|
||||
}
|
||||
|
||||
termux_step_make_install () {
|
||||
$TERMUX_PKG_SRCDIR/x.py install
|
||||
}
|
33
packages/rust/config.toml
Normal file
33
packages/rust/config.toml
Normal file
@ -0,0 +1,33 @@
|
||||
[llvm]
|
||||
link-shared = true
|
||||
|
||||
[build]
|
||||
host = ["@TRIPLE@"]
|
||||
target = ["@TRIPLE@"]
|
||||
|
||||
python = "python2.7"
|
||||
extended = true
|
||||
sanitizers = false
|
||||
|
||||
[install]
|
||||
prefix = "@TERMUX_PREFIX@"
|
||||
sysconfdir = "etc"
|
||||
|
||||
[rust]
|
||||
codegen-units = 1
|
||||
|
||||
use-jemalloc = false
|
||||
|
||||
debuginfo = true
|
||||
debuginfo-lines = true
|
||||
|
||||
channel = "stable"
|
||||
|
||||
rpath = false
|
||||
|
||||
[target.@TRIPLE@]
|
||||
android-ndk = "@TERMUX_STANDALONE_TOOLCHAIN@"
|
||||
llvm-config = "@TERMUX_PREFIX@/bin/llvm-config"
|
||||
|
||||
[dist]
|
||||
src-tarball = false
|
10
packages/rust/no-host-build.patch
Normal file
10
packages/rust/no-host-build.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- ../rustc-1.29.2-src/src/bootstrap/config.rs 2018-10-05 15:19:57.000000000 -0700
|
||||
+++ ./src/bootstrap/config.rs 2018-10-19 14:18:14.000000000 -0700
|
||||
@@ -416,7 +416,6 @@
|
||||
|
||||
let build = toml.build.clone().unwrap_or(Build::default());
|
||||
// set by bootstrap.py
|
||||
- config.hosts.push(config.build.clone());
|
||||
for host in build.host.iter() {
|
||||
let host = INTERNER.intern_str(host);
|
||||
if !config.hosts.contains(&host) {
|
11
packages/rust/os-tmpdir.patch
Normal file
11
packages/rust/os-tmpdir.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- ../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
|
||||
@@ -488,7 +488,7 @@
|
||||
pub fn temp_dir() -> PathBuf {
|
||||
::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| {
|
||||
if cfg!(target_os = "android") {
|
||||
- PathBuf::from("/data/local/tmp")
|
||||
+ PathBuf::from("/data/data/com.termux/files/usr/tmp")
|
||||
} else {
|
||||
PathBuf::from("/tmp")
|
||||
}
|
Loading…
Reference in New Issue
Block a user