Simple Directmedia Layer
at main 1.8 kB view raw
1#!/bin/bash 2# 3# Build the Android libraries without needing a project 4# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.) 5# 6# Usage: androidbuildlibs.sh [arg for ndk-build ...]" 7# 8# Useful NDK arguments: 9# 10# NDK_DEBUG=1 - build debug version 11# NDK_LIBS_OUT=<dest> - specify alternate destination for installable 12# modules. 13# 14 15 16# Android.mk is in srcdir 17srcdir=`dirname $0`/.. 18srcdir=`cd $srcdir && pwd` 19cd $srcdir 20 21 22# 23# Create the build directories 24# 25 26build=build 27buildandroid=$build/android 28platform=android-21 29abi="arm64-v8a" # "armeabi-v7a arm64-v8a x86 x86_64" 30obj= 31lib= 32ndk_args= 33 34# Allow an external caller to specify locations and platform. 35while [ $# -gt 0 ]; do 36 arg=$1 37 if [ "${arg:0:8}" == "NDK_OUT=" ]; then 38 obj=${arg#NDK_OUT=} 39 elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then 40 lib=${arg#NDK_LIBS_OUT=} 41 elif [ "${arg:0:13}" == "APP_PLATFORM=" ]; then 42 platform=${arg#APP_PLATFORM=} 43 elif [ "${arg:0:8}" == "APP_ABI=" ]; then 44 abi=${arg#APP_ABI=} 45 else 46 ndk_args="$ndk_args $arg" 47 fi 48 shift 49done 50 51if [ -z $obj ]; then 52 obj=$buildandroid/obj 53fi 54if [ -z $lib ]; then 55 lib=$buildandroid/lib 56fi 57 58for dir in $build $buildandroid $obj $lib; do 59 if test -d $dir; then 60 : 61 else 62 mkdir $dir || exit 1 63 fi 64done 65 66 67# APP_* variables set in the environment here will not be seen by the 68# ndk-build makefile segments that use them, e.g., default-application.mk. 69# For consistency, pass all values on the command line. 70ndk-build \ 71 NDK_PROJECT_PATH=null \ 72 NDK_OUT=$obj \ 73 NDK_LIBS_OUT=$lib \ 74 APP_BUILD_SCRIPT=Android.mk \ 75 APP_ABI="$abi" \ 76 APP_PLATFORM="$platform" \ 77 APP_MODULES="SDL3" \ 78 $ndk_args