58 lines
2.8 KiB
Bash
Executable File
58 lines
2.8 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/jlibtorrent-<version>.jar
|
|
# ../build/libs/${LIBRARY_NAME}-android-x86_64-<version>.jar
|
|
# remote android-x86 build with travis is available at https://s3.amazonaws.com/gubatron-${LIBRARY_NAME}/release/android/x86_64/lib${LIBRARY_NAME}.so
|
|
source build-utils.shinc
|
|
check_min_req_vars
|
|
export os_arch=x86_64
|
|
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 run_openssl_configure="./Configure linux-x86_64 ${OPENSSL_NO_OPTS} -fPIC -mstackrealign --prefix=${OPENSSL_ROOT}";
|
|
export run_readelf="${ANDROID_TOOLCHAIN}/bin/i686-linux-android-readelf -d bin/release/${os_build}/${os_arch}/${SHARED_LIB}"
|
|
export run_bjam="${BOOST_ROOT}/b2 -j8 --user-config=config/${os_build}-${os_arch}-config.jam variant=release toolset=clang-${os_arch} target-os=${os_build} location=bin/release/${os_build}/${os_arch}"
|
|
export run_strip="${ANDROID_TOOLCHAIN}/bin/i686-linux-android-strip --strip-unneeded -x -g bin/release/${os_build}/${os_arch}/${SHARED_LIB}"
|
|
export run_objcopy="${ANDROID_TOOLCHAIN}/bin/i686-linux-android-objcopy --only-keep-debug bin/release/${os_build}/${os_arch}/${SHARED_LIB} bin/release/${os_build}/${os_arch}/${SHARED_LIB}.debug"
|
|
export PATH=$ANDROID_TOOLCHAIN/i686-linux-android/bin:$PATH;
|
|
sed -i 's/RANLIB = ranlib/RANLIB = "${ANDROID_TOOLCHAIN}\/bin\/i686-linux-android-ranlib"/g' ${BOOST_ROOT}/tools/build/src/tools/gcc.jam;
|
|
create_folder_if_it_doesnt_exist ${SRC}
|
|
|
|
|
|
|
|
FILE=../../torrentStream/src/main/jnLibs/${os_arch}/${SHARED_LIB}
|
|
if [ -f "$FILE" ]; then
|
|
echo "${SHARED_LIB} exists for ${os_arch}"
|
|
else
|
|
FILE2=bin/release/${os_build}/${os_arch}/${SHARED_LIB}
|
|
if [ -f "$FILE2" ]; then
|
|
cd ..
|
|
mkdir -p ../torrentStream/src/main/jnLibs/${os_arch}
|
|
cp swig/bin/release/${os_build}/${os_arch}/${SHARED_LIB} ../torrentStream/src/main/jnLibs/${os_arch}/
|
|
cd swig || exit
|
|
else
|
|
prompt_msg "About to prepare BOOST ${BOOST_VERSION}"
|
|
prepare_boost
|
|
# openssl compilation fails for x86_64 if we use the c++ compiler
|
|
export CC=${ANDROID_TOOLCHAIN}/bin/x86_64-linux-android${android_api}-clang
|
|
prepare_openssl
|
|
build_openssl
|
|
export CC=${ANDROID_TOOLCHAIN}/bin/x86_64-linux-android${android_api}-clang++
|
|
prepare_libtorrent
|
|
./run-swig.sh
|
|
build_libraries
|
|
|
|
cd ..
|
|
mkdir -p ../torrentStream/src/main/jnLibs/${os_arch}
|
|
cp swig/bin/release/${os_build}/${os_arch}/${SHARED_LIB} ../torrentStream/src/main/jnLibs/${os_arch}/
|
|
cd swig || exit
|
|
fi
|
|
fi
|
|
|