#!/bin/bash
#!/bin/bash
NDK=/home/youle/Android/Sdk/ndk/20.1.5948944
SYSROOT=${NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot
PLATFORM=${NDK}/toolchains/llvm/prebuilt/linux-x86_64


function build_armv7a
{
   PREFIX=$(pwd)/android-armv7a
   CPU=armv7-a
   ./configure-android \
       --prefix=$PREFIX \
       --target-os=android \
       --arch=$CPU \
       --enable-shared \
       --disable-static \
       --disable-doc \
       --disable-ffmpeg \
       --disable-ffplay \
       --disable-ffprobe \
       --disable-avdevice \
       --disable-symver \
       --enable-cross-compile \
       --sysroot=$SYSROOT \
       --cross-prefix=$PLATFORM/bin/arm-linux-androideabi- \
       --cross-prefix-clang=$PLATFORM/bin/armv7a-linux-androideabi16- \
       --extra-cflags="-I$SYSROOT/usr/include" \
       --extra-ldflags="-L$SYSROOT/usr/lib"
       $ADDITIONAL_CONFIGURE_FLAG
       make clean
       make -j6
       make install
       make distclean
}

function build_aarch64
{
   PREFIX=$(pwd)/android-aarch64
   CPU=aarch64
   ./configure-android \
       --prefix=$PREFIX \
       --target-os=android \
       --arch=$CPU \
       --enable-shared \
       --disable-static \
       --disable-doc \
       --disable-ffmpeg \
       --disable-ffplay \
       --disable-ffprobe \
       --disable-avdevice \
       --disable-symver \
       --enable-cross-compile \
       --sysroot=$SYSROOT \
       --cross-prefix=$PLATFORM/bin/aarch64-linux-android- \
       --cross-prefix-clang=$PLATFORM/bin/aarch64-linux-android21- \
       --extra-cflags="-I$SYSROOT/usr/include" \
       --extra-ldflags="-L$SYSROOT/usr/lib"
       $ADDITIONAL_CONFIGURE_FLAG
       make clean
       make -j6
       make install
       make distclean
}

build_armv7a
build_aarch64

