1#!/bin/bash
2
3# See also http://developer.mozilla.org/en/docs/Build_Documentation
4SRCURL="ftp://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.0/source"
5
6SRCDIR="$HOME/software"
7SRC="$SRCDIR/mozilla"
8DOWNLOADS="$SRCDIR/downloads"
9BUILD="${SRC}-build"
10TAR="firefox-3.0-source.tar.bz2"
11PREFIX="$HOME/firefox3"
12MOZCONFIG="$BUILD/mozconfig-firefox"
13export MOZCONFIG
14export LC_ALL=C
15export MAKEFLAGS="-j$(($(grep -c '^processor' /proc/cpuinfo) + 1))"
16
17if [ ! -e /usr/include/dbus-1.0/dbus/dbus-glib.h ]; then
18  echo "Please install the dbus-1-glib-devel package first."
19  exit 1
20fi
21
22if [ ! -e /usr/include/libIDL-2.0/libIDL/IDL.h ]; then
23  echo "Please install the libidl-devel package first."
24  exit 1
25fi
26
27if [ ! -e /usr/include/valgrind/valgrind.h ]; then
28  echo "Please install the valgrind-devel package first."
29  exit 1
30fi
31
32rm -rf   ${BUILD}   || exit $?
33rm -rf   ${PREFIX}  || exit $?
34mkdir -p ${DOWNLOADS} || exit $?
35mkdir -p ${BUILD}   || exit $?
36cd       ${BUILD}   || exit $?
37
38if [ ! -e $DOWNLOADS/$TAR ]; then
39  ( cd $DOWNLOADS && wget -q $SRCURL/$TAR )
40fi
41
42if [ ! -e $SRC ]; then
43  ( cd $SRCDIR && tar -xjf $DOWNLOADS/$TAR )
44fi
45
46cat <<EOF >$MOZCONFIG
47. $SRC/browser/config/mozconfig
48mk_add_options MOZ_OBJDIR="$BUILD"
49ac_add_app_options browser --enable-application=browser
50ac_add_options --disable-optimize
51ac_add_options --disable-tests
52ac_add_options --enable-debug
53ac_add_options --enable-optimize="-O1 -g -pipe"
54ac_add_options --enable-static
55ac_add_options --prefix $PREFIX
56ac_add_options --with-valgrind
57EOF
58
59${SRC}/configure
60
61make -s -j2     || exit $?
62# make -s install || exit $?
63