# HG changeset patch # User Wuzzy # Date 1570683980 -3600 # Node ID 789721f40796b556aa362eba743652d3ac628dc4 # Parent 32149ab9ebda34806e264377212bcb4365ee35f7 BuildingForAndroid: Clean up formatting diff -r 32149ab9ebda -r 789721f40796 BuildingForAndroid.wiki --- a/BuildingForAndroid.wiki Wed Oct 09 22:39:51 2019 +0100 +++ b/BuildingForAndroid.wiki Thu Oct 10 06:06:20 2019 +0100 @@ -3,7 +3,7 @@ = Building on Android = == Introduction == -This guide will take you through the steps needed to succesfully compile Hedgewars for Android +This guide will take you through the steps needed to succesfully compile Hedgewars for Android. ==Download== @@ -21,57 +21,61 @@ ==Hedgewars Source== -Using mercurial you can pull the hedgeroid branch using +Using Mercurial you can pull the `hedgeroid` branch using {{{ hg clone https://hg.hedgewars.org/hedgewars/ hedgewars }}} ==Android SDK== -Download the latest version using the link above. And unzip it at a place you can remember, I’ll refer to the location with `<`SDK`>`. Once you’ve unzipped/extracted the tar navigate to `<`SDK`>`/tools and execute ‘android’. This should bring up a GUI select ‘Available packages’, then ‘Android Repository’ and check atleast SDK Platform Android 1.6 / 2.2 / 4.0. I would recommend checking all of them, but it’s up to you. Next select ‘Install Selected’ press ‘Next’ a couple of times and you should have the SDK installed. +Download the latest version using the link above. And unzip it at a place you can remember, I’ll refer to the location with ``. Once you’ve unzipped/extracted the tar navigate to `/tools` and execute ‘android’. This should bring up a GUI select ‘Available packages’, then ‘Android Repository’ and check atleast SDK Platform Android 1.6 / 2.2 / 4.0. I would recommend checking all of them, but it’s up to you. Next select ‘Install Selected’ press ‘Next’ a couple of times and you should have the SDK installed. -Optionally you could permanently add `<`SDK`>`/platform-tools to your $PATH, this makes it easier to use ‘adb’. Adb is the main program to communicate with Android, think logging/pushing and pulling files/shell. +Optionally you could permanently add `/platform-tools` to your `$PATH`, this makes it easier to use ‘adb’. Adb is the main program to communicate with Android, think logging/pushing and pulling files/shell. -If you do not have a real android device you can create an emulator if you do I’d skip this and continue at Android NDK +If you do not have a real android device you can create an emulator if you do I’d skip this and continue at Android NDK. -You can use either the GUI, run android and follow the signs or from cli +You can use either the GUI, run Android and follow the signs or from command-line: {{{ android create avd -n -t 4 }}} --n is a name of your choice -t stands for the target ID + +`` is a name of your choice. The number after `-t` stands for the target ID. -See this for more information +See this for more information: -To run the emulator navigate to `<`SDK`>`/tools and run +To run the emulator navigate to `/tools` and run {{{emulator -avd }}} -where `<`name`>` is the same name as when you created it with the line above. + +where `` is the same name as when you created it with the line above. Note when using ant: -Ant needs a JDK, but tries to use a JRE sometimes (there is usually a separate JRE installation outside the JDK). If you get an error about missing tools.jar, make sure Ant is actually attempting to use the JDK. You can coax it to cooperate by setting the JAVA_HOME environment variable to point to the JDK directory. + +Ant needs a JDK, but tries to use a JRE sometimes (there is usually a separate JRE installation outside the JDK). If you get an error about missing `tools.jar`, make sure Ant is actually attempting to use the JDK. You can coax it to cooperate by setting the `JAVA_HOME` environment variable to point to the JDK directory. ==Android NDK== -Download and untar it, ill refer to the ndk as `<`NDK`>`. That’s it :) +Download and untar it, I'll refer to the ndk as ``. That’s it. :) ==!FreePascal == -We need to download the sources from the Freepascal website and compile the crosscompiler. ~~I have grabbed the latest stable release 2.4.4 , though any version will work.~~ _Because of a bug in the latest fpc sources I recommend you download the p-tools repository/tar. Follow this link http://sourceforge.net/projects/p-tools/ and find the directory fpc4android in their source repository. Download a tarball and extract it to a new directory, which will be called '<'fpc'>' from now on._ Once downloaded, extract the tar/zip and place the files in a known directory. I will refer to the directory with `<`fpc`>` from now on. Next navigate to the `<`fpc`>` directory and compile it, for this various tools are needed, ‘make’ for instance. But also a fpc compiler for your system. Some apt-get/aptitude magic will solve these problems, make a comment if you run in to problems. Use this to compile the crosscompiler: +We need to download the sources from the FreePascal website and compile the crosscompiler. I have grabbed the latest stable release 2.4.4, though any version will work. Because of a bug in the latest fpc sources I recommend you download the p-tools repository/tar. Follow this link http://sourceforge.net/projects/p-tools/ and find the directory fpc4android in their source repository. Download a tarball and extract it to a new directory, which will be called `` from now on. Once downloaded, extract the tar/zip and place the files in a known directory. I will refer to the directory with `` from now on. Next navigate to the `` directory and compile it, for this various tools are needed, ‘make’ for instance. But also a fpc compiler for your system. Some apt-get/aptitude magic will solve these problems, make a comment if you run in to problems. Use this to compile the crosscompiler: {{{ make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin OPT=-dFPC_ARMEL BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=/fpc_install }}} -Note: The flag CROSSBINDDIR points to the ndk/toolchain/../prebuilt/linux-x86/bin dir, change linux-x86 to your host machine, so for windows it would be 'windows' instead of linux-x86 +Note: The flag `CROSSBINDDIR` points to the `ndk/toolchain/../prebuilt/linux-x86/bin` dir, change `linux-x86` to your host machine, so for Windows it would be `windows` instead of `linux-x86`. -Note2: On windows use forward slashes so '/' not '\' +Note 2: On Windows, use forward slashes, so '/', not '\'. + ==Final== -We will generate the Makefile.android, which is needed to compile hedgewars, download SDL and you’ll need to make sure cmake knows where all the compilers are +We will generate the `Makefile.android`, which is needed to compile hedgewars, download SDL and you’ll need to make sure CMake knows where all the compilers are. 1.
-Add `<`NDK`>`:`<`SDK`>`/platform-tools:`<`FPC`>`/compiler to your path, on debian based system I would do it as follows: +Add `:/platform-tools:/compiler` to your path, on Debian-based system I would do it as follows: {{{ export PATH=$PATH:/home/xeli/SoftDev/android/ndk @@ -79,9 +83,9 @@ export PATH=$PATH:/home/xeli/SoftDev/android/fpc-2.4.4/compiler }}} -(Check google on how to do it for your specific OS if you don't know how) +(Check Google on how to do it for your specific OS if you don't know how.) -for windows the PATH var should include this, mind the order: +For Windows, the `PATH` var should include this, mind the order: {{{ - %WINDIR%\System32 (for Java)
- \bin
@@ -97,7 +101,8 @@ 2.
-Now we're gonna download sdl and a couple of its libraries, if you're on linux there's a script you can use +Now we're gonna download sdl and a couple of its libraries, if you're on GNU/Linux, there's a script you can use: + {{{ cd /project_files/Android-build chmod +x download_libs.sh (might not be needed) @@ -105,18 +110,18 @@ }}} This will download and unzip sdl to the expected folders -On windows the script should work fine with Git Bash. +On Windows, the script should work fine with Git Bash. 3.
-Finally you can use cmake to create the scripts +Finally you can use CMake to create the scripts: {{{ cd cmake . -DANDROID=1 }}} -on windows you will need some extra arguments: +On Windows, you will need some extra arguments: {{{ cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="%CD%/misc/winutils/include" -DCMAKE_LIBRARY_PATH="%CD%/misc/winutils/lib" -DANDROID=1 . }}} @@ -129,9 +134,9 @@ }}} and it should be installed on your emulator/device if it was connected. -On the device/emulator you can start the application up :) +On the device/emulator you can start the application up. :) == TODO == - * Verify that it works on OS X, is the depencency list complete now? \ No newline at end of file + * Verify that it works on macOS, is the depencency list complete now? \ No newline at end of file