From eb11b1778fc2e4354ccdbfc8c036a39b5584be35 Mon Sep 17 00:00:00 2001 From: Jan Trmal Date: Wed, 22 Jul 2015 15:23:38 -0400 Subject: [PATCH] Making irstlm installation optional --- tools/Makefile | 27 ++++------------ tools/extras/install_irstlm.sh | 59 ++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 21 deletions(-) create mode 100755 tools/extras/install_irstlm.sh diff --git a/tools/Makefile b/tools/Makefile index 802220fe5f5..ab4a1452bd7 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -25,18 +25,20 @@ else endif endif -all: check_required_programs sph2pipe atlas sclite openfst irstlm_tgt +all: check_required_programs sph2pipe atlas sclite openfst + @echo -e "\n\n" + @echo "Warning: IRSTLM is not installed by default anymore. If you need IRSTLM" + @echo "Warning: use the script extras/install_irstlm.sh" + @echo "All done OK." check_required_programs: extras/check_dependencies.sh -clean: openfst_cleaned sclite_cleaned irstlm_cleaned +clean: openfst_cleaned sclite_cleaned openfst_cleaned: $(MAKE) -C openfst-$(OPENFST_VERSION) clean -irstlm_cleaned: - $(MAKE) -C irstlm clean sclite_cleaned: $(MAKE) -C sctk clean @@ -46,7 +48,6 @@ distclean: rm -rf sctk-2.4.9/ rm -rf sctk rm -rf ATLAS/ - rm -rf irstlm/ rm -rf sph2pipe_v2.5/ rm -rf sph2pipe_v2.5.tar.gz rm -rf atlas3.8.3.tar.gz @@ -115,22 +116,6 @@ sctk-2.4.9-20141015-1634Z.tar.bz2: wget -T 10 -t 3 ftp://jaguar.ncsl.nist.gov/pub/sctk-2.4.9-20141015-1634Z.tar.bz2|| \ wget --no-check-certificate -T 10 http://www.openslr.org/resources/4/sctk-2.4.9-20141015-1634Z.tar.bz2 -irstlm_tgt: irstlm_compiled - -.PHONY: irstlm_compiled -irstlm_compiled: irstlm/Makefile - cd irstlm/; \ - make; $(MAKE) install - -irstlm/Makefile: irstlm - cd irstlm; \ - automake --version | grep 1.13.1 >/dev/null && \ - sed s:AM_CONFIG_HEADER:AC_CONFIG_HEADERS: configure.ac; \ - (./regenerate-makefiles.sh || ./regenerate-makefiles.sh) && \ - ./configure --prefix `pwd` - -irstlm: - svn -r 618 co --non-interactive --trust-server-cert https://svn.code.sf.net/p/irstlm/code/trunk irstlm atlas: ATLAS/include/cblas.h diff --git a/tools/extras/install_irstlm.sh b/tools/extras/install_irstlm.sh new file mode 100755 index 00000000000..a69e0ba36be --- /dev/null +++ b/tools/extras/install_irstlm.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# Copyright (c) 2015, Johns Hopkins University (Yenda Trmal ) +# License: Apache 2.0 + +# Begin configuration section. +# End configuration section +set -e -o pipefail + +errcho() { echo "$@" 1>&2; } + +errcho "****() Installing IRSTLM" + +if [ ! -x ./irstlm ] ; then + svn=`which svn` + if [ $? != 0 ] ; then + errcho "****() You need to have svn (subversion) installed" + exit 1 + fi + ( + svn -r 618 co --non-interactive --trust-server-cert \ + https://svn.code.sf.net/p/irstlm/code/trunk irstlm + ) || { + errcho "****() Error getting the IRSTLM sources. The server hosting it" + errcho "****() might be down." + exit 1 + } +else + echo "****() Assuming IRSTLM is already installed. Please delete" + echo "****() the directory ./irstlm if you need us to download" + echo "****() the sources again." +fi + +( + cd irstlm || exit 1 + automake --version | grep 1.13.1 >/dev/null && \ + sed s:AM_CONFIG_HEADER:AC_CONFIG_HEADERS: configure.ac; + + ./regenerate-makefiles.sh || ./regenerate-makefiles.sh + + ./configure --prefix `pwd` + + make; make install +) || { + errcho "***() Error compiling IRSTLM. The error messages could help you " + errcho "***() in figuring what went wrong." +} + +( + . ./env.sh + [ ! -z ${IRSTLM} ] && exit + + wd=`pwd` + wd=`readlink -f $wd` + + echo "export IRSTLM=$wd/irstlm" + echo "export PATH=\${PATH}:\${IRSTLM}/bin" +) >> env.sh + +errcho "***() Installation of IRSTLM finished successfully"