Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 121 lines (94 sloc) 2.77 KB
#!/bin/bash
PLATFORM="android"
DEFAULT_UI="glw"
CONFIGURE_POSTFIX="android"
source support/configure.inc
SDK="${ANDROID_HOME}"
NDK="${ANDROID_HOME}/../ndk"
export ANDROID_API=android-17
export ANDROID_EABI=arm-linux-androideabi-4.9
install_openssl()
{
OPENSSL_VER="1.0.2"
download_file http://www.lonelycoder.com/download/openssl-${OPENSSL_VER}-${ANDROID_API}-${ANDROID_EABI}.tar.gz openssltarball
tar -C "${BUILDDIR}/inst" --strip-components=1 -xf "${openssltarball}"
}
show_help(){
common_help
echo " --sdk=PREFIX Use Android SDK from this path [$SDK]"
echo " --ndk=DIR Use Android NDK from this path [$NDK]"
exit 1
}
enable sqlite_internal
enable glw_backend_opengl_es
enable glw
#enable librtmp
enable httpserver
enable libfreetype
enable stdin
enable openssl
enable vmir
[ -f project.config ] && source project.config
for opt do
optval="${opt#*=}"
case "$opt" in
--help) show_help
;;
--ndk=*) NDK="$optval"
;;
--sdk=*) SDK="$optval"
;;
*)
common_opt $opt $optval
esac
done
if [ -z "${SDK}" ]; then
echo "Android SDK not found"
echo "Either specify path to SDK using --sdk=/path/to/sdk"
echo " OR "
echo "Set ANDROID_HOME environment variable"
die
fi
echo "Using Android SDK at : ${SDK}"
echo
if [ ! -x "${SDK}/tools/ant" ]; then
echo "''ant'' not found in ${SDK}/tools/"
echo "Check that your configured path to the SDK is correct"
die
fi
TOOLCHAIN=${TOPDIR}/build.android/toolchain/bin/arm-linux-androideabi-
CC=${TOOLCHAIN}gcc
CXX=${TOOLCHAIN}g++
setup_env "$@"
echo "Using Android NDK at : ${NDK}"
stat "${NDK}"
echo
if [ ! -f "${CC}" ]; then
echo "Installing toolchain..."
stat "${NDK}/build/tools/make-standalone-toolchain.sh"
if [ ! -f "${NDK}/build/tools/make-standalone-toolchain.sh" ]; then
echo "NDK not found, either set NDK environment varable or specify --ndk=/path/to/ndk"
die
fi
${NDK}/build/tools/make-standalone-toolchain.sh --platform=${ANDROID_API} --install-dir=${TOPDIR}/build.android/toolchain --toolchain=${ANDROID_EABI}
fi
bzip2_setup
freetype_setup --host=arm-linux-gnueabihf
install_openssl
ARCH_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
ARCH_LDFLAGS="-march=armv7-a -Wl,--fix-cortex-a8"
LIBAV_CFLAGS="-I${EXT_INSTALL_DIR}/include ${ARCH_CFLAGS}"
LIBAV_LDFLAGS="-L${EXT_INSTALL_DIR}/lib ${ARCH_LDFLAGS}"
LIBAV_ARCH_FLAGS="--cross-prefix=${TOOLCHAIN} --enable-cross-compile --arch=armv7 --target-os=android --enable-shared --disable-static"
ext_setup
libyuv_setup
cat >> ${CONFIG_MAK} <<EOF
CFLAGS_arch = ${ARCH_CFLAGS}
CFLAGS_cfg += ${ARCH_CFLAGS}
LDFLAGS_cfg += ${ARCH_LDFLAGS} -lOpenSLES -lGLESv2 -llog -landroid -ljnigraphics
LDFLAGS_cfg += -lssl -lcrypto
SDK = ${SDK}
NDK = ${NDK}
ADB = ${SDK}/platform-tools/adb
EOF
finalize