编译faac 静态库

下载faac源码
链接:https://pan.baidu.com/s/13jxXSDdseI5K6NVAHKXUTQ
提取码:zh2n
或者https://www.audiocoding.com/index.html

拷贝到linux
解压unzip faac-1.28.zip

赋予权限
chmod 777 -R faac-1.28

编写android_build.sh

#!/bin/bash

export NDK_HOME=/root/android-ndk-r10e
export SYSROOT=$NDK_HOME/platforms/android-9/arch-arm/
export TOOLCHAIN=$NDK_HOME/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64
export CPU=arm
export PREFIX=$(pwd)/android/$CPU

CFLAGS="-fpic -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP "
CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
export CPPFLAGS="$CFLAGS"
export CFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export CXX="${CROSS_COMPILE}g++ --sysroot=${SYSROOT}"
export LDFLAGS="$LDFLAGS"
export CC="${CROSS_COMPILE}gcc --sysroot=${SYSROOT}"
export NM="${CROSS_COMPILE}nm"
export STRIP="${CROSS_COMPILE}strip"
export RANLIB="${CROSS_COMPILE}ranlib"
export AR="${CROSS_COMPILE}ar"


./configure --prefix=$PREFIX \
--without-mp4v2 \
--host=arm-linux

make clean
make
make install

编译faac
./build_android.sh

另一个版本

#!/bin/bash

function build_faac
{
./configure \
--prefix=$PREFIX \
--host=$CPU-linux \
--with-pic \
--enable-shared=no
make clean
make install
}
#CPU架构 不含bit
CPU=x86
#CPU架构 包含bit
ARCH=x86
PREFIX=$(pwd)/android/$ARCH
#编译库使用的最低版本
PLATFORM_VERSION=android-17
SYSROOT=$NDK_ROOT/platforms/$PLATFORM_VERSION/arch-$ARCH/
#编译库头文件目录
TOOLCHAIN=$NDK_ROOT/toolchains/x86-4.8/prebuilt/linux-x86_64
#交叉编译头文件目录
CROSS_COMPILE=$TOOLCHAIN/bin/i686-linux-android
export CC="$CROSS_COMPILE-gcc --sysroot=$SYSROOT"
build_faac


CPU=arm
ARCH=arm
PREFIX=$(pwd)/android/$ARCH
PLATFORM_VERSION=android-17
SYSROOT=$NDK_ROOT/platforms/$PLATFORM_VERSION/arch-$ARCH/
TOOLCHAIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi
export CC="$CROSS_COMPILE-gcc --sysroot=$SYSROOT"
build_faac

CPU=arm
ARCH=arm64
PREFIX=$(pwd)/android/$ARCH
PLATFORM_VERSION=android-21
SYSROOT=$NDK_ROOT/platforms/$PLATFORM_VERSION/arch-$ARCH/
TOOLCHAIN=$NDK_ROOT/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64
CROSS_COMPILE=$TOOLCHAIN/bin/aarch64-linux-android
export CC="$CROSS_COMPILE-gcc --sysroot=$SYSROOT"
build_faac

你可能感兴趣的:(编译faac 静态库)