# Recipe for version 3.0 by Michael Homer <michael@gobolinux.org>, on Wed Jun 18 09:39:28 NZST 2008
# Recipe (MakeRecipe) for Firefox by Jonas Karlsson <jonka750@student.liu.se>, on Sun May 1 10:13:41 CEST 2005
compile_version=1.9.0
url="http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0/source/firefox-3.0-source.tar.bz2"
dir='mozilla'
recipe_type=configure
file_size=37010746
file_md5=4210ae0801df2eb498408533010d97c1

configure_options=(
    --enable-application=browser   # It's the browser Firefox we want to build, right?
    --enable-default-toolkit=cairo-gtk2  # Use gtk+ 2.x instead of gtk+ 1.x

    --enable-xft
    --enable-safe-browsing
    --enable-jemalloc              # New memory management in 3.0

    # Our system libpng does not have  APNG support, which is mandatory, 
    # so disable it for the time being.
    --with-system-zlib             # These options are used so that the Firefox binaries are linked to
    --with-system-bz2              # the system-installed copies of the specified libraries instead of
    --with-system-jpeg             # the source tree code which may not be the most recent versions.
#    --with-system-png #<- need apng support (https://bugzilla.mozilla.org/show_bug.cgi?id=418900)
    --enable-system-lcms
    --enable-system-sqlite
    --enable-system-cairo

    --enable-canvas
    --enable-svg

    --enable-official-branding     # This option causes the installed binaries to have the official Firefox name embedded in them. 
# Due to license restrictions, you may not distribute binaries created using this option.

    --with-distribution-id=GoboLinux

    --enable-strip                 # This option is used so that the debugging symbols are removed from the
    --enable-optimize              # installed binaries during the installation process. Comment out this option
    --disable-debug                # if you may have a need to retain the debugging symbols in the installed binaries.

    --disable-tests                # This option is added so that test libraries and programs are not built.
    --disable-installer            # This option is added so that the Mozilla Installer program is not built or installed.
    --disable-accessibility        # Disable the a11y support. Comment out this option if you require a11y support.
    --disable-crashreporter
    
    --with-system-nss
    --with-system-nspr

    --enable-updater # enable automatic updates

)

make_variables=(
   MOZ_CO_PROJECT=browser
   MOZ_OBJDIR=@TOPSRCDIR@/../firefox-build
)

with_startup_notification="--enable-startup-notification"
with_glitz="--enable-glitz"
with_xinerama="--enable-xinerama"
with_ldap="--enable-ldap"
with_pango="--enable-pango"

pre_build()
{
    # Fix an anonymous enum in an external/public interface header file
    sed -i "s/^    enum$/& xptinfo_enum_1/" xpcom/reflect/xptinfo/public/xptinfo.h
}

pre_link()
{
    mkdir -p ${target}/Shared/applications
    cp $recipedir/firefox.desktop ${target}/Shared/applications
}

post_install()
{
    # Give Firefox an icon while minimized
    install -v -m755 -o0 -g0 -d ${target}/lib/firefox-3.0/chrome/icons/default
    ln -v -s ../../../icons/mozicon16.xpm ${target}/lib/firefox-3.0/chrome/icons/default
    
    # install some additional LDAP interface headers
    #install -v -m644 -o0 -g0 firefox-build/dist/public/ldap-private/* ${target}/include/firefox-3.0/ldap
    
    # Shortcut to the icon
    install -v -m755 -o0 -g0 -d ${target}/Shared/icons/firefox
    ln -v -s ../../../lib/firefox-3.0/icons/mozicon128.png ${target}/Shared/icons/firefox
}
