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

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

byte_compile_options="-batch -f batch-byte-compile"
el_files="`cd /usr/share/emacs/site-lisp/calc; echo *.el`"
el_dir=/usr/share/emacs/site-lisp/calc/
elc_dir=/usr/share/${FLAVOR}/site-lisp/calc/

if [ ${FLAVOR} != emacs ]; then
    echo install/calc: install Info links for ${FLAVOR}
    if test -x /usr/sbin/install-info-altdir; then
	install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/calc.info.gz
    fi

    echo install/calc: byte-compiling for ${FLAVOR}
	    
    rm -rf ${elc_dir}
    mkdir -p ${elc_dir}
    cp ${el_dir}/* ${elc_dir}
    cd ${elc_dir}
    make EMACS=${FLAVOR} compile

    rm Makefile
    for d in *.el; do
	if test -f ${d}c; then
	    rm $d
	fi
    done
fi
exit 0
