install_irstlm.sh
1.86 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/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 [ ! -d ./extras ]; then
errcho "****** You are trying to install IRSTLM from the wrong directory. You should"
errcho "****** go to tools/ and type extras/install_irstlm.sh."
exit 1
fi
if [ ! -d ./irstlm ] ; then
svn=`which git`
if [ $? != 0 ] ; then
errcho "****() You need to have git installed"
exit 1
fi
(
git clone https://github.com/irstlm-team/irstlm.git 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."
exit 0
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;
patch -p1 < ../extras/irstlm.patch
./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."
exit 1
}
(
[ ! -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 -P`
echo "export IRSTLM=$wd/irstlm"
echo "export PATH=\${PATH}:\${IRSTLM}/bin"
) >> env.sh
errcho "***() Installation of IRSTLM finished successfully"
errcho "***() Please source the tools/extras/env.sh in your path.sh to enable it"