HedgeroidGuide.wiki
author kyberneticist@gmail.com
Sun, 26 Feb 2012 17:39:27 +0000
changeset 202 47363108b6b6
parent 201 cac9c3805597
child 207 f46af5897066
permissions -rw-r--r--
Edited wiki page LuaAPI through web user interface.
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
199
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
     9
We need to download these packages:
119
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>
160
8196e13b5b61 last one i promise, forgot <br>
richarddeurtje@gmail.com
parents: 159
diff changeset
    15
* [http://ant.apache.org/ Ant] (Linux distro should just use their package manager to get it, version isn't really important)<br>
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    16
* Java compiler, make sure you get JDK (not JRE) version 6 and up
119
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
}}}
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
==Android SDK==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    26
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    27
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
    28
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    29
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.
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    30
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    31
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
    32
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    33
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
    34
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    35
{{{
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    36
android create avd -n <name> -t 4
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    37
}}}
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    38
-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
    39
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    40
See this for more information
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    41
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    42
To run the emulator navigate to `<`SDK`>`/tools and run
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    43
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    44
{{{emulator -avd <name>}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    45
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
    46
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    47
==Android NDK==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    48
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    49
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
    50
122
8a5eb06794eb Edited wiki page HedgeroidGuide through web user interface.
richarddeurtje@gmail.com
parents: 121
diff changeset
    51
==!FreePascal ==
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    52
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    53
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
    54
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    55
{{{
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    56
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
    57
}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    58
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    59
==Final==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    60
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    61
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
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    62
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    63
1.<br>
159
b9af15388627 forgot to escape < and >
richarddeurtje@gmail.com
parents: 158
diff changeset
    64
Add `<`NDK`>`:`<`SDK`>`/platform-tools:`<`FPC`>`/compiler to your path, on debian based system I would do it as follows:
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    65
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    66
{{{
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    67
export PATH=$PATH:/home/xeli/SoftDev/android/ndk
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    68
export PATH=$PATH:/home/xeli/SoftDev/android/sdk/platform-tools
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    69
export PATH=$PATH:/home/xeli/SoftDev/android/fpc-2.4.4/compiler
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    70
}}}
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    71
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    72
(Check google on how to do it for your specific OS if you don't know how)
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    73
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    74
2.<br>
199
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    75
Now we're gonna download sdl and a couple of its libraries, if you're on linux there's a script you can use
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    76
{{{
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    77
cd <hedgewars-root>/project_files/Android-build
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    78
chmod +x download_libs.sh (might not be needed)
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    79
./download_libs.sh
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    80
}}}
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    81
This will download and unzip sdl to the expected folders
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    82
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    83
TODO: make script for windows and verify if it works for osx
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    84
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    85
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    86
3.<br>
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    87
Finally you can use cmake to create the scripts
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    88
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
cd <hedgewars-root>
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    91
cmake .
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    92
}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    93
And that’s it. To compile:
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    94
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
cd <hedgewars-root>/project_files/Android-build/
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    97
make -f Makefile.android
119
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
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
   100
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
   101
On the device/emulator you can start the application up :)
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   102
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   103
120
230afa501524 Edited wiki page HedgeroidGuide through web user interface.
richarddeurtje@gmail.com
parents: 119
diff changeset
   104
230afa501524 Edited wiki page HedgeroidGuide through web user interface.
richarddeurtje@gmail.com
parents: 119
diff changeset
   105
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   106
TODO verify that it works on Windows and OS X add dependency list of utilities (ant, fpc compiler for host, make etcetc)