diff --git a/packages/rust/build.sh b/packages/rust/build.sh new file mode 100644 index 000000000..3b56ae211 --- /dev/null +++ b/packages/rust/build.sh @@ -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 +} diff --git a/packages/rust/config.toml b/packages/rust/config.toml new file mode 100644 index 000000000..5a43d14e4 --- /dev/null +++ b/packages/rust/config.toml @@ -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 diff --git a/packages/rust/no-host-build.patch b/packages/rust/no-host-build.patch new file mode 100644 index 000000000..ee868f747 --- /dev/null +++ b/packages/rust/no-host-build.patch @@ -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) { diff --git a/packages/rust/os-tmpdir.patch b/packages/rust/os-tmpdir.patch new file mode 100644 index 000000000..f6afb60e0 --- /dev/null +++ b/packages/rust/os-tmpdir.patch @@ -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") + }