forked from andoma/movian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.android
executable file
·141 lines (117 loc) · 4.13 KB
/
configure.android
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/bash
PLATFORM="android"
DEFAULT_UI="glw"
CONFIGURE_POSTFIX="android"
source support/configure.inc
SDK="${ANDROID_HOME}"
BUILD_TOOLS=27.0.3
show_help(){
common_help
echo " --sdk=PREFIX Use Android SDK from this path [$SDK]"
echo " --ndk=DIR Use Android NDK from this path [$SDK/ndk-bundle]"
echo " --kind=KIND Build for specific android configuration"
echo " api15_armv7 ARMv7 SDK version 15 (4.0.3)"
echo " api15_x86 x86 SDK version 15 (4.0.3)"
exit 1
}
enable sqlite_internal
enable glw_backend_opengl_es
enable glw
enable librtmp
enable httpserver
enable libfreetype
enable stdin
enable polarssl
enable vmir
disable upgrade
[ -f project.config ] && source project.config
for opt do
optval="${opt#*=}"
case "$opt" in
--help)
show_help
;;
--ndk=*)
NDK="$optval"
;;
--sdk=*)
SDK="$optval"
;;
--kind=api15_armv7)
ANDROID_MIN_SDK_VERSION=15
ANDROID_TARGET_SDK_VERSION=21
TOOLCHAIN_NAME=arm-linux-androideabi-4.9
ANDROID_BUILDKIND_DESCRIMINATOR=1
ANDROID_ABI=armeabi
BUILD=android.api15_armv7
TOOLCHAIN=${TOPDIR}/build.${BUILD}/toolchain/bin/arm-linux-androideabi-
ARCH_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon -funwind-tables"
ARCH_LDFLAGS="-march=armv7-a -Wl,--fix-cortex-a8"
LIBAV_ARCH_FLAGS="--cross-prefix=${TOOLCHAIN} --enable-cross-compile --arch=armv7 --target-os=android --enable-shared --disable-static --as=${TOOLCHAIN}gcc"
CC=${TOOLCHAIN}clang
CXX=${TOOLCHAIN}clang++
;;
--kind=api15_x86)
ANDROID_MIN_SDK_VERSION=15
ANDROID_TARGET_SDK_VERSION=21
TOOLCHAIN_NAME=x86-linux
ANDROID_ABI=x86
ANDROID_BUILDKIND_DESCRIMINATOR=2
BUILD=android.api15_x86
TOOLCHAIN=${TOPDIR}/build.${BUILD}/toolchain/bin/i686-linux-android-
LIBAV_ARCH_FLAGS="--cross-prefix=${TOOLCHAIN} --enable-cross-compile --arch=x86 --target-os=android --enable-shared --disable-static --as=${TOOLCHAIN}gcc --disable-inline-asm"
CC="${TOOLCHAIN}clang -mstackrealign"
CXX="${TOOLCHAIN}clang++ -mstackrealign"
;;
*)
common_opt $opt $optval
esac
done
if [ -z "${ANDROID_BUILDKIND_DESCRIMINATOR}" ]; then
echo "Android build kind not set (--kind option)"
echo "See ./configure.android --help"
die
fi
if [ -z "${SDK}" ]; then
echo "Android SDK not set"
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 [ -z "${NDK}" ]; then
NDK=${SDK}/ndk-bundle
fi
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-${ANDROID_MIN_SDK_VERSION} --install-dir=${TOPDIR}/build.${BUILD}/toolchain --toolchain=${TOOLCHAIN_NAME}
fi
bzip2_setup
freetype_setup --host=arm-linux-gnueabihf
LIBAV_CFLAGS="-I${EXT_INSTALL_DIR}/include ${ARCH_CFLAGS}"
LIBAV_LDFLAGS="-L${EXT_INSTALL_DIR}/lib ${ARCH_LDFLAGS}"
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
ANDROID_BUILD_TOOLS := ${SDK}/build-tools/${BUILD_TOOLS}
ANDROID_PLATFORM_PATH := ${SDK}/platforms/android-${ANDROID_TARGET_SDK_VERSION}
ANDROID_BUILDKIND_DESCRIMINATOR := ${ANDROID_BUILDKIND_DESCRIMINATOR}
ANDROID_MIN_SDK_VERSION := ${ANDROID_MIN_SDK_VERSION}
ANDROID_TARGET_SDK_VERSION := ${ANDROID_TARGET_SDK_VERSION}
ANDROID_ABI := ${ANDROID_ABI}
EOF
finalize