default_pre_build &&
cd ${SOURCE_DIRECTORY} &&

for i in "$SPELL_DIRECTORY"/patches/*; do
  desc="$(sed -r '/^Subject: /!d;s@[^ ]* *(\[[^\]]*\] *)*@ (@;s@$@)@;q' "$i")" &&
  if query "Apply ${i##*/}$desc?" n; then
    patch -sp1 -i "$i" || break
  fi
done &&

if [[ "${ST_CONFIG}" == "y" ]]; then
  if [[ -e ${INSTALL_ROOT}/usr/share/doc/st/config.def.h ]]; then
    cp ${INSTALL_ROOT}/usr/share/doc/st/config.def.h ./
  fi &&
  if query 'Do you want to edit your config now?' n; then
    if [ -z"$EDITOR" ]; then
      . /etc/profile.d/editor.sh
    fi
    ${EDITOR:-nano} config.def.h
  fi
fi
