19 * [http://www.cmake.org/ Cmake] |
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 |
20 * You will also need qt4 although this is not strictly required for the android build it is needed for the desktop frontend |
21 |
21 |
22 ==Hedgewars Source== |
22 ==Hedgewars Source== |
23 |
23 |
24 Using mercurial you can pull the hedgeroid branch using |
24 Using Mercurial you can pull the `hedgeroid` branch using |
25 {{{ |
25 {{{ |
26 hg clone https://hg.hedgewars.org/hedgewars/ hedgewars |
26 hg clone https://hg.hedgewars.org/hedgewars/ hedgewars |
27 }}} |
27 }}} |
28 |
28 |
29 ==Android SDK== |
29 ==Android SDK== |
30 |
30 |
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. |
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. |
32 |
32 |
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. |
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. |
34 |
34 |
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 |
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. |
36 |
36 |
37 You can use either the GUI, run android and follow the signs or from cli |
37 You can use either the GUI, run Android and follow the signs or from command-line: |
38 |
38 |
39 {{{ |
39 {{{ |
40 android create avd -n <name> -t 4 |
40 android create avd -n <name> -t 4 |
41 }}} |
41 }}} |
42 -n is a name of your choice -t stands for the target ID |
|
43 |
42 |
44 See this for more information |
43 `<name>` is a name of your choice. The number after `-t` stands for the target ID. |
45 |
44 |
46 To run the emulator navigate to `<`SDK`>`/tools and run |
45 See this for more information: |
|
46 |
|
47 To run the emulator navigate to `<SDK>/tools` and run |
47 |
48 |
48 {{{emulator -avd <name>}}} |
49 {{{emulator -avd <name>}}} |
49 where `<`name`>` is the same name as when you created it with the line above. |
50 |
|
51 where `<name>` is the same name as when you created it with the line above. |
50 |
52 |
51 Note when using ant: |
53 Note when using ant: |
52 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. |
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. |
53 |
56 |
54 ==Android NDK== |
57 ==Android NDK== |
55 |
58 |
56 Download and untar it, ill refer to the ndk as `<`NDK`>`. That’s it :) |
59 Download and untar it, I'll refer to the ndk as `<NDK>`. That’s it. :) |
57 |
60 |
58 ==!FreePascal == |
61 ==!FreePascal == |
59 |
62 |
60 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: |
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: |
61 |
64 |
62 {{{ |
65 {{{ |
63 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 |
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 |
64 }}} |
67 }}} |
65 |
68 |
66 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 |
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`. |
67 |
70 |
68 Note2: On windows use forward slashes so '/' not '\' |
71 Note 2: On Windows, use forward slashes, so '/', not '\'. |
|
72 |
69 ==Final== |
73 ==Final== |
70 |
74 |
71 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 |
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. |
72 |
76 |
73 1.<br> |
77 1.<br> |
74 Add `<`NDK`>`:`<`SDK`>`/platform-tools:`<`FPC`>`/compiler to your path, on debian based system I would do it as follows: |
78 Add `<NDK>:<SDK>/platform-tools:<FPC>/compiler` to your path, on Debian-based system I would do it as follows: |
75 |
79 |
76 {{{ |
80 {{{ |
77 export PATH=$PATH:/home/xeli/SoftDev/android/ndk |
81 export PATH=$PATH:/home/xeli/SoftDev/android/ndk |
78 export PATH=$PATH:/home/xeli/SoftDev/android/sdk/platform-tools |
82 export PATH=$PATH:/home/xeli/SoftDev/android/sdk/platform-tools |
79 export PATH=$PATH:/home/xeli/SoftDev/android/fpc-2.4.4/compiler |
83 export PATH=$PATH:/home/xeli/SoftDev/android/fpc-2.4.4/compiler |
80 }}} |
84 }}} |
81 |
85 |
82 (Check google on how to do it for your specific OS if you don't know how) |
86 (Check Google on how to do it for your specific OS if you don't know how.) |
83 |
87 |
84 for windows the PATH var should include this, mind the order: |
88 For Windows, the `PATH` var should include this, mind the order: |
85 {{{ |
89 {{{ |
86 - %WINDIR%\System32 (for Java)<br> |
90 - %WINDIR%\System32 (for Java)<br> |
87 - <CMake>\bin<br> |
91 - <CMake>\bin<br> |
88 - <QtSDK>\mingw\bin<br> |
92 - <QtSDK>\mingw\bin<br> |
89 - <QtSDK>\Desktop\Qt\4.8.0\mingw\bin<br> |
93 - <QtSDK>\Desktop\Qt\4.8.0\mingw\bin<br> |
95 - <mercurial> (directory containing hg.exe, TortoiseHg dir in my case)<br> |
99 - <mercurial> (directory containing hg.exe, TortoiseHg dir in my case)<br> |
96 }}} |
100 }}} |
97 |
101 |
98 |
102 |
99 2.<br> |
103 2.<br> |
100 Now we're gonna download sdl and a couple of its libraries, if you're on linux there's a script you can use |
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 |
101 {{{ |
106 {{{ |
102 cd <hedgewars-root>/project_files/Android-build |
107 cd <hedgewars-root>/project_files/Android-build |
103 chmod +x download_libs.sh (might not be needed) |
108 chmod +x download_libs.sh (might not be needed) |
104 ./download_libs.sh |
109 ./download_libs.sh |
105 }}} |
110 }}} |
106 This will download and unzip sdl to the expected folders |
111 This will download and unzip sdl to the expected folders |
107 |
112 |
108 On windows the script should work fine with Git Bash. |
113 On Windows, the script should work fine with Git Bash. |
109 |
114 |
110 |
115 |
111 3.<br> |
116 3.<br> |
112 Finally you can use cmake to create the scripts |
117 Finally you can use CMake to create the scripts: |
113 |
118 |
114 {{{ |
119 {{{ |
115 cd <hedgewars-root> |
120 cd <hedgewars-root> |
116 cmake . -DANDROID=1 |
121 cmake . -DANDROID=1 |
117 }}} |
122 }}} |
118 |
123 |
119 on windows you will need some extra arguments: |
124 On Windows, you will need some extra arguments: |
120 {{{ |
125 {{{ |
121 cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="%CD%/misc/winutils/include" -DCMAKE_LIBRARY_PATH="%CD%/misc/winutils/lib" -DANDROID=1 . |
126 cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="%CD%/misc/winutils/include" -DCMAKE_LIBRARY_PATH="%CD%/misc/winutils/lib" -DANDROID=1 . |
122 }}} |
127 }}} |
123 |
128 |
124 And that’s it. To compile: |
129 And that’s it. To compile: |