#! /bin/sh -e
# /usr/lib/emacsen-common/packages/install/bigloo-ude

# Written by Jim Van Zandt <jrv@vanzandt.mv.com>, borrowing heavily
# from the install scripts for gettext by Santiago Vila
# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>.

FLAVOR=$1
PACKAGE=bigloo-ude

if [ ${FLAVOR} = emacs ]; then exit 0; fi

case ${FLAVOR} in
xemacs*) BRAND=xemacs ;;
emacs21) BRAND=emacs21 ;;
*) exit 0 ;;
esac

echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}

ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}

# Install-info-altdir does not actually exist. 
# Maybe somebody will write it.
if test -x /usr/sbin/install-info-altdir; then
    echo install/${PACKAGE}: install Info links for ${FLAVOR}
    install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz
fi

install -m 755 -d ${ELCDIR}
cd ${ELDIR}
cp -a `ls -1 | grep -Ev 'etc|README'` ${ELCDIR}
cd ${ELCDIR}


#make EMACSBRAND=${BRAND} EMACS=${FLAVOR} COMMONFLAGS="-batch -q -l path.el -f batch-byte-compile"
echo "Saving build log in $PWD/build.log"
make EMACSBRAND=${BRAND} EMACS=${FLAVOR} > build.log 2>&1
rm -f Makefile */*.el

exit 0
