diff options
Diffstat (limited to 'src/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh')
-rwxr-xr-x | src/contrib/SDL-3.2.20/build-scripts/androidbuildlibs.sh | 85 |
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 | ||
17 | srcdir=`dirname $0`/.. | ||
18 | srcdir=`cd $srcdir && pwd` | ||
19 | cd $srcdir | ||
20 | |||
21 | |||
22 | # | ||
23 | # Create the build directories | ||
24 | # | ||
25 | |||
26 | build=build | ||
27 | buildandroid=$build/android | ||
28 | platform=android-21 | ||
29 | abi="arm64-v8a" # "armeabi-v7a arm64-v8a x86 x86_64" | ||
30 | obj= | ||
31 | lib= | ||
32 | ndk_args= | ||
33 | flexpage=true | ||
34 | |||
35 | # Allow an external caller to specify locations and platform. | ||
36 | while [ $# -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 | ||
52 | done | ||
53 | |||
54 | if [ -z $obj ]; then | ||
55 | obj=$buildandroid/obj | ||
56 | fi | ||
57 | if [ -z $lib ]; then | ||
58 | lib=$buildandroid/lib | ||
59 | fi | ||
60 | |||
61 | for dir in $build $buildandroid $obj $lib; do | ||
62 | if test -d $dir; then | ||
63 | : | ||
64 | else | ||
65 | mkdir $dir || exit 1 | ||
66 | fi | ||
67 | done | ||
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 | ||
76 | ndk-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 | ||