-
Notifications
You must be signed in to change notification settings - Fork 178
/
build.sh
executable file
·57 lines (50 loc) · 1.67 KB
/
build.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
#!/usr/bin/env bash
case $ANDROID_ABI in
x86)
# Disabling assembler optimizations, because they have text relocations
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --disable-asm"
;;
x86_64)
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --x86asmexe=${FAM_YASM}"
;;
esac
if [ "$FFMPEG_GPL_ENABLED" = true ] ; then
EXTRA_BUILD_CONFIGURATION_FLAGS="$EXTRA_BUILD_CONFIGURATION_FLAGS --enable-gpl"
fi
# Preparing flags for enabling requested libraries
ADDITIONAL_COMPONENTS=
for LIBARY_NAME in ${FFMPEG_EXTERNAL_LIBRARIES[@]}
do
ADDITIONAL_COMPONENTS+=" --enable-$LIBARY_NAME"
done
# Referencing dependencies without pkgconfig
DEP_CFLAGS="-I${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/include"
DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS"
# Android 15 with 16 kb page size support
# https://developer.android.com/guide/practices/page-sizes#compile-r27
EXTRA_LDFLAGS="-Wl,-z,max-page-size=16384 $DEP_LD_FLAGS"
./configure \
--prefix=${BUILD_DIR_FFMPEG}/${ANDROID_ABI} \
--enable-cross-compile \
--target-os=android \
--arch=${TARGET_TRIPLE_MACHINE_ARCH} \
--sysroot=${SYSROOT_PATH} \
--cc=${FAM_CC} \
--cxx=${FAM_CXX} \
--ld=${FAM_LD} \
--ar=${FAM_AR} \
--as=${FAM_CC} \
--nm=${FAM_NM} \
--ranlib=${FAM_RANLIB} \
--strip=${FAM_STRIP} \
--extra-cflags="-O3 -fPIC $DEP_CFLAGS" \
--extra-ldflags="$EXTRA_LDFLAGS" \
--enable-shared \
--disable-static \
--disable-vulkan \
--pkg-config=${PKG_CONFIG_EXECUTABLE} \
${EXTRA_BUILD_CONFIGURATION_FLAGS} \
$ADDITIONAL_COMPONENTS || exit 1
${MAKE_EXECUTABLE} clean
${MAKE_EXECUTABLE} -j${HOST_NPROC}
${MAKE_EXECUTABLE} install