#!/bin/sh
# /usr/lib/emacsen-common/packages/install/w3-el
# [ This particular script hasn't been tested, so be careful. ]
set -e

FLAVOR=$1
echo install/w3-el: Handling install of emacsen flavor ${FLAVOR}

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

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

    echo install/w3-el: byte-compiling for ${FLAVOR}
	    
    mkdir -p ${elc_dir}
    cd ${el_dir}
    ./configure --with-emacs=${FLAVOR} --with-lispdir=${elc_dir}
    make clean
    make w3
    cd lisp; make install
    make distclean

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