1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-03 15:37:12 +02:00

Update WIP discord and some vendors.

CPR has features disabled and PCRE is fully disabled until updated to new code.
This commit is contained in:
Sandu Liviu Catalin
2023-08-05 21:31:33 +03:00
parent e0761bf3b9
commit 9298065cef
1562 changed files with 55070 additions and 76299 deletions

View File

@ -1,22 +1,63 @@
FROM ubuntu:14.04
MAINTAINER Benjamin Henrion <zoobab@gmail.com>
RUN DEBIAN_FRONTEND=noninteractive apt-get update -y -q
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q --force-yes tar git curl nano wget dialog net-tools build-essential vim emacs apt-utils file uuid-dev cmake asciidoc python autoconf automake libtool pkg-config xmlto sudo gettext apt-utils
# FROM debian:7 # APT repo no more available.
# FROM debian:8
# FROM debian:9
# FROM debian:10
# FROM debian:11
RUN useradd -d /home/zmq -m -s /bin/bash zmq
RUN echo "zmq ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/zmq
RUN chmod 0440 /etc/sudoers.d/zmq
# FROM ubuntu:12.04 # APT repo no more available.
# FROM ubuntu:14.04
# FROM ubuntu:16.04
# FROM ubuntu:18.04
# FROM ubuntu:20.04
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y -q
RUN apt-get install -y -q \
apt-utils
RUN apt-get install -y -q \
autoconf \
automake \
cmake \
file \
git \
libtool \
pkg-config \
unzip \
wget
# Create user ZMQ, and run Android build with it.
# This ensures that nothing weird is performed with
# ROOT privileges.
RUN useradd -d /home/zmq -m -s /bin/bash zmq
USER zmq
WORKDIR /home/zmq
# Install android NDK (up to NDK 22):
# ENV NDK_VERSION=android-ndk-r18 # Build failed to detect NDK tools (bug).
# ENV NDK_VERSION=android-ndk-r19 # Build passed
# ENV NDK_VERSION=android-ndk-r20 # Build passed
# ENV NDK_VERSION=android-ndk-r21 # Build passed
# ENV NDK_VERSION=android-ndk-r22 # Build passed
# RUN wget -q -O ndk_archive.zip http://dl.google.com/android/repository/${NDK_VERSION}-linux-x86_64.zip
# Install android NDK (from NDK 23):
# ENV NDK_VERSION=android-ndk-r23 # Build passed
# ENV NDK_VERSION=android-ndk-r24 # Build passed
ENV NDK_VERSION=android-ndk-r25
RUN wget -q -O ndk_archive.zip http://dl.google.com/android/repository/${NDK_VERSION}-linux.zip
RUN unzip -q ndk_archive.zip
# Clone and build LIBZMQ
ENV ANDROID_NDK_ROOT=/home/zmq/${NDK_VERSION}
RUN git clone --quiet --depth 1 https://github.com/zeromq/libzmq.git
RUN libzmq/builds/android/ci_build.sh
USER zmq
# install android-ndk
RUN cd ~ && wget -q http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -O android-ndk-r10e-linux-x86_64.bin && chmod +x android-ndk-r10e-linux-x86_64.bin
RUN cd ~ && ./android-ndk-r10e-linux-x86_64.bin
ENV ANDROID_NDK_ROOT /home/zmq/android-ndk-r10e
ENV TOOLCHAIN_NAME arm-linux-androideabi-4.9
ENV TOOLCHAIN_HOST arm-linux-androideabi
ENV TOOLCHAIN_PATH ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_NAME}/prebuilt/linux-x86_64/bin
ENV TOOLCHAIN_ARCH arm
# build libzmq for android
RUN cd ~ && git clone --depth 1 https://github.com/zeromq/libzmq.git
RUN cd ~/libzmq/builds/android && ./build.sh

View File

