forked from luoriloutai/ffmpeg_compile_for_android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
75 lines (69 loc) · 1.82 KB
/
config.sh
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
#NDK路径
export ANDROID_NDK_ROOT=/home/kali/Libs/ndk21
export AOSP_API="21"
#cpu架构
if [ "$#" -lt 1 ]; then
THE_ARCH=armv7
else
THE_ARCH=$(tr [A-Z] [a-z] <<< "$1")
fi
#根据不同架构配置变量
case "$THE_ARCH" in
armv7a|armeabi-v7a)
TOOLNAME_BASE="arm-linux-androideabi"
COMPILER_BASE="armv7a-linux-androideabi"
AOSP_ABI="armeabi-v7a"
AOSP_ARCH="armeabi-v7a"
OPENSSL_ARCH="android-arm"
HOST="arm-linux-androideabi"
FF_EXTRA_CFLAGS="-DANDROID -Wall -fPIC"
FF_CFLAGS="-DANDROID -Wall -fPIC"
;;
armv8|armv8a|aarch64|arm64|arm64-v8a)
TOOLNAME_BASE="aarch64-linux-android"
COMPILER_BASE="aarch64-linux-android"
AOSP_ABI="arm64-v8a"
AOSP_ARCH="arm64"
OPENSSL_ARCH="android-arm64"
HOST="aarch64-linux-android"
FF_EXTRA_CFLAGS="-DANDROID -Wall -fPIC"
FF_CFLAGS="-DANDROID -Wall -fPIC"
;;
x86)
TOOLNAME_BASE="i686-linux-android"
COMPILER_BASE="i686-linux-android"
AOSP_ABI="x86"
AOSP_ARCH="x86"
OPENSSL_ARCH="android-x86"
HOST="i686-linux-android"
FF_EXTRA_CFLAGS="-DANDROID -Wall -fPIC"
FF_CFLAGS="-DANDROID -Wall -fPIC"
;;
x86_64|x64)
TOOLNAME_BASE="x86_64-linux-android"
COMPILER_BASE="x86_64-linux-android"
AOSP_ABI="x86_64"
AOSP_ARCH="x86_64"
OPENSSL_ARCH="android-x86_64"
HOST="x86_64-linux-android"
FF_EXTRA_CFLAGS="-DANDROID -Wall -fPIC"
FF_CFLAGS="-DANDROID -Wall -fPIC"
;;
*)
echo "ERROR: Unknown architecture $1"
[ "$0" = "$BASH_SOURCE" ] && exit 1 || return 1
;;
esac
# 工具链
TOOLCHAIN=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64
SYS_ROOT=$TOOLCHAIN/sysroot
# 交叉编译路径
CROSS_PREFIX=$TOOLCHAIN/bin/$TOOLNAME_BASE-
# 编译器
CC=$TOOLCHAIN/bin/$COMPILER_BASE$AOSP_API-clang
CXX=$TOOLCHAIN/bin/$COMPILER_BASE$AOSP_API-clang++
echo "TOOLNAME_BASE="$TOOLNAME_BASE
echo "COMPILER_BASE="$COMPILER_BASE
echo "AOSP_ABI="$AOSP_ABI
echo "AOSP_ARCH="$AOSP_ARCH
echo "HOST="$HOST