Difference between revisions of "User:Jamesboston"

From CDOT Wiki
Jump to: navigation, search
(Projects)
(Building Firefox)
Line 72: Line 72:
 
= Building Firefox =
 
= Building Firefox =
  
== Building on Windows Vista or XP ==
+
== Install prerequisites ==
 +
 
 +
=== Windows ===
  
 
Install Visual Studio:
 
Install Visual Studio:
Line 87: Line 89:
 
  http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.3.exe
 
  http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.3.exe
  
Open a shell window (on Vista right click and using admin privileges):
+
To open a shell window click (right-click for admin privileges on Vista):
 +
c:\mozilla-build\start-msvc8.bat
 +
 
 +
(The example above is for Visual Studio 2005. The name of the bat file you use should match the directory that Visual Studio is installed in.)
 +
 
 +
=== Linux ===
 +
 
 +
Install build pre-requisites for Fedora 10 users:
 +
su -c "yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'"
 +
su -c "yum install mercurial autoconf213 libXt-devel"
  
''(The example here is for Visual Studio 2005. The name of the bat file you use should match the directory that Visual Studio is installed in.)''
+
Install Firefox 3 build re-requisites for Ubuntu 8.10 users:
  c:\mozilla-build\start-msvc8.bat
+
sudo apt-get install build-essential
 +
sudo apt-get build-dep firefox
 +
sudo apt-get install mercurial libasound2 libasound2-dev curl libcurl4-gnutls-dev
 +
 
 +
You may need to set an environment variable if the build system can't find autoconf:
 +
export AUTOCONF=autoconf2.13
 +
 
 +
=== OS X ===
 +
 
 +
In order to build Firefox you will need something called MacPorts which can be dowloaded from here:
 +
  http://www.macports.org/install.php
 +
 
 +
After downloading and installing MacPorts you can then install the pre-requisites:
 +
sudo port sync
 +
sudo port install mercurial libidl autoconf213
  
If you are attempting to build Firefox 3.1 you can checkout the source using mercurial as described below. When creating a working directory and checking out the source it doesn't really matter where you put it, but avoid paths that contain spaces. If your user name doesn't have space you can checkout the source to your home directory like this:
+
== Configuration ==
cd
 
mkdir mozilla
 
cd mozilla
 
hg clone http://hg.mozilla.org/mozilla-central/ src
 
  
It is still possible to checkout older versions of Firefox using cvs as described below but Mercurial is preferred:
+
You need to create a hidden file for the build system that contains instructions on how you want your build completed.
cd
 
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk
 
cd ~/mozilla
 
make -f client.mk checkout MOZ_CO_PROJECT=browser
 
  
Create and open a hidden file called .mozconfig in your home directory:
+
Create and open a hidden file called .mozconfig in your home directory using notepad or vim:
 
  notepad.exe ~/.mozconfig
 
  notepad.exe ~/.mozconfig
  
Line 113: Line 130:
 
  ac_add_options --disable-optimize
 
  ac_add_options --disable-optimize
 
  ac_add_options --enable-debug
 
  ac_add_options --enable-debug
ac_add_options --disable-static --enable-shared
 
  
 
