summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh')
-rwxr-xr-xsrc/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh b/src/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh
new file mode 100755
index 0000000..1004a98
--- /dev/null
+++ b/src/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh
@@ -0,0 +1,85 @@
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=
33flexpage=true
34
35# Allow an external caller to specify locations and platform.
36while [ $# -gt 0 ]; do
37 arg=$1
38 if [ "${arg:0:8}" == "NDK_OUT=" ]; then
39 obj=${arg#NDK_OUT=}
40 elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then
41 lib=${arg#NDK_LIBS_OUT=}
42 elif [ "${arg:0:13}" == "APP_PLATFORM=" ]; then
43 platform=${arg#APP_PLATFORM=}
44 elif [ "${arg:0:8}" == "APP_ABI=" ]; then
45 abi=${arg#APP_ABI=}
46 elif [ "${arg:0:32}" == "APP_SUPPORT_FLEXIBLE_PAGE_SIZES=" ]; then
47 flexpage=${arg#APP_SUPPORT_FLEXIBLE_PAGE_SIZES=}
48 else
49 ndk_args="$ndk_args $arg"
50 fi
51 shift
52done
53
54if [ -z $obj ]; then
55 obj=$buildandroid/obj
56fi
57if [ -z $lib ]; then
58 lib=$buildandroid/lib
59fi
60
61for dir in $build $buildandroid $obj $lib; do
62 if test -d $dir; then
63 :
64 else
65 mkdir $dir || exit 1
66 fi
67done
68
69
70# APP_* variables set in the environment here will not be seen by the
71# ndk-build makefile segments that use them, e.g., default-application.mk.
72# For consistency, pass all values on the command line.
73#
74# Add support for Google Play 16 KB Page size requirement:
75# https://developer.android.com/guide/practices/page-sizes#ndk-build
76ndk-build \
77 NDK_PROJECT_PATH=null \
78 NDK_OUT=$obj \
79 NDK_LIBS_OUT=$lib \
80 APP_BUILD_SCRIPT=Android.mk \
81 APP_ABI="$abi" \
82 APP_PLATFORM="$platform" \
83 APP_MODULES="SDL3" \
84 APP_SUPPORT_FLEXIBLE_PAGE_SIZES="$flexpage" \
85 $ndk_args