#!/bin/sh
# /usr/lib/emacsen-common/packages/install/bhl
set -e

FLAVOR=$1
echo install/midge-mode: Handling install of emacsen flavor ${FLAVOR}

byte_compile_options="-batch -f batch-byte-compile"
el_dir=/usr/share/emacs/site-lisp/
elc_dir=/usr/share/${FLAVOR}/site-lisp/

if [ ${FLAVOR} != emacs ]; then
  echo install/midge-mode: byte-compiling for ${FLAVOR}
  cp ${el_dir}midge-mode.el ${elc_dir}
  cd ${elc_dir} && ${FLAVOR} ${byte_compile_options} midge-mode.el
  rm ${elc_dir}midge-mode.el
fi

exit 0
