#!/bin/sh

EMACSPEAK_VERSION=31.0

# Indicate the emacspeak archive to download
FILE=emacspeak-${EMACSPEAK_VERSION}.tar.bz2
# and its URL
URL=http://emacspeak.googlecode.com/files/$FILE

echo "Installing emacspeak and the outloud server in 7 steps"

echo "1. installing the emacspeak dependencies"
echo "Enter please the root password"
su -c "apt-get build-dep emacspeak > /dev/null; apt-get install libtool build-essential tcl8.4-dev tclx8.4-dev libasound2-dev> /dev/null"

echo "2. downloading emacspeak ${EMACSPEAK_VERSION}"
wget -q $URL
tar -jxf $FILE

echo "3. making config"
cd emacspeak-${EMACSPEAK_VERSION}
make config &> /dev/null
echo "4. compiling emacspeak, be patient please..."
make emacspeak &> /dev/null
PWD1=$PWD

# the bin and share directory will be installed under 'target'
echo "5. installing emacspeak locally"
make prefix=$PWD1/target install &> /dev/null

# compile the espeak driver
echo "6. compiling the outloud server"
cd $PWD1/target/share/emacs/site-lisp/emacspeak/servers/linux-outloud
make all > /dev/null

echo "7. please copy the three following lines to your .bashrc file"
echo "export ECIINI=/var/opt/IBM/ibmtts/cfg/eci.ini"
echo "export EMACSPEAK_DIR=$PWD1/target/share/emacs/site-lisp/emacspeak"
echo "alias emacspeak=\"$PWD1/target/bin/emacspeak\""
echo
echo "then start a new shell and type"
echo "emacspeak"


