# Recipe for version 3.5 by Michael Homer <michael@gobolinux.org>, on Wed Jul 1 11:16:51 NZST 2009
# 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.5/source/firefox-3.5-source.tar.bz2"
file_size=46444013
file_md5=6dd59399db08963ef022a1d0e5010053
dir='mozilla-1.9.1'
recipe_type=configure

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
   --enable-webservices
    
   # 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
   --with-system-nss
   --with-system-nspr
   --with-libxul-sdk="${goboLibraries}"/xulrunner-sdk-1.9.1

   --enable-canvas
   --enable-svg
   --enable-oji
   --enable-mathml
   --enable-image-encoder=all

   --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
   --disable-mochitest
   --disable-pedantic
   --disable-tests

   --disable-updater # disable automatic updates
)

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

with_startup_notification="--enable-startup-notification"
#with_glitz="--enable-glitz" # build failure https://bugzilla.mozilla.org/show_bug.cgi?id=376083
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

   # Somehow the files are installed with wrong owner and permissions
   chown -R 0:0 "${target}"
   chmod -R a+rX "${target}"
}

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