#!/bin/bash #make clean # NDK的路径,根据自己的安装位置进行设置 export NDK=/Users/wangt/Library/Android/sdk/ndk/21.4.7075529 export SYSROOT=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/ export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64/ export CPU=arm export PREFIX=$(pwd)/android/$CPU export ADDI_CFLAGS="-marm" function build_one { ./configure --prefix=$PREFIX --target-os=android --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- --arch=arm --sysroot=$SYSROOT --extra-cflags="-Os -fpic $ADDI_CFLAGS" --extra-ldflags="$ADDI_LDFLAGS" --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-small --enable-cross-compile --cc=$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang --disable-debug --disable-static --disable-doc --disable-asm --disable-ffmpeg --disable-ffplay --disable-ffprobe --enable-postproc --enable-avdevice --disable-symver --disable-stripping $ADDITIONAL_CONFIGURE_FLAG # # --nm=$TOOLCHAIN/bin/arm-linux-androideabi-nm # 这里是定义用几个CPU编译,我用4个,一般在5分钟之内编译完成 make -j4 make install } build_one