#!/bin/sh -e

FILES="mmm-compat.el mmm-vars.el mmm-utils.el mmm-auto.el mmm-region.el mmm-class.el mmm-cmds.el mmm-mode.el mmm-sample.el mmm-mason.el mmm-univ.el mmm-rpm.el"

FLAVOR="$1"

echo "install/mmm-mode: Handling install of emacsen flavor ${FLAVOR}"

if [ "${FLAVOR}" != "emacs" ]; then
  echo "install/mmm-mode: byte-compiling for ${FLAVOR}"
  cd /usr/share/emacs/site-lisp/mmm-mode
  cp $FILES /usr/share/${FLAVOR}/site-lisp
  cd /usr/share/${FLAVOR}/site-lisp
  echo "(setq load-path (cons nil load-path))" > script
  ${FLAVOR} -q -batch -l script -f batch-byte-compile $FILES
  rm script $FILES
fi

exit 0;
