libzmq/builds/android/ci_build.sh
Stephan Guilloux 2a7c9efe81
Problem: Android build environment variables need clarifications. (#4443)
* Problem: Android build environment variables need clarifications.

Reason: All are spread and initialized throughout the code.

Solution: Declare, initialize and document environment variables on top of build.sh.

Side effect: This participates to documentation.
2022-10-21 10:55:33 +01:00

47 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Exit if any step fails
set -e
# Use directory of current script as the working directory
cd "$( dirname "${BASH_SOURCE[0]}" )"
# Configuration
export NDK_VERSION="${NDK_VERSION:-android-ndk-r25}"
export ANDROID_NDK_ROOT="${ANDROID_NDK_ROOT:-/tmp/${NDK_VERSION}}"
export MIN_SDK_VERSION=${MIN_SDK_VERSION:-21}
export ANDROID_BUILD_DIR="${ANDROID_BUILD_DIR:-${PWD}}"
# Cleanup.
rm -rf /tmp/android_build/
rm -rf "${PWD}/prefix"
rm -rf /tmp/tmp-deps
mkdir -p /tmp/tmp-deps
case $(uname | tr '[:upper:]' '[:lower:]') in
linux*)
HOST_PLATFORM=linux
;;
darwin*)
HOST_PLATFORM=darwin
;;
*)
echo "Unsupported platform"
exit 1
;;
esac
if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
export FILENAME=$NDK_VERSION-$HOST_PLATFORM.zip
(cd '/tmp' \
&& wget "http://dl.google.com/android/repository/${FILENAME}" -O "${FILENAME}" &> /dev/null \
&& unzip -q "${FILENAME}") || exit 1
unset FILENAME
fi
./build.sh "arm"
./build.sh "arm64"
./build.sh "x86"
./build.sh "x86_64"