#!/bin/ksh -p
#
# Wrapper to build it the way I want

cat << EOF > .mozconfig
ac_add_options --disable-composer
ac_add_options --disable-debug
ac_add_options --disable-freetype2
ac_add_options --disable-ldap
ac_add_options --disable-logging
ac_add_options --disable-mailnews
ac_add_options --disable-profilesharing
ac_add_options --disable-tests
ac_add_options --disable-freetypetest
ac_add_options --disable-glibtest
ac_add_options --disable-gtktest
ac_add_options --disable-libIDLtest

ac_add_options --enable-crypto
ac_add_options --enable-ctl
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --enable-extensions="cookie,xml-rpc,xmlextras,pref,transformiix,universalchardet,webservices,inspector,gnomevfs,negotiateauth"
ac_add_options --enable-image-decoders=all
ac_add_options --enable-optimize="-xO3"
ac_add_options --enable-official-branding
ac_add_options --enable-single-profile
ac_add_options --enable-xft

ac_add_options --with-gtk-prefix=/opt/csw
ac_add_options --with-glib-prefix=/opt/csw

ac_add_options --x-includes=/usr/openwin/include
ac_add_options --x-libraries=/usr/openwin/lib

ac_add_options --without-system-mng

mk_add_options BUILD_OFFICIAL=1
mk_add_options MOZ_PHOENIX=1
mk_add_options MOZILLA_OFFICIAL=1
EOF

export BUILD_OFFICIAL=1
export MOZ_PHOENIX=1
export MOZILLA_OFFICIAL=1
export CC=cc
export CXX=CC
export CFLAGS="-xlibmil"
export CXXFLAGS="-xlibmil -xlibmopt -features=tmplife -norunpath"
export LDFLAGS='-R$ORIGIN -R/opt/csw/lib -R/usr/sfw/lib -R/opt/sfw/lib'
#export PATH="/usr/sfw/bin:/opt/csw/bin:/opt/sfw/bin:/opt/pub/src/mozilla/bin:$PATH"
#export LD_LIBRARY_PATH="/opt/csw/lib:/usr/sfw/lib:/opt/sfw/lib:$LD_LIBRARY_PATH"

gmake -f client.mk build_all
cd xpinstall/packager
gmake
