4 echo "Preparing android build directory"
5 echo "You'll need android-sdk, android-ndk, SDL2 sources and ant"
6 echo "You'll also need open-jdk and open-jre"
9 # See if user has 'ant' installed
10 if [ `which ant` = "" ]; then
11 echo "Can't find `ant` program."
12 echo "Install it using your package manager."
13 echo "NOTE: If `ant-optinal` exists in your package manager, install it too."
18 # See if NDK is in the Makefile.local already
19 NDK_BUILD
=`cat Makefile.local | grep NDK_BUILD= | sed 's/NDK_BUILD=//'`
20 if [ "$NDK_BUILD" = "" ]; then
21 echo "ndk-build not found in Makefile.local"
23 # See if NDK is in the PATH
24 NDK_BUILD
=`which ndk-build`
26 if [ "$NDK_BUILD" = "" ]; then
27 echo "ndk-build not found in PATH."
29 echo -n "Enter path to android-ndk:"
31 NDK
=`echo ${TMP} | sed 's/\/$//'` # remove trailing slash
33 NDK_BUILD
="${NDK}/ndk-build"
35 echo "Found ndk-build at $NDK_BUILD"
39 echo "Found ndk-build in Makefile.local, $NDK_BUILD"
42 # Verify NDK-BUILD is correct
43 NDK_TEST
=`${NDK_BUILD} --version | grep GNU`
44 if [ "${NDK_TEST}" != "" ]; then
45 echo "(re)Writing Makefile.local"
46 echo "NDK_BUILD=${NDK_BUILD}" > Makefile.
local
47 echo "WWW_PATH=/tmp" >> Makefile.
local
49 echo "Path to ndk-build is wrong."
54 # See if SDK is in the local.properties already
55 ANDROID_SDK_PATH
=`cat local.properties | grep sdk.dir= | sed 's/sdk\.dir=//'`
56 if [ "$ANDROID_SDK_PATH" = "" ]; then
57 # Or ask user to enter it
58 echo -n "Enter path to android-sdk:"
60 ANDROID_SDK_PATH
=`echo ${TMP} | sed 's/\/$//'` # remove trailing slash
62 echo "Using sdk.dir from local.properties."
65 # See if SDK path is correct
66 if [ -f ${ANDROID_SDK_PATH}/platform-tools
/adb
]; then
68 echo "(re)Writing local.properties"
69 echo "sdk.dir=$ANDROID_SDK_PATH" > local.properties
70 echo "target=android-17" >> local.properties
72 echo "Error: Unable to find ${ANDROID_SDK_PATH}/platform-tools/adb"
79 # See if it's already symlinked/copied
80 if [ -f jni
/SDL
/README.android
]; then
81 echo "SDL2 sources found"
83 echo -n "Enter path to SDL source dir:"
85 SDL_SOURCE_PATH
=`echo ${TMP} | sed 's/\/$//'` # remove trailing slash
87 # Verify SDL_SOURCE_PATH is correct
88 if [ -f "${SDL_SOURCE_PATH}/README.android" ]; then
89 echo "Symlinking to jni/SDL"
90 ln -s ${SDL_SOURCE_PATH} jni
/SDL
92 echo "Error: Unable to find ${SDL_SOURCE_PATH}/README.android"