Mobile/Build/Windows Mobile BuildingIt

From MozillaWiki
< Mobile‎ | Build
Jump to: navigation, search

Actual Building of XULRunner and Fennec For Windows Mobile

This page describes the steps for actually building XULRunner and Fennec for Windows Mobile, once you have the prerequisite software installed.

For information about software prerequisites for building XULRunner and Fennec for Windows Mobile, see here.

If you want to skip reading this whole page, then download the sources and then just build it.


Virtual Machines And Building

Several Mozilla engineers use VMware virtual machines running on Macintosh MacBook Pro notebooks.

Here is some of the information that we have found about doing builds this way.

We prefer to use Windows XP over Windows Vista, because Windows Vista is just slower at almost everything, and the builds take a LONG time to run.

There are three main ways to run Windows XP on a MacBook Pro:

(1) Use Mac OS X's Boot Camp, and boot into a Windows XP partition

(2) Use Mac OS X's Boot Camp to set up a Windows XP partition, then use VMware accessing that WinXP partition running under Mac OS X

(3) Use VMware with a Virtual Machine running under Mac OS X

Of these three options, builds run fastest under option (1).

Builds slow down ~10% when running under option (2).

Builds are REALLY slow under option (3).


Opening A Command Window

Run a batch file from the Mozilla-Build directory to open a shell:

For VS9 use: C:\mozilla-build\start-msvc9.bat

For VS8 use: C:\mozilla-build\start-msvc8.bat

NOTE: This will setup and open a MingW32 command prompt. All commands shown on this page are to be run inside MingW32.


Getting The Source

You will either need to download the source for building, or you will need to update your source code repositories.


Downloading The Sources

This series of commands will update your source code trees for XULRunner and Fennec mobile browser.

These commands are to be run inside a command shell which should be opened as described in this section.

NOTE: Let us assume you have created /c/hg/ to hold your mozilla source tree
      This directory is actually C:\hg on your Windows desktop.

$ cd /c/hg

$ hg clone http://hg.mozilla.org/mozilla-central

$ cd mozilla-central

$ hg clone http://hg.mozilla.org/mobile-browser mobile

$ wget http://people.mozilla.org/~blassey/mozconfig


Updating The Sources

This series of commands will update your source code trees for XULRunner and Fennec mobile browser.

These commands are to be run inside a command shell which should be opened as described in this section.

NOTE: Let us assume you have created /c/hg/ to hold your mozilla source tree
      This directory is actually C:\hg on your Windows desktop.

$ cd /c/hg/mozilla-central

$ hg qpop -a

$ hg pull; hg update

$ cd mobile

$ hg pull; hg update

$ hg qpush -a


CRUD - The Clone of Mozilla-Central Freezes

Several people have reported that the cloning of mozilla-central as described above freezes and does not complete.

If your clone of mozilla-central is taking more than an hour to complete, you may be in this same situation. Basically, this can be caused by a number of different situations:

  • The Mozilla hg repository is overloaded,
  • The Internet Connection you have is very slow and times out
  • The Internet Connection you have drops enough packets that HG gets confused

