mk_source_dir  $SOURCE_DIRECTORY  &&
cd  $SOURCE_DIRECTORY             &&
unpack_file  ''                   &&
cd  mozilla*                       &&

#Fedora  patch to remove glyph in title bar
# http://osdir.com/ml/scm-fedora-commits/2011-06/msg10320.html
patch -p0 < $SPELL_DIRECTORY/glyph.patch &&

# Archlinux patch to drop release point from install path
# http://projects.archlinux.org/svntogit/packages.git/plain/trunk/firefox-install-dir.patch?h=packages/firefox
patch -p1 < $SPELL_DIRECTORY/install_dir.patch &&

cp -v $SPELL_DIRECTORY/mozconfig .mozconfig &&

if [[ "$FIREFOX_SAFE" == "y" ]]; then
   sed -i '27iac_add_options --enable-safe-browsing' .mozconfig
else
   sed -i '27iac_add_options --disable-safe-browsing' .mozconfig
fi &&

if [[ "$FIREFOX_STRIP" == "y" ]]; then
   sed -i '27iac_add_options --enable-strip' .mozconfig
fi &&


if [[ $FIREFOX_OFFICIAL == y ]]; then
  sed -i '27iac_add_options --enable-official-branding' .mozconfig || return 1
fi
