Difference between revisions of "Compiling ScummVM/Android-SDL"

Jump to navigation Jump to search
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
1. You need linux-console
= Compiling the Android-SDL port of ScummVM =


This page describes how to build the [[Android-SDL]] port of ScummVM (supporting SDL 1.2) from the ScummVM source tree.


2. Install Android sdk&ndk (unpack it into ~/android directory)
{| border="0" cellpadding="1" cellspacing="2" style="margin-left:5em; background:#FF9999; width:80%"
|- align="center"
| '''NOTE'''
|- style="margin-left:1em; background:#ffffff;"
|- style="background:#ffffff"
| Please note that the Android''-SDL'' port is considered deprecated, which means it is no longer under active development or maintenance. Thus, the information on this page will be outdated and we will no longer be providing official support for this port.


http://developer.android.com/ndk/downloads/index.html
You may find instructions on how to compile our currently active [[Compiling_ScummVM/Android|Android port here]].
|}


https://developer.android.com/sdk/index.html
= Basic prerequisites =


In order to build the androidsdl port you will need a '''64-bit Linux OS''' installation with an '''Internet connection'''.<br />The following has been tested in '''lubuntu 64-bit 16.04.6 LTS (xenial)''', '''kernel 4.15.0-47-generic'''.
# It's recommended that you have ''at least 20 GB of free space'' on your home partition before you begin this process.
# Make sure you have the latest updates for your OS by running from a shell terminal:<br /><syntaxhighlight lang="console">sudo apt-get update
sudo apt-get upgrade</syntaxhighlight>You can also check the Software Updater GUI utility (or similar) for additional pending updates, such as kernel updates or Ubuntu Base updates (for Ubuntu based distributions). ''Reboot'' your PC, ''if you are prompted to''.
# Install the Linux packages that are required for the build:<br /><syntaxhighlight lang="console">sudo apt-get install build-essential
sudo apt-get install git</syntaxhighlight>
# Install the JDK. You can do this using the apt-get tool or by downloading the JDK from Oracle's official site (in the latter case you must set environment variables for JDK; see guides on "How install JDK and set environment variables for JDK").<br />Recommended command:<br /><syntaxhighlight lang="console">sudo apt-get install openjdk-8-jdk</syntaxhighlight>


to run android environment you can create simple script setenv-android.sh
= Install the Android SDK and NDK =


This guide assumes that you create an "''~/Android''" folder inside your home directory to put the ''Android SDK'' and ''NDK''.
=== Install Android SDK with command line tools only ===
Navigate to url: https://developer.android.com/studio/index.html<br />
Download the "''Command line tools only''" packet for Linux ("''sdk-tools-linux-4333796.zip''" at the time of this writing).
# Create an "''~/.android''" and an "''~/Android''" folder in your home directory. Then, create a "''~/Android/android-sdk''" subfolder.<br />To do this from a shell terminal, issue:<br /><syntaxhighlight lang="console">mkdir ~/.android
mkdir ~/Android
mkdir ~/Android/android-sdk</syntaxhighlight>
# Unpack the ''command line tools'' zip file inside the "''~/Android/android-sdk''" folder. This should create a "''tools''" subfolder.<br />
# Install the required Android SDK tools.<br />Using a shell terminal issue:<br /><syntaxhighlight lang="console">touch ~/.android/repositories.cfg
cd ~/Android/android-sdk/tools/bin
./sdkmanager --install "platforms;android-26"
./sdkmanager --install "build-tools;26.0.0"
./sdkmanager --install "extras;android;m2repository"</syntaxhighlight>Accept any license agreement you are prompted with during the above installation process. Also, for good measure, issue the following command, then review and accept any pending license agreements:<br /><syntaxhighlight lang="console">./sdkmanager --licenses</syntaxhighlight>Then, using the following command verify that you've installed the correct tools:<br /><syntaxhighlight lang="console">./sdkmanager --list</syntaxhighlight>You should see a printout that begins like the following:<syntaxhighlight lang="console">
Path                        | Version | Description                    | Location
-------                    | ------- | -------                        | -------
build-tools;26.0.0          | 26.0.0  | Android SDK Build-Tools 26.0.0 | build-tools/26.0.0/
extras;android;m2repository | 47.0.0  | Android Support Repository    | extras/android/m2repository/
platforms;android-26        | 2      | Android SDK Platform 26        | platforms/android-26/
tools                      | 26.1.1  | Android SDK Tools 26.1.1      | tools/
</syntaxhighlight>


<code>#!/bin/sh
=== Install Android SDK with Android Studio ===
'''Alternatively''', you could download and install the Android Studio for Linux 64-bit. You can then use the ''sdk-manager GUI tool'' to install the required additional tools and SDK resources. Use the above list as a guide to what packages you should download and install.


export PATH=~/android/android-ndk-r13b:$PATH
== Install the Android NDK ==
Install the ''r15c (July 2017)'' version for Android NDK ("''android-ndk-r15c-linux-x86_64.zip''"). Newer versions are currently not supported.<br />The ''r15c NDK'' can be found in the following url: https://developer.android.com/ndk/downloads/older_releases.html<br />Extract the zip file you downloaded into the "''~/Android''" folder. This should create a "''android-ndk-r15c''" subfolder.
== Set the environment variables for the session ==
For this purpose you can create and use a simple "''setenv-android.sh''" script. Within this script define the environment variables for the paths to your SDK tools and NDK.<br />Sample (suggested) script:<syntaxhighlight lang="sh">
#!/bin/sh


