Mobile/Build/Fennec: Difference between revisions

From MozillaWiki
< Mobile‎ | Build
Jump to navigation Jump to search
(Redirected page to Mobile/Get Involved)
 
(23 intermediate revisions by 11 users not shown)
Line 1: Line 1:
==Building Fennec and XULRunner==
#REDIRECT [[Mobile/Get_Involved]]
If you want to cross-compile Fennec and XULRunner for ARM devices, you should first [[Mobile/Build/cs2007q3|set up scratchbox]].


===Pulling the code from hg===
== Building [[Fennec]] ==
<pre>
hg clone http://hg.mozilla.org/mozilla-central
cd mozilla-central
hg clone http://hg.mozilla.org/mobile-browser mobile
</pre>


===Creating a mozconfig===
Here's an example mozconfig for building in scratchbox. The LDFLAGS, with-arm-kuser, and disable-tests options should be removed if you're building outside of scratchbox (for x86).


<pre>
# cs2007q3 gcc 4.2 is busted, we think, and doesn't
# look in the expected places. --dougt.
# $PWD/... was added due to bug 463076
export LDFLAGS="-Wl,-rpath-link,$PWD/dist/bin/:/usr/lib:/lib"


# Options for client.mk.
Look here for the Android build instructions
mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mobilebase


# Global options
[[https://wiki.mozilla.org/Mobile/Fennec/Android
#ac_add_options --enable-debug
]]
#ac_add_options --disable-optimize


# XULRunner options
ac_add_app_options xulrunner --enable-application=xulrunner
ac_add_app_options xulrunner --disable-javaxpcom


# Enabling --with-arm-kuser implies Linux on ARM and enables kernel
=== Install and run Scratchbox (Maemo only) ===
# optimizations for that platform
If you want to cross-compile Fennec and XULRunner for Maemo, you should first [[Mobile/Build/cs2007q3|set up scratchbox]].  Scratchbox is a cross-compilation environment that you will run before compiling Fennec.
ac_add_app_options xulrunner --with-arm-kuser


# Disabling tests due to bug 454881
'''NOTE: All the following instructions assume that you are logged in to scratchbox by typing this:'''
ac_add_options --disable-tests
/scratchbox/login


# mobile options
'''NOTE 2:''' When you are logged in to scratchbox, you are chroot'ed. This means that /scratchbox/users/YOUR_NAME/home/YOUR_NAME matches to your home directory inside of scratchbox which is /home/YOUR_NAME
ac_add_app_options mobile --enable-application=mobile
ac_add_app_options mobile --with-libxul-sdk=../xulrunner/dist
</pre>


===libIDL===
=== Install build dependencies (non-Maemo) ===
libIDL is required.


