编译x264
#!/bin/bash
NDK=/Users/li/Documents/android-ndk-r14b
SYSROOT=$NDK/platforms/android-14/arch-arm
TOOLCHAIN=/Users/li/Documents/android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
CPU=arm
PREFIX=/Users/li/room/h264/so/arm
ADDI_CFLAGS=""
ADDI_LDFLAGS=""
function build_arm
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--enable-static \
--disable-asm \
--enable-pic \
--enable-strip \
--host=arm-linux-androideabi \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--sysroot=$SYSROOT
--extra-cflags="-Os -fpic"\
--extra-ldflags=""\
$ADDITIONAL_CONFIGURE_FLAG
}
build_arm
编译ffmpeg
#!/bin/bash
exportTMPDIR=/Users/li/room/video/ffmpeg/tmpDir
NDK=/Users/li/Documents/android-ndk-r14b
SYSROOT=$NDK/platforms/android-14/arch-arm/
TOOLCHAIN=/Users/li/Documents/android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
CPU=arm
PREFIX=/Users/li/room/video/so/arm/
ADDI_CFLAGS="-marm"
ADDI_LDFLAGS=""
EXTRA_DIR=/Users/li/room/video/android
EXTRA_CFLAGS="-I ${EXTRA_DIR}/include"
EXTRA_LDFLAGS="-L ${EXTRA_DIR}/lib"
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-doc \
--disable-symver \
--enable-small \
--disable-everything \
--enable-gpl \
--enable-libx264 \
--enable-decoder=h264 \
--enable-decoder=aac \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS $EXTRA_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS $EXTRA_LDFLAGS" \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make
make install
}
build_one