default_pre_build  &&
cd  $SOURCE_DIRECTORY &&

# 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
   echo 'ac_add_options --enable-safe-browsing' >> .mozconfig
else
   echo 'ac_add_options --disable-safe-browsing' >> .mozconfig
fi &&

# Be explicit: stripped install is the default.
if [[ "$FIREFOX_STRIP" == "y" ]]; then
  echo 'ac_add_options --enable-install-strip' >> .mozconfig
else
  echo 'ac_add_options --disable-install-strip' >> .mozconfig
fi &&

if [[ "$FIREFOX_SDK" == "n" ]]; then
  sed -i 's/^\(INSTALL_SDK = .*\)$/#\1/' browser/installer/Makefile.in
fi &&

if [[ $FIREFOX_OFFICIAL == y ]]; then
  echo 'ac_add_options --enable-official-branding' >> .mozconfig
fi &&

if [[ $FIREFOX_PGO == y ]]; then
  echo "mk_add_options PROFILE_GEN_SCRIPT='\$(PYTHON) \$(OBJDIR)/_profile/pgo/profileserver.py'" >> .mozconfig
else
  echo "ac_add_options --disable-tests" >> .mozconfig 
fi
