-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild_arm64-v8a.sh
85 lines (67 loc) · 1.92 KB
/
build_arm64-v8a.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
75
76
77
78
79
80
81
82
83
#!/bin/sh
# 根目录
export ROOT_SOURCE=$(cd `dirname $0`; pwd)
#判断系统类型
SYSTEM=$(uname -s)
if [ "${SYSTEM}" = "Linux" ]; then
export NDK=/opt/Android/android-ndk-r13b
export TOOLCHAIN=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64
fi
if [ "${SYSTEM}" = "Darwin" ]; then
export NDK=/opt/Android/android-ndk-r13b
export TOOLCHAIN=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64
fi
if [ "$(uname -o)" = "Msys" ]; then
export NDK=D:/Android/sdk/ndk-bundle
export TOOLCHAIN=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/windows-x86_64
fi
# 编译的API
export ANDROID_API=android-21
export PLATFORM=$NDK/platforms/${ANDROID_API}/arch-arm64
# 编译目录是否存在
if [ ! -d "build" ]; then
mkdir ${ROOT_SOURCE}/build/
fi
# 源码是否存在
if [ ! -d "ffmpeg" ]; then
tar -zxvf ffmpeg.tar.gz
fi
if [ ! -d "x264" ]; then
tar -zxvf x264.tar.gz
fi
if [ ! -d "fdk-aac" ]; then
tar -zxvf fdk-aac.tar.gz
fi
# 判断编译目录是否存在源码, 不存在则复制到编译目录
if [ ! -d "build/ffmpeg" ]; then
cp -R ffmpeg/ ${ROOT_SOURCE}/build/ffmpeg/
fi
if [ ! -d "build/x264" ]; then
cp -R x264/ ${ROOT_SOURCE}/build/x264/
fi
if [ ! -d "build/fdk-aac" ]; then
cp -R fdk-aac/ ${ROOT_SOURCE}/build/fdk-aac/
fi
# 到工具目录执行编译
cd tools
# 编译x264
if [ ! -x "libx264/build_x264_arm64-v8a.sh" ]; then
echo "can not find x264 build script"
else
chmod a+x libx264/build_x264_arm64-v8a.sh
./libx264/build_x264_arm64-v8a.sh
fi
# 编译fdk-aac
if [ ! -x "fdk-aac/build_fdk_aac_arm64_v8a.sh" ]; then
echo "can not find x264 build script"
else
chmod a+x ./fdk-aac/build_fdk_aac_arm64_v8a.sh
./fdk-aac/build_fdk_aac_arm64_v8a.sh
fi
# 编译ffmpeg
if [ ! -x "ffmpeg/build_ffmpeg_arm64-v8a.sh" ]; then
echo "can not find ffmpeg build script"
else
chmod a+x ./ffmpeg/build_ffmpeg_arm64-v8a.sh
./ffmpeg/build_ffmpeg_arm64-v8a.sh
fi