How to Build Camino Though the Mozilla Developer Center online documentation is a carefully thought out and concise set of documents, there is no one-stop shop with instructions for creating an optimized build of Camino on Mac OS X. Just about everything in the following document is an aggregation of a lot of hard work and ideas done by people way smarter than I am. I am just bringing together approximately 10+ hours worth of Google searching, testing, tweaking, and code building into one document so building the great browser that is Camino won't be so taxing in the future. Preliminaries - Build Hardware: Mac mini w/ Intel Core Duo @ 1.66 GHz. 1024 MB DDR2 SDRAM (80 MB in use by Intel GMA950 Graphics Accelerator) 80 GB 5,400 RPM FUJITSU MHV2080BHPL Serial-ATA Hard Drive DVD +/- Superdrive on PATA Bus Kensington Slim Type Keyboard Microsoft Mouse System Software: Mac OS Mac OS X 10.4.6 (8I1119) Kernel Version: Darwin 8.6.1 Apple GCC 4.0.1 XCode Tools 2.3 Rationale: Camino was released as a universal binary on Feb. 14, 2006 (www.wikipedia.org), and performance on my Mac mini was great, but I knew it could get even better. One caveat with it being a universal release was the extra code bloat needed to keep both machine architectures in the release, and that's something I do not like about the universal binary architecture. There are frequent optimized build of Firefox released on the web, but after 4 months of patient waiting, no one had publicly released an Intel optimized build of Camino, so that's when I decided to take matters into my own hands. How to build: 1. Get the latest release of XCode Tools from Apple's Developer web site. http://developer.apple.com I don't even bother installing from the DVD included with my Mac as Apple is continually updating the software. In short I treat my development software much in the same way gamers will constantly look for and fetch the latest stable drivers for their video cards. 2. Download and install the latest release of DarwinPorts. http://darwinports.opendarwin.org/getdp/ The Mozilla Developer Center (MDC) specifies that either the Fink or DarwinPorts package management system can be used, but I choose to install DarwinPorts as it came in a universal disk image that would just be ready to work in Tiger. "The easiest way to install DarwinPorts on a Mac OS X system is by downloading the dmg for Tiger or the one for Panther and running Installer.app on the pkg contained therein by double clicking on them, following the on-screen instructions until completion. This procedure will place a fully functional and default DarwinPorts installation on your host system, ready for usage. If needed, your shell configuration files will be adapted by the installer to include the necessary settings to run DarwinPorts. You may need to open a new shell for these changes to take effect." --DarwinPorts Install homepage Synchronize with the DarwinPorts server to make sure you have the freshest files. In a terminal window, type this: sudo port -d selfupdate 3. Install libIDL and GLib: At a terminal window, type these 2 commands: sudo port sync sudo port install libidl 4. Download, Build, and create symbolic links to the SharedMenusCocoa.framwork. (From the MDC. Direct cut & paste. This is a VERY IMPORTANT step!) http://developer.mozilla.org/en/docs/Mac_OS_X_Universal_Binaries#Building_a_Universal_SharedMenusCocoa Camino imposes an additional requirement that the Shared Menus Cocoa framework be present. The binary that ships with this framework is PowerPC-only, and will cause Intel builds (including universal binary builds) to fail. The Shared Menus Cocoa framework package contains source code. This section describes how to build a universal binary of the framework from that source. * Download SharedMenusCocoa, mount the disk image, and copy the SharedMenusCocoa folder to your hard drive. You can now eject and discard the disk image. * Open the SharedMenusCocoa folder, and double-click the SharedMenusCocoa.pbproj project inside. This will launch Xcode. * In the dialog that appears, click "Upgrade a Copy" to upgrade the project file to the Xcode 2.1 format. Name your upgraded copy SharedMenusCocoa.xcodeproj. * From the "Project" menu, select "Upgrade All Targets in Project to Native", and click "Upgrade" in the sheet that appears. * A "Native Target Upgrade Log" window will appear. It may be closed. * From the "Project" menu, select "Edit Project Settings", and select the "Build" tab in the settings window. * Set "Architectures" to ppc i386 by double-clicking Architectures, typing "ppc i386", and pressing return. * Add the following four new settings. Settings are added by clicking the "+" button below the settings list. You should add these settings: o GCC_VERSION_i386 = 4.0 o GCC_VERSION_ppc = 3.3 o SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk o SDKROOT_ppc = /Developer/SDKs/MacOSX10.2.8.sdk * Close the settings window. * From the "Project" menu, choose "Set Active Build Configuration" and set it to "Default". * Click "Build" in the project windows toolbar, and wait for the build process to complete. It should complete successfully with no errors, although some warnings may be produced. * You now have a universal binary of SharedMenusCocoa. Quit Xcode. * Copy SharedMenusCocoa.framework from build/Default/SharedMenusCocoa.framework to /Library/Frameworks. Don't forget to provide symbolic links to the framework from the SDKs. From a shell, type: sudo mkdir -p /Developer/SDKs/MacOSX10.2.8.sdk/Library/Frameworks sudo ln -s /Library/Frameworks/SharedMenusCocoa.framework /Developer/SDKs/MacOSX10.2.8.sdk/Library/Frameworks sudo mkdir -p /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks sudo ln -s /Library/Frameworks/SharedMenusCocoa.framework /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks (Since I exclusively used the GCC 4.0 compiler I also had to create a symbolic link to the 10.3.9 SDK. Again, another important step.) From a shell, type: sudo mkdir -p /Developer/SDKs/MacOSX10.3.9.sdk/Library/Frameworks sudo ln -s /Library/Frameworks/SharedMenusCocoa.framework /Developer/SDKs/MacOSX10.3.9.sdk/Library/Frameworks 5. Download the latest source from the Mozilla ftp servers and unpack. ftp://ftp.mozilla.org/pub/mozilla.org/camino/source I chose to save the .tar file in my home directory and unpacked by typing this in the terminal: tar xvfj camino-1.0.2.tar.bz2 6. Create and edit your .mozconfig file. This is the main file that directs the compiler how you want to compile and build your source code. Here is my final .mozconfig that was used when I ran the build: . $topsrcdir/camino/config/mozconfig mk_add_options MOZ_MAKE_FLAGS=-j4 ac_add_options --enable-reorder ac_add_options --enable-strip ac_add_options --enable-static ac_add_options --enable-static-libs ac_add_options --enable-svg ac_add_options --enable-canvas ac_add_options --enable-pthreads ac_add_options --enable-optimize="-O3 -fast -march=i686 -mfpmath=sse,387 -fforce-addr -mieee-fp -msse3 -msse2 -msse -mmmx" ac_add_options --disable-debug ac_add_options --disable-tests ac_add_options --disable-shared ac_add_options --without-system-png ac_add_options --without-system-mng ac_add_options --without-system-nspr ac_add_options --without-system-zlib ac_add_options --without-system-jpeg (Some notes) I know the .mozconfig above is not the most efficient. Since this is the first build I have ever done for Camino (and actually only the second build from source I have ever completed) I just pieced together lines from an optimized version of Firefox I already downloaded in order to get things working. BeatnikPad's Optimized Firefox 1.5.0.4 for G4, G5, and Intel is where I got started. http://www.beatnikpad.com/archives/2006/06/04/firefox-1504 ) Also I like to create the .mozconfig file in my home directory and copy it over to the mozilla directory when I am ready to start a build. This ensures I have a backup of the .mozconfig file in case anything goes wrong. 7. Begin the build. cd into the mozilla directory. This is what your prompt should look like: MacIntel:~ JZ$ cd mozilla MacIntel:~/mozilla JZ$ At the prompt type: ./configure && make -j4 On a 1.66 GHz Intel Core Duo w/ 1 GB of RAM, running the make command takes about 41 minutes. If you have either a duo core or multi-processor Mac, use the -j4 flag to milk every last bit of processing power from your system. 8. Create a compressed disk image of your optimized build. If you wish to create a disk image of your build for distribution purposed, type this in the command prompt: make -C mozilla/camino/installer This will create the disk image in the mozilla/dist directory, and from there you can copy the disk image to the location of your choice.