[Android] Improve buildAndroidBOINC-CI.sh

1. It is extremely inefficient to delete downloaded files and download them again for every new build
2. Allow resuming partial downloads whenever possible
3. Delete the files when passing --clean
This commit is contained in:
Jia Yuan Lo 2020-03-13 23:24:13 +08:00 committed by GitHub
parent c7f043cb0b
commit c96d2f3ead
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -112,6 +112,10 @@ if [ "${doclean}" = "yes" ]; then
echo "cleaning build dir"
rm -rf "${BUILD_DIR}"
mkdir -p "${BUILD_DIR}"
echo "cleaning downloaded cache files"
rm -f /tmp/ndk.zip
rm -f /tmp/openssl.tgz
rm -f /tmp/curl.tgz
fi
if [ "${silent}" = "yes" ]; then
@ -125,20 +129,18 @@ CURL_FLAGFILE="$PREFIX/curl-${CURL_VERSION}-${arch}_done"
OPENSSL_FLAGFILE="$PREFIX/openssl-${OPENSSL_VERSION}-${arch}_done"
if [ ! -e "${NDK_FLAGFILE}" ]; then
rm -f /tmp/ndk.zip
rm -rf "$HOME/android-ndk-r${NDK_VERSION}"
rm -rf "${PREFIX}/${arch}"
rm -f "${CURL_FLAGFILE}" "${OPENSSL_FLAGFILE}"
wget --no-verbose -O /tmp/ndk.zip https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-linux-x86_64.zip
wget -c --no-verbose -O /tmp/ndk.zip https://dl.google.com/android/repository/android-ndk-r${NDK_VERSION}-linux-x86_64.zip
unzip -qq /tmp/ndk.zip -d $HOME
touch "${NDK_FLAGFILE}"
fi
export NDK_ROOT=$HOME/android-ndk-r${NDK_VERSION}
if [ ! -e "${OPENSSL_FLAGFILE}" ]; then
rm -f /tmp/openssl.tgz
rm -rf "$BUILD_DIR/openssl-${OPENSSL_VERSION}"
wget --no-verbose -O /tmp/openssl.tgz https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
wget -c --no-verbose -O /tmp/openssl.tgz https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
tar xzf /tmp/openssl.tgz --directory=$BUILD_DIR
export COMPILEOPENSSL="yes"
touch "${OPENSSL_FLAGFILE}"
@ -146,9 +148,8 @@ fi
export OPENSSL_SRC=$BUILD_DIR/openssl-${OPENSSL_VERSION}
if [ ! -e "${CURL_FLAGFILE}" ]; then
rm -f /tmp/curl.tgz
rm -rf "$BUILD_DIR/curl-${CURL_VERSION}"
wget --no-verbose -O /tmp/curl.tgz https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.gz
wget -c --no-verbose -O /tmp/curl.tgz https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.gz
tar xzf /tmp/curl.tgz --directory=$BUILD_DIR
export COMPILECURL="yes"
touch "${CURL_FLAGFILE}"