#!/bin/sh
# /usr/lib/emacsen-common/packages/install/mozart

set -e

FLAVOR=$1
echo install/mozart: handling install of emacsen flavor ${FLAVOR}

el_dir=/usr/share/emacs/site-lisp/mozart
el_files="mozart.el oz-extra.el oz-server.el oz.el Fontifier.el"
elc_dir=/usr/share/${FLAVOR}/site-lisp/mozart

byte_compile_options="-batch -f batch-byte-compile"

if [ ${FLAVOR} != emacs ]; then
    echo install/mozart: byte-compiling for ${FLAVOR}
    test -d ${elc_dir} || mkdir ${elc_dir}
    (cd ${el_dir} && cp ${el_files} ${elc_dir})
    (cd ${elc_dir} && ${FLAVOR} ${byte_compile_options} ${el_files} 2>/dev/null)
    for f in ${el_files}; do rm ${elc_dir}/$f; done
fi

exit 0
