1) Install 64-bit Linux (on real hardware or inside VM). Apply available updates.

Note:
	At least 8 GB RAM is required for building libSDL by Pelya and Bochs.
	If you have VBox and Win 10/11, turn off "Hyper-V" and "Windows Hypervisor Platform".
	Then disable "Memory Integrity" and "Credential Guard" (via DG Readiness Tool) in order to avoid "green turtle".
	If it's shown - VBox cannot use hypervisor directly and cannot run at full performance.

2) Install OpenJDK 17

Command (Debian-based distros):
	sudo apt-get install openjdk-17-jdk

Command (OpenSUSE):
	sudo zypper install java-17-openjdk-devel

Use "sudo update-alternatives --config java" and "sudo update-alternatives --config javac" to set Java 17 as default.
	
3) Install packages, which are necessary for build:

Commands (Debian-based distros):
	sudo apt-get install ant
	sudo apt-get install make
	sudo apt-get install g++
	sudo apt-get install git-core

Command (OpenSUSE):
	sudo zypper install ant
	sudo zypper install make
	sudo zypper install gcc-c++
	sudo zypper install git-core

Also make sure that Python 3 is installed and available by typing "python" in terminal.
	
4) Install Android SDK and NDK

Download this:

	Android Studio Command-Line Tools:
	https://developer.android.com/studio#command-tools
	Extract into "/home/<username>/android/sdk/" directory (preserving symlinks!).
	
	Android SDK Command-Line tools:
	./sdkmanager --sdk_root=/home/<username>/android/sdk "cmdline-tools;3.0"                                     
	
	Android SDK Platform-tools:
	./sdkmanager --sdk_root=/home/<username>/android/sdk "platform-tools"
	
	Android SDK Build tools 34.0.0:
	./sdkmanager --sdk_root=/home/<username>/android/sdk "build-tools;34.0.0"
	
	Android SDK Platform (API 33) or higher
	./sdkmanager --sdk_root=/home/<username>/android/sdk "platforms;android-33"
	
	Android NDK r25c (newer versions don't work yet):
	https://github.com/android/ndk/wiki/Unsupported-Downloads
	Extract into "/home/<username>/android/ndk/" directory (preserving symlinks!).
	Rename "android-ndk-r25c" subdirectory to "25.2.9519653".

5) Download required repos from GitHub. Use separate directory like "/home/<username>/kitchen".

Commands:
	git clone -b sdl_android https://github.com/pelya/commandergenius androidsdl
	git clone https://github.com/bochs-emu/bochs
	cd androidsdl
	git submodule update --init --recursive project/jni/sdl2
	git submodule update --init --recursive project/jni/sdl2_image
	git submodule update --init --recursive project/jni/sdl2_mixer
	git submodule update --init --recursive project/jni/sdl2_ttf
	git pull origin pull/151/head
	
Note:
	SDL (v1.2) and SDL2 configurations share common dependencies (like jpeg, png, etc.),
	but only sdl2_* folders are defined as git submodules,
	so you have to download them too (see above) in order
	to fetch dependencies for corresponding SDL (v1.2) libraries.

Note:
	Pull request contains patches for running pelya's libSDL environment on Android 11+.


6) Collect BIOS binaries, license files, etc. into "/home/<username>/kitchen/bochs/build/android/bochs/AndroidData/" directory.
Create zip archive there (it's name is defined at "AppDataDownloadUrl" in "/home/<username>/kitchen/bochs/bochs/build/android/bochs/AndroidAppSettings.cfg").

7) Create script "setenv-android.sh" at "/home/<username>/android/" directory.
	
Contents:
	#!/bin/sh

	# JAVA_HOME example: /usr/lib64/jvm/java-17-openjdk-17
	export JAVA_HOME=<your_path_to_java_17>
	export ANDROID_HOME=/home/<username>/android/sdk
	export ANDROID_NDK_HOME=/home/<username>/android/ndk/25.2.9519653
	export ANDROID_SDL_HOME=/home/<username>/kitchen/androidsdl
	export ANDROID_BOCHS_HOME=/home/<username>/kitchen/bochs/bochs
	export PATH=$ANDROID_HOME/platform-tools:$PATH
	export PATH=$ANDROID_HOME/build-tools/34.0.0:$PATH

Commands:
	chmod +x /home/<username>/android/setenv-android.sh
	source /home/<username>/android/setenv-android.sh

8) Create debug keystore at "/home/<username>/.android/" like this:

Command (example):
	keytool -genkey -v -keystore /home/<username>/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
	
Description:
    Keystore name: "debug.keystore"
    Keystore password: "android"
    Key alias: "androiddebugkey"
    Key password: "android"
    CN: "CN=Android Debug,O=Android,C=US"

9) Run ./build-core.sh from "/home/<username>/kitchen/bochs/bochs/build/android/". Wait and pray)
If you see "BUILD SUCCESSFUL" - you'll find apk in the same directory.

Guide by:
https://github.com/lubomyr
https://github.com/MVoloshin
https://github.com/pelya
