Creating Universal Build of XULRunner

October 2, 2007

It is possible to build XULRunner as a universal binary that runs natively on both PowerPC and Intel processors running Mac OS X.


 **  XULRunner (developer preview release) Source Code

 **  Mac OS X 10.4.9 (Tiger)

 **  XCode Tools 2.4.1

 **  Fink ,  libIDL , gLib.

Note : In my previous blog i’ve given detailed documentation on installing fink.  Once you have setup the fink , issue the following command in the terminal to install the libIDl , gLib ( if you don’t have already).libIDL is included in the ORBit installation

$ sudo apt-get install orbit orbit-dev glib


When preparing your own .mozconfig file, you must source the $topsrcdir/build/macosx/universal/mozconfig fragment. It should be sourced after any product-specific mozconfig, in case it needs to override any options.

Universal binaries must be built as objdir builds, so MOZ_OBJDIR must be set. The location of your objdir is unimportant, so long as you provide one.

Here is a sample .mozconfig suitable for building a universal binary of XULRunner in a release configuration:

. $topsrcdir/xulrunner/config/mozconfig
. $topsrcdir/build/macosx/universal/mozconfig
ac_add_options --enable-optimize=-O2
ac_add_options --disable-shared
ac_add_options --enable-shared
ac_add_options --disable-tests
ac_add_app_options ppc --enable-prebinding
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.4u.sdk
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../build


Once the configuration is in place, building Mozilla as a universal binary is as easy as performing an ordinary build. Type:

$ make -w -f build

The source code required for your build will be checked out and
compiled. Two build passes are made: one to compile Mozilla for
PowerPC, and another for Intel processors. Understandably, this process
takes approximately twice as long as compiling for a single processor.
After both passes are complete, the results are automatically merged
into a single universal binary.

Results of a Build

Two subdirectories are created in your objdir: ppc and i386.
Each of these directories contains a complete processor-specific build.
The merged universal binary is placed in your objdir, at ppc/dist/universal with a symbolic link at i386/dist/universal.


Create a chown_root.c file with following content.( This file can be created in any directory )

#include <unistd.h>
   int main(int argc, char **argv)
      if (argc != 2)
        return 1;
      return execl(“/usr/sbin/chown”,
                   “/usr/sbin/chown”, “-R”, “-h”, “root:admin”, argv[1], (char*) 0);

Create a chown_revert.c file with following content.( This file can also  be created in any directory )

 #include <unistd.h>
 #include <stdio.h>
 int main(int argc, char **argv)
    if (argc != 2)
       return 1;
     uid_t realuser = getuid();
     char uidstring[20];
     snprintf(uidstring, 19, “%i”, realuser);
     uidstring[19] = ”;
     return execl(“/usr/sbin/chown”,
                  “/usr/sbin/chown”, “-R”, “-h”, uidstring, argv[1], (char*) 0);

Use gcc to compile the above files

$ gcc -o chown_root chown_root.c

$ gcc -o chown_revert chown_revert.c

Export the above executable as …

$ export CHOWN_ROOT=”absolute_path_to_your_chown_root_binary”
$ export CHOWN_REVERT=”absolute_path_to_your_chown_revert_binary”

When configured as a universal binary, the
packaging phase will produce a disk image containing the merged
universal binary. In order to perform the packaging phase, you must
keep the new objdir structure in mind. If you had used the sample .mozconfig above, you would build a universal disk image of XULRunner by typing:

$ make -C ../build/ppc/xulrunner/installer

The disk image will be produced in ../build/ppc/dist. You could just as easily substitute i386 for ppc, this only affects the location that the disk image is produced in.

To bypass universal packaging, and create a disk image
containing the application for a single processor only, you can
override the UNIVERSAL_BINARY variable, setting it to
empty. This will package Firefox for Intel processors into a disk
image, the result will not launch at all on PowerPC:

$ make -C ../build/i386/browser/installer UNIVERSAL_BINARY=

Thats it we have created the Universal build of XULRunner ( version ) .

Blogged with Flock


Installing Fink

October 2, 2007

Today i’ve installed fink in my Mac OS X  Tiger (10.4.9).

I’ve installed XCode 2.4.1 as a prerequisite.

Installation Procedure:

New to Fink? These quick start instructions are here to get you up to speed with the binary release.

  1. Download the installer disk image:
    Fink 0.8.1 Binary Installer (PowerPC) – 17930 KB
    Fink 0.8.1 Binary Installer (Intel) – 17510 KB

  2. Double-click “Fink-0.8.1-XYZ-Installer.dmg” (where XYZ is either PowerPC or Intel) to mount the disk image, then double-click the “Fink 0.8.1 XYZ Installer.pkg” package inside. Follow the instructions on screen.

  3. At the end of the installation, the pathsetup utility will be launched. You will be asked for permission before your shell’s configuration files are edited. When the utility has finished, you are set to go!

  4. If anything goes wrong during this process, you can try again by launching the pathsetup application which appears on the installer disk, or by running (from the command line in a window)


    (This step should also be repeated by any other users on your system: each user must run pathsetup in his or her own account.)

  5. Open a new window and run the following: “fink scanpackages; fink index“.

  6. Once those two commands are finished you should update the fink package, in case there have been significant changes since the last point release. After you do this you can install other packages.

    • Use apt-get. Apt-get will fetch and install binary packages for you, saving compiling time. To update fink open a window and type sudo apt-get update ; sudo apt-get install fink

      Once you’ve updated fink, you can install other packages, using the same syntax, e.g sudo apt-get install gimp to install the Gimp. Note, however, that not all fink packages are in binary form.

        Thats it , fink is now installed in your Mac OS X Tiger.

Blogged with Flock

Tags: ,