2016-01-11 17:19:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function build_one {
|
|
|
|
|
|
|
|
echo "Cleaning..."
|
2018-07-30 02:07:02 +00:00
|
|
|
rm config.h
|
2016-01-11 17:19:48 +00:00
|
|
|
make clean
|
|
|
|
|
|
|
|
echo "Configuring..."
|
|
|
|
|
|
|
|
./configure \
|
|
|
|
--cc=$CC \
|
|
|
|
--nm=$NM \
|
|
|
|
--enable-stripping \
|
|
|
|
--arch=$ARCH \
|
|
|
|
--target-os=linux \
|
|
|
|
--enable-cross-compile \
|
|
|
|
--yasmexe=$NDK/prebuilt/darwin-x86_64/bin/yasm \
|
|
|
|
--prefix=$PREFIX \
|
|
|
|
--enable-pic \
|
|
|
|
--disable-shared \
|
|
|
|
--enable-static \
|
2018-07-30 02:07:02 +00:00
|
|
|
--enable-asm \
|
|
|
|
--enable-inline-asm \
|
2016-01-11 17:19:48 +00:00
|
|
|
--cross-prefix=$CROSS_PREFIX \
|
|
|
|
--sysroot=$PLATFORM \
|
2018-07-30 02:07:02 +00:00
|
|
|
--extra-cflags="-Wl,-Bsymbolic -Os -DCONFIG_LINUX_PERF=0 -DANDROID $OPTIMIZE_CFLAGS -fPIE -pie --static -fPIC" \
|
|
|
|
--extra-ldflags="-Wl,-Bsymbolic -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -fPIC" \
|
2016-01-11 17:19:48 +00:00
|
|
|
--extra-libs="-lgcc" \
|
|
|
|
\
|
|
|
|
--enable-version3 \
|
|
|
|
--enable-gpl \
|
|
|
|
\
|
|
|
|
--disable-doc \
|
|
|
|
--disable-avx \
|
|
|
|
\
|
|
|
|
--disable-everything \
|
|
|
|
--disable-network \
|
|
|
|
--disable-zlib \
|
|
|
|
--disable-avfilter \
|
|
|
|
--disable-avdevice \
|
|
|
|
--disable-postproc \
|
|
|
|
--disable-debug \
|
|
|
|
--disable-programs \
|
|
|
|
--disable-network \
|
|
|
|
\
|
2018-07-30 02:07:02 +00:00
|
|
|
--enable-runtime-cpudetect \
|
2016-01-11 17:19:48 +00:00
|
|
|
--enable-pthreads \
|
2018-07-30 02:07:02 +00:00
|
|
|
--enable-avresample \
|
2016-01-11 17:19:48 +00:00
|
|
|
--enable-protocol=file \
|
|
|
|
--enable-decoder=h264 \
|
2018-07-30 02:07:02 +00:00
|
|
|
--enable-decoder=mpeg4 \
|
2016-01-11 17:19:48 +00:00
|
|
|
--enable-decoder=gif \
|
2018-07-30 02:07:02 +00:00
|
|
|
--enable-decoder=alac \
|
2016-01-11 17:19:48 +00:00
|
|
|
--enable-demuxer=mov \
|
|
|
|
--enable-demuxer=gif \
|
|
|
|
--enable-hwaccels \
|
|
|
|
--enable-runtime-cpudetect \
|
|
|
|
$ADDITIONAL_CONFIGURE_FLAG
|
|
|
|
|
|
|
|
#echo "continue?"
|
|
|
|
#read
|
|
|
|
make -j8 install
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-07-30 02:07:02 +00:00
|
|
|
NDK=/path-to-NDK
|
2016-01-11 17:19:48 +00:00
|
|
|
|
2018-07-30 02:07:02 +00:00
|
|
|
#x86_64
|
|
|
|
PREBUILT=$NDK/toolchains/x86_64-4.9/prebuilt/darwin-x86_64
|
|
|
|
PLATFORM=$NDK/platforms/android-21/arch-x86_64
|
|
|
|
LD=$PREBUILT/bin/x86_64-linux-android-ld
|
|
|
|
AR=$PREBUILT/bin/x86_64-linux-android-ar
|
|
|
|
NM=$PREBUILT/bin/x86_64-linux-android-nm
|
|
|
|
GCCLIB=$PREBUILT/lib/gcc/x86_64-linux-android/4.9/libgcc.a
|
|
|
|
CC=$PREBUILT/bin/x86_64-linux-android-gcc
|
|
|
|
CROSS_PREFIX=$PREBUILT/bin/x86_64-linux-android-
|
|
|
|
ARCH=x86_64
|
|
|
|
CPU=x86_64
|
|
|
|
PREFIX=./android/$CPU
|
|
|
|
ADDITIONAL_CONFIGURE_FLAG="--disable-mmx --disable-inline-asm"
|
|
|
|
build_one
|
2016-01-11 17:19:48 +00:00
|
|
|
|
2018-07-30 02:07:02 +00:00
|
|
|
#arm64-v8a
|
|
|
|
PREBUILT=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64
|
|
|
|
PLATFORM=$NDK/platforms/android-21/arch-arm64
|
|
|
|
LD=$PREBUILT/bin/aarch64-linux-android-ld
|
|
|
|
AR=$PREBUILT/bin/aarch64-linux-android-ar
|
|
|
|
NM=$PREBUILT/bin/aarch64-linux-android-nm
|
|
|
|
GCCLIB=$PREBUILT/lib/gcc/aarch64-linux-android/4.9/libgcc.a
|
|
|
|
CC=$PREBUILT/bin/aarch64-linux-android-gcc
|
|
|
|
CROSS_PREFIX=$PREBUILT/bin/aarch64-linux-android-
|
|
|
|
ARCH=arm64
|
|
|
|
CPU=arm64-v8a
|
|
|
|
OPTIMIZE_CFLAGS=
|
2016-01-11 17:19:48 +00:00
|
|
|
PREFIX=./android/$CPU
|
2018-07-30 02:07:02 +00:00
|
|
|
ADDITIONAL_CONFIGURE_FLAG="--enable-neon --enable-optimizations"
|
2016-01-11 17:19:48 +00:00
|
|
|
build_one
|
|
|
|
|
|
|
|
#arm v7n
|
2018-07-30 02:07:02 +00:00
|
|
|
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
|
|
|
|
PLATFORM=$NDK/platforms/android-16/arch-arm
|
|
|
|
LD=$PREBUILT/bin/arm-linux-androideabi-ld
|
|
|
|
AR=$PREBUILT/bin/arm-linux-androideabi-ar
|
|
|
|
NM=$PREBUILT/bin/arm-linux-androideabi-nm
|
|
|
|
GCCLIB=$PREBUILT/lib/gcc/arm-linux-androideabi/4.9/libgcc.a
|
|
|
|
CC=$PREBUILT/bin/arm-linux-androideabi-gcc
|
|
|
|
CROSS_PREFIX=$PREBUILT/bin/arm-linux-androideabi-
|
|
|
|
ARCH=arm
|
2016-01-11 17:19:48 +00:00
|
|
|
CPU=armv7-a
|
|
|
|
OPTIMIZE_CFLAGS="-marm -march=$CPU"
|
|
|
|
PREFIX=./android/$CPU
|
|
|
|
ADDITIONAL_CONFIGURE_FLAG=--enable-neon
|
|
|
|
build_one
|
2018-07-30 02:07:02 +00:00
|
|
|
#
|
|
|
|
#x86
|
|
|
|
PREBUILT=$NDK/toolchains/x86-4.9/prebuilt/darwin-x86_64
|
|
|
|
PLATFORM=$NDK/platforms/android-16/arch-x86
|
2016-01-11 17:19:48 +00:00
|
|
|
LD=$PREBUILT/bin/i686-linux-android-ld
|
|
|
|
AR=$PREBUILT/bin/i686-linux-android-ar
|
|
|
|
NM=$PREBUILT/bin/i686-linux-android-nm
|
2018-07-30 02:07:02 +00:00
|
|
|
GCCLIB=$PREBUILT/lib/gcc/i686-linux-android/4.9/libgcc.a
|
2016-01-11 17:19:48 +00:00
|
|
|
CC=$PREBUILT/bin/i686-linux-android-gcc
|
|
|
|
CROSS_PREFIX=$PREBUILT/bin/i686-linux-android-
|
2018-07-30 02:07:02 +00:00
|
|
|
ARCH=x86
|
2016-01-11 17:19:48 +00:00
|
|
|
CPU=i686
|
|
|
|
OPTIMIZE_CFLAGS="-march=$CPU"
|
|
|
|
PREFIX=./android/$CPU
|
|
|
|
ADDITIONAL_CONFIGURE_FLAG="--disable-mmx --disable-yasm"
|
|
|
|
build_one
|
|
|
|
|
2018-07-30 02:07:02 +00:00
|
|
|
|