| 2 | | = Setting up development environment for Nokia N9 = |
| 3 | | |
| 4 | | Build Qt5 and WebKit2 for N9 on Ubuntu 11.10 x64. Running MiniBrowser on the device. |
| 5 | | |
| 6 | | = 1. Scratchbox Instructions = |
| 7 | | |
| 8 | | This section based on |
| 9 | | * https://github.com/resworb/scripts |
| 10 | | * https://trac.webkit.org/wiki/BuildingQt5OnHarmattan |
| 11 | | |
| 12 | | Follow the instructions exactly! |
| 13 | | |
| 14 | | == 1.1. Install and configure Scratchbox for Harmattan == |
| 15 | | (run@host) |
| 16 | | {{{ |
| 17 | | $ wget http://harmattan-dev.nokia.com/unstable/beta3/harmattan-sdk-setup.py |
| 18 | | $ chmod +x harmattan-sdk-setup.py |
| 19 | | $ sudo ./harmattan-sdk-setup.py admininstall |
| 20 | | }}} |
| 21 | | |
| 22 | | Post install (run@host): |
| 23 | | {{{ |
| 24 | | $ newgrp sbox |
| 25 | | }}} |
| 26 | | or logout / login to get user access to /scratchbox/login. |
| 27 | | Verify by writing (run@host) |
| 28 | | {{{ |
| 29 | | $ /scratchbox/login |
| 30 | | }}} |
| 31 | | you will get prompt |
| 32 | | {{{ |
| 33 | | #!html |
| 34 | | <div style="color:#000055;border: 1pt dotted; margin:1em 2em 1em 2em; padding: 1em;background:none repeat scroll 0 0 #CCDDFF;"> |
| 35 | | <pre> |
| 36 | | [sbox-HARMATTAN_X86: ~] > |
| 37 | | </pre></div> |
| | 2 | |
| | 3 | This guide will allow you to build Qt5 and WebKit2 for N9/N950 (MeeGo Harmattan), and run MiniBrowser on the device. |
| | 4 | |
| | 5 | = 1. Setting up cross-compile environment = |
| | 6 | |
| | 7 | The easiest way to develop for Harmattan is to cross-compile using a sysroot. The Qt SDK already comes with a Harmattan sysroot and the required ARM toolchain, and we build on top of that to create a sysroot suitable for building Qt5 and WebKit2. |
| | 8 | |
| | 9 | 1. Prepare your environment |
| | 10 | |
| | 11 | {{{ |
| | 12 | $ mkdir ~/swork |
| | 13 | $ cd ~/swork |
| 40 | | and now you can switch to armel target (run@sbox) |
| 41 | | {{{ |
| 42 | | [sbox-HARMATTAN_X86: ~] >sb-conf select HARMATTAN_ARMEL |
| 43 | | [sbox-HARMATTAN_ARMEL: ~] > |
| 44 | | }}} |
| 45 | | |
| 46 | | CTRL+D to exit. |
| 47 | | |
| 48 | | Sync resolv.conf and host.conf for network access in Scratchbox (run@host): |
| 49 | | {{{ |
| 50 | | $ sudo /scratchbox/sbin/sbox_sync |
| 51 | | }}} |
| 52 | | |
| 53 | | |
| 54 | | == 1.2. Prepare your environment == |
| 55 | | (run@host) |
| 56 | | {{{ |
| 57 | | $ mkdir /scratchbox/users/$USER/home/$USER/swork |
| 58 | | $ ln -s /scratchbox/users/$USER/home/$USER/swork ~/swork |
| 59 | | }}} |
| 60 | | |
| 61 | | NB: You don't need the explicit swork directory as long as the script directory resides on the same level as the source directories. |
| 62 | | |
| 63 | | You should now have a working dir (~/swork), residing in/accessible from Scratchbox, linked in the root of your user root. (Not root user!) |
| 64 | | |
| 65 | | Go to swork directory (run@host): |
| 66 | | {{{ |
| 67 | | $ cd ~/swork |
| 68 | | }}} |
| 69 | | |
| 70 | | Download scripts for building (run@host): |
| | 16 | ''Note:'' This base directory is just an example used in this guide. You're free to change where you keep your sources and builds (shadow-builds), as long as you account for that when running the various commands. |
| | 17 | |
| | 18 | 2. Download and install the Qt SDK from http://qt.nokia.com/downloads/ |
| | 19 | |
| | 20 | Both Mac OS X and Linux X11/64-bit should work fine. |
| | 21 | |
| | 22 | 3. Get some convenience-scripts used in this guide and for development |
| | 23 | |
| 75 | | Apply the patch attached to this page: [attachment:browser-script.patch?format=raw browser-script.patch] |
| 76 | | |
| 77 | | {{{ |
| 78 | | $ cd browser-scripts |
| 79 | | $ patch -p1 < browser-script.patch |
| 80 | | }}} |
| 81 | | Tested with resworb script hash: [https://github.com/resworb/scripts/tree/378c7cb835ad7f65ba8b6756c3a05381e861b110 378c7cb835ad7f65ba8b6756c3a05381e861b110]. |
| 82 | | |
| 83 | | Download testfonts (run@host): |
| 84 | | {{{ |
| 85 | | $ git clone git://gitorious.org/qtwebkit/testfonts.git ~/swork/testfonts |
| 86 | | }}} |
| 87 | | |
| 88 | | Install required dependencies inside scratchbox (run@host): |
| 89 | | {{{ |
| 90 | | $ /scratchbox/login |
| 91 | | [sbox-HARMATTAN_ARMEL: ~] > cd swork |
| 92 | | [sbox-HARMATTAN_ARMEL: ~/swork] > browser-scripts/builddeps-install.sh |
| 93 | | [sbox-HARMATTAN_ARMEL: ~/swork] > exit |
| 94 | | $ |
| 95 | | }}} |
| 96 | | |
| 97 | | In order to get git installed inside Scratchbox please follow these steps (run@host): |
| 98 | | {{{ |
| 99 | | $ sudo su |
| 100 | | $ echo "deb http://scratchbox.org/debian harmattan main" >> /etc/apt/sources.list.d/sb.list |
| 101 | | $ apt-get update |
| 102 | | $ apt-get install scratchbox-devkit-git |
| 103 | | $ exit |
| 104 | | }}} |
| 105 | | |
| 106 | | Add this to your PATH inside Scratchbox (preferrably add to .bashrc) (run@sbox): |
| 107 | | {{{ |
| 108 | | [sbox-HARMATTAN_ARMEL: ~] > echo "export PATH=/scratchbox/devkits/git/bin:\$PATH" >> ~/.bashrc |
| 109 | | [sbox-HARMATTAN_ARMEL: ~] > . ./.bashrc |
| 110 | | }}} |
| 111 | | |
| 112 | | The next step is getting the source of Qt5 and WebKit (run@host): |
| | 28 | 4. Set up custom MADDE target |
| | 29 | |
| | 30 | {{{ |
| | 31 | $ browser-scripts/setup-madde-toolchain.sh |
| | 32 | }}} |
| | 33 | |
| | 34 | This will create a new target based on the original Harmattan target that comes with the QtSDK, but with different names for the ARM-toolchain binaries, and pre-installed packages needed for Qt5 development. |
| | 35 | |
| | 36 | 5. Download testfonts |
| | 37 | {{{ |
| | 38 | $ git clone git://gitorious.org/qtwebkit/testfonts.git |
| | 39 | }}} |
| | 40 | |
| | 41 | 6. Get the source of Qt5 and WebKit |
| 162 | | $ /scratchbox/login |
| 163 | | [sbox-HARMATTAN_ARMEL: ~] > |
| 164 | | [sbox-HARMATTAN_ARMEL: ~] > cd ~/swork |
| 165 | | [sbox-HARMATTAN_ARMEL: ~/swork] > . icecc-env.sh |
| 166 | | }}} |
| 167 | | |
| 168 | | Before building, you have to remove environment variable that was used to work with other Qt version (run@sbox): |
| 169 | | {{{ |
| 170 | | [sbox-HARMATTAN_ARMEL: ~/swork] > export -n QTDIR |
| 171 | | }}} |
| 172 | | |
| 173 | | You should also remove '''/usr/X11R6/bin''' and '''Qt''' from PATH. |
| 174 | | Check and modify your path variable (run@sbox): |
| 175 | | {{{ |
| 176 | | [sbox-HARMATTAN_ARMEL: ~/swork] > echo $PATH |
| 177 | | }}} |
| 178 | | You may get something similar to this: |
| 179 | | {{{ |
| 180 | | #!html |
| 181 | | <div style="color:#000055;border: 1pt dotted; margin:1em 2em 1em 2em; padding: 1em;background:none repeat scroll 0 0 #CCDDFF;"> |
| 182 | | /scratchbox/devkits/git/bin:/host_usr/bin:/scratchbox/devkits/hashutils-squeeze-sdk/bin:/scratchbox/devkits/debian-squeeze/bin:/scratchbox/devkits/perl/bin:/scratchbox/devkits/qemu/bin:/scratchbox/tools/bin:/targets/links/arch_tools/bin:/scratchbox/compilers/bin:/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin |
| 183 | | </div> |
| 184 | | }}} |
| 185 | | |
| 186 | | |
| 187 | | Building Qt5 for Harmattan. You should use the --clean parameter (run@sbox): |
| 188 | | {{{ |
| 189 | | [sbox-HARMATTAN_ARMEL: ~/swork] > browser-scripts/qt5-build.sh --clean |
| 190 | | }}} |
| 191 | | |
| 192 | | |
| 193 | | When building is successful you get a similar message: |
| | 91 | $ . icecc-env.sh |
| | 92 | $ source browser-scripts/setup-madde-toolchain.sh |
| | 93 | $ export -n QTDIR |
| | 94 | $ browser-scripts/build-sources.sh --cross-compile |
| | 95 | }}} |
| | 96 | |
| | 97 | Sourcing the madde-script will set up your PATH and SYSROOT_DIR to the custom Harmattan target. |
| | 98 | |
| | 99 | If everything is right you should get similar result: |
| 198 | | Build completed, run the following to use your new Qt build |
| 199 | | export PATH=/scratchbox/users/$USER/home/$USER/swork/browser-scripts/../qt5/qtbase/bin:$PATH |
| 200 | | </pre> |
| 201 | | </div> |
| 202 | | }}} |
| 203 | | |
| 204 | | So, follow this instuction that printed (run@sbox): |
| 205 | | {{{ |
| 206 | | [sbox-HARMATTAN_ARMEL: ~/swork] > export PATH=/scratchbox/users/$USER/home/$USER/swork/browser-scripts/../qt5/qtbase/bin:$PATH |
| 207 | | }}} |
| 208 | | |
| 209 | | The next step is building Qt-Components (run@sbox): |
| 210 | | {{{ |
| 211 | | [sbox-HARMATTAN_ARMEL: ~/swork] > browser-scripts/qt-components-build.sh |
| 212 | | }}} |
| 213 | | |
| 214 | | Now, build !QtWebKit2 (run@sbox): |
| 215 | | {{{ |
| 216 | | [sbox-HARMATTAN_ARMEL: ~/swork] > browser-scripts/webkit-build.sh |
| 217 | | }}} |
| 218 | | |
| 219 | | If everything is right you should get similar result: |
| 220 | | {{{ |
| 221 | | #!html |
| 222 | | <div style="color:#000055;border: 1pt dotted; margin:1em 2em 1em 2em; padding: 1em;background:none repeat scroll 0 0 #CCDDFF;"> |
| 223 | | <pre> |
| 224 | | ... |
| 225 | | make[1]: Leaving directory `/home/azbest/swork/qtwebkit-webkit2-dev-builddir-armel-m6/Release' |
| 226 | | |
| 235 | | == 1.4.b. Build QtWebKit with Sysroot == |
| 236 | | Optionally you can build Qt and WebKit on your host with cross-compiler using sysroot. This method seems to be faster, but you can not use ICECC for this, yet. |
| 237 | | |
| 238 | | Download and install QtSDK 1.2 from http://qt.nokia.com/downloads/ (Linux/X11 64-bit and Mac OS X should both work). |
| 239 | | |
| 240 | | Clear QTDIR, ICECC_VERSION environment variables and remove Qt specific things from PATH. |
| 241 | | |
| 242 | | Follow the steps (run@host): |
| 243 | | {{{ |
| 244 | | $ browser-scripts/setup-madde-toolchain.sh |
| 245 | | $ browser-scripts/build-sources.sh --cross-compile |
| 246 | | }}} |
| 247 | | |
| 248 | | This will produce qtwebkit-webkit2-dev-builddir-xarmel-m6 build. Don't forget to change your variables to xarmel in your variables in section [#a3.2.1.Environmentvariables 3.2.1.] |
| 249 | | |
| 250 | | == 1.5. Updating build environment == |
| | 112 | == 1.1 Updating build environment == |