Development:Building:Mozilla 1.8.* Branches

From Camino Wiki
Jump to navigation Jump to search
DRAFT
This page is not complete.

While the Mozilla trunk (and future 1.9 branch/Camino 2.0pre) require a Mac OS X 10.4 runtime and gcc 4.0 and the 10.4u SDK for building, the requirements of the MOZILLA_1_8_BRANCH/Camino 1.6pre (and the security-fixes-only CAMINO_1_5_BRANCH and MOZILLA_1_8_BRANCH/Camino 1.0.x) are rather different. This page contains information on how to modify the main build instructions in order to produce successful builds of Camino on these branches.

General Configuration

Installing additional SDKs

Camino builds on the MOZILLA_1_8_BRANCH/Camino 1.6 and CAMINO_1_5_BRANCH/Camino 1.5.x require the 10.3.9 SDK for PPC and 10.4u SDK for Intel. The MOZILLA_1_8_0_BRANCH/Camino 1.0.x still requires the Mac OS X 10.2.8 SDK on PPC. To build a Universal Camino, you must be running Mac OS X 10.4 or higher and use Xcode 2.4.1 or higher.

If you plan on building any of these versions of Camino on a PPC Mac or as Universal builds, you must install the 10.3.9 and 10.2.8 SDKs in addition to the 10.4u SDK specified in the trunk instructions.

Selecting the proper default compiler on Mac OS X 10.4

When building on the CAMINO_1_5_BRANCH or MOZILLA_1_8_0_BRANCH on Mac OS X 10.4 ("Tiger") or later on PowerPC, you must change the default system compiler to gcc 3.3, the compiler used to produce official PowerPC builds. Use the following command:

$ sudo gcc_select 3.3

Be sure to repeat this step each time you install an Xcode upgrade.

Builds on Intel Macintoshes use the proper compiler version (gcc 4.0.1, from Xcode 2.4.1 or later) by default, so no changes are needed.

Q. Can I build on Mac OS X 10.4 on PowerPC using gcc 4?

A. Yes, with a few caveats. Builds produced with gcc 4 will only run on Mac OS X 10.3.9 and above. Because of this, official Camino releases for PowerPC will continue to be built with gcc 3.3. To use gcc 3.3 on Tiger, simply enter sudo gcc_select 3.3 in a terminal.

The version of gcc 4 that initially shipped with Mac OS X 10.4 Tiger is a pre-release version and will not build Camino. Users with Xcode 2.0 must upgrade to Xcode 2.4.1, which includes a working version of gcc 4.

Building the legacy Camino 1.0.x security releases with gcc 4 and the 10.3.9 SDK has not been tested and is not recommended.


below this point has not been edited/proofed


If you've read this and are still positive that you want to use gcc 4, you must add the following line to the end of your .mozconfig file: ac_add_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.3.9.sdk

gcc 4 users will also need to create a link to the Shared Menus Framework in the 10.3.9 SDK if one does not already exist.
$ 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

Pulling the correct source files from the repository

In order to build code from any of these branches, be sure to check out mozilla/client.mk, mozilla/camino/config/mozconfig and the Universal mozconfig using the appropriate check-out command and branch tag. See this FAQ and the following one for more information. Note that if your checkout fails in the middle, you should restart the checkout from the beginning; otherwise, your tree may end up with some files from the branch and some files from the trunk.

Building on the MOZILLA_1_8_BRANCH/Camino 1.6pre

To build a single-architecture PPC Camino from Xcode on PPC and target 10.3.9 (i.e., to create a PPC build similar to the PPC half of the official Universal Camino), you need to change the default compiler, SDK, and deployment target in your Camino.xcodeproj. N.B. Most people will not need to do this.

pull/build

In your mozilla directory, create a plain text file called .mozconfig (note the leading period). This file is where you will set up the options for your Camino build. To begin, add the following line to your .mozconfig file (note the leading dot and space):

. $topsrcdir/camino/config/mozconfig

Universal builds will need to add the following line immediately before the above line:

. $topsrcdir/build/macosx/universal/mozconfig

and the following lines immediately after those two lines:
ac_add_app_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.3.9.sdk
ac_add_app_options ppc --enable-macos-target=10.3

Universal builds must also be built using an OBJDIR; be sure to add an OBJDIR line to your .mozconfig:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoUni

Sample Uni mozconfig

Universal Distribution on a Dual-CPU Mac:

. $topsrcdir/build/macosx/universal/mozconfig 
. $topsrcdir/camino/config/mozconfig
ac_add_app_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.3.9.sdk
ac_add_app_options ppc --enable-macos-target=10.3
ac_add_options --disable-shared
ac_add_options --enable-static
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoUni
mk_add_options MOZ_MAKE_FLAGS=-j4

Building on the CAMINO_1_5_BRANCH/Camino 1.5.x

Shared Menus Framework

