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

FLAVOR=$1
echo install/tnt: Handling install of emacsen flavor ${FLAVOR}

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

el_dir=/usr/share/emacs/site-lisp/tnt/
elc_dir=/usr/share/${FLAVOR}/site-lisp/tnt/

el_files="`cd ${el_dir}; echo *.el`"

if [ ${FLAVOR} != emacs ]; then

    echo install/tnt: byte-compiling for ${FLAVOR}
    
    rm -rf ${elc_dir}
    mkdir -p ${elc_dir}
    cp ${el_dir}/*.el ${elc_dir}
    cd ${elc_dir}
    ${FLAVOR} ${byte_compile_options} ${el_files} 2>/dev/null
    rm ${elc_dir}/*.el
fi
exit 0
