install_irstlm.sh 1.43 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#!/bin/bash
# Copyright (c) 2015, Johns Hopkins University (Yenda Trmal <jtrmal@gmail.com>)
# 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.in >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"