From 2bd607112bb7953f660a67f85cbcfa7739ae84c7 Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Tue, 26 Feb 2019 21:33:42 +0100 Subject: [PATCH] build-package: mv termux_setup_rust to scripts/build/setup --- build-package.sh | 18 +----------------- scripts/build/setup/termux_setup_rust.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 scripts/build/setup/termux_setup_rust.sh diff --git a/build-package.sh b/build-package.sh index dc1aaed49..bd7f76b9f 100755 --- a/build-package.sh +++ b/build-package.sh @@ -13,23 +13,7 @@ source scripts/build/termux_download.sh source scripts/build/setup/termux_setup_golang.sh # Utility function for rust-using packages to setup a rust toolchain. -termux_setup_rust() { - if [ $TERMUX_ARCH = "arm" ]; then - CARGO_TARGET_NAME=armv7-linux-androideabi - else - CARGO_TARGET_NAME=$TERMUX_ARCH-linux-android - fi - - local ENV_NAME=CARGO_TARGET_${CARGO_TARGET_NAME^^}_LINKER - ENV_NAME=${ENV_NAME//-/_} - export $ENV_NAME=$CC - - curl https://sh.rustup.rs -sSf > $TERMUX_PKG_TMPDIR/rustup.sh - sh $TERMUX_PKG_TMPDIR/rustup.sh -y - export PATH=$HOME/.cargo/bin:$PATH - - rustup target add $CARGO_TARGET_NAME -} +source scripts/build/setup/termux_setup_rust.sh # Utility function to setup a current ninja build system. termux_setup_ninja() { diff --git a/scripts/build/setup/termux_setup_rust.sh b/scripts/build/setup/termux_setup_rust.sh new file mode 100644 index 000000000..1bd44cb74 --- /dev/null +++ b/scripts/build/setup/termux_setup_rust.sh @@ -0,0 +1,17 @@ +termux_setup_rust() { + if [ $TERMUX_ARCH = "arm" ]; then + CARGO_TARGET_NAME=armv7-linux-androideabi + else + CARGO_TARGET_NAME=$TERMUX_ARCH-linux-android + fi + + local ENV_NAME=CARGO_TARGET_${CARGO_TARGET_NAME^^}_LINKER + ENV_NAME=${ENV_NAME//-/_} + export $ENV_NAME=$CC + + curl https://sh.rustup.rs -sSf > $TERMUX_PKG_TMPDIR/rustup.sh + sh $TERMUX_PKG_TMPDIR/rustup.sh -y + export PATH=$HOME/.cargo/bin:$PATH + + rustup target add $CARGO_TARGET_NAME +}