spf_template gnu &&
spf_url home  'http://www.mozilla.com/firefox/' &&
spf_url watch 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/' &&
case ${spf_version?} in
  1.*|2.*|3.0.*)
    spf_url src "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${spf_version?}/source/firefox-${spf_version?}-source.tar.bz2";;
  *)
    spf_url src "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${spf_version?}/source/firefox-${spf_version?}.source.tar.bz2";;
esac &&
#case ${spf_version?}. in
#  1.*|2.*|3.[05].*|3.6.*) spf_depend gtk versions '2.*';;
#  *)                      spf_depend gtk;;
#esac &&
spf_depend gtk &&
spf_depend gdk-pixbuf                                  &&
spf_depend atk                                         &&
spf_depend pango                                       &&
spf_depend cairo                                       &&
spf_depend pixman                                      &&
spf_depend glib                                        &&
spf_depend libidl                                      &&
spf_depend freetype                                    &&
spf_depend fontconfig                                  &&
spf_depend libpng                                      &&
spf_depend zlib                                        &&
spf_depend libxext                                     &&
spf_depend libxt                                       &&
spf_depend libxft                                      &&
spf_depend libsm                         flags include &&
spf_depend libice                                      &&
spf_depend libxi                                       &&
spf_depend libx11                                      &&
spf_depend libxcb                                      &&
spf_depend libpthread-stubs              flags include &&
spf_depend libxdmcp                      flags include &&
spf_depend libxau                        flags include &&
spf_depend kbproto                       flags include &&
spf_depend xproto                        flags include &&
spf_depend libxrender                                  &&
spf_depend renderproto                   flags include &&
spf_depend xextproto     degree optional flags include &&
spf_depend xineramaproto degree optional flags include &&
spf_depend libxinerama   degree optional               &&
spf_depend libxp         degree optional               &&
spf_depend jpeg          degree optional               &&
spf_depend libxmu        degree optional               &&
spf_depend alsa-lib      degree optional               &&
case ${spf_version?} in
  [12].*)
    spf_args configure --with-system-jpeg="${spf_path_conf?}"/jpeg/prefix &&
    spf_args configure --with-system-png="${spf_path_conf?}"/libpng/prefix &&
    spf_args configure --with-glib-prefix="${spf_path_conf?}"/glib/prefix &&
    spf_args configure --with-gtk-prefix="${spf_path_conf?}"/gtk/prefix &&
    spf_args configure --with-libIDL-prefix="${spf_path_conf?}"/libidl/prefix;;
  *)
    spf_depend curl degree optional flags include;;
esac &&
case ${spf_version?} in
  [12].*) :;;
  3.0.*)
    spf_depend dbus      degree optional flags include &&
    spf_depend dbus-glib degree optional flags include;;
  *)
    spf_depend dbus      &&
    spf_depend dbus-glib &&
    spf_args configure --enable-libxul;;
esac &&
case ${spf_version?} in
  [12].*|3.[05].*) :;;
  *)
    spf_depend libnotify      flags include &&
    spf_depend wireless-tools flags include degree optional;;
esac &&
case ${spf_version?} in
  [12].*|3.[05].*|3.6.[012345678])
    spf_depend python flags none versions '2.*';;
  *)
    spf_depend python flags none;;
esac &&
spf_cc_ cc_args -O &&
# --with-system-libevent=[PFX] 
spf_cc_ configure_args '--enable-application=browser --enable-optimize' &&
#### --enable-pango
spf_args configure --with-system-zlib="${spf_path_conf?}"/zlib/prefix &&
spf_args configure --with-ft-prefix="${spf_path_conf?}"/freetype/prefix &&
spf_args configure --enable-system-cairo &&
spf_template_gnu_x &&
case ${spf_version?}. in
  [12].*|3.0.*) spf_srcdir mozilla;;
  3.5.*)        spf_srcdir mozilla-1.9.1;;
  3.6.*)        spf_srcdir mozilla-1.9.2;;
  *)            spf_srcdir mozilla-2.0;;
esac &&
spf_template_gnu_do_before_configure() {
  if prj_match '[12].*' "${spf_version?}" ||
     test -d "${spf_path_compile?}"/conf/curl/.
    then :
    else spf_args configure --disable-crashreporter
  fi &&
  #echo '. $topsrcdir/browser/config/mozconfig' >> .mozconfig && 
  case ${spf_version?} in
    2.0.0.3)
      # fixes libplds4:
      prj_sedfile nsprpub/config/autoconf.mk.in \
        's/@DSO_LDOPTS@/& $(OS_LDFLAGS)/' &&
      # fixes libssl3:
      prj_u2 prj_capture pkg_ldflags prj_quote_sed : "${spf_args_ld?}" &&
      prj_sedfile security/coreconf/Linux.mk \
        "s:^DSO_LDOPTS${spf_c_cws?}*=.*\$:& ${pkg_ldflags?}:";;
    *) :;;
  esac &&
  case ${spf_version?} in
    2.*)
#http://lists.gobolinux.org/pipermail/gobolinux-users/2007-January/004344.html
      prj_sedfile layout/build/Makefile.in \
        's/EXTRA_DSO_LDOPTS =/& -lX11 -lXrender/';;
    *) :;;
  esac &&
  case ${spf_version?} in
    3.0.*|3.5.6)
      prj_unset pkg_file &&
      for pkg_file in \
        toolkit/crashreporter/google-breakpad/src/common/linux/dump_symbols.cc \
        toolkit/crashreporter/google-breakpad/src/client/linux/handler/exception_handler.cc \
        toolkit/crashreporter/google-breakpad/src/client/linux/handler/minidump_generator.cc \
        ; do {
          prj_sedfile "${pkg_file?}" '
/^#include <unistd\.h>$/a\
#include <stdio.h>\
'
      } || return "$?"; done;;
    *) :;;
  esac &&
  case ${spf_version?} in
    [12].*|3.[05].*) :;;
    *)
      if test -d "${spf_path_compile?}"/conf/wireless-tools/.
        then :
        else spf_args configure --disable-necko-wifi
      fi;;
  esac
} &&
spf_template_gnu_do_after_install() {
  "${spf_path_prefix?}"/bin/firefox -register
} &&
#spf_tested_version 4.0.1 && 
spf_tested_version 3.6.17 &&
spf_tested_version 3.6.13 &&
spf_tested_version 3.6.12 &&
spf_tested_version 3.6.11 &&
spf_tested_version 3.6.8 &&
spf_tested_version 3.6.3 &&
spf_tested_version 3.6 &&
spf_tested_version 3.5.9 &&
spf_tested_version 3.5.6 &&
spf_tested_version 3.0.14 &&
spf_tested_version 3.0.10 &&
spf_tested_version 3.0.8 &&
spf_tested_version 3.0.6 &&
spf_tested_version 3.0.5 &&
spf_tested_version 3.0.4 &&
spf_tested_version 2.0.0.20 &&
spf_tested_version 2.0.0.19 &&
spf_tested_version 2.0.0.18 &&
spf_tested_version 2.0.0.17 &&
spf_tested_version 2.0.0.16 &&
spf_tested_version 2.0.0.13 &&
spf_tested_version 2.0.0.11 &&
spf_tested_version 2.0.0.3  &&
spf_tested_version 1.5.0.12 &&
spf_tested_version 1.5.0.11