As a point of reference, John Wolfe has a very fast RCN cable modem connection at home. However, he found out a while ago that RCN considers a 7% data loss to be within acceptable limits for customer service. 7% Data Loss (tested via pinging from an internal-to-RCN server to John Wolfe's cable modem) means that 7 out of every 100 packets gets lost' within the RCN internal network.

This means that when RCN gets busy (nights and weekends, for instance), it is almost guaranteed that John Wolfe will not be able to do a full HG clone operation on the mozilla-central repository.

Here is what you can do to get around HG freezing when cloning mozilla-central:

# Download [| a recent HG bundle]
  (made on 19-Feb-089 after a new clone operation on mozilla-central)

# Run the batch file from the Mozilla-Build directory to open a shell:
  For VS9 use: C:\mozilla-build\start-msvc9.bat 
  For VS8 use: C:\mozilla-build\start-msvc8.bat

   NOTE: This will setup and open a MingW32 command prompt.
         All further commands are to be run inside MingW32.

   NOTE: Let us assume you have created /c/hg/ for your mozilla source tree


# Create a new, empty mozilla-central repository:
$ cd /c/hg
$ hg init mozilla-central

# Un-bundle the real mozilla-central changes to that repository:
$ cd mozilla-central;
$ hg unbundle /path/to/mc.bundle.2009_02_19

# Tell mercurial where you normally want to pull from by copying the 
  following content into your mozilla-central/.hg/hgrc file:
  
    [paths]
    default = http://hg.mozilla.org/mozilla-central/

# Pull any changes that happened since the bundle was created:
$ hg pull

# Update your working directory to the latest change:
$ hg update

NOTE: You will want to do two seperate operations for pulling then updating, as some versions of HG have a bug in their hg pull -u command. I forget exactly what the bug is - but the work-around is to do these two seperate operations.

Thanks go out to Benjamin Smedbergs for this solution - [Original Blog Posting Here]


Setting Up Your MOZCONFIG File

Building options are controlled by mozconfig, a master file within your top source directory (in our case, /c/hg/mozilla-central/mozconfig).

The instructions for downloading the sources have you download a default MOZCONFIG file put in place by Brad Lassey of Mozilla. This mozconfig will typically be set up for a Visual Studio 9 Debug build.

You may want to create a different MOZCONFIG file. Here are four example MOZCONFIG files for Windows Mobile 6 development:

 (1)  Visual Studio 9 Debug Build
(2) Visual Studio 9 Release Build
(3) Visual Studio 8 Debug Build
(4) Visual Studio 8 Release Build


VS9 Debug Build MOZCONFIG

Here is our current VS9 mozconfig for building a Debug XULRunner and Fennec for WinMobile:

    # Options for client.mk.
    mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
    
    # Uncomment this line to do parallel make jobs
    #  -jN, where N=2 works best on MacBook Pro Dual Processors
    # mk_add_options MOZ_MAKE_FLAGS=-j2
    
    # Options for VS8 verses VS9 / Debug verses Release
    # Debug/Non-Opt = ~28 MByte XUL.dll
    # Debug/Opt     = ~20 MByte XUL.dll
    # Release/Opt   = ~12 MByte XUL.dll
    ac_add_options --enable-debug
    ac_add_options --disable-optimize
    #ac_add_options --enable-optimize
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-wm6-dbg
    
    # mobile options
    ac_add_app_options mobile --enable-application=mobile
    ac_add_app_options mobile --with-libxul-sdk=../xulrunner/dist
    
    # Disabling tests due to bug 454881
    ac_add_options --disable-tests
    
    #WINCE specific options
    ac_add_options --disable-javaxpcom
    ac_add_options --disable-plugins
    ac_add_options --disable-accessibility
    ac_add_options --disable-printing
    ac_add_options --disable-oji
    ac_add_options --disable-vista-sdk-requirements
    ac_add_options --disable-updater
    ac_add_options --disable-installer
    ac_add_options --disable-xpinstall
    ac_add_options --enable-image-decoders="png gif jpeg"
    ac_add_options --disable-dbm
    ac_add_options --disable-ogg
    ac_add_options --enable-jemalloc
    
    CROSS_COMPILE=1
    
    MIDL=/c/Program\ Files/Microsoft\ Visual\ Studio\ 9.0/VC/ce/bin/x86_arm/midl.exe
    
    ac_add_options --target=arm-wince
    ac_add_options --enable-win32-target=WINCE
    ac_add_options --enable-default-toolkit=cairo-windows
    
    ac_add_options --with-wince-sdk="c:/program files/windows mobile 6 sdk/pocketpc"

VS9 Release Build MOZCONFIG

Here is our current VS9 mozconfig for building a non-debug XULRunner for WinMobile:

    # Options for client.mk.
    mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
    
    # Uncomment this line to do parallel make jobs
    #  -jN, where N=2 works best on MacBook Pro Dual Processors
    # mk_add_options MOZ_MAKE_FLAGS=-j2
    # do not build js.exe
    mk_add_options MOZ_MAKE_FLAGS="JS_DISABLE_SHELL=1" 
    
    # Options for VS8 verses VS9 / Debug verses Release
    # Debug/Non-Opt = ~28 MByte XUL.dll
    # Debug/Opt     = ~20 MByte XUL.dll
    # Release/Opt   = ~12 MByte XUL.dll
    #ac_add_options --enable-debug
    #ac_add_options --disable-optimize
    ac_add_options --enable-optimize
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-wm6-rel
    
    # mobile options
    ac_add_app_options mobile --enable-application=mobile
    ac_add_app_options mobile --with-libxul-sdk=../xulrunner/dist
    
    # Disabling tests due to bug 454881
    ac_add_options --disable-tests
    
    #WINCE specific options
    ac_add_options --disable-javaxpcom
    ac_add_options --disable-plugins
    ac_add_options --disable-accessibility
    ac_add_options --disable-printing
    ac_add_options --disable-oji
    ac_add_options --disable-vista-sdk-requirements
    ac_add_options --disable-updater
    ac_add_options --disable-installer
    ac_add_options --disable-xpinstall
    ac_add_options --enable-image-decoders="png gif jpeg"
    ac_add_options --disable-dbm
    ac_add_options --disable-ogg
    ac_add_options --enable-jemalloc
    
    CROSS_COMPILE=1
    
    MIDL=/c/Program\ Files/Microsoft\ Visual\ Studio\ 9.0/VC/ce/bin/x86_arm/midl.exe
    
    ac_add_options --target=arm-wince
    ac_add_options --enable-win32-target=WINCE
    ac_add_options --enable-default-toolkit=cairo-windows
    
    ac_add_options --with-wince-sdk="c:/program files/windows mobile 6 sdk/pocketpc"

VS8 Debug Build MOZCONFIG

Here is our current VS8 mozconfig for building a Debug XULRunner and Fennec for WinMobile:

    # Options for client.mk.
    mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-wm6-dbg
    
    # Uncomment this line to do parallel make jobs
    #  -jN, where N=2 works best on MacBook Pro Dual Processors
    # mk_add_options MOZ_MAKE_FLAGS=-j2
    
    # Options for VS8 verses VS9 / Debug verses Release
    # Debug/Non-Opt = ~28 MByte XUL.dll
    # Debug/Opt     = ~20 MByte XUL.dll
    # Release/Opt   = ~12 MByte XUL.dll
    ac_add_options --enable-debug
    ac_add_options --disable-optimize
    #ac_add_options --enable-optimize
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-wm6-dbg-vs8
    
    # mobile options
    ac_add_app_options mobile --enable-application=mobile
    ac_add_app_options mobile --with-libxul-sdk=../xulrunner/dist
    
    # Disabling tests due to bug 454881
    ac_add_options --disable-tests
    
    #WINCE specific options
    ac_add_options --disable-javaxpcom
    ac_add_options --disable-plugins
    ac_add_options --disable-accessibility
    ac_add_options --disable-printing
    ac_add_options --disable-oji
    ac_add_options --disable-vista-sdk-requirements
    ac_add_options --disable-updater
    ac_add_options --disable-installer
    ac_add_options --disable-xpinstall
    ac_add_options --enable-image-decoders="png gif jpeg"
    ac_add_options --disable-dbm
    ac_add_options --disable-ogg
    ac_add_options --enable-jemalloc
    
    CROSS_COMPILE=1
    
    MIDL=/c/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/ce/bin/x86_arm/midl.exe
    
    ac_add_options --target=arm-wince
    ac_add_options --enable-win32-target=WINCE
    ac_add_options --enable-default-toolkit=cairo-windows
    
    ac_add_options --with-wince-sdk="c:/program files/windows mobile 6 sdk/pocketpc"


VS8 Release Build MOZCONFIG

Here is our current VS8 mozconfig for building a non-debug XULRunner for WinMobile:

    # Options for client.mk.
    mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
    
    # Uncomment this line to do parallel make jobs
    #  -jN, where N=2 works best on MacBook Pro Dual Processors
    # mk_add_options MOZ_MAKE_FLAGS=-j2
    
    # Options for VS8 verses VS9 / Debug verses Release
    # Debug/Non-Opt = ~28 MByte XUL.dll
    # Debug/Opt     = ~20 MByte XUL.dll
    # Release/Opt   = ~12 MByte XUL.dll
    #ac_add_options --enable-debug
    #ac_add_options --disable-optimize
    ac_add_options --enable-optimize
    mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-wm6-rel-vs8
    
    # mobile options
    ac_add_app_options mobile --enable-application=mobile
    ac_add_app_options mobile --with-libxul-sdk=../xulrunner/dist
    
    # Disabling tests due to bug 454881
    ac_add_options --disable-tests
    
    #WINCE specific options
    ac_add_options --disable-javaxpcom
    ac_add_options --disable-plugins
    ac_add_options --disable-accessibility
    ac_add_options --disable-printing
    ac_add_options --disable-oji
    ac_add_options --disable-vista-sdk-requirements
    ac_add_options --disable-updater
    ac_add_options --disable-installer
    ac_add_options --disable-xpinstall
    ac_add_options --enable-image-decoders="png gif jpeg"
    ac_add_options --disable-dbm
    ac_add_options --disable-ogg
    ac_add_options --enable-jemalloc
    
    CROSS_COMPILE=1
    
    MIDL=/c/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/ce/bin/x86_arm/midl.exe
    
    ac_add_options --target=arm-wince
    ac_add_options --enable-win32-target=WINCE
    ac_add_options --enable-default-toolkit=cairo-windows
    
    ac_add_options --with-wince-sdk="c:/program files/windows mobile 6 sdk/pocketpc"

Build It!

Now you can build xulrunner (and the mobile fennec code) using these commands:

 $ cd /c/hg/mozilla-central
 
 $ hg qpush -a
 
 $ make -f client.mk build

The actual building commands are very anti-climactic after all that you have to do to get to here, right?

The time for a complete XULRunner and Fennec Mobile Browser rebuild appears to be anywhere from 25 minutes to over an hour - depending upon your machine and its configuration.