#! /bin/sh -e
# /usr/lib/emacsen-common/packages/install/haxe-mode
# With thanks to Dirk Eddelbuettel, Michael Olson, Santiago Vila, Jim Van Zandt.
FLAVOR=$1
PACKAGE=haxe-mode
if [ ${FLAVOR} != emacs-snapshot -a ${FLAVOR} != emacs22 ]; then exit 0; fi
echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
FLAGS="${SITEFLAG} --no-init-file --batch --load path.el --funcall batch-byte-compile"
ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
install -m 755 -d ${ELCDIR}
cd ${ELDIR}
FILES=`echo *.el`
cd ${ELCDIR}
ln -sf ${ELDIR}/*.el .
cat << EOF > path.el
(setq load-path (cons "." load-path) byte-compile-warnings nil)
EOF
${FLAVOR} ${FLAGS} ${FILES}
rm -f *.el path.el
exit 0
