1
0
mirror of https://github.com/PurpleI2P/i2pd-android.git synced 2025-01-10 14:57:55 +00:00
i2pd-android/app/jni/build_boost.sh
2022-05-22 13:41:42 +03:00

83 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
BOOST_VERSION=1.74.0
BOOST_LIBS=date_time,filesystem,program_options,system
function build_one {
mkdir out
echo "Configuring and building..."
CXXFLAGS="-std=c++14" \
NCPU=$(nproc) \
./build-android.sh \
--boost=$BOOST_VERSION \
--arch=$CPU \
--target-version=$API \
--with-libraries=$BOOST_LIBS \
--layout=system \
$ANDROID_NDK_HOME
}
function checkPreRequisites {
if ! [ -d "boost" ] || ! [ "$(ls -A boost)" ]; then
echo -e "\033[31mFailed! Submodule 'boost' not found!\033[0m"
echo -e "\033[31mTry to run: 'git submodule update --init'\033[0m"
exit
fi
if [ -z "$ANDROID_NDK_HOME" -a "$ANDROID_NDK_HOME" == "" ]; then
echo -e "\033[31mFailed! ANDROID_NDK_HOME is empty. Run 'export ANDROID_NDK_HOME=[PATH_TO_NDK]'\033[0m"
exit
fi
}
function build {
for arg in "$@"; do
case "$arg" in
x86_64)
API=21
TARGET=x86_64
build_one
;;
arm64)
API=21
CPU=arm64-v8a
build_one
;;
x86)
API=16
CPU=x86
build_one
;;
arm)
API=16
CPU=armeabi-v7a
build_one
;;
all)
API=16
build_one
;;
*)
;;
esac
done
}
checkPreRequisites
cd boost
rm -rf out
# disable verbose output
sed -i -e 's/d+2/d+0/' build-android.sh
if (( $# == 0 )); then
build all
else
build $@
fi