From ca3c81bf7f1345327eb5c19a3775d8176869366f Mon Sep 17 00:00:00 2001 From: Jan Trmal Date: Tue, 4 Aug 2015 12:24:28 -0400 Subject: [PATCH] Improving the self-configuration capability of some of the extra tools --- .gitignore | 6 ++++++ tools/extras/install_irstlm.sh | 10 ++++++++-- tools/extras/install_mpg123.sh | 24 +++++++++++++++++------- tools/extras/install_sequitur.sh | 26 +++++++++++++++++++++----- tools/extras/install_srilm.sh | 25 +++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 12cf8b0d1f2..54d247780c8 100644 --- a/.gitignore +++ b/.gitignore @@ -58,6 +58,12 @@ /tools/CLAPACK_include /tools/kaldi_lm /tools/env.sh +/tools/g2p-r1668.tar.gz +/tools/mpg123 +/tools/mpg123-1.21.0.tar.bz2 +/tools/mpg123-1.21.0 +/tools/sequitur +/tools/srilm.tgz # /src/ /src/doc/table/ diff --git a/tools/extras/install_irstlm.sh b/tools/extras/install_irstlm.sh index a69e0ba36be..7f87ce5d6aa 100755 --- a/tools/extras/install_irstlm.sh +++ b/tools/extras/install_irstlm.sh @@ -46,8 +46,13 @@ fi } ( - . ./env.sh - [ ! -z ${IRSTLM} ] && exit + [ ! -z ${IRSTLM} ] && \ + echo >&2 "IRSTLM variable is aleady defined. Undefining..." && \ + unset IRSTLM + + [ -f ./env.sh ] && . ./env.sh + [ ! -z ${IRSTLM} ] && \ + echo >&2 "IRSTLM config is already in env.sh" && exit wd=`pwd` wd=`readlink -f $wd` @@ -57,3 +62,4 @@ fi ) >> env.sh errcho "***() Installation of IRSTLM finished successfully" +errcho "***() Please source the tools/env.sh in your path.sh to enable it" diff --git a/tools/extras/install_mpg123.sh b/tools/extras/install_mpg123.sh index a0763d39313..7cd93128825 100755 --- a/tools/extras/install_mpg123.sh +++ b/tools/extras/install_mpg123.sh @@ -34,7 +34,7 @@ if [ ! -e mpg123-1.21.0.tar.bz2 ]; then wget -T 10 -t 3 -c 'http://downloads.sourceforge.net/project/mpg123/mpg123/1.21.0/mpg123-1.21.0.tar.bz2' - if [ ! -e mpg123-1.21.0.tar.bz2]; then + if [ ! -e mpg123-1.21.0.tar.bz2 ]; then errcho "Download of mpg123-1.21.0.tar.bz2 failed!" errcho "You can also just download mpg123-1.21.0.tar.bz2 from" errcho "http://www.mpg123.org/download.shtml)" @@ -54,13 +54,23 @@ ln -s mpg123-1.21.0 mpg123 ) ( -. ./env.sh -[ ! -z ${MPG123} ] && exit + set +u + [ ! -z ${MPG123} ] && \ + echo >&2 "MPG123 variable is aleady defined. Undefining..." && \ + unset MPG123 -wd=`pwd` -wd=`readlink -f $wd` + [ -f ./env.sh ] && . ./env.sh -echo "export MPG123=$wd/mpg123" -echo "export PATH=\${PATH}:\${MPG123}/bin" + [ ! -z ${MPG123} ] && \ + echo >&2 "MPG123 config is already in env.sh" && exit + + wd=`pwd` + wd=`readlink -f $wd` + + echo "export MPG123=$wd/mpg123" + echo "export PATH=\${PATH}:\${MPG123}/bin" ) >> env.sh +echo >&2 "Installation of MPG123 finished successfully" +echo >&2 "Please source the tools/env.sh in your path.sh to enable it" + diff --git a/tools/extras/install_sequitur.sh b/tools/extras/install_sequitur.sh index 635317fcf73..76199122411 100755 --- a/tools/extras/install_sequitur.sh +++ b/tools/extras/install_sequitur.sh @@ -51,9 +51,25 @@ python setup.py install --prefix `pwd` cd ../ ( -set -x -echo "export G2P=`pwd`/sequitur" -echo "export PATH=\$PATH:\${G2P}/bin" -echo "_site_packages=\`readlink -f \${G2P}/lib/python*/site-packages\`" -echo "export PYTHONPATH=\$PYTHONPATH:\$_site_packages" + set +u + [ ! -z ${SEQUITUR} ] && \ + echo >&2 "SEQUITUR variable is aleady defined. Undefining..." && \ + unset SEQUITUR + + [ -f ./env.sh ] && . ./env.sh + + [ ! -z ${SEQUITUR} ] && \ + echo >&2 "SEQUITUR config is already in env.sh" && exit + + wd=`pwd` + wd=`readlink -f $wd` + + echo "export SEQUITUR=$wd/sequitur" + echo "export PATH=\$PATH:\${SEQUITUR}/bin" + echo "_site_packages=\`readlink -f \${SEQUITUR}/lib/python*/site-packages\`" + echo "export PYTHONPATH=\$PYTHONPATH:\$_site_packages" ) >> env.sh + +echo >&2 "Installation of SEQUITUR finished successfully" +echo >&2 "Please source the tools/env.sh in your path.sh to enable it" + diff --git a/tools/extras/install_srilm.sh b/tools/extras/install_srilm.sh index 2462c2c4dcc..969984273a4 100755 --- a/tools/extras/install_srilm.sh +++ b/tools/extras/install_srilm.sh @@ -24,3 +24,28 @@ cat tmpf | awk -v pwd=`pwd` '/SRILM =/{printf("SRILM = %s\n", pwd); next;} {prin make +cd .. +( + [ ! -z ${SRILM} ] && \ + echo >&2 "SRILM variable is aleady defined. Undefining..." && \ + unset SRILM + + [ -f ./env.sh ] && . ./env.sh + + [ ! -z ${SRILM} ] && \ + echo >&2 "SRILM config is already in env.sh" && exit + + wd=`pwd` + wd=`readlink -f $wd` + + echo "export SRILM=$wd/srilm" + dirs="\${PATH}" + for directory in $(cd srilm && find bin -type d ) ; do + dirs="$dirs:\${SRILM}/$directory" + done + echo "export PATH=$dirs" +) >> env.sh + +echo >&2 "Installation of SRILM finished successfully" +echo >&2 "Please source the tools/env.sh in your path.sh to enable it" +