It is possible to build XULRunner as a universal binary that runs natively on both PowerPC and Intel processors running Mac OS X.
Prerequisites
** XULRunner 1.8.0.9 (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
Configuration
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
Building
Once the configuration is in place, building Mozilla as a universal binary is as easy as performing an ordinary build. Type:
$ make -w -f client.mk 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.
Packaging
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 ( 1.8.0.9 version ) .
Blogged with Flock
Tags: XULRunner+ Mac
October 6, 2007 at 9:41 am |
[...] Creating Universal Build of XULRunner October 6th, 2007 — praveenmatanam Creating Universal Build of XULRunner [...]