HedgeroidGuide.wiki
author richarddeurtje@gmail.com
Thu, 04 Aug 2011 21:52:44 +0000
changeset 119 cd022c242e50
child 120 230afa501524
permissions -rw-r--r--
Hedgewars build guide for Android
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     1
#summary Instructions for building Hedgewars for Android
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     2
= Hedgewars for Android =
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     3
== Introduction ==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     4
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     5
This guide will take you through the steps needed to succesfully compile Hedgewars for Android
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     6
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     7
==Download==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     8
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     9
We need to download four packages:
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    10
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    11
* [http://code.google.com/p/hedgewars/ Hedgewars Source]<br>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    12
* [http://developer.android.com/sdk/index.html Android SDK] (Latest version will do)<br>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    13
* [http://developer.android.com/sdk/ndk/index.html Android NDK] (current version is r5b but anything up will probably work)<br>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    14
* [http://freepascal.org/down/source/sources.var FreePascal] (Latest (stable) version will do)<br>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    15
* [http://www.libsdl.org/tmp/android-project.zip SDL]<br>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    16
* [http://www.lua.org/ftp/lua-5.1.4.tar.gz Lua] (Current version is 5.1.4 but anything higher will probably work)<br>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    17
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    18
==Hedgewars Source==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    19
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    20
Using mercurial you can pull the hedgeroid branch using
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    21
{{{
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    22
hg clone https://hedgewars.googlecode.com/hg/ hedgewars
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    23
hg up hedgeroid
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    24
}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    25
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    26
==Android SDK==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    27
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    28
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.1 / 2.2. 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.
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    29
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    30
Optionally you could 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.
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    31
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    32
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
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    33
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    34
You can use either the GUI, run android and follow the signs or from cli
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    35
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    36
{{{android create avd -n <name> -t 4}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    37
-n is a name of your choice -t stands for the target ID
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    38
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    39
See this for more information
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    40
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    41
To run the emulator navigate to `<`SDK`>`/tools and run
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    42
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    43
{{{emulator -avd <name>}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    44
where `<`name`>` is the same name as when you created it with the line above.
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    45
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    46
==Android NDK==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    47
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    48
Download and untar it, ill refer to the ndk as `<`NDK`>`. That’s it :)
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    49
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    50
==FreePascal==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    51
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    52
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. 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:
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    53
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    54
{{{
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    55
make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=<ndk>/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin BINUTILSPREFIX=arm-linux-androideabi- OPT=-dFPC_ARMEL INSTALL_PREFIX=<fpc>/fpc_install
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    56
}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    57
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    58
==Lua==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    59
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    60
For the missions hedgewars uses Lua as it’s scripting environment. Lua almost completely works out of the box only a few files need to be modified I’ve added these to the repo so all we need to do for now is download the tar.gz, extract and decompress the tar somewhere we’ll use it in the final step.
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    61
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    62
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    63
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    64
==SDL==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    65
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    66
Last thing we need is SDL, download the android-project.zip from the link above. unzip/tar it to some location. and that’s it :) After the ‘FINAL’ step (after running cmake .) you can remove this directory if you want
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    67
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    68
==Final==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    69
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    70
Next we will create the scripts to compile hedgewars and move SDL directories first you’ll need to make sure cmake knows where all the compilers are
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    71
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    72
open hedgeroid/project_files/Android-build/CMakeLists.txt with your favorite editor and change the first five lines.
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    73
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    74
Change 
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    75
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    76
{{{/home/richard/SoftDev/what/ever}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    77
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    78
to the location where you have stored the Android NDK/SDK, FPC crosscompiler, SDL (android-project) and LUA
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    79
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    80
Only the first 3 lines are needed. The forth and fifth moves the SDL and Lua directories for you if you do not want to do it manually (It’s recommended you let cmake handle this and change these lines!)
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    81
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    82
Next you can use cmake to create the scripts
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    83
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    84
{{{
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    85
cd <hedgewars-root>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    86
cmake .
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    87
}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    88
And that’s it. To compile:
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    89
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    90
{{{
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    91
cd <hedgewars-root>/project_files/Android-build/
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    92
./complete_build.sh
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    93
}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    94
and it should be installed on your emulator/device if it was connected.
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    95
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    96
On the device/emulator start the application up :)
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    97
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    98
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    99
TODO verify that it works on Windows and OS X add dependency list of utilities (ant, fpc compiler for host, make etcetc)