Development:Building:Mac OS X 10.7

From Camino Wiki
Revision as of 23:14, 11 January 2012 by Phiw (talk | contribs) (Created page with "Building on Mac OS X 10.7 is unfortunately complicated. Gecko 1.9.2 is not Xcode 4 / 10.7-build-friendly. This page contains a full list of supplemental instructions to help you ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Building on Mac OS X 10.7 is unfortunately complicated. Gecko 1.9.2 is not Xcode 4 / 10.7-build-friendly. This page contains a full list of supplemental instructions to help you complete a Cm2.1-M1.9.2 build on Mac OS X 10.7 with Xcode 4 (please be sure you follow all of the other instructions on Development:Building:Mozilla 1.9.2 Branch and Development:Building:Mac OS X 10.6). Please let us know of any additional issues in Bug 717513

Preparing the build environment: installing Xcode 3 alongside Xcode 4

Xcode 4 (available for free through the Mac App Store) does not include the necessary tools for building Camino: the 10.4 sdk and the GCC 4.0 compiler. Those need to be fetched from Xcode 3. The necessary steps have originally been documented in this post on Stack Overflow and reposted on MacOS X hints (note that those steps were written before Lion and Xcode 4.2 had been released; X code 4.2.1 changed a few things).

Before installing Xcode 3, it is recommended to uninstall Xcode 4 if it was installed. Any preferences, color scheme or key binding customizations will not be deleted.

Installing Xcode 3

Xcode 3 can be downloaded for free from Apple Developer site (direct download link). But the installer does a version check and won't allow installation on Lion 10.7.2. The necessary Xcode Toolset component is disabled. If the COMMAND_LINE_INSTALL environment variable is set, the version check can be bypassed (source: anatomic wax).

  1. Mount the Xcode 3.2.6 DMG
  2. From a Terminal window:
    $ export COMMAND_LINE_INSTALL=1
    $ open "/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg"
    The installer.app will open.
  3. Create a destination folder before continuing with the installation process (e.g. /Xcode 3).
  4. Proceed with the installation through the installer. As noted in the Stack Overflow exchange above, do not install the "System Tools" or "Unix Development" packages of Xcode 3. But make sure to install the 10.4u SDK (the option is checked off by default).

Install Xcode 4

The most recent version (4.2.1) doesn't allow any custom choices. By default it will install in /Developer.

Restoring 10.4u SDK support

$ cd /Developer/SDKs
$ sudo ln -s /Xcode3/SDKs/MacOSX10.4u.sdk .

Restoring GCC 4.0 support

$ cd /Developer/usr/bin
$ sudo ln -s /Xcode3/usr/bin/*4.0* .
$ cd /Developer/usr/libexec/
$ sudo ln -s /Xcode3/usr/libexec/gcc .

Let Xcode 4 see the gcc 4.0 compiler

$ cd /Developer/Library/Xcode/PrivatePlugIns
$ cd Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins
$ sudo ln -s "/Xcode3/Library/Xcode/Plug-ins/GCC 4.0.xcplugin" .

Command line build process

The process above needs to be repeated to install the GCC 4.0 compiler in a location that Gecko will understand without problems. By default, Gecko is looking in /usr.

$ cd /usr/bin; sudo ln -s /Xcode3/usr/bin/*4.0* .
$ cd /usr/libexec; sudo ln -s /Xcode3/usr/libexec/gcc .
$ cd /usr/lib; sudo ln -s /Xcode3/usr/lib/gcc .

Patches

On Mac OS X 10.7 Lion, the configure process fails silently to generate a number of defines… and for some obscure reason the version detection for Xcode is not accurate.

See also the patch(es) linked in Development:Building:Mac OS X 10.6.

Building in Xcode 4

(untested so far) Afaict, the project file opens correctly and see the correct compiler and SDK.