author | sheepluva |
Thu, 23 Mar 2023 20:47:32 +0000 | |
changeset 2221 | 4bf8172a73a1 |
parent 2000 | 869c787e818d |
permissions | -rw-r--r-- |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
1 |
#summary Instructions for building Hedgewars for Android |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
2 |
#labels Phase-Implementation,Phase-Design,Phase-Support |
754 | 3 |
= Building on Android = |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
4 |
== Introduction == |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
5 |
|
1999 | 6 |
This guide will take you through the steps needed to succesfully compile Hedgewars for Android. |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
7 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
8 |
==Download== |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
9 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
10 |
We need to download these packages: |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
11 |
|
798
30c5f1ebd552
global replace of http with https for hedgewars.org wiki links
nemo
parents:
754
diff
changeset
|
12 |
* [https://hg.hedgewars.org/hedgewars/ Hedgewars Source]<br> |
679 | 13 |
* [http://developer.android.com/sdk/index.html Android SDK] (Latest version will do)<br> |
14 |
* [http://developer.android.com/sdk/ndk/index.html Android NDK] (current version is r5b but anything up will probably work)<br> |
|
15 |
* ~~[http://freepascal.org/down/source/sources.var FreePascal] (Latest (stable) version will do)~~<br> |
|
16 |
* [http://sourceforge.net/projects/p-tools/ p-tools] (Fixed freepascal compiler, read below which to download)<br> |
|
17 |
* [http://ant.apache.org/ Ant] (Linux distro should just use their package manager to get it, version isn't really important)<br> |
|
18 |
* Java compiler, make sure you get JDK (not JRE) version 6 and up |
|
19 |
* [http://www.cmake.org/ Cmake] |
|
20 |
* You will also need qt4 although this is not strictly required for the android build it is needed for the desktop frontend |
|
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
21 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
22 |
==Hedgewars Source== |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
23 |
|
1999 | 24 |
Using Mercurial you can pull the `hedgeroid` branch using |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
25 |
{{{ |
798
30c5f1ebd552
global replace of http with https for hedgewars.org wiki links
nemo
parents:
754
diff
changeset
|
26 |
hg clone https://hg.hedgewars.org/hedgewars/ hedgewars |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
27 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
28 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
29 |
==Android SDK== |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
30 |
|
1999 | 31 |
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. |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
32 |
|
1999 | 33 |
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. |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
34 |
|
1999 | 35 |
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. |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
36 |
|
1999 | 37 |
You can use either the GUI, run Android and follow the signs or from command-line: |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
38 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
39 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
40 |
android create avd -n <name> -t 4 |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
41 |
}}} |
1999 | 42 |
|
43 |
`<name>` is a name of your choice. The number after `-t` stands for the target ID. |
|
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
44 |
|
1999 | 45 |
See this for more information: |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
46 |
|
1999 | 47 |
To run the emulator navigate to `<SDK>/tools` and run |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
48 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
49 |
{{{emulator -avd <name>}}} |
1999 | 50 |
|
51 |
where `<name>` is the same name as when you created it with the line above. |
|
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
52 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
53 |
Note when using ant: |
1999 | 54 |
|
55 |
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. |
|
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
56 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
57 |
==Android NDK== |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
58 |
|
1999 | 59 |
Download and untar it, I'll refer to the ndk as `<NDK>`. That’s it. :) |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
60 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
61 |
==!FreePascal == |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
62 |
|
2000 | 63 |
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: |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
64 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
65 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
66 |
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 |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
67 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
68 |
|
1999 | 69 |
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`. |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
70 |
|
1999 | 71 |
Note 2: On Windows, use forward slashes, so '/', not '\'. |
72 |
||
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
73 |
==Final== |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
74 |
|
1999 | 75 |
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. |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
76 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
77 |
1.<br> |
1999 | 78 |
Add `<NDK>:<SDK>/platform-tools:<FPC>/compiler` to your path, on Debian-based system I would do it as follows: |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
79 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
80 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
81 |
export PATH=$PATH:/home/xeli/SoftDev/android/ndk |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
82 |
export PATH=$PATH:/home/xeli/SoftDev/android/sdk/platform-tools |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
83 |
export PATH=$PATH:/home/xeli/SoftDev/android/fpc-2.4.4/compiler |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
84 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
85 |
|
1999 | 86 |
(Check Google on how to do it for your specific OS if you don't know how.) |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
87 |
|
1999 | 88 |
For Windows, the `PATH` var should include this, mind the order: |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
89 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
90 |
- %WINDIR%\System32 (for Java)<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
91 |
- <CMake>\bin<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
92 |
- <QtSDK>\mingw\bin<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
93 |
- <QtSDK>\Desktop\Qt\4.8.0\mingw\bin<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
94 |
- <fpc-win>\bin\i386-win32<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
95 |
- <fpc-android>\compiler<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
96 |
- <ndk><br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
97 |
- <sdk>\platform-tools<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
98 |
- <ant>\bin<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
99 |
- <mercurial> (directory containing hg.exe, TortoiseHg dir in my case)<br> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
100 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
101 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
102 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
103 |
2.<br> |
1999 | 104 |
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: |
105 |
||
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
106 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
107 |
cd <hedgewars-root>/project_files/Android-build |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
108 |
chmod +x download_libs.sh (might not be needed) |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
109 |
./download_libs.sh |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
110 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
111 |
This will download and unzip sdl to the expected folders |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
112 |
|
1999 | 113 |
On Windows, the script should work fine with Git Bash. |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
114 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
115 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
116 |
3.<br> |
1999 | 117 |
Finally you can use CMake to create the scripts: |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
118 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
119 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
120 |
cd <hedgewars-root> |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
121 |
cmake . -DANDROID=1 |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
122 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
123 |
|
1999 | 124 |
On Windows, you will need some extra arguments: |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
125 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
126 |
cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="%CD%/misc/winutils/include" -DCMAKE_LIBRARY_PATH="%CD%/misc/winutils/lib" -DANDROID=1 . |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
127 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
128 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
129 |
And that’s it. To compile: |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
130 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
131 |
{{{ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
132 |
cd <hedgewars-root>/project_files/Android-build/ |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
133 |
make -f Makefile.android |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
134 |
}}} |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
135 |
and it should be installed on your emulator/device if it was connected. |
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
136 |
|
1999 | 137 |
On the device/emulator you can start the application up. :) |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
138 |
|
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
139 |
|
679 | 140 |
== TODO == |
296
545c549e454c
Moved HedgeroidGuide to the BuildingOn name convention
vittorio.giovara@gmail.com
parents:
diff
changeset
|
141 |
|
1999 | 142 |
* Verify that it works on macOS, is the depencency list complete now? |