HedgeroidGuide.wiki
author Wuzzy
Wed, 02 May 2018 22:48:07 +0100
changeset 1330 d92ed3272533
parent 798 30c5f1ebd552
permissions -rw-r--r--
LuaLibraries: fix indent
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
298
9eb97ce0fec8 deprecated old hedgeroidguide
vittorio.giovara@gmail.com
parents: 213
diff changeset
     1
#summary (old) instructions for building Hedgewars for Android
9eb97ce0fec8 deprecated old hedgeroidguide
vittorio.giovara@gmail.com
parents: 213
diff changeset
     2
#labels Deprecated
9eb97ce0fec8 deprecated old hedgeroidguide
vittorio.giovara@gmail.com
parents: 213
diff changeset
     3
9eb97ce0fec8 deprecated old hedgeroidguide
vittorio.giovara@gmail.com
parents: 213
diff changeset
     4
*NOTE: this page is depecrated, refer to [BuildingForAndroid]*
9eb97ce0fec8 deprecated old hedgeroidguide
vittorio.giovara@gmail.com
parents: 213
diff changeset
     5
9eb97ce0fec8 deprecated old hedgeroidguide
vittorio.giovara@gmail.com
parents: 213
diff changeset
     6
-----
9eb97ce0fec8 deprecated old hedgeroidguide
vittorio.giovara@gmail.com
parents: 213
diff changeset
     7
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     8
= Hedgewars for Android =
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
     9
== Introduction ==
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
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
    12
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    13
==Download==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    14
199
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
    15
We need to download these packages:
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    16
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 592
diff changeset
    17
