Hi everyone,
tl;dr:
- I successfully compiled fs2open on android with Antipodes, since this branch uses SDL2.
- However it crashes.
- you can grab the android project here:
http://tinyurl.com/hjx2heodetails:
I'm new here.
I own a Nvidia Shield TV, and I thought it would be cool if FSO could run on it.
I did not find much information on FSO and Android, so I assumed that it did not work as of yet.
I successfully made it compile with Antipodes, since this branch uses SDL2. However it crashes.
I am not able to continue right now, but I give the instructions here in the case someone wants to pursue this work (and this someone may be me in the future).
I first followed the steps here:
https://wiki.libsdl.org/Android to install SDL in a GCC toolchain (4.2).
Make sure to update the PATH so the compiler/linker binaries are found.
Then I did the very first step of 4.4: "Copy and adapt the /usr/src/SDL2/android-project skeleton as explained in README-android.md. You can leave it as-is in a first step."
I renamed the project (or dir name) to fs2open-android.
I got the git repo of regal (GL on top of GLES) and openal-soft, and the tar balls of ogg, vorbis, theora.
I put regal and openal-soft in fs2open-android and ogg, vorbis and theora in fs2open-android/jni/src. The reason is that regal and openal-soft have a build procedure for Android, while I just compile the c files of ogg, vorbis and theora (I do not bother making a lib, all .o are linked against the final binary)
for regal and openal-soft I had to make a few adjustments.
I provide a tarball with everything included here:
http://tinyurl.com/hjx2heogo into regal/build/android/Regal/ and do a nkd-build (it takes a while)
then copy regal/build/android/Regal/obj/local/armeabi-v7a/lib* in ($NDK_ROOT)/sysroot/usr/lib
go into openal-soft/build and do what's explained in ../XCompile-Android.txt:
edit /XCompile-Android.txt to set the NDK_ROOT path: $(NDK_ROOT)/sysroot/usr
$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile-Android.txt -DHOST=arm-linux-androideabi
make sure OpenSLES backend is selected: edit CMakeLists.txt. (I also edited CMakeFiles/openal.dir/link.txt and removed the soname stuff to get rid of a link problem involving libopenal.so.1)
$ make
$ make install (I think you might skip this)
copy $(NDK_ROOT)/sysroot/usr/lib/libRegal.so and opean-soft/build/libopenal.so in fs2open-android/jni/src
assuming there is a fs2open.gituhb.com antipodes along fs2open-android, go to fs2open.gitgub.com and do
$ git apply ../fs2open-android/android_patch_to_fs2open_antipodes.txt
then go back to fs2open-android and do:
$ ndk-build
this should build fs2open. If it fails and you have to tweak jni/src/Android.mk, I advise you to use this command to build instead of a simple ndk-build:
$ touch -r obj/local/armeabi-v7a/objs/main/__/__/__/fs2open.github.com/code/ai/ai.o jni/src/Android.mk && ndk-build
This will ensure that the build directory is not wiped out and no fully rebuilt...
Then to make the apk, install it and test:
$ android update project --name org.fs2open --path . --target android-23 --subprojects
$ ant debug
$ ant installd
$ adb shell am start -a fs2open.org.MAIN -n org.libsdl.app/org.libsdl.app.SDLActivity
It should crash on a c++ destructor unfortunately, so there is something wrong somewhere. I'm not knowledgeable enough to debug it efficiently, and I have no time left to do it, I hope that someone could try...
Hope I did not forget an important step.
Cheers,
s.