Building Camino also requires that you download and properly install the Shared Menus Framework. The binary that ships with this framework is PowerPC-only and will cause Intel builds (including universal binary builds) to fail. Because of this, building on Intel Macs (or building a Universal Camino) requires building a universal binary of the framework from the source code contained in the Shared Menus Framework distribution. The following steps will walk you through downloading, building (if necessary), and installing the Shared Menus Framework. (If you're in a hurry, simply grab the framework from any recent Camino and skip to step 4.)

  1. Download the Shared Menus Framework.
  2. Decode the .bin file using StuffIt Expander if necessary and mount the disk image.
  3. Follow the instructions below to create a Universal Shared Menus Framework from the included source code.
    1. Copy the SharedMenusCocoa folder from the disk image to your hard drive. You can now eject and discard the disk image.
    2. Open the SharedMenusCocoa folder, and double-click the SharedMenusCocoa.pbproj project inside. This will launch Xcode.
    3. In the dialog that appears, click “Upgrade a Copy” to upgrade the project file to the Xcode 2.4.1 format. Name your upgraded copy SharedMenusCocoa.xcodeproj.
    4. From the “Project” menu, select “Upgrade All Targets in Project to Native”, and click “Upgrade” in the sheet that appears.
    5. A “Native Target Upgrade Log” window will appear. It may be closed.
    6. From the “Project” menu, select “Edit Project Settings”, and select the “Build” tab in the settings window.
    7. Set “Architectures” to ppc i386 by double-clicking Architectures, typing “ppc i386”, and pressing return.
    8. Add the following four new settings. Settings are added by clicking the “+” button below the settings list. You should add these settings:
      • GCC_VERSION_i386 = 4.0
      • GCC_VERSION_ppc = 3.3
      • SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk
      • SDKROOT_ppc = /Developer/SDKs/MacOSX10.3.9.sdk
    9. Close the settings window.
    10. From the “Project” menu, choose “Set Active Build Configuration”, and set it to “Default”.
    11. Click “Build” in the project window’s toolbar, and wait for the build process to complete. It should complete successfully with no errors, although some warnings may be produced.
    12. You now have a universal binary of SharedMenusCocoa. Quit Xcode.
  4. Install the framework:
    • PowerPC-only builds: copy the SharedMenusCocoa.framework file from the build directory on the disk image and place it in /Library/Frameworks
      You can now eject and discard the disk image.
    • Intel-only or Universal builds: copy the newly-built SharedMenusCocoa.framework from build/Default/SharedMenusCocoa.framework to /Library/Frameworks.
  5. You now need to create a reference to the Shared Menus Framework inside the appropriate SDK folder(s). If you are building a Universal Camino, follow the steps for both PowerPC and Intel builds below. Note: recent versions of Xcode will automatically have a link from /Developer/SDKs/*/Library/Frameworks to Library/Frameworks, in which case this step is not necessary (and will cause build failures), so be sure to check before following these steps.
    • PowerPC builds:
      1. Check to see if you have the folder /Developer/SDKs/MacOSX10.3.9.sdk
        If so, proceed to step 2; if not, install the Xcode Cross Development tools as described above.
      2. $ sudo mkdir -p /Developer/SDKs/MacOSX10.3.9.sdk/Library/Frameworks
      3. $ cd /Developer/SDKs/MacOSX10.3.9.sdk/Library/Frameworks
      4. $ sudo ln -s /Library/Frameworks/SharedMenusCocoa.framework SharedMenusCocoa.framework
    • Intel builds:
      1. Check to see if you have the folder /Developer/SDKs/MacOSX10.4u.sdk
        If so, proceed to step 2; if not, install the Xcode Cross Development tools as described above.
      2. $ sudo mkdir -p /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks
      3. $ cd /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks
      4. $ sudo ln -s /Library/Frameworks/SharedMenusCocoa.framework SharedMenusCocoa.framework

pull/build

In your mozilla directory, create a plain text file called .mozconfig (note the leading period). This file is where you will set up the options for your Camino build. To begin, add the following line to your .mozconfig file (note the leading dot and space):

. $topsrcdir/camino/config/mozconfig

Universal builds will need to add the following lines immediately after the above line:

. $topsrcdir/build/macosx/universal/mozconfig
ac_add_app_options ppc --with-macos-sdk=/Developer/SDKs/MacOSX10.3.9.sdk
ac_add_app_options ppc --enable-macos-target=10.3

Universal builds must also be built using an OBJDIR; be sure to add an OBJDIR line to your .mozconfig:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../CaminoUni

Building on the MOZILLA_1_8_0_BRANCH/Camino 1.0.x

Q. What are the requirements for building Camino 1.0.x stable releases?

A. If you wish to build Camino 1.0.x for PPC or Universal, you must install the Mac OS X 10.2.8 SDK and properly configure your build.

  • Ensure you have selected gcc 3.3 for PowerPC builds.
  • In the section for configuring the Shared Menus Framework, you must use
    • GCC_VERSION_i386 = 4.0
      GCC_VERSION_ppc = 3.3
      instead of
      GCC_VERSION = 4.0
    • SDKROOT_ppc = /Developer/SDKs/MacOSX10.2.8.sdk
      SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk
      instead of
      SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk.