By | 27 octobre 2018

[ANDROID] Compilation de Tic-80

Distribution de travail : Lubuntu 17.10
Téléphone : Archos 55 Platinum
Android : Lollipop 5.1

1/ Vérification de la version de Java.

util06@station06:~/ANDROID.tic80/TIC80/TIC-80/build/ANDROID$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

2/ Création du répertoire de travail.

util06@station06:~/ANDROID.tic80$ cd ..
util06@station06:~$ mkdir -p ANDROID/TIC80
util06@station06:~/ANDROID.tic80/TIC80$ 

3/ Installation de Android SDK.

util06@station06:~/ANDROID.tic80/TIC80$ wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
util06@station06:~/ANDROID.tic80/TIC80$ tar xvfz android-sdk_r24.4.1-linux.tgz 

4/ Installation du Android NDK.

util06@station06:~/ANDROID.tic80/TIC80$ wget https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip
util06@station06:~/ANDROID.tic80/TIC80$ unzip android-ndk-r11c-linux-x86_64.zip

5/ Mise-à-jour du SDK.

util06@station06:~/ANDROID.tic80/TIC80$ android-sdk-linux/tools/android update sdk 
v ANDROID SDK Tools
v ANDROID SDK SDK Platform-tools
v ANDROID SDK Build-tools

ANDROID 4.1.2 API (16)
  v Google APIs
  
[Install 3 packages...]


0 Accept License
[Install]

6/ Exportation des variables d’environnement.

util06@station06:~/ANDROID.tic80/TIC80$ export PATH=${PATH}:/home/util06/ANDROID.tic80/TIC80/android-sdk-linux/tools/
util06@station06:~/ANDROID.tic80/TIC80$ export PATH=${PATH}:/home/util06/ANDROID.tic80/TIC80/android-sdk-linux/platform-tools/
util06@station06:~/ANDROID.tic80/TIC80$ export PATH=${PATH}:/home/util06/ANDROID.tic80/TIC80/android-ndk-r11c/
util06@station06:~/ANDROID.tic80/TIC80$ export android_HOME=/home/util06/ANDROID.tic80/TIC80/android-sdk-linux/   

7/ Téléchargement du code source.

util06@station06:~/ANDROID.tic80/TIC80$ git clone --recursive https://github.com/nesbox/TIC-80

8/ Téléchargement des librairies ‘3rd party’ pré-compilé.

util06@station06:~/ANDROID.tic80/TIC80$ mv TIC-80/3rd-party/ 3rd-party.old
util06@station06:~/ANDROID.tic80/TIC80$ git clone https://github.com/brunophilipe/tic80-3rd-party.git
util06@station06:~/ANDROID.tic80/TIC80$ mv tic80-3rd-party/ 3rd-party/
util06@station06:~/ANDROID.tic80/TIC80$ mv 3rd-party TIC-80/

9/ Installation de la librairie SDL2.

util06@station06:~/ANDROID.tic80/TIC80$ mv 3rd-party.old/SDL2-2.0.8/ TIC-80/3rd-party/

10/ Compilation de la SDL2_net.

util06@station06:~$ cd ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2_net-2.0.1/
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2_net-2.0.1$ 
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2_net-2.0.1$ sudo make install
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2_net-2.0.1$ sudo /sbin/ldconfig

11/ Compilation de la SDL2.

util06@station06:~/ANDROID.tic80/TIC80$ cd TIC-80/3rd-party/SDL2-2.0.8/
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2-2.0.8$ ./configure 
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2-2.0.8$ make
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2-2.0.8$ sudo make install
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2-2.0.8$ sudo /sbin/ldconfig
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/3rd-party/SDL2-2.0.8$ cd ../../..

12/ Installation des démos Lua.