@ -1,33 +1,160 @@
# Android Build
## Prerequisites
## Preamble
You need the Android Native Development Kit (NDK) installed. See
[here](https://developer.android.com/ndk) to download it.
The last known NDK is automatically downloaded, if not specified otherwise.
This project is tested against Android NDK version r21d.
As indicated in the main [README](../../README.md#supported-platforms-with-primary-CI), Android support is still DRAFT.
If you installed version r21e all you have to do is to expose the NDK root
directory as environment variable, e.g:
## Configuration
export ANDROID_NDK_ROOT=$HOME/android-ndk-r21e
### Basics
If you installed another version you have to expose the NDK root directory as
well as the NDK version, e.g:
Basically, LIBZMQ build for Android, relies on exported variables.
export ANDROID_NDK_ROOT=$HOME/android-ndk-r17c
export NDK_VERSION=android-ndk-r17c
Provided build scripts can mainly be used like
To specify the minimum sdk version set the environment variable below:
export XXX=xxx
export YYY=yyy
...
cd <libzmq>/builds/android
./<build_script>
### Android NDK
LIBZMQ is tested against Android NDK versions r19 to r25.
By default, LIBZMQ uses NDK `android-ndk-r25`, but you can specify
a different one:
export NDK_VERSION=android-ndk-r23c
If you already have installed your favorite NDK somewhere, all you have to
do is to export and set NDK_VERSION and ANDROID_NDK_ROOT environment
variables, e.g:
export NDK_VERSION="android-ndk-r23b"
export ANDROID_NDK_ROOT=$HOME/${NDK_VERSION}
**Important:** ANDROID_NDK_ROOT must be an absolute path !
If you specify only NDK_VERSION, ANDROID_NDK_ROOT will be automatically set
to its default:
export ANDROID_NDK_ROOT=/tmp/${NDK_VERSION}
To specify the minimum SDK version set the environment variable below:
export MIN_SDK_VERSION=21 # Default value if unset
To specify the prefix directory set the environment variable below:
To specify the build directory set the environment variable below:
export ANDROID_BUILD_DIR=./builds/android/prefix/<android_arch> # Default value if unset
export ANDROID_BUILD_DIR=${HOME}/android_build
**Important:** ANDROID_BUILD_ROOT must be an absolute path !
### Android build folder
All Android libraries will be generated under:
${ANDROID_BUILD_DIR}/prefix/<arch>/lib
where <arch> is one of `arm`, `arm64`, `x86` or `x86_64`.
### Android build cleanup
Build and Dependency storage folders are automatically cleaned,
by ci_build.sh. This can be avoided with the help of
ANDROID_BUILD_DIR="no"
If you turn this to "no", make sure to clean what has to be, before
calling `build.sh` or `ci_build.sh`.
### Prebuilt Android libraries
Android prebuilt libraries have to be stored under
ANDROID_BUILD_DIR/prefix/<arch>/lib
Do not forget to disable [Android cleanup](#android-build-cleanup).
### Dependencies
By default, `build.sh` download dependencies under `/tmp/tmp-deps`.
You can specify another folder with the help of ANDROID_DEPENDENCIES_DIR:
ANDROID_DEPENDENCIES_DIR=${HOME}/my_dependencies
If you place your own dependency source trees there,
do not forget to disable [Android cleanup](#android-build-cleanup).
### Cryptographic configuration
The variable CURVE accepts 2 different values:
"" : LIBZMQ is built without any encryption support.
"libsodium" : LIBZMQ is built with LIBSODIUM encryption support (see below).
### Other configuration variables
You can also check configuration variables in `build.sh` itself, in its
"Configuration & tuning options" comment block.
## LIBSODIUM
LIBSODIUM is built along with LIBZMQ, when CURVE="libsodium".
- If you have your own clone of LIBSODIUM, set LIBSODIUM_ROOT to point to
its folder.
- If the variable LIBSODIUM_ROOT is not set, LIBZMQ will look for a folder
'libsodium' close to his own one.
- If no folder 'libsodium' exists, then LIBZMQ will clone LIBSODIUM from its
official STABLE branch.
## Build
In the android directory, run:
See chapter [Configuration](#configuration) for configuration options and
other details.
Select your preferred parameters:
export XXX=xxx
export YYY=yyy
...
and run:
cd <libzmq>/builds/android
./build.sh [ arm | arm64 | x86 | x86_64 ]
Parameter selection and the calls to build.sh can be located in a
SHELL script, like in ci_build.sh.
## CI build
Basically, it will call `build.sh` once, for each Android target.
This script accepts the same configuration variables, but some are set
with different default values. For instance, the dependencies are not
downloaded or cloned in `/tmp/tmp-deps, but inside LIBZMQ clone.
It can be used in the same way as build.sh
export XXX=xxx
export YYY=yyy
cd <libzmq>/builds/android
./ci_build.sh
## Dockerfile
An example of Docker file is provided, for Ubuntu 22.04
Minimal changes are required to support Debian 9 to 11.
Minimal changes are required to support CentOS (7 only), Rocky Linux (8 & 9),
and many Fedora (22 to 37).

View File

@ -31,6 +31,7 @@
#
###
#
# Courtesy of Joe Eli McIlvain; original code at:
# https://github.com/jemc/android_build_helper
# android_build_helper.sh
#
@ -43,24 +44,27 @@
# To get the latest version of this script, please download from:
# https://github.com/jemc/android_build_helper
#
# You are free to modify this script, but if you add improvements,
# please consider submitting a pull request to the aforementioned upstream
# repository for the benefit of other users.
# You are free to modify and redistribute this script, but if you add
# improvements, please consider submitting a pull request or patch to the
# aforementioned upstream repository for the benefit of other users.
#
# This script is provided with no express or implied warranties.
#
# Get directory of current script (if not already set)
# This directory is also the basis for the build directories the get created.
if [ -z "$ANDROID_BUILD_DIR" ]; then
ANDROID_BUILD_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
fi
# Set up a variable to hold the global failure reasons, separated by newlines
# (Empty string indicates no failure)
ANDROID_BUILD_FAIL=()
########################################################################
# Utilities & helper functions
########################################################################
function android_build_trace {
if [ -n "${BUILD_ARCH}" ] ; then
echo "LIBZMQ (${BUILD_ARCH}) - $*"
else
echo "LIBZMQ - $*"
fi
}
function android_build_check_fail {
if [ ! ${#ANDROID_BUILD_FAIL[@]} -eq 0 ]; then
echo "Android (${TOOLCHAIN_ARCH}) build failed for the following reasons:"
android_build_trace "Android build failed for the following reasons:"
for reason in "${ANDROID_BUILD_FAIL[@]}"; do
local formatted_reason=" ${reason}"
echo "${formatted_reason}"
@ -69,36 +73,122 @@ function android_build_check_fail {
fi
}
function android_download_ndk {
if [ -d "${ANDROID_NDK_ROOT}" ] ; then
# NDK folder detected, let's assume it's valid ...
android_build_trace "Using existing NDK folder '${ANDROID_NDK_ROOT}'."
return
fi
if [ ! -d "$(dirname "${ANDROID_NDK_ROOT}")" ] ; then
ANDROID_BUILD_FAIL+=("Cannot download NDK in a non existing folder")
ANDROID_BUILD_FAIL+=(" $(dirname "${ANDROID_NDK_ROOT}/")")
fi
android_build_check_fail
local filename
local platform="$(uname | tr '[:upper:]' '[:lower:]')"
case "${platform}" in
linux*)
if [ "${NDK_NUMBER}" -ge 2300 ] ; then
# Since NDK 23, NDK archives are renamed.
filename=${NDK_VERSION}-linux.zip
else
filename=${NDK_VERSION}-linux-x86_64.zip
fi
;;
darwin*)
if [ "${NDK_NUMBER}" -ge 2300 ] ; then
# Since NDK 23, NDK archives are renamed.
filename=${NDK_VERSION}-darwin.zip
else
filename=${NDK_VERSION}-darwin-x86_64.zip
fi
;;
*) android_build_trace "Unsupported platform ('${platform}')" ; exit 1 ;;
esac
if [ -z "${filename}" ] ; then
ANDROID_BUILD_FAIL+=("Unable to detect NDK filename.")
fi
android_build_check_fail
android_build_trace "Downloading NDK '${NDK_VERSION}'..."
(
cd "$(dirname "${ANDROID_NDK_ROOT}")" \
&& rm -f "${filename}" \
&& wget -q "http://dl.google.com/android/repository/${filename}" -O "${filename}" \
&& android_build_trace "Extracting NDK '${filename}'..." \
&& unzip -q "${filename}" \
&& android_build_trace "NDK extracted under '${ANDROID_NDK_ROOT}'."
) || {
ANDROID_BUILD_FAIL+=("Failed to install NDK ('${NDK_VERSION}')")
ANDROID_BUILD_FAIL+=(" ${filename}")
}
android_build_check_fail
}
function android_build_set_env {
BUILD_ARCH=$1
export TOOLCHAIN_PATH="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${HOST_PLATFORM}/bin"
local platform="$(uname | tr '[:upper:]' '[:lower:]')"
case "${platform}" in
linux*)
export ANDROID_BUILD_PLATFORM=linux-x86_64
;;
darwin*)
export ANDROID_BUILD_PLATFORM=darwin-x86_64
;;
*) android_build_trace "Unsupported platform ('${platform}')" ; exit 1 ;;
esac
export ANDROID_BUILD_TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${ANDROID_BUILD_PLATFORM}"
export TOOLCHAIN_PATH="${ANDROID_BUILD_TOOLCHAIN}/bin"
# Set variables for each architecture
if [ $BUILD_ARCH == "arm" ]; then
if [ "${BUILD_ARCH}" == "arm" ]; then
export TOOLCHAIN_HOST="arm-linux-androideabi"
export TOOLCHAIN_COMP="armv7a-linux-androideabi${MIN_SDK_VERSION}"
export TOOLCHAIN_ABI="armeabi-v7a"
export TOOLCHAIN_ARCH="arm"
elif [ $BUILD_ARCH == "x86" ]; then
elif [ "${BUILD_ARCH}" == "x86" ]; then
export TOOLCHAIN_HOST="i686-linux-android"
export TOOLCHAIN_COMP="i686-linux-android${MIN_SDK_VERSION}"
export TOOLCHAIN_ABI="x86"
export TOOLCHAIN_ARCH="x86"
elif [ $BUILD_ARCH == "arm64" ]; then
elif [ "${BUILD_ARCH}" == "arm64" ]; then
export TOOLCHAIN_HOST="aarch64-linux-android"
export TOOLCHAIN_COMP="aarch64-linux-android${MIN_SDK_VERSION}"
export TOOLCHAIN_ABI="arm64-v8a"
export TOOLCHAIN_ARCH="arm64"
elif [ $BUILD_ARCH == "x86_64" ]; then
elif [ "${BUILD_ARCH}" == "x86_64" ]; then
export TOOLCHAIN_HOST="x86_64-linux-android"
export TOOLCHAIN_COMP="x86_64-linux-android${MIN_SDK_VERSION}"
export TOOLCHAIN_ABI="x86_64"
export TOOLCHAIN_ARCH="x86_64"
fi
export ANDROID_BUILD_SYSROOT="${ANDROID_NDK_ROOT}/platforms/android-${MIN_SDK_VERSION}/arch-${TOOLCHAIN_ARCH}"
# Since NDK r22 the "platforms" dir got removed
if [ -d "${ANDROID_NDK_ROOT}/platforms" ]; then
export ANDROID_BUILD_SYSROOT="${ANDROID_NDK_ROOT}/platforms/android-${MIN_SDK_VERSION}/arch-${TOOLCHAIN_ARCH}"
else
export ANDROID_BUILD_SYSROOT="${ANDROID_BUILD_TOOLCHAIN}/sysroot"
fi
export ANDROID_BUILD_PREFIX="${ANDROID_BUILD_DIR}/prefix/${TOOLCHAIN_ARCH}"
# Since NDK r25, libc++_shared.so is no more in 'sources/cxx-stl/...'
export ANDROID_STL="libc++_shared.so"
if [ -x "${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/${TOOLCHAIN_ABI}/${ANDROID_STL}" ] ; then
export ANDROID_STL_ROOT="${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/${TOOLCHAIN_ABI}"
else
export ANDROID_STL_ROOT="${ANDROID_BUILD_SYSROOT}/usr/lib/${TOOLCHAIN_HOST}"
# NDK 25 requires -L<path-to-libc.so> ...
# I don't understand why, but without it, ./configure fails to build a valid 'conftest'.
export ANDROID_LIBC_ROOT="${ANDROID_BUILD_SYSROOT}/usr/lib/${TOOLCHAIN_HOST}/${MIN_SDK_VERSION}"
fi
}
function android_build_env {
@ -107,12 +197,17 @@ function android_build_env {
if [ -z "$ANDROID_NDK_ROOT" ]; then
ANDROID_BUILD_FAIL+=("Please set the ANDROID_NDK_ROOT environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"/home/user/android/android-ndk-r20\")")
ANDROID_BUILD_FAIL+=(" (eg. \"/home/user/android/android-ndk-r25\")")
fi
if [ -z "$ANDROID_BUILD_TOOLCHAIN" ]; then
ANDROID_BUILD_FAIL+=("Please set the ANDROID_BUILD_TOOLCHAIN environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"/home/user/android/android-ndk-r25/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64\")")
fi
if [ -z "$TOOLCHAIN_PATH" ]; then
ANDROID_BUILD_FAIL+=("Please set the TOOLCHAIN_PATH environment variable")
ANDROID_BUILD_FAIL+=(" (eg. \"/home/user/android/android-ndk-r20/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin\")")
ANDROID_BUILD_FAIL+=(" (eg. \"/home/user/android/android-ndk-r25/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin\")")
fi
if [ -z "$TOOLCHAIN_HOST" ]; then
@ -145,6 +240,21 @@ function android_build_env {
ANDROID_BUILD_FAIL+=(" ${ANDROID_NDK_ROOT}")
fi
if [ ! -d "$ANDROID_STL_ROOT" ]; then
ANDROID_BUILD_FAIL+=("The ANDROID_STL_ROOT directory does not exist")
ANDROID_BUILD_FAIL+=(" ${ANDROID_STL_ROOT}")
fi
if [ -n "${ANDROID_LIBC_ROOT}" ] && [ ! -d "${ANDROID_LIBC_ROOT}" ]; then
ANDROID_BUILD_FAIL+=("The ANDROID_LIBC_ROOT directory does not exist")
ANDROID_BUILD_FAIL+=(" ${ANDROID_LIBC_ROOT}")
fi
if [ ! -d "${ANDROID_BUILD_TOOLCHAIN}" ]; then
ANDROID_BUILD_FAIL+=("The ANDROID_BUILD_TOOLCHAIN directory does not exist")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_TOOLCHAIN}")
fi
if [ ! -d "$TOOLCHAIN_PATH" ]; then
ANDROID_BUILD_FAIL+=("The TOOLCHAIN_PATH directory does not exist")
ANDROID_BUILD_FAIL+=(" ${TOOLCHAIN_PATH}")
@ -167,58 +277,74 @@ function android_build_env {
}
function _android_build_opts_process_binaries {
local TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${HOST_PLATFORM}"
local CC="${TOOLCHAIN_PATH}/${TOOLCHAIN_COMP}-clang"
local CXX="${TOOLCHAIN_PATH}/${TOOLCHAIN_COMP}-clang++"
local LD="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ld"
local AS="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-as"
local AR="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ar"
local RANLIB="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ranlib"
local STRIP="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-strip"
export ANDROID_BUILD_CC="${TOOLCHAIN_PATH}/${TOOLCHAIN_COMP}-clang"
export ANDROID_BUILD_CXX="${TOOLCHAIN_PATH}/${TOOLCHAIN_COMP}-clang++"
# Since NDK r22 the "platforms" dir got removed and the default linker is LLD
if [ -d "${ANDROID_NDK_ROOT}/platforms" ]; then
export ANDROID_BUILD_LD="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ld"
else
export ANDROID_BUILD_LD="${TOOLCHAIN_PATH}/ld"
fi
# Since NDK r24 this binary was removed due to LLVM being now the default
if [ ! -x "${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-as" ]; then
export ANDROID_BUILD_AS="${TOOLCHAIN_PATH}/llvm-as"
else
export ANDROID_BUILD_AS="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-as"
fi
# Since NDK r23 those binaries were removed due to LLVM being now the default
if [ ! -x "${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ar" ]; then
export ANDROID_BUILD_AR="${TOOLCHAIN_PATH}/llvm-ar"
export ANDROID_BUILD_RANLIB="${TOOLCHAIN_PATH}/llvm-ranlib"
export ANDROID_BUILD_STRIP="${TOOLCHAIN_PATH}/llvm-strip"
else
export ANDROID_BUILD_AR="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ar"
export ANDROID_BUILD_RANLIB="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ranlib"
export ANDROID_BUILD_STRIP="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-strip"
fi
if [ ! -x "${CC}" ]; then
if [ ! -x "${ANDROID_BUILD_CC}" ]; then
ANDROID_BUILD_FAIL+=("The CC binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${CC}")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_CC}")
fi
if [ ! -x "${CXX}" ]; then
if [ ! -x "${ANDROID_BUILD_CXX}" ]; then
ANDROID_BUILD_FAIL+=("The CXX binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${CXX}")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_CXX}")
fi
if [ ! -x "${LD}" ]; then
if [ ! -x "${ANDROID_BUILD_LD}" ]; then
ANDROID_BUILD_FAIL+=("The LD binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${LD}")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_LD}")
fi
if [ ! -x "${AS}" ]; then
if [ ! -x "${ANDROID_BUILD_AS}" ]; then
ANDROID_BUILD_FAIL+=("The AS binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${AS}")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_AS}")
fi
if [ ! -x "${AR}" ]; then
if [ ! -x "${ANDROID_BUILD_AR}" ]; then
ANDROID_BUILD_FAIL+=("The AR binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${AR}")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_AR}")
fi
if [ ! -x "${RANLIB}" ]; then
if [ ! -x "${ANDROID_BUILD_RANLIB}" ]; then
ANDROID_BUILD_FAIL+=("The RANLIB binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${RANLIB}")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_RANLIB}")
fi
if [ ! -x "${STRIP}" ]; then
if [ ! -x "${ANDROID_BUILD_STRIP}" ]; then
ANDROID_BUILD_FAIL+=("The STRIP binary does not exist or is not executable")
ANDROID_BUILD_FAIL+=(" ${STRIP}")
ANDROID_BUILD_FAIL+=(" ${ANDROID_BUILD_STRIP}")
fi
ANDROID_BUILD_OPTS+=("TOOLCHAIN=${TOOLCHAIN}")
ANDROID_BUILD_OPTS+=("CC=${CC}")
ANDROID_BUILD_OPTS+=("CXX=${CXX}")
ANDROID_BUILD_OPTS+=("LD=${LD}")
ANDROID_BUILD_OPTS+=("AS=${AS}")
ANDROID_BUILD_OPTS+=("AR=${AR}")
ANDROID_BUILD_OPTS+=("RANLIB=${RANLIB}")
ANDROID_BUILD_OPTS+=("STRIP=${STRIP}")
ANDROID_BUILD_OPTS+=("TOOLCHAIN=${ANDROID_BUILD_TOOLCHAIN}")
ANDROID_BUILD_OPTS+=("CC=${ANDROID_BUILD_CC}")
ANDROID_BUILD_OPTS+=("CXX=${ANDROID_BUILD_CXX}")
ANDROID_BUILD_OPTS+=("LD=${ANDROID_BUILD_LD}")
ANDROID_BUILD_OPTS+=("AS=${ANDROID_BUILD_AS}")
ANDROID_BUILD_OPTS+=("AR=${ANDROID_BUILD_AR}")
ANDROID_BUILD_OPTS+=("RANLIB=${ANDROID_BUILD_RANLIB}")
ANDROID_BUILD_OPTS+=("STRIP=${ANDROID_BUILD_STRIP}")
android_build_check_fail
}
@ -229,19 +355,35 @@ function android_build_opts {
_android_build_opts_process_binaries
local LIBS="-lc -lgcc -ldl -lm -llog -lc++_shared"
local LDFLAGS="-L${ANDROID_BUILD_PREFIX}/lib"
LDFLAGS+=" -L${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/${TOOLCHAIN_ABI}"
CFLAGS+=" -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE"
CPPFLAGS+=" -I${ANDROID_BUILD_PREFIX}/include"
# Since NDK r23 we don't need -lgcc due to LLVM being now the default
if [ ! -x "${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-ar" ]; then
export ANDROID_BUILD_LIBS="-lc -ldl -lm -llog -lc++_shared"
else
export ANDROID_BUILD_LIBS="-lc -lgcc -ldl -lm -llog -lc++_shared"
fi
ANDROID_BUILD_OPTS+=("CFLAGS=${CFLAGS} ${ANDROID_BUILD_EXTRA_CFLAGS}")
ANDROID_BUILD_OPTS+=("CPPFLAGS=${CPPFLAGS} ${ANDROID_BUILD_EXTRA_CPPFLAGS}")
ANDROID_BUILD_OPTS+=("CXXFLAGS=${CXXFLAGS} ${ANDROID_BUILD_EXTRA_CXXFLAGS}")
ANDROID_BUILD_OPTS+=("LDFLAGS=${LDFLAGS} ${ANDROID_BUILD_EXTRA_LDFLAGS}")
ANDROID_BUILD_OPTS+=("LIBS=${LIBS} ${ANDROID_BUILD_EXTRA_LIBS}")
export ANDROID_BUILD_LDFLAGS="-L${ANDROID_BUILD_PREFIX}/lib"
if [ -n "${ANDROID_LIBC_ROOT}" ] ; then
ANDROID_BUILD_LDFLAGS+=" -L${ANDROID_LIBC_ROOT}"
fi
ANDROID_BUILD_LDFLAGS+=" -L${ANDROID_STL_ROOT}"
ANDROID_BUILD_OPTS+=("PKG_CONFIG_LIBDIR=${ANDROID_NDK_ROOT}/prebuilt/${HOST_PLATFORM}/lib/pkgconfig")
export ANDROID_BUILD_CFLAGS+=" -D_GNU_SOURCE -D_REENTRANT -D_THREAD_SAFE"
export ANDROID_BUILD_CPPFLAGS+=" -I${ANDROID_BUILD_PREFIX}/include"
if [ "${NDK_NUMBER}" -ge 2400 ] ; then
if [ "${BUILD_ARCH}" = "arm64" ] ; then
export ANDROID_BUILD_CXXFLAGS+=" -mno-outline-atomics"
fi
fi
ANDROID_BUILD_OPTS+=("CFLAGS=${ANDROID_BUILD_CFLAGS} ${ANDROID_BUILD_EXTRA_CFLAGS}")
ANDROID_BUILD_OPTS+=("CPPFLAGS=${ANDROID_BUILD_CPPFLAGS} ${ANDROID_BUILD_EXTRA_CPPFLAGS}")
ANDROID_BUILD_OPTS+=("CXXFLAGS=${ANDROID_BUILD_CXXFLAGS} ${ANDROID_BUILD_EXTRA_CXXFLAGS}")
ANDROID_BUILD_OPTS+=("LDFLAGS=${ANDROID_BUILD_LDFLAGS} ${ANDROID_BUILD_EXTRA_LDFLAGS}")
ANDROID_BUILD_OPTS+=("LIBS=${ANDROID_BUILD_LIBS} ${ANDROID_BUILD_EXTRA_LIBS}")
ANDROID_BUILD_OPTS+=("PKG_CONFIG_LIBDIR=${ANDROID_NDK_ROOT}/prebuilt/${ANDROID_BUILD_PLATFORM}/lib/pkgconfig")
ANDROID_BUILD_OPTS+=("PKG_CONFIG_PATH=${ANDROID_BUILD_PREFIX}/lib/pkgconfig")
ANDROID_BUILD_OPTS+=("PKG_CONFIG_SYSROOT_DIR=${ANDROID_BUILD_SYSROOT}")
ANDROID_BUILD_OPTS+=("PKG_CONFIG_DIR=")
@ -267,19 +409,20 @@ function android_build_verify_so {
fi
android_build_check_fail
local READELF="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-readelf"
if command -v ${READELF} >/dev/null 2>&1 ; then
local readelf_bin="${READELF}"
local readelf="${TOOLCHAIN_PATH}/${TOOLCHAIN_HOST}-readelf"
if command -v "${readelf}" >/dev/null 2>&1 ; then
export ANDROID_BUILD_READELF="${readelf}"
elif command -v readelf >/dev/null 2>&1 ; then
local readelf_bin="readelf"
export ANDROID_BUILD_READELF="readelf"
elif command -v greadelf >/dev/null 2>&1 ; then
local readelf_bin="greadelf"
export ANDROID_BUILD_READELF="greadelf"
else
ANDROID_BUILD_FAIL+=("Could not find any of readelf, greadelf, or ${READELF}")
ANDROID_BUILD_FAIL+=("Could not find any of readelf, greadelf, or ${readelf}")
fi
android_build_check_fail
local elfoutput=$(LC_ALL=C $readelf_bin -d ${sofile})
local elfoutput
elfoutput=$(LC_ALL=C ${ANDROID_BUILD_READELF} -d "${sofile}")
local soname_regexp='soname: \[([[:alnum:]\.]+)\]'
if [[ $elfoutput =~ $soname_regexp ]]; then
@ -293,8 +436,12 @@ function android_build_verify_so {
ANDROID_BUILD_FAIL+=(" ${elfoutput}")
fi
for dep_soname do
if [[ $elfoutput != *"library: [${dep_soname}]"* ]]; then
for dep_soname in "$@" ; do
local dep_sofile="${ANDROID_BUILD_PREFIX}/lib/${dep_soname}"
if [ ! -f "${dep_sofile}" ]; then
ANDROID_BUILD_FAIL+=("Found no library named ${dep_soname}")
ANDROID_BUILD_FAIL+=(" ${dep_sofile}")
elif [[ $elfoutput != *"library: [${dep_soname}]"* ]]; then
ANDROID_BUILD_FAIL+=("Library ${soname} was expected to be linked to library with soname:")
ANDROID_BUILD_FAIL+=(" ${dep_soname}")
fi
@ -302,3 +449,185 @@ function android_build_verify_so {
android_build_check_fail
}
function android_show_configure_opts {
local tag=$1
shift
android_build_trace "./configure options to build '${tag}':"
for opt in "$@"; do
echo " > ${opt}"
done
echo ""
}
# Initialize env variable XXX_ROOT, given dependency name "xxx".
# If XXX_ROOT is not set:
# If ${PROJECT_ROOT}/../xxx exists
# set XXX_ROOT with it.
# Else
# set XXX_ROOT with ${ANDROID_DEPENDENCIES_DIR}/xxx.
# Else
# Verify that folder XXX_ROOT exists.
function android_init_dependency_root {
local lib_name
lib_name="$1"
local variable_name
variable_name="$(echo "${lib_name}" | tr '[:lower:]' '[:upper:]')_ROOT"
local variable_value
variable_value="$(eval echo "\${${variable_name}}")"
if [ -z "${PROJECT_ROOT}" ] ; then
android_build_trace "Error: Variable PROJECT_ROOT is not set."
exit 1
fi
if [ ! -d "${PROJECT_ROOT}" ] ; then
android_build_trace "Error: Cannot find folder '${PROJECT_ROOT}'."
exit 1
fi
if [ -z "${variable_value}" ] ; then
if [ -d "${PROJECT_ROOT}/../${lib_name}" ] ; then
eval "export ${variable_name}=\"$(cd "${PROJECT_ROOT}/../${lib_name}" && pwd)\""
else
eval "export ${variable_name}=\"${ANDROID_DEPENDENCIES_DIR}/${lib_name}\""
fi
variable_value="$(eval echo "\${${variable_name}}")"
elif [ ! -d "${variable_value}" ] ; then
android_build_trace "Error: Folder '${variable_value}' does not exist."
exit 1
fi
android_build_trace "${variable_name}=${variable_value}"
}
function android_download_library {
local tag="$1" ; shift
local root="$1" ; shift
local url="$1" ; shift
local parent="$(dirname "${root}")"
local archive="$(basename "${url}")"
mkdir -p "${parent}"
cd "${parent}"
android_build_trace "Downloading ${tag} from '${url}' ..."
rm -f "${archive}"
wget -q "${url}"
case "${archive}" in
*."tar.gz" ) folder="$(basename "${archive}" ".tar.gz")" ;;
*."tgz" ) folder="$(basename "${archive}" ".tgz")" ;;
* ) android_build_trace "Unsupported extension for '${archive}'." ; exit 1 ;;
esac
android_build_trace "Extracting '${archive}' ..."
tar -xzf "${archive}"
if [ ! -d "${root}" ] ; then
mv "${folder}" "${root}"
fi
android_build_trace "${tag} extracted under under '${root}'."
}
function android_clone_library {
local tag="$1" ; shift
local root="$1" ; shift
local url="$1" ; shift
local branch="$1" ; shift
mkdir -p "$(dirname "${root}")"
if [ -n "${branch}" ] ; then
android_build_trace "Cloning '${url}' (branch '${branch}') under '${root}'."
git clone --quiet --depth 1 -b "${branch}" "${url}" "${root}"
else
android_build_trace "Cloning '${url}' (default branch) under '${root}'."
git clone --quiet --depth 1 "${url}" "${root}"
fi
( cd "${root}" && git log --oneline -n 1) || exit 1
}
# Caller must set CONFIG_OPTS[], before call.
function android_build_library {
local tag=$1 ; shift
local root=$1 ; shift
android_build_trace "Cleaning library '${tag}'."
(
if [ -n "${ANDROID_BUILD_PREFIX}" ] && [ -d "${ANDROID_BUILD_PREFIX}" ] ; then
# Remove *.la files as they might cause errors with cross compiled libraries
find "${ANDROID_BUILD_PREFIX}" -name '*.la' -exec rm {} +
fi
cd "${root}" \
&& ( make clean || : ) \
&& rm -f config.status
) &> /dev/null
android_build_trace "Building library '${tag}'."
(
set -e
android_show_configure_opts "${tag}" "${CONFIG_OPTS[@]}"
cd "${root}"
if [ -e autogen.sh ]; then
./autogen.sh 2> /dev/null
fi
if [ -e buildconf ]; then
./buildconf 2> /dev/null
fi
if [ ! -e autogen.sh ] && [ ! -e buildconf ] && [ ! -e ./configure ] && [ -s ./configure.ac ] ; then
libtoolize --copy --force && \
aclocal -I . && \
autoheader && \
automake --add-missing --copy && \
autoconf || \
autoreconf -fiv
fi
./configure "${CONFIG_OPTS[@]}"
make -j 4
make install
)
}
########################################################################
# Initialization
########################################################################
# Get directory of current script (if not already set)
# This directory is also the basis for the build directories the get created.
if [ -z "$ANDROID_BUILD_DIR" ]; then
export ANDROID_BUILD_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
fi
# Where to download our dependencies
export ANDROID_DEPENDENCIES_DIR="${ANDROID_DEPENDENCIES_DIR:-/tmp/tmp-deps}"
# Set up a variable to hold the global failure reasons, separated by newlines
# (Empty string indicates no failure)
ANDROID_BUILD_FAIL=()
########################################################################
# Sanity checks
########################################################################
case "${NDK_VERSION}" in
"android-ndk-r"[0-9][0-9] ) : ;;
"android-ndk-r"[0-9][0-9][a-z] ) : ;;
"" ) android_build_trace "Variable NDK_VERSION not set." ; exit 1 ;;
* ) android_build_trace "Invalid format for NDK_VERSION ('${NDK_VERSION}')" ; exit 1 ;;
esac
if [ -z "${ANDROID_NDK_ROOT}" ] ; then
android_build_trace "ANDROID_NDK_ROOT not set !"
exit 1
fi
########################################################################
# Compute NDK version into a numeric form:
# android-ndk-r21e -> 2105
# android-ndk-r25 -> 2500
########################################################################
export NDK_NUMBER="$(( $(echo "${NDK_VERSION}"|sed -e 's|android-ndk-r||g' -e 's|[a-z]||g') * 100 ))"
NDK_VERSION_LETTER="$(echo "${NDK_VERSION}"|sed -e 's|android-ndk-r[0-9][0-9]||g'|tr '[:lower:]' '[:upper:]')"
if [ -n "${NDK_VERSION_LETTER}" ] ; then
NDK_NUMBER=$(( $(( NDK_NUMBER + $(printf '%d' \'"${NDK_VERSION_LETTER}") )) - 64 ))
fi
android_build_trace "Configured NDK_VERSION: ${NDK_VERSION} ($NDK_NUMBER)."

View File

@ -1,101 +1,154 @@
#!/usr/bin/env bash
#
# Exit if any step fails
set -e
function usage {
echo "Usage ./build.sh [ arm | arm64 | x86 | x86_64 ]"
}
# Use directory of current script as the build directory and working directory
# Use directory of current script as the working directory
cd "$( dirname "${BASH_SOURCE[0]}" )"
ANDROID_BUILD_DIR="${ANDROID_BUILD_DIR:-`pwd`}"
# Get access to android_build functions and variables
source ./android_build_helper.sh
# Choose a C++ standard library implementation from the ndk
ANDROID_BUILD_CXXSTL="gnustl_shared_49"
BUILD_ARCH=$1
if [ -z $BUILD_ARCH ]; then
usage
exit 1
fi
case $(uname | tr '[:upper:]' '[:lower:]') in
linux*)
export HOST_PLATFORM=linux-x86_64
;;
darwin*)
export HOST_PLATFORM=darwin-x86_64
;;
*)
echo "Unsupported platform"
exit 1
;;
esac
PROJECT_ROOT="$(cd ../.. && pwd)"
########################################################################
# Configuration & tuning options.
########################################################################
# Set default values used in ci builds
export NDK_VERSION="${NDK_VERSION:-android-ndk-r25}"
export NDK_VERSION=${NDK_VERSION:-android-ndk-r21e}
# With NDK r21e, the minimum SDK version range is [16, 29].
# Set default path to find Android NDK.
# Must be of the form <path>/${NDK_VERSION} !!
export ANDROID_NDK_ROOT="${ANDROID_NDK_ROOT:-/tmp/${NDK_VERSION}}"
# With NDK r22b, the minimum SDK version range is [16, 31].
# Since NDK r24, the minimum SDK version range is [19, 31].
# SDK version 21 is the minimum version for 64-bit builds.
export MIN_SDK_VERSION=${MIN_SDK_VERSION:-21}
# Use directory of current script as the build directory
# ${ANDROID_BUILD_DIR}/prefix/<build_arch>/lib will contain produced libraries
export ANDROID_BUILD_DIR="${ANDROID_BUILD_DIR:-${PWD}}"
# Where to download our dependencies: default to /tmp/tmp-deps
export ANDROID_DEPENDENCIES_DIR="${ANDROID_DEPENDENCIES_DIR:-/tmp/tmp-deps}"
# Clean before processing
export ANDROID_BUILD_CLEAN="${ANDROID_BUILD_CLEAN:-no}"
# Set this to 'no', to enable verbose ./configure
export CI_CONFIG_QUIET="${CI_CONFIG_QUIET:-no}"
# Select CURVE implementation:
# - "" # Do not use any CURVE implementation.
# - "libsodium" # Use LIBSODIUM implementation.
export CURVE="${CURVE:-}"
# By default, dependencies will be cloned to /tmp/tmp-deps.
# If you have your own source tree for LIBSODIUM, uncomment
# the line below, and provide its absolute path:
# export LIBSODIUM_ROOT="<absolute_path_to_LIBSODIUM_source_tree>"
########################################################################
# Utilities
########################################################################
# Get access to android_build functions and variables
# Perform some sanity checks and calculate some variables.
source "${PROJECT_ROOT}/builds/android/android_build_helper.sh"
function usage {
echo "LIBZMQ - Usage:"
echo " export XXX=xxx"
echo " ./build.sh [ arm | arm64 | x86 | x86_64 ]"
echo ""
echo "See this file (configuration & tuning options) for details"
echo "on variables XXX and their values xxx"
exit 1
}
########################################################################
# Sanity checks
########################################################################
BUILD_ARCH="$1"
[ -z "${BUILD_ARCH}" ] && usage
# Set ROOT path for LIBSODIUM source tree, if CURVE is "libsodium"
if [ "${CURVE}x" = "libsodiumx" ] ; then
# Check or initialize LIBSODIUM_ROOT
android_init_dependency_root "libsodium"
fi
########################################################################
# Compilation
########################################################################
# Choose a C++ standard library implementation from the ndk
export ANDROID_BUILD_CXXSTL="gnustl_shared_49"
# Additional flags for LIBTOOL, for LIBZMQ and other dependencies.
export LIBTOOL_EXTRA_LDFLAGS='-avoid-version'
# Set up android build environment and set ANDROID_BUILD_OPTS array
android_build_set_env $BUILD_ARCH
android_build_set_env "${BUILD_ARCH}"
android_download_ndk
android_build_env
android_build_opts
# Use a temporary build directory
cache="/tmp/android_build/${TOOLCHAIN_ARCH}"
rm -rf "${cache}"
mkdir -p "${cache}"
# Check for environment variable to clear the prefix and do a clean build
if [[ $ANDROID_BUILD_CLEAN ]]; then
echo "Doing a clean build (removing previous build and depedencies)..."
rm -rf "${ANDROID_BUILD_PREFIX}"/*
if [ "${ANDROID_BUILD_CLEAN}" = "yes" ]; then
android_build_trace "Doing a clean build (removing previous build and dependencies)..."
rm -rf "${ANDROID_BUILD_PREFIX:?}"/*
# Called shells MUST not clean after ourselves !
export ANDROID_BUILD_CLEAN="no"
fi
if [ -z $CURVE ]; then
DEPENDENCIES=()
if [ -z "${CURVE}" ]; then
CURVE="--disable-curve"
VERIFY="libzmq.so"
elif [ $CURVE == "libsodium" ]; then
elif [ "${CURVE}" == "libsodium" ]; then
CURVE="--with-libsodium=yes"
VERIFY="libzmq.so libsodium.so"
DEPENDENCIES+=("libsodium.so")
##
# Build libsodium from latest master branch
# Build LIBSODIUM from latest STABLE branch
(android_build_verify_so "libsodium.so" &> /dev/null) || {
rm -rf "${cache}/libsodium"
(cd "${cache}" && git clone -b stable --depth 1 git://github.com/jedisct1/libsodium.git) || exit 1
(cd "${cache}/libsodium" && ./autogen.sh \
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" --disable-soname-versions \
&& make -j 4 \
&& make install) || exit 1
if [ ! -d "${LIBSODIUM_ROOT}" ] ; then
android_clone_library "LIBSODIUM" "${LIBSODIUM_ROOT}" "https://github.com/jedisct1/libsodium.git" "stable"
fi
(
CONFIG_OPTS=()
[ "${CI_CONFIG_QUIET}" = "yes" ] && CONFIG_OPTS+=("--quiet")
CONFIG_OPTS+=("${ANDROID_BUILD_OPTS[@]}")
CONFIG_OPTS+=("--without-docs")
CONFIG_OPTS+=("--disable-soname-versions")
android_build_library "LIBSODIUM" "${LIBSODIUM_ROOT}"
) || exit 1
}
elif [ $CURVE == "tweetnacl" ]; then
# Default
CURVE=""
VERIFY="libzmq.so"
fi
##
# Build libzmq from local source
LIBTOOL_EXTRA_LDFLAGS='-avoid-version'
(android_build_verify_so "libzmq.so" "${DEPENDENCIES[@]}" &> /dev/null) || {
(
CONFIG_OPTS=()
[ "${CI_CONFIG_QUIET}" = "yes" ] && CONFIG_OPTS+=("--quiet")
CONFIG_OPTS+=("${ANDROID_BUILD_OPTS[@]}")
CONFIG_OPTS+=("${CURVE}")
CONFIG_OPTS+=("--without-docs")
(android_build_verify_so ${VERIFY} &> /dev/null) || {
rm -rf "${cache}/libzmq"
(cp -r ../.. "${cache}/libzmq" && cd "${cache}/libzmq" && make clean)
(cd "${cache}/libzmq" && ./autogen.sh \
&& ./configure --quiet "${ANDROID_BUILD_OPTS[@]}" ${CURVE} --without-docs \
&& make -j 4 \
&& make install) || exit 1
android_build_library "LIBZMQ" "${PROJECT_ROOT}"
) || exit 1
}
##
# Verify shared libraries in prefix
# Fetch the STL as well.
android_build_verify_so ${VERIFY}
echo "libzmq android build succeeded"
cp "${ANDROID_STL_ROOT}/${ANDROID_STL}" "${ANDROID_BUILD_PREFIX}/lib/."
##
# Verify shared libraries in prefix
for library in "libzmq.so" "${DEPENDENCIES[@]}" ; do
android_build_verify_so "${library}"
done
android_build_verify_so "libzmq.so" "${DEPENDENCIES[@]}" "${ANDROID_STL}"
android_build_trace "Android build successful"

View File

@ -1,28 +1,28 @@
#!/usr/bin/env bash
#
# Exit if any step fails
set -e
export NDK_VERSION=android-ndk-r21e
export ANDROID_NDK_ROOT="/tmp/${NDK_VERSION}"
# Use directory of current script as the working directory
cd "$( dirname "${BASH_SOURCE[0]}" )"
case $(uname | tr '[:upper:]' '[:lower:]') in
linux*)
HOST_PLATFORM=linux-x86_64
;;
darwin*)
HOST_PLATFORM=darwin-x86_64
;;
*)
echo "Unsupported platform"
exit 1
;;
esac
# 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}/.build}"
export ANDROID_BUILD_CLEAN="${ANDROID_BUILD_CLEAN:-yes}"
export ANDROID_DEPENDENCIES_DIR="${ANDROID_DEPENDENCIES_DIR:-${PWD}/.deps}"
if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
export FILENAME=$NDK_VERSION-$HOST_PLATFORM.zip
# Cleanup.
if [ "${ANDROID_BUILD_CLEAN}" = "yes" ] ; then
rm -rf "${ANDROID_BUILD_DIR}/prefix"
mkdir -p "${ANDROID_BUILD_DIR}/prefix"
rm -rf "${ANDROID_DEPENDENCIES_DIR}"
mkdir -p "${ANDROID_DEPENDENCIES_DIR}"
(cd '/tmp' \
&& wget http://dl.google.com/android/repository/$FILENAME -O $FILENAME &> /dev/null \
&& unzip -q $FILENAME) || exit 1
unset FILENAME
# Called shells MUST not clean after ourselves !
export ANDROID_BUILD_CLEAN="no"
fi
./build.sh "arm"