diff --git a/disabled-packages/rustc-nightly/build.sh b/disabled-packages/rustc-nightly/build.sh new file mode 100644 index 000000000..4774183b5 --- /dev/null +++ b/disabled-packages/rustc-nightly/build.sh @@ -0,0 +1,111 @@ +TERMUX_PKG_HOMEPAGE=https://www.rust-lang.org +TERMUX_PKG_DESCRIPTION="Rust compiler and utilities (nightly version)" +TERMUX_PKG_DEPENDS="libc++, clang, openssl, lld, zlib, libllvm" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@its-pointless" +TERMUX_PKG_VERSION=1.52.0 +TERMUX_PKG_REVISION=2 +TERMUX_PKG_SRCURL=https://static.rust-lang.org/dist/2021-02-24/rustc-nightly-src.tar.xz +TERMUX_PKG_SHA256=80536b0050fc83cdffedf617bac0fd23dc60081adc00648b90404e1a14baba18 +TERMUX_PKG_KEEP_SHARE_DOC=true + +termux_step_configure () { + termux_setup_cmake + termux_setup_rust + + # nightlys don't build with stable + rustup install beta-2021-02-14-x86_64-unknown-linux-gnu + rustup target add $CARGO_TARGET_NAME + export PATH=$HOME/.rustup/toolchains/beta-2021-02-14-x86_64-unknown-linux-gnu/bin:$PATH + export RUST_BACKTRACE=1 + mkdir -p $TERMUX_PREFIX/opt/rust-nightly + RUST_PREFIX=$TERMUX_PREFIX/opt/rust-nightly + export PATH=$TERMUX_PKG_TMPDIR/bin:$PATH + sed $TERMUX_PKG_BUILDER_DIR/config.toml \ + -e "s|@RUST_PREFIX@|$RUST_PREFIX|g" \ + -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \ + -e "s|@TERMUX_HOST_PLATFORM@|$TERMUX_HOST_PLATFORM|g" \ + -e "s|@RUST_TARGET_TRIPLE@|$CARGO_TARGET_NAME|g" \ + -e "s|@CARGO@|$(which cargo)|g" \ + -e "s|@RUSTC@|$(which rustc)|g" > $TERMUX_PKG_BUILDDIR/config.toml + + 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 PKG_CONFIG_ALLOW_CROSS=1 + # for backtrace-sys + export CC_x86_64_unknown_linux_gnu=gcc + export CFLAGS_x86_64_unknown_linux_gnu="-O2" + # it won't link with it in TERMUX_PREFIX/lib without breaking other things. + cp $PREFIX/lib/libLLVM-11.1.0.so $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/ + unset CC CXX CPP LD CFLAGS CXXFLAGS CPPFLAGS LDFLAGS PKG_CONFIG AR RANLIB + if [ $TERMUX_ARCH = "x86_64" ]; then + cp $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/x86_64-linux-android/$TERMUX_PKG_API_LEVEL/libc.so $TERMUX_PREFIX/lib/ + cp $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/x86_64-linux-android/$TERMUX_PKG_API_LEVEL/libdl.so $TERMUX_PREFIX/lib/ + mv $TERMUX_PREFIX/lib/libtinfo.so.6 $TERMUX_PREFIX/lib/libtinfo.so.6.tmp + fi +} + +termux_step_make_install () { + if [ ! -f "/usr/bin/llvm-dwp" ]; then + # errr yeah this needs to be here for docker stuff + sudo ln -s /usr/bin/llvm-dwp-10 /usr/bin/llvm-dwp + fi + if [ $TERMUX_ARCH = "x86_64" ]; then + mv $TERMUX_PREFIX ${TERMUX_PREFIX}a + ../src/x.py dist cargo --host x86_64-unknown-linux-gnu + ../src/x.py dist rls --host x86_64-unknown-linux-gnu + ../src/x.py dist rust-analyzer --host x86_64-unknown-linux-gnu + ../src/x.py dist rustfmt --host x86_64-unknown-linux-gnu + ../src/x.py dist miri --host x86_64-unknown-linux-gnu + mv ${TERMUX_PREFIX}a ${TERMUX_PREFIX} + fi + ../src/x.py build --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME --target wasm32-unknown-unknown || bash + ../src/x.py dist --host $CARGO_TARGET_NAME --target $CARGO_TARGET_NAME --target wasm32-unknown-unknown || bash + mkdir $TERMUX_PKG_BUILDDIR/install + # miri-nightly not working. + for tar in rustc-nightly miri-nightly rustc-dev-nightly rust-docs-nightly rust-std-nightly rust-analysis-nightly cargo-nightly rls-nightly rustc-dev-nightly rustfmt-nightly clippy-nightly; do + tar -xf $TERMUX_PKG_BUILDDIR/build/dist/$tar-$CARGO_TARGET_NAME.tar.gz -C $TERMUX_PKG_BUILDDIR/install + # uninstall previous version + $TERMUX_PKG_BUILDDIR/install/$tar-$CARGO_TARGET_NAME/install.sh --uninstall --prefix=$RUST_PREFIX || true + $TERMUX_PKG_BUILDDIR/install/$tar-$CARGO_TARGET_NAME/install.sh --prefix=$RUST_PREFIX + done + + tar -xf $TERMUX_PKG_BUILDDIR/build/dist/rust-src-nightly.tar.gz -C $TERMUX_PKG_BUILDDIR/install + $TERMUX_PKG_BUILDDIR/install/rust-src-nightly/install.sh --uninstall --prefix=$RUST_PREFIX || true + $TERMUX_PKG_BUILDDIR/install/rust-src-nightly/install.sh --prefix=$RUST_PREFIX + WASM=wasm32-unknown-unknown + for tar in rust-std-nightly rust-analysis-nightly; do + tar -xf $TERMUX_PKG_BUILDDIR/build/dist/$tar-$WASM.tar.gz -C $TERMUX_PKG_BUILDDIR/install + # uninstall previous version + $TERMUX_PKG_BUILDDIR/install/$tar-$WASM/install.sh --uninstall --prefix=$RUST_PREFIX || true + $TERMUX_PKG_BUILDDIR/install/$tar-$WASM/install.sh --prefix=$RUST_PREFIX + done + if [ $TERMUX_ARCH = "x86_64" ]; then + rm -f $TERMUX_PREFIX/lib/libc.so $TERMUX_PREFIX/lib/libdl.so + mv $TERMUX_PREFIX/lib/libtinfo.so.6.tmp $TERMUX_PREFIX/lib/libtinfo.so.6 + fi + +} + +termux_step_post_massage () { + rm $TERMUX_PKG_MASSAGEDIR/$RUST_PREFIX/lib/rustlib/{components,rust-installer-version,install.log,uninstall.sh} + mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/etc/profile.d + mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib + echo "#!$TERMUX_PREFIX/bin/sh" > $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/etc/profile.d/rust-nightly.sh + echo "export PATH=$RUST_PREFIX/bin:\$PATH" >> $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/etc/profile.d/rust-nightly.sh + cd $TERMUX_PKG_MASSAGEDIR/$RUST_PREFIX/lib + ln -sf rustlib/$CARGO_TARGET_NAME/lib/lib*.so . + cd $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib + ln -sf ../opt/rust-nightly/lib/lib*.so . + ln -sf $TERMUX_PREFIX/bin/lld $TERMUX_PKG_MASSAGEDIR$RUST_PREFIX/bin/rust-lld + rm -f ../bin/llvm-dwp + if [ $TERMUX_ARCH = "x86_64" ]; then + rm -f $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/lib/libtinfo.so.6 + fi + rm $TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/libLLVM-11.1.0.so +} +termux_step_create_debscripts () { + echo "#!$TERMUX_PREFIX/bin/sh" > postinst + echo "echo 'source \$PREFIX/etc/profile.d/rust-nightly.sh to use nightly'" >> postinst + echo "echo 'or export RUSTC=\$PREFIX/opt/rust-nightly/bin/rustc'" >> postinst +} diff --git a/disabled-packages/rustc-nightly/config.toml b/disabled-packages/rustc-nightly/config.toml new file mode 100644 index 000000000..16bf77940 --- /dev/null +++ b/disabled-packages/rustc-nightly/config.toml @@ -0,0 +1,48 @@ +[build] +build = "x86_64-unknown-linux-gnu" +host = [ "@RUST_TARGET_TRIPLE@" ] +target = [ '@RUST_TARGET_TRIPLE@', 'wasm32-unknown-unknown' ] +#python = "python2.7" +#full-bootstrap = false +extended = true +rustc = '@RUSTC@' +cargo = '@CARGO@' +#configure-args = ['--target=wasm32-unknown-unknown', '--set', 'llvm.experimental-targets=WebAssembly'] +#tools = ["rls", "rustfmt", "analysis"] +local-rebuild = false + +[install] +prefix = "@RUST_PREFIX@" + +[llvm] +experimental-targets = 'WebAssembly' +link-shared = true + +[rust] +#backtrace = false +#default-linker = "clang" +#default-ar = "ar" +channel = "nightly" +rpath = true +optimize-tests = false +codegen-tests = false +#lld = false +deny-warnings = false +backtrace-on-ice = true + +[target.wasm32-unknown-unknown] +#linker = @TERMUX_PREFIX@/bin/wasm-ld +#crt-static = true + +[target.x86_64-unknown-linux-gnu] +llvm-config = "/usr/bin/llvm-config-10" + +[target.@RUST_TARGET_TRIPLE@] +cc = "@TERMUX_HOST_PLATFORM@-clang" +cxx = "@TERMUX_HOST_PLATFORM@-clang++" +llvm-config = "@TERMUX_PREFIX@/bin/llvm-config" + +#jemalloc = "/path/to/jemalloc/libjemalloc_pic.a" +#android-ndk = "/path/to/ndk" +[dist] +missing-tools = true diff --git a/disabled-packages/rustc-nightly/miri-nightly.subpackage.sh b/disabled-packages/rustc-nightly/miri-nightly.subpackage.sh new file mode 100644 index 000000000..954c4f68f --- /dev/null +++ b/disabled-packages/rustc-nightly/miri-nightly.subpackage.sh @@ -0,0 +1,4 @@ +TERMUX_SUBPKG_DESCRIPTION="An interpreter for Rust's mid-level intermediate representation" +TERMUX_SUBPKG_INCLUDE="opt/rust-nightly/bin/cargo-miri opt/rust-nightly/bin/miri opt/rust-nightlyshare/doc/miri" +TERMUX_SUBPKG_DEPENDS="rustc-nightly" + diff --git a/disabled-packages/rustc-nightly/os-tmpdir.patch b/disabled-packages/rustc-nightly/os-tmpdir.patch new file mode 100644 index 000000000..24d208178 --- /dev/null +++ b/disabled-packages/rustc-nightly/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 ++++ ./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(|| { + if cfg!(target_os = "android") { +- PathBuf::from("/data/local/tmp") ++ PathBuf::from("@TERMUX_PREFIX@/tmp") + } else { + PathBuf::from("/tmp") + } diff --git a/disabled-packages/rustc-nightly/rust-nightly-wasm32-unknown-unknown.subpackage.sh b/disabled-packages/rustc-nightly/rust-nightly-wasm32-unknown-unknown.subpackage.sh new file mode 100644 index 000000000..8e4d68dde --- /dev/null +++ b/disabled-packages/rustc-nightly/rust-nightly-wasm32-unknown-unknown.subpackage.sh @@ -0,0 +1,3 @@ +TERMUX_SUBPKG_DESCRIPTION="rust std for wasm32-unknown-unknown target" +TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true +TERMUX_SUBPKG_INCLUDE="opt/rust-nightly/lib/rustlib/wasm32-unknown-unknown" diff --git a/disabled-packages/rustc-nightly/rust-rls-nightly.subpackage.sh b/disabled-packages/rustc-nightly/rust-rls-nightly.subpackage.sh new file mode 100644 index 000000000..e72e641ef --- /dev/null +++ b/disabled-packages/rustc-nightly/rust-rls-nightly.subpackage.sh @@ -0,0 +1,3 @@ +TERMUX_SUBPKG_DESCRIPTION="server that provides IDEs, editors, and other tools with information about Rust programs" +TERMUX_SUBPKG_INCLUDE="opt/rust-nightly/bin/rls opt/rust-nightly/share/doc/rls" +TERMUX_PKG_DEPENDS="rustc-nightly" diff --git a/disabled-packages/rustc-nightly/rust-src-nightly.subpackage.sh b/disabled-packages/rustc-nightly/rust-src-nightly.subpackage.sh new file mode 100644 index 000000000..0d3114cd4 --- /dev/null +++ b/disabled-packages/rustc-nightly/rust-src-nightly.subpackage.sh @@ -0,0 +1,3 @@ +TERMUX_SUBPKG_DESCRIPTION="rust src" +TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true +TERMUX_SUBPKG_INCLUDE="opt/rust-nightly/lib/rustlib/src" diff --git a/disabled-packages/rustc-nightly/rustc-dev-nightly.subpackage.sh b/disabled-packages/rustc-nightly/rustc-dev-nightly.subpackage.sh new file mode 100644 index 000000000..0a2fbdfb6 --- /dev/null +++ b/disabled-packages/rustc-nightly/rustc-dev-nightly.subpackage.sh @@ -0,0 +1,3 @@ +TERMUX_SUBPKG_DESCRIPTION="developer compiler libs" +INCLUDED=$(sed 's/^...../opt\/rust-nightly\//' $TERMUX_PKG_BUILDDIR/install/rustc-dev-nightly-$CARGO_TARGET_NAME/rustc-dev/manifest.in | grep -v '\.so$' ) +TERMUX_SUBPKG_INCLUDE="$INCLUDED" diff --git a/disabled-packages/rustc-nightly/rustfmt-nightly.subpackage.sh b/disabled-packages/rustc-nightly/rustfmt-nightly.subpackage.sh new file mode 100644 index 000000000..c0f5ec542 --- /dev/null +++ b/disabled-packages/rustc-nightly/rustfmt-nightly.subpackage.sh @@ -0,0 +1,4 @@ +TERMUX_SUBPKG_DESCRIPTION="A tool for formatting Rust code according to style guidelines" +TERMUX_SUBPKG_INCLUDE="opt/rust-nightly/bin/cargo-fmt opt/rust-nightly/bin/rustfmt opt/rust-nightlyshare/doc/rustfmt" +TERMUX_SUBPKG_DEPENDS="rustc-nightly" + diff --git a/disabled-packages/rustc-nightly/src-librustc_llvm-build.rs.patch b/disabled-packages/rustc-nightly/src-librustc_llvm-build.rs.patch new file mode 100644 index 000000000..53f94185f --- /dev/null +++ b/disabled-packages/rustc-nightly/src-librustc_llvm-build.rs.patch @@ -0,0 +1,12 @@ +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 ++++ ./compiler/rustc_llvm/build.rs 2019-05-05 20:56:34.090330174 +0000 +@@ -244,6 +244,8 @@ + "c++" + } else if target.contains("darwin") { + "c++" ++ } else if target.contains("android") { ++ "c++_shared" + } else if target.contains("netbsd") && llvm_static_stdcpp.is_some() { + // NetBSD uses a separate library when relocation is required + "stdc++_pic" diff --git a/disabled-packages/rustc-nightly/use-rustc-nightly b/disabled-packages/rustc-nightly/use-rustc-nightly new file mode 100644 index 000000000..1aa8b348f --- /dev/null +++ b/disabled-packages/rustc-nightly/use-rustc-nightly @@ -0,0 +1,2 @@ +#!/data/data/com.termux/files/usr/bin/sh +export PATH=/data/data/com.termux/files/usr/opt/rustc-nightly/bin:$PATH