53 lines
2.9 KiB
Bash
Executable File
53 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# This script is meant to run here inside the swig folder
|
|
# It's supposed to be a one step build for the java jar and android (.so enclosing) jars (armv7 and x86)
|
|
# Output .jar files will be at:
|
|
# ../build/libs/${LIBRARY_NAME}-<version>.jar
|
|
# ../build/libs/${LIBRARY_NAME}-android-arm-<version>.jar
|
|
# remote android-arm build with travis is available at https://s3.amazonaws.com/gubatron-jlibtorrent/release/android/arm64-v8a/libjlibtorrent.so
|
|
source build-utils.shinc
|
|
check_min_req_vars
|
|
export os_arch=arm
|
|
export os_build=android
|
|
export android_api=21
|
|
export SHARED_LIB=lib${LIBRARY_NAME}.so
|
|
export CXX=g++
|
|
export NDK_VERSION=r21d
|
|
prepare_android_toolchain
|
|
abort_if_var_unset "ANDROID_TOOLCHAIN" ${ANDROID_TOOLCHAIN}
|
|
export CC=${ANDROID_TOOLCHAIN}/bin/armv7a-linux-androideabi${android_api}-clang
|
|
export run_openssl_configure="./Configure linux-${os_arch}v4 ${OPENSSL_NO_OPTS} -march=armv7-a -mfpu=neon -fPIC --prefix=${OPENSSL_ROOT}";
|
|
export run_readelf="${ANDROID_TOOLCHAIN}/bin/arm-linux-androideabi-readelf -d bin/release/${os_build}/${os_arch}eabi-v7a/${SHARED_LIB}"
|
|
export run_bjam="${BOOST_ROOT}/b2 -j8 --user-config=config/${os_build}-${os_arch}-config.jam variant=release toolset=clang-linux-${os_arch} target-os=${os_build} location=bin/release/${os_build}/${os_arch}eabi-v7a"
|
|
export run_strip="${ANDROID_TOOLCHAIN}/bin/arm-linux-androideabi-strip --strip-unneeded -x -g bin/release/${os_build}/${os_arch}eabi-v7a/${SHARED_LIB}"
|
|
export run_objcopy="${ANDROID_TOOLCHAIN}/bin/arm-linux-androideabi-objcopy --only-keep-debug bin/release/${os_build}/${os_arch}eabi-v7a/${SHARED_LIB} bin/release/${os_build}/${os_arch}eabi-v7a/${SHARED_LIB}.debug"
|
|
export PATH=$ANDROID_TOOLCHAIN/arm-linux-androideabi/bin:$PATH;
|
|
sed -i 's/RANLIB = ranlib/RANLIB = "${ANDROID_TOOLCHAIN}\/bin\/arm-linux-androideabi-ranlib"/g' ${BOOST_ROOT}/tools/build/src/tools/gcc.jam;
|
|
create_folder_if_it_doesnt_exist ${SRC}
|
|
|
|
FILE=../../torrentStream/src/main/jnLibs/${os_arch}eabi-v7a/${SHARED_LIB}
|
|
if [ -f "$FILE" ]; then
|
|
echo "${SHARED_LIB} exists for ${os_arch}eabi-v7a"
|
|
else
|
|
FILE2=bin/release/${os_build}/${os_arch}eabi-v7a/${SHARED_LIB}
|
|
if [ -f "$FILE2" ]; then
|
|
cd ..
|
|
mkdir -p ../torrentStream/src/main/jnLibs/${os_arch}eabi-v7a
|
|
cp swig/bin/release/${os_build}/${os_arch}eabi-v7a/${SHARED_LIB} ../torrentStream/src/main/jnLibs/${os_arch}eabi-v7a/
|
|
cd swig || exit
|
|
else
|
|
prompt_msg "About to prepare BOOST ${BOOST_VERSION}"
|
|
prepare_boost
|
|
prepare_openssl
|
|
build_openssl
|
|
export CC=${ANDROID_TOOLCHAIN}/bin/armv7a-linux-androideabi${android_api}-clang++
|
|
prepare_libtorrent
|
|
./run-swig.sh
|
|
build_libraries
|
|
cd ..
|
|
mkdir -p ../torrentStream/src/main/jnLibs/${os_arch}eabi-v7a
|
|
cp swig/bin/release/${os_build}/${os_arch}eabi-v7a/${SHARED_LIB} ../torrentStream/src/main/jnLibs/${os_arch}eabi-v7a/
|
|
cd swig || exit
|
|
fi
|
|
fi
|