* [https://hg.hedgewars.org/hedgewars/ Hedgewars Source]<br>
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    18
* [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
    19
* [http://developer.android.com/sdk/ndk/index.html Android NDK] (current version is r5b but anything up will probably work)<br>
211
2aebd9de1a5e Use another fpc version which doesnt have the dynamically linked libs bug
richarddeurtje@gmail.com
parents: 210
diff changeset
    20
* ~~[http://freepascal.org/down/source/sources.var FreePascal] (Latest (stable) version will do)~~<br>
2aebd9de1a5e Use another fpc version which doesnt have the dynamically linked libs bug
richarddeurtje@gmail.com
parents: 210
diff changeset
    21
* [http://sourceforge.net/projects/p-tools/ p-tools] (Fixed freepascal compiler, read below which to download)<br>
160
8196e13b5b61 last one i promise, forgot <br>
richarddeurtje@gmail.com
parents: 159
diff changeset
    22
* [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
    23
* Java compiler, make sure you get JDK (not JRE) version 6 and up
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    24
* [http://www.cmake.org/ Cmake]
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    25
* You will also need qt4 although this is not strictly required for the android build it is needed for the desktop frontend
119
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
==Hedgewars Source==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    28
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    29
Using mercurial you can pull the hedgeroid branch using
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    30
{{{
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 592
diff changeset
    31
hg clone https://hg.hedgewars.org/hedgewars/ hedgewars
119
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
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    34
==Android SDK==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    35
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    36
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.
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    37
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    38
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
    39
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    40
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
    41
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    42
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
    43
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    44
{{{
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    45
android create avd -n <name> -t 4
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    46
}}}
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    47
-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
    48
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    49
See this for more information
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    50
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    51
To run the emulator navigate to `<`SDK`>`/tools and run
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
{{{emulator -avd <name>}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    54
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
    55
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    56
Note when using ant:
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    57
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.
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    58
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    59
==Android NDK==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    60
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    61
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
    62
122
8a5eb06794eb Edited wiki page HedgeroidGuide through web user interface.
richarddeurtje@gmail.com
parents: 121
diff changeset
    63
==!FreePascal ==
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    64
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    65
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:
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    66
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    67
{{{
207
f46af5897066 not sure why....but on windows this prevent error like: selected processor does not support `wfs r0'
richarddeurtje@gmail.com
parents: 201
diff changeset
    68
make crossinstall CPU_TARGET=arm OS_TARGET=linux CROSSBINDIR=<ndk>/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin OPT=-dFPC_ARMEL BINUTILSPREFIX=arm-linux-androideabi- INSTALL_PREFIX=<fpc>/fpc_install
119
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
210
richarddeurtje@gmail.com
parents: 208
diff changeset
    71
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
richarddeurtje@gmail.com
parents: 208
diff changeset
    72
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    73
Note2: On windows use forward slashes so '/' not '\'
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    74
==Final==
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    75
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    76
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
    77
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
    78
1.<br>
159
b9af15388627 forgot to escape < and >
richarddeurtje@gmail.com
parents: 158
diff changeset
    79
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
    80
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    81
{{{
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    82
export PATH=$PATH:/home/xeli/SoftDev/android/ndk
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    83
export PATH=$PATH:/home/xeli/SoftDev/android/sdk/platform-tools
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    84
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
    85
}}}
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
    86
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
    87
(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
    88
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    89
for windows the PATH var should include this, mind the order:
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    90
{{{
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    91
    - %WINDIR%\System32 (for Java)<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    92
    - <CMake>\bin<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    93
    - <QtSDK>\mingw\bin<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    94
    - <QtSDK>\Desktop\Qt\4.8.0\mingw\bin<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    95
    - <fpc-win>\bin\i386-win32<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    96
    - <fpc-android>\compiler<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    97
    - <ndk><br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    98
    - <sdk>\platform-tools<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
    99
    - <ant>\bin<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   100
    - <mercurial> (directory containing hg.exe, TortoiseHg dir in my case)<br>
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   101
}}}
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   102
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   103
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
   104
2.<br>
199
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   105
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
   106
{{{
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   107
cd <hedgewars-root>/project_files/Android-build
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   108
chmod +x download_libs.sh (might not be needed)
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   109
./download_libs.sh
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   110
}}}
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   111
This will download and unzip sdl to the expected folders
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   112
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   113
On windows the script should work fine with Git Bash.
199
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   114
2db424bc559b should be up to date again
richarddeurtje@gmail.com
parents: 160
diff changeset
   115
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
   116
3.<br>
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
   117
Finally you can use cmake to create the scripts
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   118
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   119
{{{
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   120
cd <hedgewars-root>
210
richarddeurtje@gmail.com
parents: 208
diff changeset
   121
cmake . -DANDROID=1
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   122
}}}
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   123
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   124
on windows you will need some extra arguments:
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   125
{{{
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   126
cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="%CD%/misc/winutils/include" -DCMAKE_LIBRARY_PATH="%CD%/misc/winutils/lib" -DANDROID=1 .
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   127
}}}
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   128
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   129
And that’s it. To compile:
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   130
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   131
{{{
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   132
cd <hedgewars-root>/project_files/Android-build/
158
3c2429fd0b51 updated to the current build process
richarddeurtje@gmail.com
parents: 122
diff changeset
   133
make -f Makefile.android
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   134
}}}
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   135
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
   136
201
cac9c3805597 made the "Final" part a bit more readable
richarddeurtje@gmail.com
parents: 200
diff changeset
   137
On the device/emulator you can start the application up :)
119
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   138
cd022c242e50 Hedgewars build guide for Android
richarddeurtje@gmail.com
parents:
diff changeset
   139
120
230afa501524 Edited wiki page HedgeroidGuide through web user interface.
richarddeurtje@gmail.com
parents: 119
diff changeset
   140
230afa501524 Edited wiki page HedgeroidGuide through web user interface.
richarddeurtje@gmail.com
parents: 119
diff changeset
   141
213
a2be6fe1d509 Added windows notes provided by Medo42
richarddeurtje@gmail.com
parents: 211
diff changeset
   142
TODO verify that it works on OS X, is the depencency list complete now?