# installing the ibmtts module from speech-dispatcher 
# on a 64 bits architecture
#
# run this script
# and the start speech-dispatcher as this:
# /usr/local/bin/speech-dispatcher
# 
# Jan 2010
#

set -evx

BASE=~/SD
mkdir -p $BASE

sudo apt-get install libdotconf-dev libc6-dev-i386 libaudio-dev

dotconf32()
{
# libdotconf: 32 bits
    cd $BASE
    mkdir dotconf
    cd dotconf
    apt-get source dotconf
    cd dotconf-*
#    export CFLAGS="-m32"
    CFLAGS="-m32" ./configure --bindir=/usr/local/bin32 --libdir=/usr/local/lib32
    make
    sudo make install
}

get_sd_sources()
{
    cd $BASE
    git clone git://git.themuso.com/git/speechd.git
    cp -a speechd speechd.i386
}

build_sd_64()
{
# 64 bits
    sudo apt-get build-dep speech-dispatcher
    cd speechd
    ./build.sh
    ./configure
    make
    sudo make install
}

build_sd_32()
{
    cd $BASE/speechd.i386
    ./build.sh
#    export CFLAGS="-m32"
    CFLAGS="-m32" ./configure --with-ibmtts --bindir=/usr/local/bin32 --libdir=/usr/local/lib32
    make
    sudo make install
}

# install sd_ibmtts 32 bits in the speech-dispatcher 64 bits tree
install_ibmtts_32()
{
    cd /usr/local/lib/speech-dispatcher-modules/
    sudo ln -s /usr/local/lib32/speech-dispatcher-modules/sd_ibmtts .
}

dotconf32
get_sd_sources
build_sd_64
build_sd_32
install_ibmtts_32



