default_pre_build                                &&
cd  $SOURCE_DIRECTORY                            &&
cp  composer/config/mozconfig.linux  .mozconfig  &&

#
# Add user optimizations
#
sedit  "s:#export CFLAGS=.*:export CFLAGS=\"$CFLAGS\":"        .mozconfig  &&
sedit  "s:#export CXXFLAGS=.*:export CXXFLAGS=\"$CXXFLAGS\":"  .mozconfig  &&

#
# Fix compilation with gcc 4.1.x
#
message  "${MESSAGE_COLOR}Fixing compilation with gcc 4.1.x${DEFAULT_COLOR}"  &&
patch  -p1  <  $SCRIPT_DIRECTORY/nvu-1.0-gcc4-1.patch                         &&

#
# Fix compilation with glibc 2.4
#
message  "${MESSAGE_COLOR}Fixing compilation with glibc 2.4${DEFAULT_COLOR}"  &&
patch  -p1  <  $SCRIPT_DIRECTORY/nvu-1.0-glibc-2.4.patch                      &&

#
# Fix linking against gfxshared
#
message  "${MESSAGE_COLOR}Fix linking against gfxshared_s${DEFAULT_COLOR}"  &&
patch  -p1  <  $SCRIPT_DIRECTORY/gfxshared_s.patch                          &&

#
# Fix linking against xprintutil
#
message  "${MESSAGE_COLOR}Fix linking against xprintutil${DEFAULT_COLOR}"  &&
patch  -p1  <  $SCRIPT_DIRECTORY/xprintutil.patch                          &&

#
# Use the system provided NSS/NSPR libraries
#
message  "${MESSAGE_COLOR}Use system NSS/NSPR libraries${DEFAULT_COLOR}"  &&
mozilla_remove_nspr_nss                                                   &&

message  "${MESSAGE_COLOR}Begin building ${SPELL_COLOR}$SPELL${DEFAULT_COLOR}..."
