#export TOOLCHAIN=/opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64
export TOOLCHAIN=/c/Users/david/AppData/Local/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64
export TARGET=armv7a-linux-androideabi
#export TARGET=x86_64-linux-android
export API=21
export AR=$TOOLCHAIN/bin/llvm-ar
export AS=$TOOLCHAIN/bin/llvm-as
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
export LD=$TOOLCHAIN/bin/ld
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
export STRIP=$TOOLCHAIN/bin/llvm-strip

export CFLAGS=-DNOXFERMEM
./configure --host $TARGET --with-audio=dummy --with-cpu=arm_fpu --prefix=$(pwd)/install
make
make install

# add NOXFERMEM ifdefs to buffer.c and xfermem.c
# see https://android.googlesource.com/platform/external/mpg123/+/refs/heads/master/src/buffer.c
#

# run 'make' with MSYS2, not Chocolatey make -> avoid 'C:/Program Files/' style SHELL