util06@station06:~/ANDROID.tic80/TIC80$ git clone --recursive https://github.com/nesbox/TIC-80 TIC-80.x86
util06@station06:~/ANDROID.tic80/TIC80$ cd TIC-80.x86
util06@station06:~/ANDROID.tic80/TIC80/TIC-80.x86$ cmake .
util06@station06:~/ANDROID.tic80/TIC80/TIC-80.x86$ make
util06@station06:~/ANDROID.tic80/TIC80/TIC-80.x86$ cp bin/assets/* ../TIC-80/bin/assets/
util06@station06:~/ANDROID.tic80/TIC80/TIC-80.x86$ cd ..

13/ Compilation des sources ‘.c’.

util06@station06:~/ANDROID.tic80/TIC80$ cd TIC-80/build/android/jni/
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/build/android/jni$ ndk-build 
[armeabi-v7a] Install        : libSDL2.so => libs/armeabi-v7a/libSDL2.so
[armeabi-v7a] Install        : libgif.so => libs/armeabi-v7a/libgif.so
[armeabi-v7a] Install        : liblua.so => libs/armeabi-v7a/liblua.so
[armeabi-v7a] Compile thumb  : main <= tic.c
[armeabi-v7a] SharedLibrary  : libmain.so
[armeabi-v7a] Install        : libmain.so => libs/armeabi-v7a/libmain.so
[armeabi-v7a] Install        : libsdlgpu.so => libs/armeabi-v7a/libsdlgpu.so
[armeabi-v7a] Install        : libwren.so => libs/armeabi-v7a/libwren.so
[armeabi-v7a] Install        : libz.so => libs/armeabi-v7a/libz.so
[x86] Prebuilt       : libSDL2.so <= jni/SDL2/../../../../3rd-party/pre-built/android/sdl2/x86/
[x86] Install        : libSDL2.so => libs/x86/libSDL2.so
...
[x86] Compile        : main <= net.c
[x86] Compile        : main <= luaapi.c
[x86] Compile        : main <= jsapi.c
[x86] Compile        : main <= wrenapi.c
[x86] Compile        : main <= tic.c
[x86] Compile        : main <= dialog.c
...
[x86] Prebuilt       : libwren.so <= jni/wren/../../../../3rd-party/pre-built/android/wren/x86/
[x86] Prebuilt       : libsdlgpu.so <= jni/sdlgpu/../../../../3rd-party/pre-built/android/sdlgpu/x86/
[x86] SharedLibrary  : libmain.so
[x86] Install        : libmain.so => libs/x86/libmain.so
[x86] Install        : libsdlgpu.so => libs/x86/libsdlgpu.so
[x86] Install        : libwren.so => libs/x86/libwren.so
[x86] Install        : libz.so => libs/x86/libz.so
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/build/android/jni$

14/ Erreurs de compilation.

– Erreur :

/usr/local/include/SDL2/SDL_cpuinfo.h:64:23: fatal error: immintrin.h: No such file or directory
 #include <immintrin.h>

Solution :

Commenter ce code

– Erreur :

fatal error: SDL.h: No such file or directory

Solution :

#include "/usr/local/include/SDL2/SDL.h"
#include "/usr/local/include/SDL2/SDL_endian.h"
#include "/usr/local/include/SDL2/SDL_version.h"

– Erreur :

/home/util06/ANDROID.tic80/TIC80/TIC-80/build/android/jni/src/../../../../3rd-party/SDL2_net-2.0.1/SDL_net.h:50:24: fatal error: begin_code.h: No such file or directory
 #include <SDL.h>

Solution :

#include "/usr/local/include/SDL2/begin_code.h"
#include "/usr/local/include/SDL2/close_code.h" 

– Erreur :

/home/util06/ANDROID.tic80/TIC80/TIC-80/build/android/jni/src/../../../../src/ext/file_dialog.c:25:17: fatal error: SDL.h: No such file or directory

Solution :

#include "/usr/local/include/SDL2/SDL.h"

– Erreur :

/home/util06/ANDROID.tic80/TIC80/TIC-80/build/android/jni/src/../../../../3rd-party/sdl-gpu/include/SDL_gpu.h:4:17: fatal error: SDL.h: No such file or directory
 #include "SDL.h"

Solution :

#include "/usr/local/include/SDL2/SDL.h"

– Erreur :

/home/util06/ANDROID.tic80/TIC80/TIC-80/build/android/jni/src/../../../../3rd-party/sdl-gpu/include/SDL_gpu.h:9:24: fatal error: begin_code.h: No such file or directory
 #include "begin_code.h"
                        ^

Solution :

#include "/usr/local/include/SDL2/begin_code.h"   
#include "/usr/local/include/SDL2/close_code.h"

– Erreur :

/home/util06/ANDROID.tic80/TIC80/TIC-80/build/android/jni/src/../../../../src/tic.c:1627: error: undefined reference to 'getSquirrelScriptConfig'
/home/util06/ANDROID.tic80/TIC80/TIC-80/build/android/jni/src/../../../../src/tic.c:1628: error: undefined reference to 'getSquirrelScriptConfig'
/home/util06/ANDROID.tic80/TIC80/TIC-80/build/android/jni/src/../../../../src/tic.c:578: error: undefined reference to 'getSquirrelScriptConfig'

Solution :

Supprimer toutes les références au "Squirrel script".

15/ Compilation des sources ‘.java’.

util06@station06:~/ANDROID.tic80/TIC80$ cd TIC-80/build/ANDROID/
util06@station06:~/ANDROID.tic80/TIC80/TIC-80/build/ANDROID$ ant release install

16/ Vérification.

util06@station06:~/ANDROID.tic80/TIC80/TIC-80/build/ANDROID$ ls -lh bin/TIC-release.apk
-rw-r--r-- 1 util06 util06 41K oct.  25 22:56 bin/TIC-release.apk

17/ Installation de l’apk.

Transférer le fichier ‘TIC-release.apk’ et lancer son installation avec un gestionnaire de fichier Android.

18/ Captures d’écran.

19/ Liens.

https://github.com/nesbox/TIC-80/tree/master/build/android