*I think the [[Mobile/Build/cs2007q3|latest scratchbox instructions]] include a step to obtain libIDL, so building it yourself shouldn't be necessary. If that's wrong, there are instructions for building libIDL in scratchbox [https://wiki.mozilla.org/index.php?title=Mobile/Build/Maemo_Build_Instructions&oldid=117369#Building_libIDL here]. If you follow those steps you must also set the PKG_CONFIG_PATH environment variable. [[User:GavinSharp|GavinSharp]]
If you are ''not'' building for Maemo/Scratchbox, follow the [https://developer.mozilla.org/En/Simple_Firefox_build "Installing build tools" instructions] for your platform.


===Start the build===
=== Pull the code from Mercurial ===
<pre>
<pre>
make -f client.mk build
hg clone http://hg.mozilla.org/mozilla-central
 
</pre>
</pre>


== Running Fennec on Maemo ==
=== Create a mozconfig ===
If you did the above in a [[Mobile/Build/cs2007q3|Maemo Scratchbox]] for the CHINOOK_ARMEL target, you can run the build on the N800/N810 device.


Create a Fennec tarball:
Create a file named "mozconfig" in the mozilla-central directory.  Here's an example mozconfig. The LDFLAGS, with-arm-kuser, and with-maemo-version options should be removed if you're building outside of scratchbox (for x86).


<code><pre>
<pre>
cd ../mobilebase/mobile/
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir
make package
ac_add_options --enable-application=mobile
</pre></code>


You'll now have a tarball in mobilebase/mobile/dist/ named fennec-0.3.en-US.linux-arm.tar.bz2. Copy it to your device (you'll probably want to run bunzip2 on it first, since Maemo doesn't include it).
# For improved compile speeds, all optional.
#mk_add_options MOZ_MAKE_FLAGS=-j4
#export CCACHE_HARDLINK=1
#ac_add_options --with-ccache=ccache


Extract and launch from a command line (X Terminal) on the device:
# Make a debug build, optional.
#export MOZ_DEBUG_SYMBOLS=1
#ac_add_options --enable-debug
#ac_add_options --disable-optimize


<code><pre>
# Needed on Win32 to fix problem with Windows Vista SDK
$ tar xf fennec-0.3.en-US.linux-arm.tar
#ac_add_options --disable-accessibility
$ cd fennec
$ ./fennec
</pre></code>


==Building Fennec with the Gecko SDK==
####################################################
# SCRATCHBOX ONLY: Remove everything below this line
# if you are not building in Scratchbox for Maemo.


===Download SDK===
ac_add_options --with-maemo-version=5
First download the appropriate Gecko SDK from [ftp://ftp.mozilla.org/pub/xulrunner/nightly/latest-trunk/ ftp.mozilla.org]


===Get the source===
# Enabling --with-arm-kuser implies Linux on ARM and enables kernel
Follow the steps from [[#Pulling the code from hg]]
# optimizations for that platform
ac_add_options --with-arm-kuser


===Creating a mozconfig===
# cs2007q3 gcc 4.2 is busted, we think, and doesn't
<pre>
# look in the expected places. --dougt.
# Options for client.mk.
# $PWD/... was added due to bug 463076
mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
export LDFLAGS="-Wl,-rpath-link,$PWD/dist/bin/:/usr/lib:/lib"
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mobilebase
 
ac_add_options  --enable-application=mobile
ac_add_options  --with-libxul-sdk=<path to the SDK you downloaded and extracted>
</pre>
</pre>


Note: if you are building for x86 ubuntu, you might want to add "ac_add_options --disable-dbus" to your mozconfig, or obtain the necessary dbus libraries.
See [https://developer.mozilla.org/en/Configuring_Build_Options Configuring Build Options] for more information about customizing your build settings.


===Build===
=== Build ===
In the mozilla-central directory:
<pre>
<pre>
make -f client.mk build
make -f client.mk build
</pre>
</pre>
The build will appear in ../objdir (or whatever MOZ_OBJDIR is set to in your mozconfig).


<b>Note</b>: At this point, you should be able to run and/or debug fennec, as your downloaded Gecko SDK is properly found by your app. However, since you're not using a xulrunner objdir, some package-related features (e.g. xptlinking) will not work unless you *package* or *install* your SDK. To turn them on, add the following line to your mozconfig ...
== Running Fennec ==


<pre>
=== Desktop ===
ac_add_options --with-system-libxul
 
</pre>
cd ../objdir/dist/bin
./fennec
 
You may want to add the $MOZ_OBJDIR/dist/bin directory to your shell's $PATH so you can just type "fennec" anywhere.
 
=== Maemo ===
 
If you did the above in a [[Mobile/Build/cs2007q3|Maemo Scratchbox]] for the CHINOOK_ARMEL target, you can run the build on the N800/N810 device.
 
Create a Fennec tarball:
 
cd ../objdir
  make package
 
You'll now have a tarball in objdir/dist/ named fennec-1.1b2pre.en-US.linux-arm.tar.bz2.  (you'll probably want to run bunzip2 on it first, since Maemo doesn't include it):


... And install your SDK as described in the following section :
cd dist
bunzip2 fennec-*.tar.bz2


===Install libxul SDK===
Connect your N900 to your computer in USB Mass Storage mode and copy the tarball to it, then unmount it and disconnect (note: you must actually disconnect the USB cable; also, be sure to close an open terminal on your N900 if you have one). The file will appear in ~/MyDocs. You can drag it in the file manager, or run something like this command:
If you're not building a xulrunner objdir, but are rather using a downloaded Gecko SDK, you'll want to *install* your SDK prior to hacking fennec (especially if you intend to do 'performance' stuff) because some build features are only triggered are package-time. The easiest way to achieve this is throught system installation of your downloaded Gecko SDK :
<pre>
make -f client.mk install
</pre>


==Building Win32==
  cp fennec-*.tar "/media/Nokia N900"
Start by setting up your system with the needed SDKs. This means Visual Studio 2008 and the Vista SDKYou can install the Windows Mobile 6 SDK also, but it's not needed for the Win32-only build.
  umount "/media/Nokia N900"


Check out the hg repo listed above.  Create a .mozconfig file in the mozilla-central directory.  This looks similar to the above, but with some ARM/Linux specific lines removed:
Extract and launch from a command line (X Terminal) on the device:


<pre>
# Run this outside of the MyDocs directory, which is mounted noexec:
# Options for client.mk.
tar xvf MyDocs/fennec-*.tar
mk_add_options MOZ_BUILD_PROJECTS="xulrunner mobile"
./fennec/fennec
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mobilebase


# XULRunner options
== Building Win32 ==
ac_add_app_options xulrunner --enable-application=xulrunner
ac_add_app_options xulrunner --disable-javaxpcom


# mobile options
Start by setting up your system with the needed SDKs. This means Visual Studio 2008 and the Vista SDK.
ac_add_app_options mobile --enable-application=mobile
ac_add_app_options mobile --with-libxul-sdk=../xulrunner/dist


# Global options -- uncomment these lines for debug version
Check out the source and create a mozconfig following the instructions above.  Be sure to add or uncomment this line:
#ac_add_options --enable-debug
#ac_add_options --disable-optimize


# needed to fix problem with Vista SDK
ac_add_options --disable-accessibility
ac_add_options --disable-accessibility
</pre>


Then use the commands
Then use the commands


<pre>
configure
configure
make -f client.mk build
make -f client.mk build
</pre>


Don't panic if configure fails; the make will rerun it with the right options to allow this to work.
Don't panic if configure fails; the make will rerun it with the right options to allow this to work.

Latest revision as of 20:43, 1 August 2017

Building Fennec

Look here for the Android build instructions

[[https://wiki.mozilla.org/Mobile/Fennec/Android ]]


Install and run Scratchbox (Maemo only)

If you want to cross-compile Fennec and XULRunner for Maemo, you should first set up scratchbox. Scratchbox is a cross-compilation environment that you will run before compiling Fennec.

NOTE: All the following instructions assume that you are logged in to scratchbox by typing this:

/scratchbox/login

NOTE 2: When you are logged in to scratchbox, you are chroot'ed. This means that /scratchbox/users/YOUR_NAME/home/YOUR_NAME matches to your home directory inside of scratchbox which is /home/YOUR_NAME

Install build dependencies (non-Maemo)

If you are not building for Maemo/Scratchbox, follow the "Installing build tools" instructions for your platform.

Pull the code from Mercurial

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

Create a mozconfig

Create a file named "mozconfig" in the mozilla-central directory. Here's an example mozconfig. The LDFLAGS, with-arm-kuser, and with-maemo-version options should be removed if you're building outside of scratchbox (for x86).

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir
ac_add_options --enable-application=mobile

# For improved compile speeds, all optional.
#mk_add_options MOZ_MAKE_FLAGS=-j4
#export CCACHE_HARDLINK=1
#ac_add_options --with-ccache=ccache

# Make a debug build, optional.
#export MOZ_DEBUG_SYMBOLS=1
#ac_add_options --enable-debug
#ac_add_options --disable-optimize

# Needed on Win32 to fix problem with Windows Vista SDK
#ac_add_options --disable-accessibility

####################################################
# SCRATCHBOX ONLY: Remove everything below this line
# if you are not building in Scratchbox for Maemo. 

ac_add_options --with-maemo-version=5

# Enabling --with-arm-kuser implies Linux on ARM and enables kernel
# optimizations for that platform
ac_add_options --with-arm-kuser

# cs2007q3 gcc 4.2 is busted, we think, and doesn't
# look in the expected places. --dougt.
# $PWD/... was added due to bug 463076
export LDFLAGS="-Wl,-rpath-link,$PWD/dist/bin/:/usr/lib:/lib"

See Configuring Build Options for more information about customizing your build settings.

Build

In the mozilla-central directory:

make -f client.mk build

The build will appear in ../objdir (or whatever MOZ_OBJDIR is set to in your mozconfig).

Running Fennec

Desktop

cd ../objdir/dist/bin
./fennec

You may want to add the $MOZ_OBJDIR/dist/bin directory to your shell's $PATH so you can just type "fennec" anywhere.

Maemo

If you did the above in a Maemo Scratchbox for the CHINOOK_ARMEL target, you can run the build on the N800/N810 device.

Create a Fennec tarball:

cd ../objdir
make package

You'll now have a tarball in objdir/dist/ named fennec-1.1b2pre.en-US.linux-arm.tar.bz2. (you'll probably want to run bunzip2 on it first, since Maemo doesn't include it):

cd dist
bunzip2 fennec-*.tar.bz2

Connect your N900 to your computer in USB Mass Storage mode and copy the tarball to it, then unmount it and disconnect (note: you must actually disconnect the USB cable; also, be sure to close an open terminal on your N900 if you have one). The file will appear in ~/MyDocs. You can drag it in the file manager, or run something like this command:

cp fennec-*.tar "/media/Nokia N900"
umount "/media/Nokia N900"

Extract and launch from a command line (X Terminal) on the device:

# Run this outside of the MyDocs directory, which is mounted noexec:
tar xvf MyDocs/fennec-*.tar 
./fennec/fennec

Building Win32

Start by setting up your system with the needed SDKs. This means Visual Studio 2008 and the Vista SDK.

Check out the source and create a mozconfig following the instructions above. Be sure to add or uncomment this line:

ac_add_options --disable-accessibility

Then use the commands

configure
make -f client.mk build

Don't panic if configure fails; the make will rerun it with the right options to allow this to work.