Difference between revisions of "Android"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "= Minetest on Android = == Building == What you need: * Linux * Android NDK '''Crystax version''' * An Android device, preferably rooted * Subversion, Git, CMake * ADB (option...")
 
m
Line 7: Line 7:
 
* Subversion, Git, CMake
 
* Subversion, Git, CMake
 
* ADB (optional but very useful)
 
* ADB (optional but very useful)
=== Setting up the toolchain ==
+
=== Setting up the toolchain ===
 
Copy <code><ndk root>/sources/android/native_app_glue/android_native_app_glue.h</code> into <code><toolchain root>/sysroot/usr/include</code>.
 
Copy <code><ndk root>/sources/android/native_app_glue/android_native_app_glue.h</code> into <code><toolchain root>/sysroot/usr/include</code>.
 
=== Irrlicht ===
 
=== Irrlicht ===

Revision as of 22:26, 29 October 2013

Minetest on Android

Building

What you need:

  • Linux
  • Android NDK Crystax version
  • An Android device, preferably rooted
  • Subversion, Git, CMake
  • ADB (optional but very useful)

Setting up the toolchain

Copy <ndk root>/sources/android/native_app_glue/android_native_app_glue.h into <toolchain root>/sysroot/usr/include.

Irrlicht

Clone svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es.

Replace source/Irrlicht/Makefile with https://ghostbin.com/paste/2rfyo.

Replace include/irrCompileConfig.h with https://ghostbin.com/paste/dwn5a.

Make sure you have arm-linux-androideabi-gcc and arm-linux-androideabi-g++ usable and run make.

This will build Irrlicht as static and shared library and place it in lib/Linux

Minetest

Clone https://github.com/sfan5/minetest.git and switch to the android branch. Configure it using CMake like this:

$ cmake . \
    -DCMAKE_C_COMPILER=`which arm-linux-androideabi-gcc` \
    -DCMAKE_CXX_COMPILER=`which arm-linux-androideabi-g++` \
    -DCMAKE_FIND_ROOT_PATH=<sysroot of your android toolchain> \
    -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \
    -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \
    -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=BOTH \
    -DCMAKE_SYSTEM_NAME=Linux \
    -DIRRLICHT_LIBRARY=<path to libIrrlicht.a> \
    -DIRRLICHT_INCLUDE_DIR=<patch to include/ of Irrlicht>

Now just enter make package and it will create src/libminetest.so and a package with all resources.

Running

For this step you need minetest-x.x.x.tar.gz and libminetest.so from the previous step.

Put all resource files & folders (builtin, client, ...) into /sdcard/minetest on your Android device. Download http://sfan5.duckdns.org/upload/userdata/1/MinetestLoader.apk.

If you don't have a rooted device you need to use an hex editor to edit the shared library and change the path of minetest.so to /data/local/tmp/minetest.so and put libminetest.so at /data/local/tmp/minetest.so on your Android device.

If you do have a rooted device just put libminetest.so at /sdcard/minetest/minetest.so and run mount - /sdcard -o remount,exec to allow the Loader app to load shared libraries from the external storage.

After you've done that just launch the Load application (currently called IrrlichtExample01). If it does not start you can use ADB's LogCat to see messages for com.sfan5.irrlichtexample01.