2020-02-12 12:14:32 +01:00
|
|
|
# Android Build
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
## Preamble
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
The last known NDK is automatically downloaded, if not specified otherwise.
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
As indicated in the main [README](../../README.md#supported-platforms-with-primary-CI), Android support is still DRAFT.
|
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
## Configuration
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-11-21 11:23:47 +01:00
|
|
|
### Basics
|
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
Basically, LIBZMQ build for Android, relies on exported variables.
|
|
|
|
|
2022-11-21 11:23:47 +01:00
|
|
|
Provided build scripts can mainly be used like
|
2022-11-20 00:26:38 +01:00
|
|
|
|
|
|
|
export XXX=xxx
|
|
|
|
export YYY=yyy
|
|
|
|
...
|
|
|
|
cd <libzmq>/builds/android
|
|
|
|
./<build_script>
|
|
|
|
|
|
|
|
|
|
|
|
### Android NDK
|
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
LIBZMQ is tested against Android NDK versions r19 to r25.
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
By default, LIBZMQ uses NDK `android-ndk-r25`, but you can specify
|
2022-10-19 00:52:13 +02:00
|
|
|
a different one:
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
export NDK_VERSION=android-ndk-r23c
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
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:
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
export NDK_VERSION="android-ndk-r23b"
|
2022-10-19 00:52:13 +02:00
|
|
|
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:
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2020-02-12 12:14:32 +01:00
|
|
|
export MIN_SDK_VERSION=21 # Default value if unset
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
To specify the build directory set the environment variable below:
|
|
|
|
|
|
|
|
export ANDROID_BUILD_DIR=${HOME}/android_build
|
|
|
|
|
|
|
|
**Important:** ANDROID_BUILD_ROOT must be an absolute path !
|
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
### Android build folder
|
|
|
|
|
|
|
|
All Android libraries will be generated under:
|
2022-10-19 00:52:13 +02:00
|
|
|
|
|
|
|
${ANDROID_BUILD_DIR}/prefix/<arch>/lib
|
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
where <arch> is one of `arm`, `arm64`, `x86` or `x86_64`.
|
2022-10-19 00:52:13 +02:00
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
### Android build cleanup
|
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
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
|
2022-11-20 00:26:38 +01:00
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
Android prebuilt libraries have to be stored under
|
|
|
|
|
|
|
|
ANDROID_BUILD_DIR/prefix/<arch>/lib
|
|
|
|
|
|
|
|
Do not forget to disable [Android cleanup](#android-build-cleanup).
|
2022-11-20 00:26:38 +01:00
|
|
|
|
|
|
|
### Dependencies
|
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
By default, `build.sh` download dependencies under `/tmp/tmp-deps`.
|
|
|
|
|
|
|
|
You can specify another folder with the help of ANDROID_DEPENDENCIES_DIR:
|
2022-11-20 00:26:38 +01:00
|
|
|
|
|
|
|
ANDROID_DEPENDENCIES_DIR=${HOME}/my_dependencies
|
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
If you place your own dependency source trees there,
|
|
|
|
do not forget to disable [Android cleanup](#android-build-cleanup).
|
2022-11-20 00:26:38 +01:00
|
|
|
|
|
|
|
### Cryptographic configuration
|
2022-10-19 00:52:13 +02:00
|
|
|
|
2023-02-18 13:43:16 +00:00
|
|
|
The variable CURVE accepts 2 different values:
|
2022-10-19 00:52:13 +02:00
|
|
|
|
|
|
|
"" : LIBZMQ is built without any encryption support.
|
|
|
|
"libsodium" : LIBZMQ is built with LIBSODIUM encryption support (see below).
|
2020-02-12 21:49:25 +01:00
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
### Other configuration variables
|
|
|
|
|
|
|
|
You can also check configuration variables in `build.sh` itself, in its
|
|
|
|
"Configuration & tuning options" comment block.
|
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
## 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.
|
2020-02-12 21:49:25 +01:00
|
|
|
|
2020-02-12 12:14:32 +01:00
|
|
|
## Build
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
See chapter [Configuration](#configuration) for configuration options and
|
|
|
|
other details.
|
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
Select your preferred parameters:
|
2022-10-19 00:52:13 +02:00
|
|
|
|
|
|
|
export XXX=xxx
|
|
|
|
export YYY=yyy
|
|
|
|
...
|
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
and run:
|
2016-03-18 13:54:20 +01:00
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
cd <libzmq>/builds/android
|
2020-02-12 12:14:32 +01:00
|
|
|
./build.sh [ arm | arm64 | x86 | x86_64 ]
|
2022-10-19 00:52:13 +02:00
|
|
|
|
|
|
|
Parameter selection and the calls to build.sh can be located in a
|
|
|
|
SHELL script, like in ci_build.sh.
|
|
|
|
|
2022-11-20 00:26:38 +01:00
|
|
|
## CI build
|
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
Basically, it will call `build.sh` once, for each Android target.
|
2022-11-20 00:26:38 +01:00
|
|
|
|
|
|
|
This script accepts the same configuration variables, but some are set
|
|
|
|
with different default values. For instance, the dependencies are not
|
2022-11-21 12:15:38 +01:00
|
|
|
downloaded or cloned in `/tmp/tmp-deps, but inside LIBZMQ clone.
|
2022-11-20 00:26:38 +01:00
|
|
|
|
2022-11-21 12:15:38 +01:00
|
|
|
It can be used in the same way as build.sh
|
2022-11-20 00:26:38 +01:00
|
|
|
|
|
|
|
export XXX=xxx
|
|
|
|
export YYY=yyy
|
|
|
|
cd <libzmq>/builds/android
|
|
|
|
./ci_build.sh
|
|
|
|
|
|
|
|
|
2022-10-19 00:52:13 +02:00
|
|
|
## 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).
|
|
|
|
|