export PATH=~/android/android-sdk-linux/tools:$PATH
export ANDROID_HOME=~/Android/android-sdk
export ANDROID_SDK_ROOT=~/Android/android-sdk
export ANDROID_NDK_HOME=~/Android/android-ndk-r15c
export ANDROID_SDK_TOOLS=$ANDROID_HOME/tools
export ANDROID_SDK_BTOOLS=$ANDROID_HOME/build-tools/26.0.0
export PATH=$ANDROID_NDK_HOME:$ANDROID_SDK_TOOLS:$ANDROID_SDK_BTOOLS:$PATH
</syntaxhighlight>Save the "''setenv-android.sh''" script in your "''~/Android''" folder.
<br />In order to apply the script run from a shell terminal:<syntaxhighlight lang="sh">source ~/Android/setenv-android.sh</syntaxhighlight>Verify that your environmental variables have been set correctly by running:<syntaxhighlight lang="sh">echo $PATH</syntaxhighlight>You should see your NDK and SDK paths at the start of the ''$PATH'' variable.<br /><br />'''WARNING:''' These environmental variables ''will be set only for that particular command-line session''; You will need to re-run this script (by using the above <code>source</code> command), if you start another shell terminal session. You should not have to re-run this script within the same shell terminal session.


export PATH=~/android/android-sdk-linux/build-tools/25.0.0:$PATH</code>
= Create a keystore =
Create and put a keystore (you can use the debug version) in "''~/.android/debug.keystore''" in order to be able to sign the apk file that will be built.<br />To create a debug key store, run from the shell terminal the following two (2) commands:<syntaxhighlight lang="console">keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000</syntaxhighlight><syntaxhighlight lang="console">keytool -importkeystore -srckeystore ~/.android/debug.keystore -destkeystore ~/.android/debug.keystore -deststoretype pkcs12</syntaxhighlight>Enter "''android''" without the quotes when asked for the keystore password.


run this script via console
= Clone the ScummVM repository =
This guide assumes that you run the clone command from your home directory:<br /><syntaxhighlight lang="console">cd ~
git clone https://github.com/scummvm/scummvm.git</syntaxhighlight>The above command will create a "''scummvm''" folder in your home directory.


<code>. setenv-android.sh</code>
= Compiling =
Provided that you completed the above steps, you can now start building the '''android-sdl port''' project by issuing the following commands from a terminal session '''where you have already set the Android SDK and NDK environment variables''':<br /><syntaxhighlight lang="console">cd ~/scummvm/dists/androidsdl
./build.sh</syntaxhighlight>


If the process completes successfully, an apk file named "''scummvm-debug.apk''" file will be stored in that folder (''~/scummvm/dists/androidsdl'').<br />Since this apk file is self-signed, you will need to enable installation by third-party sources on your Android device in order to install it.


Now via Android SDK Manager (for call sdk manager via console type android). You need download latest version:
'''Note:''' You can significantly reduce the build time, if you target a specific Android architecture and/or build ScummVM for specific game engines only.
Android SDK Tools
* In order to target specific architectures edit the following line from the "''~/scummvm/dists/androidsdl/scummvm/AndroidAppSettings.cfg''" file:<br />From:<br /><code>MultiABI="armeabi-v7a arm64-v8a x86 x86_64"</code><br />To:<br /><code>MultiABI="arm64-v8a"</code><br />The above line is only an example; you might have to specify another architecture for your specific use case.
* In order to build the scummvm androidsdl port for specific engines only:
*# Open the "''~/scummvm/dists/androidsdl/scummvm/AndroidBuild.sh''" file
*# Find the following line which contains the configure command:<syntaxhighlight lang="sh">$ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-release --enable-optimizations --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. "</syntaxhighlight>
*# Edit the line and, after "<code>../configure</code>",  add "<code>--disable-all-engines --enable-engine=YYYY</code>", where in place of "<code>YYYY</code>" you should specify game engine for which you want to build ScummVM.<br />For example (building only for the ''bladerunner'' engine):<syntaxhighlight lang="sh">$ANDROIDSDL/project/jni/application/setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --disable-all-engines --enable-engine=bladerunner --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --disable-cloud --enable-vkeybd --enable-release --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. "</syntaxhighlight>


Android SDK Platform-tools
= References =


Android SDL Build tools
*[https://raw.githubusercontent.com/scummvm/scummvm/master/dists/androidsdl/How_to_Build.txt How to build text <nowiki>[github]</nowiki>]
 
*[https://forums.scummvm.org/viewtopic.php?t=14811 Compiling SDL Error <nowiki>[forum]</nowiki>]
Android 6.0 (API 23)
*[https://forums.scummvm.org/viewtopic.php?t=14516 ScummVM2.0.0 crash upon start <nowiki>[forum]</nowiki>]
 
*[https://developer.android.com/studio/publish/app-signing#debugmode Sign your debug build <nowiki>[Android Developers User Guide]</nowiki>]
+SDK Platform (API 23)
 
 
3. Install pelya's libSDL-environment
 
<code>cd ~
git clone git://github.com/pelya/commandergenius androidsdl</code>
 
 
4. download scummvm sources
 
<code>
cd ~
git clone https://github.com/scummvm/scummvm</code>
 
 
5. replace pelya's scummvm config to config from scummvm dists
 
<code>
cd ~/androidsdl/project/jni/application
rm -fr scummvm
ln -s ~/scummvm/dists/androidsdl/scummvm scummvm</code>
 
 
6. You have to replace one line in file AndroidAppSettings.cfg ( ~/androidsdl/project/jni/application/scummvm)
 
<code>AppVersionCode=@ANDROID_VERSIONCODE@
to
AppVersionCode=20</code>
 
 
7. Now you can build project (apk)
 
<code>cd ~/androidsdl
./build.sh scummvm</code>
1,305

edits

Navigation menu