If you are using a multi-core computer for building, you can try adding a flag to speed up compile times. Use a value of ''((# of cores)*2)+1'' (ie. five for two cores):
 
If you are using a multi-core computer for building, you can try adding a flag to speed up compile times. Use a value of ''((# of cores)*2)+1'' (ie. five for two cores):
 
  mk_add_options MOZ_MAKE_FLAGS=-j5
 
  mk_add_options MOZ_MAKE_FLAGS=-j5
  
Visual Studio 2008 users may also need to add one or more of the following to .mozconfig
+
For OS X (Leopard) add:
 +
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk
 +
 
 +
For Windows XP it may be necessary to add the following additional line to your .mozconfig file:
 +
ac_add_options --disable-vista-sdk-requirements
 +
 
 +
Visual Studio 2008 users may also need to add one or more of the following to .mozconfig:
 
  ac_add_options --disable-xpconnect-idispatch
 
  ac_add_options --disable-xpconnect-idispatch
 
  ac_add_options --disable-activex
 
  ac_add_options --disable-activex
Line 125: Line 147:
 
  ac_add_options --disable-parental-controls
 
  ac_add_options --disable-parental-controls
  
Start the build:
+
== Getting the source ==
cd ~/mozilla/src
 
make -f client.mk build
 
  
Once the build is finished you should set the following environment variable to turn-off assertion dialogs:
+
If you are attempting to build Firefox 3.1 or greater you can checkout the source using mercurial as described below. When creating a working directory and checking out the source it doesn't really matter where you put it, but avoid paths that contain spaces. Spaces in the path name will cause the build to fail. For Windows XP users, your home directory path almost certainly has spaces. If that is the case, just put the mozilla directory in your root (ie. C:\mozilla) and put the .mozconfig file in that directory. If your user name doesn't have space you can checkout the source to your home directory like this:
  export XPCOM_DEBUG_BREAK=warn
+
  cd
 +
mkdir mozilla
 +
cd mozilla
 +
hg clone http://hg.mozilla.org/mozilla-central/ src
  
When you run Firefox for the first time, create and select a new profile called "development" (or any name of your choice) to avoid corrupting your current profile. You can do this while running your current version of Firefox using these command line options:
+
It is still possible to checkout older versions of Firefox using cvs:
  ~/mozilla/src/obj*/dist/bin/firefox -Profilemanager -no-remote
+
  cd
 +
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk
 +
cd ~/mozilla
 +
make -f client.mk checkout MOZ_CO_PROJECT=browser
  
The finished build can be found in the ~/mozilla/src/obj*/dist/bin directory.
+
== Starting the build ==
  
Run the file "mozilla" or "firefox", not the binary "mozilla-bin" or "firefox-bin".
+
You need to change to the directory that contains the source code and then run the make command:
 +
cd ~/mozilla/src
 +
time make -f client.mk build
  
== Windows notes ==
+
== Running the build ==
  
The instructions are the same as for Windows Vista and XP. For Firefox 3, the Vista SDK is also required. However, for XP it may be necessary to add the following additional line to your .mozconfig file:
+
Once the build is finished you should set the following environment variable to turn-off assertion dialogs:
  ac_add_options --disable-vista-sdk-requirements
+
  export XPCOM_DEBUG_BREAK=warn
  
For more info about Visual Studio 2008 problems see [http://crashopensource.blogspot.com/2008/05/vista-building-with-vc9.html Lukas Blakk's blog].
+
When you run your build for the first time, create and select a new profile called "development" (or any name of your choice) to avoid corrupting your current profile.  
  
Another problem is that you may not be able to use your home directory because the path almost certainly has spaces. If that is the case, just put the mozilla directory in your root (ie. C:\mozilla) and put the .mozconfig file in that directory. Spaces in the path name will cause the build to fail.
+
Windows and Linux:
 +
~/mozilla/src/obj*/dist/bin/firefox -profilemanager
  
For more detailed info about the windows build requirements visit [http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites#Microsoft_Visual_C.2B.2B_and_Windows_SDK Mozilla Developer Center].
+
OS X:
 +
~/mozilla/src/obj*/dist/MinefieldDebug.app/Contents/MacOS/firefox
  
For more information on using Mercurial to checkout Mozilla code see [http://developer.mozilla.org/en/Mozilla_Source_Code_(Mercurial) Mozilla Source Code].
+
== Updating a build ==
  
For more detailed information about Mozilla building visit [http://zenit.senecac.on.ca/wiki/index.php/Real_World_Mozilla_Build_Mozilla_Lab Real World Mozilla Build Lab].
+
If you need to refresh the source code:
 
 
== Building on Ubuntu and Fedora ==
 
 
 
Install build pre-requisites for Fedora 10 users:
 
su -c "yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'"
 
su -c "yum install mercurial autoconf213 libXt-devel"
 
 
 
Install Firefox 3 build re-requisites for Ubuntu 8.10 users:
 
sudo apt-get install build-essential
 
sudo apt-get build-dep firefox
 
sudo apt-get install mercurial libasound2 libasound2-dev curl libcurl4-gnutls-dev
 
 
 
Checkout the source:
 
mkdir ~/mozilla
 
cd ~/mozilla
 
hg clone http://hg.mozilla.org/mozilla-central/ src
 
 
 
Create and open a hidden file called .mozconfig in your home directory:
 
gedit ~/.mozconfig
 
 
 
Add the following lines to .mozconfig
 
# My first mozilla config
 
. $topsrcdir/browser/config/mozconfig
 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
 
ac_add_options --disable-optimize
 
ac_add_options --enable-debug
 
ac_add_options --disable-static --enable-shared
 
 
 
If you are using a multi-core computer for building, you can try adding a flag to speed up compile times. Use a value of ((# of cores)*2)+1 (ie. five for two cores):
 
 
 
mk_add_options MOZ_MAKE_FLAGS=-j5
 
 
 
Start the build:
 
 
  cd ~/mozilla/src
 
  cd ~/mozilla/src
  make -f client.mk build
+
  hg pull -u
 
 
Here is a log of the output from building Firefox 3.1 on Ubuntu 8.04:
 
http://zenit.senecac.on.ca/wiki/imgs/Build_output.txt.zip
 
 
 
Once the build is finished you should set the following environment variable to turn-off assertion dialogs:
 
export XPCOM_DEBUG_BREAK=warn
 
 
 
When you run Firefox for the first time, create and select a new profile called "development" (or any name of your choice) to avoid corrupting your current profile. You can do this while running your current version of Firefox using these command line options:
 
~/mozilla/src/obj*/dist/bin/firefox -Profilemanager -no-remote
 
 
 
The finished build can be found in the ~/mozilla/src/obj*/dist/bin directory.
 
  
Run the file "mozilla" or "firefox", not the binary "mozilla-bin" or "firefox-bin"
+
== Rebuilding the browser ==
  
For more detailed information visit [[Real_World_Mozilla_Build_Mozilla_Lab|Real World Mozilla Build Lab]].
+
If you want to rebuild the entire browser just repeat the instructions for starting the build above. However, it is possible to do incremental builds where only the source code you have changed is compiled.  
  
== Building on OS X ==
+
For instance, to rebuild after a change in the xpcom module try:
 +
make -C ~/mozilla/src/obj*/xpcom
  
Build pre-requisites and instructions for OS X can also be found at the [http://developer.mozilla.org/en/docs/Mac_OS_X_Build_Prerequisites#Firefox_Quick_Start Mozilla Developer Center.]
+
Or as a more general form:
 +
make -C [the object directory corresponding to the source directory that has changed]
  
If you have built Firefox in your home directory and are trying to start it from the command line try these steps:
+
In most cases this will relink the changes and create a new browser binary. But there's not hard and fast rule about when you can successfully do an incremental build. Sometimes you can burrow a few levels into the object tree and sometime you need to build from the very top. It may take a bit of trial and error to discover what works.
cd ~/mozilla/src/obj*/dist/MinefieldDebug.app/Contents/MacOS
 
./firefox -Profilemanager
 
  
 
= Tunneling a VNC session =
 
= Tunneling a VNC session =

Revision as of 06:04, 17 April 2009

Profile

James Boston is a Computer Programmer.

Blog & homepage:
jamesboston.ca

Contact:
Email james at the domain that has my name or look for me on irc:
jboston on irc://irc.mozilla.org/seneca

Projects

Fixing nsIProcess

Project page: Fixing nsIProcess

The API in Firefox for managing external processes has never been fully implemented. This project aims to implement the existing API and extend the API to include inter-process communication.

The Canvas 3D JS Libary (C3DL)

Project page: C3DL

C3DL is a javascript library that will make it easier to write 3D applications using canvas 3d. It will provide a set of math, scene, and 3d object classes to make the canvas more accessible for developers that want to develop 3D content in browser.

Mozilla Developer Resource Kit

Project page: Mozilla Developer Resource Kit

Creating a package that contains everything a developer needs, including documentation, to get started with Firefox. The plan is to make it available as a live Fedora DVD for developers in countries where bandwidth is scarce.

Portable DXR

Project page: Portable DXR

This is closely related to the MDRK. The aim is to package the Mozilla developer documentation and the DXR source browsing tool in an extension that can be easily distributed/installed mostly likely as a XUL/Prism application. As an added bonus, this is a group project where the team members are experimenting with using traditional project planning tools and open source development methods.

Software

Process Manager Extension

A binary XPCOM extension that allows processes external to Firefox to be started and stopped. Currently only Win32 is supported. It is used in the SHTTPD extension.

Further notes on usage: http://jamesboston.ca/cms/node/41

Download: http://jamesboston.ca/extensions/processmanager.xpi

Source: http://jamesboston.ca/extensions/processmanager.zip

SHTTPD Extension

This is a proof of concept. Installing this extension will start a tiny webserver that runs locally. The purpose of this is to eventually provide a way to distribute web application as extensions so they can be run locally/offline. At present, when the browser starts the server also starts and installs an icon to the system tray. It only runs on Win32 machines.

Download: http://jamesboston.ca/extensions/shttpd.xpi

(The server is licensed as beerware and is available on its own at http://shttpd.sourceforge.net/).

Open in Editor Extension

This extension will open source code files from http://mxr.mozilla.org in an editor on the users machine. Simply right click on the loaded page and select the Open in Editor option from the pop up context menu. The user may choose any editor through preference settings. If no preferences are selected the extension defaults to gedit on Linux, notepad on Windows, and (currently) nothing on OS X.

Download: http://zenit.senecac.on.ca/wiki/imgs/Openineditor.xpi

Ubiquity commands

Subscribe to all my commands

Search Seneca Library

Paste to pastebin

Building Firefox

Install prerequisites

Windows

Install Visual Studio:

(The express version will work.)

http://msdn2.microsoft.com/en-us/vstudio/aa700736.aspx

Get Microsoft Windows Software Development Kit Update for Windows Vista (even if you are using XP):

http://www.microsoft.com/downloads/details.aspx?FamilyID=4377f86d-c913-4b5c-b87e-ef72e5b4e065&DisplayLang=en 

Download and install Mozilla Build, a package of software prerequisites:

(If you get a message saying this application did not install properly then you should see a windows dialog giving you the option to re-install with the 'correct settings'. After that all should be well.)

http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-1.3.exe

To open a shell window click (right-click for admin privileges on Vista):

c:\mozilla-build\start-msvc8.bat

(The example above is for Visual Studio 2005. The name of the bat file you use should match the directory that Visual Studio is installed in.)

Linux

Install build pre-requisites for Fedora 10 users:

su -c "yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'"
su -c "yum install mercurial autoconf213 libXt-devel"

Install Firefox 3 build re-requisites for Ubuntu 8.10 users:

sudo apt-get install build-essential
sudo apt-get build-dep firefox
sudo apt-get install mercurial libasound2 libasound2-dev curl libcurl4-gnutls-dev

You may need to set an environment variable if the build system can't find autoconf:

export AUTOCONF=autoconf2.13 

OS X

In order to build Firefox you will need something called MacPorts which can be dowloaded from here:

http://www.macports.org/install.php

After downloading and installing MacPorts you can then install the pre-requisites:

sudo port sync
sudo port install mercurial libidl autoconf213

Configuration

You need to create a hidden file for the build system that contains instructions on how you want your build completed.

Create and open a hidden file called .mozconfig in your home directory using notepad or vim:

notepad.exe ~/.mozconfig

Add the following lines to .mozconfig

# My first mozilla config
. $topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
ac_add_options --disable-optimize
ac_add_options --enable-debug

If you are using a multi-core computer for building, you can try adding a flag to speed up compile times. Use a value of ((# of cores)*2)+1 (ie. five for two cores):

mk_add_options MOZ_MAKE_FLAGS=-j5

For OS X (Leopard) add:

ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.5.sdk

For Windows XP it may be necessary to add the following additional line to your .mozconfig file:

ac_add_options --disable-vista-sdk-requirements

Visual Studio 2008 users may also need to add one or more of the following to .mozconfig:

ac_add_options --disable-xpconnect-idispatch
ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --disable-accessibility
ac_add_options --disable-parental-controls

Getting the source

If you are attempting to build Firefox 3.1 or greater you can checkout the source using mercurial as described below. When creating a working directory and checking out the source it doesn't really matter where you put it, but avoid paths that contain spaces. Spaces in the path name will cause the build to fail. For Windows XP users, your home directory path almost certainly has spaces. If that is the case, just put the mozilla directory in your root (ie. C:\mozilla) and put the .mozconfig file in that directory. If your user name doesn't have space you can checkout the source to your home directory like this:

cd
mkdir mozilla
cd mozilla
hg clone http://hg.mozilla.org/mozilla-central/ src

It is still possible to checkout older versions of Firefox using cvs:

cd
cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk
cd ~/mozilla
make -f client.mk checkout MOZ_CO_PROJECT=browser

Starting the build

You need to change to the directory that contains the source code and then run the make command:

cd ~/mozilla/src
time make -f client.mk build

Running the build

Once the build is finished you should set the following environment variable to turn-off assertion dialogs:

export XPCOM_DEBUG_BREAK=warn

When you run your build for the first time, create and select a new profile called "development" (or any name of your choice) to avoid corrupting your current profile.

Windows and Linux:

~/mozilla/src/obj*/dist/bin/firefox -profilemanager

OS X:

~/mozilla/src/obj*/dist/MinefieldDebug.app/Contents/MacOS/firefox

Updating a build

If you need to refresh the source code:

cd ~/mozilla/src
hg pull -u

Rebuilding the browser

If you want to rebuild the entire browser just repeat the instructions for starting the build above. However, it is possible to do incremental builds where only the source code you have changed is compiled.

For instance, to rebuild after a change in the xpcom module try:

make -C ~/mozilla/src/obj*/xpcom

Or as a more general form:

make -C [the object directory corresponding to the source directory that has changed]

In most cases this will relink the changes and create a new browser binary. But there's not hard and fast rule about when you can successfully do an incremental build. Sometimes you can burrow a few levels into the object tree and sometime you need to build from the very top. It may take a bit of trial and error to discover what works.

Tunneling a VNC session

Instruction page

One of the Mac minis in the ORI area is configured to accept VNC connections, but without an SSH tunnel it's too slow to be useful. These instructions will help you get setup.