Skip to content

Commit

Permalink
Import IRSTLM patching script from Kaldi PR #1713
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianSlzr committed Dec 5, 2017
1 parent de032cb commit a3d42f5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tools/extras/install_irstlm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
# End configuration section
set -e -o pipefail


errcho() { echo "$@" 1>&2; }

errcho "****() Installing IRSTLM"

if [ ! -x ./irstlm ] ; then
svn=`which svn`
svn=`which git`
if [ $? != 0 ] ; then
errcho "****() You need to have svn (subversion) installed"
errcho "****() You need to have git installed"
exit 1
fi
(
svn -r 618 co --non-interactive --trust-server-cert \
https://svn.code.sf.net/p/irstlm/code/trunk irstlm
git clone https://github.com/irstlm-team/irstlm.git irstlm
) || {
errcho "****() Error getting the IRSTLM sources. The server hosting it"
errcho "****() might be down."
Expand All @@ -35,6 +35,7 @@ fi
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`
Expand All @@ -43,23 +44,23 @@ fi
) || {
errcho "***() Error compiling IRSTLM. The error messages could help you "
errcho "***() in figuring what went wrong."
exit 1
}

(
[ ! -z ${IRSTLM} ] && \
[ ! -z "${IRSTLM}" ] && \
echo >&2 "IRSTLM variable is aleady defined. Undefining..." && \
unset IRSTLM

[ -f ./env.sh ] && . ./env.sh
[ ! -z ${IRSTLM} ] && \
[ ! -z "${IRSTLM}" ] && \
echo >&2 "IRSTLM config is already in env.sh" && exit

wd=`pwd`
wd=`readlink -f $wd`
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/env.sh in your path.sh to enable it"
errcho "***() Please source the tools/extras/env.sh in your path.sh to enable it"
47 changes: 47 additions & 0 deletions tools/extras/irstlm.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/configure.ac b/configure.ac
index 2b20543..7b4acb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -160,21 +160,21 @@ else
AC_MSG_NOTICE([optimization disabled (default)])
fi

-if test "x$enable_cxx0" != 'xno'
-then
- AC_MSG_NOTICE([c++x0 dialect is enabled (default), compilation with "-DHAVE_CXX0 -std=c++0x "])
- CPPFLAGS="$CPPFLAGS -DHAVE_CXX0 -std=c++0x";
-else
- AC_MSG_NOTICE([c++x0 dialect is disabled, compilation without "-std=c++0x" and with "-UHAVE_CXX0"])
- CPPFLAGS="$CPPFLAGS -UHAVE_CXX0";
-fi
-
if test "x$with_zlib" != 'xno'
then
CPPFLAGS="$CPPFLAGS -I${with_zlib}/include"
LDFLAGS="$LDFLAGS -L${with_zlib}/lib"
fi

+if test "x$enable_cxx0" != 'xno'
+then
+ AC_MSG_NOTICE([c++x0 dialect is enabled (default), compilation with "-DHAVE_CXX0 -std=c++0x "])
+ CXXFLAGS="$CXXFLAGS -DHAVE_CXX0 -std=c++0x";
+else
+ AC_MSG_NOTICE([c++x0 dialect is disabled, compilation without "-std=c++0x" and with "-UHAVE_CXX0"])
+ CXXFLAGS="$CXXFLAGS -UHAVE_CXX0";
+fi
+
LIBS="$LIBS -lz"

AC_CONFIG_FILES([
diff --git a/src/Makefile.am b/src/Makefile.am
index 6169e64..e08adbc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libirstlm.la

-AM_CXXFLAGS = -static -isystem/usr/include -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES $(BOOST_CPPFLAGS) -DMYCODESIZE=3
+AM_CXXFLAGS = -static -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES $(BOOST_CPPFLAGS) -DMYCODESIZE=3

libirstlm_ladir = ${includedir}

0 comments on commit a3d42f5

Please sign in to comment.