Changes between Version 19 and Version 20 of SettingUpDevelopmentEnvironmentForN9


Ignore:
Timestamp:
Feb 16, 2012 2:35:57 AM (12 years ago)
Author:
vestbo@webkit.org
Comment:

Update instructions to use sysroot

Legend:

Unmodified
Added
Removed
Modified
  • SettingUpDevelopmentEnvironmentForN9

    v19 v20  
    11[[PageOutline]]
    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
     3This 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
     7The 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
     91. Prepare your environment
     10
     11{{{
     12  $ mkdir ~/swork
     13  $ cd ~/swork
    3814}}}
    3915
    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
     182. Download and install the Qt SDK from  http://qt.nokia.com/downloads/
     19
     20Both Mac OS X and Linux X11/64-bit should work fine.
     21
     223. Get some convenience-scripts used in this guide and for development
     23
    7124{{{
    7225  $ git clone https://github.com/resworb/scripts.git browser-scripts
    7326}}}
    7427
    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):
     284. Set up custom MADDE target
     29
     30{{{
     31  $ browser-scripts/setup-madde-toolchain.sh
     32}}}
     33
     34This 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
     365. Download testfonts
     37{{{
     38  $ git clone git://gitorious.org/qtwebkit/testfonts.git
     39}}}
     40
     416. Get the source of Qt5 and WebKit
    11342{{{
    11443  $ browser-scripts/clone-sources.sh
    11544}}}
     45
    11646This will try to clone Qt5 and WebKit git repository to ~/swork/qt5 and ~/swork/webkit.
    11747
     
    12252}}}
    12353
    124 If you have already a local git repo for WebKit, you can speed up the process by copying its contents to ~/swork/webkit directory. After copying you should run ''git reset --hard HEAD'' on it before running clone-sources.sh . You can update the sources by running (run@host):
     54If you have already a local git repo for WebKit, you can speed up the process by copying its contents to ~/swork/webkit directory. After copying you should run ''git reset --hard HEAD'' on it before running clone-sources.sh . You can update the sources by running:
    12555{{{
    12656  $ browser-scripts/update-sources.sh
    12757}}}
    12858
    129 == 1.3. Create ICECC toolchain (optional) ==
     595. Create ICECC toolchain (optional)
    13060
    13161If you have multiple workstations configured to use [http://en.opensuse.org/Icecream ICECC], you can speed up building process significantly.
     
    15484}}}
    15585
    156 Make the script runnable and execute it before building inside scratchbox when you need speedup.
    157 
    158 == 1.4.a. Build QtWebKit in Scratchbox ==
    159 
    160 Login to scratchbox and optionally execute script for icecc (run@host):
     86Make the script runnable and execute it before building when you need speedup.
     87
     887. Build Qt5, QtComponents, and QtWebKit
     89
    16190{{{
    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
     97Sourcing the madde-script will set up your PATH and SYSROOT_DIR to the custom Harmattan target.
     98
     99If everything is right you should get similar result:
    194100{{{
    195101#!html
    196102<div style="color:#000055;border: 1pt dotted; margin:1em 2em 1em 2em; padding: 1em;background:none repeat scroll 0 0 #CCDDFF;">
    197103<pre>
    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 
    227104===========================================================
    228105 WebKit is now built (30m:22s).
     
    233110}}}
    234111
    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 ==
    251113If you need to update browser-scripts, run on host:
    252114{{{
     
    254116  $ git reset --hard HEAD
    255117  $ git pull
    256   $ patch -p1 < ../browser-script.patch
    257118}}}
    258119
     
    269130  $ browser-scripts/update-sources.sh
    270131}}}
    271 Than rebuild binaries inside scratchbox:
    272 {{{
    273   [sbox-HARMATTAN_ARMEL: ~] > cd ~/swork
    274   [sbox-HARMATTAN_ARMEL: ~] > browser-scripts/build-sources.sh
    275 }}}
    276 
    277 
    278132
    279133= 2. Configuring N9 =