Commit 63259f5f authored by Dan Povey's avatar Dan Povey
Browse files

Modifying scripts in tools /directory

git-svn-id: https://svn.code.sf.net/p/kaldi/code/trunk@2427 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
parent fce08c4f
......@@ -25,12 +25,15 @@ distclean:
rm -rf openfst-1.3.2.tar.gz
rm -f openfst
openfst_tgt: openfst_compiled
openfst_tgt: openfst_compiled openfst/lib
.PHONY: openfst_compiled
openfst_compiled: openfst-1.3.2/Makefile
cd openfst-1.3.2/; \
$(MAKE) install
cd openfst-1.3.2/ && \
$(MAKE) install
openfst/lib:
-cd openfst && [ -d lib64 -a ! -d lib ] && ln -s lib64 lib
openfst-1.3.2/Makefile: openfst-1.3.2/.patched
cd openfst-1.3.2/; \
......
This directory contains various installation scripts for programs that are required by
certain example scripts in the egs/ directory. Those example scripts will either
call, or instruct you to call, these scripts as necessary.
All these scripts should be run from one level up, i.e. in tools/: for example,
cd ../tools
extras/install_atlas.sh
The older scripts here, such as install_atlas.sh, will have a soft link from one
level up, in tools/, because various things still expect them to be there, but
in future, the installation scripts will only be here.
#!/bin/bash
# You would typically only have to run this if the ATLAS libraries are not
# already installed on your system... i.e. only after you have tried to
# do ./configure in ../src and it has failed.
# This script tries to install ATLAS-- the install script is supposed to be
# pretty system independent, but try to run it on the same machine type as the
# one you intend to use the library on-- it may produce binaries that use
# CPU dependent instructions. If you want to use the Kaldi toolkit on a cluster
# that has different machine types, you will probably have to get your sysadmin
# involved-- either to find the "lowest common denominator" machine type, or
# to install dynamic libraries somewhere... but note that the "configure" script
# isn't currently set up to work with dynamically linked libraries. You'd have
# to mess with ../src/kaldi.mk yourself in order to get this to work (adding
# probably -lclapack -lcblas -latalas -lf77blas, or something like that...
# let us know what worked.)
# note: to get this install process to work you have to make
# sure CPU throttling is disabled. To do this, on some systems
# you can edit
# /etc/sysconfig/cpuspeed
# to set GOVERNOR=performance
# On others you can do
# sudo cpufreq-selector performance
# You may under some circumstances have to specify -b 32 to the configure
# script (e.g. if you are compiling Kaldi in 32-bit on a 64-bit CPU).
if [ ! -f atlas3.10.0.tar.bz2 ]; then
wget -T 10 -t 3 http://sourceforge.net/projects/math-atlas/files/Stable/3.10.0/atlas3.10.0.tar.bz2 || exit 1;
fi
tar -xvjf atlas3.10.0.tar.bz2 || exit 1;
cd ATLAS
mkdir build # you should probably have a name that reflects OS, CPU, etc... but this is fine
cd build
# sometimes the -b 32 option can be helpful to "configure"
# when it's on a 64-bit CPU but a 32-bit OS. It won't hurt
# if it's not a 64-bit CPU.
x=`uname -a | awk '{print $(NF-1)}'`
if [ "$x" == "i686" -o "$x" == "x86" ]; then
opt="-b 32"
fi
../configure $opt --prefix=`pwd`/install || exit 1;
make -j 2 || exit 1;
make check -j 2 || exit 1;
make install || exit 1;
#!/bin/bash
# This was needed for a specific purpose-- some neural net training for the
# BABEL setup that was done by Yajie Miao. We don't expect these tools will
# be used very heavily.
! which pkg-config >/dev/null && \
echo "pkg-config is not installed, this will not work. Ask your sysadmin to install it" && exit 1;
if [ ! -s quicknet.tar.gz ]; then
wget ftp://ftp.icsi.berkeley.edu/pub/real/davidj/quicknet.tar.gz || exit 1
fi
tar -xvzf quicknet.tar.gz
cd quicknet-v3_32/
./configure --prefix=`pwd` || exit 1
make install || exit 1
cd ..
if [ ! -s pfile_utils-v0_51.tar.gz ]; then
wget http://www.icsi.berkeley.edu/ftp/pub/real/davidj/pfile_utils-v0_51.tar.gz || exit 1
fi
tar -xvzf pfile_utils-v0_51.tar.gz || exit 1
cd pfile_utils-v0_51
./configure --prefix=`pwd` --with-quicknet=`pwd`/../quicknet-v3_32/lib || exit 1
make -j 4 || exit 1
make install || exit 1
#!/bin/bash
#Copyright 2012 Cisco Systems; Matthias Paulik
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0
#
#THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
#WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
#MERCHANTABLITY OR NON-INFRINGEMENT.
#See the Apache 2 License for the specific language governing permissions and
#limitations under the License.
#
#This script attempts to install port audio, which is needed for the run-on
#decoding stuff. Portaudio enables the decoder to grab a live audio stream
#from the soundcard. I tested portaudio on Linux (RedHat and Suse Linux) and
#on MacOS 10.7. On Linux, it compiles out of the box. For MacOS 10.7,
#it is necessary to edit the Makefile (this script tries to do that).
#The script will remove all occurances of
#
# -Werror (occurs once in the Makefile)
# -arch i386 (occurs twice in the Makefile)
# -arch ppc (occurs twice in the Makefile)
# -isysroot /Developer/SDKs/MacOSX10.4u.sdk
#
#also, it seems that one has to uncomment the inclusion of AudioToolbox in
#include/pa_mac_core.h
#
#All this should make it compile fine for x86_64 under MacOS 10.7
#(always assuming that you installed XCode, wget and
#the Linux environment stuff on MacOS)
echo "****() Installing portaudio"
if [ ! -e pa_stable_v19_20111121.tgz ]; then
echo "Could not find portaudio tarball pa_stable_v19_20111121.tgz"
echo "Trying to download it via wget!"
if ! which wget >&/dev/null; then
echo "This script requires you to first install wget"
echo "You can also just download pa_stable_v19_20111121.tgz from"
echo "http://www.portaudio.com/download.html)"
exit 1;
fi
wget -T 10 -t 3 http://www.portaudio.com/archives/pa_stable_v19_20111121.tgz
if [ ! -e pa_stable_v19_20111121.tgz ]; then
echo "Download of pa_stable_v19_20111121.tgz - failed!"
echo "Aborting script. Please download and install port audio manually!"
exit 1;
fi
fi
tar -xovzf pa_stable_v19_20111121.tgz || exit 1
read -d '' pa_patch << "EOF"
--- portaudio/Makefile.in 2012-08-05 10:42:05.000000000 +0300
+++ portaudio/Makefile_mod.in 2012-08-05 10:41:54.000000000 +0300
@@ -57,6 +57,7 @@
src/common/pa_process.o \\
src/common/pa_stream.o \\
src/common/pa_trace.o \\
+ src/common/pa_ringbuffer.o \\
src/hostapi/skeleton/pa_hostapi_skeleton.o
LOOPBACK_OBJS = \\
@@ -193,6 +194,8 @@
for include in $(INCLUDES); do \\
$(INSTALL_DATA) -m 644 $(top_srcdir)/include/$$include $(DESTDIR)$(includedir)/$$include; \\
done
+ $(INSTALL_DATA) -m 644 $(top_srcdir)/src/common/pa_ringbuffer.h $(DESTDIR)$(includedir)/$$include;
+ $(INSTALL_DATA) -m 644 $(top_srcdir)/src/common/pa_memorybarrier.h $(DESTDIR)$(includedir)/$$include;
$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 portaudio-2.0.pc $(DESTDIR)$(libdir)/pkgconfig/portaudio-2.0.pc
@echo ""
EOF
MACOS=`uname 2>/dev/null | grep Darwin`
cd portaudio
if [ -z "$MACOS" ]; then
echo "Patching Makefile.in to include ring buffer functionality..."
echo "${pa_patch}" | patch -p0 Makefile.in
fi
./configure --prefix=`pwd`/install
if [ "$MACOS" != "" ]; then
echo "detected MacOS operating system ... trying to fix Makefile"
mv Makefile Makefile.bck
cat Makefile.bck | sed 's/\-isysroot\ \/Developer\/SDKs\/MacOSX10\.4u\.sdk//g' | sed 's/-Werror//g' | sed 's/-arch i386//g' | sed 's/-arch ppc//g' > Makefile
mv include/pa_mac_core.h include/pa_mac_core.h.bck
cat include/pa_mac_core.h.bck | sed 's/\/\/\#include \<AudioToolbox\/AudioToolbox.h\>/#include \<AudioToolbox\/AudioToolbox.h\>/g' > include/pa_mac_core.h
fi
make
make install
if [ "$MACOS" != "" ]; then
cp src/common/pa_ringbuffer.h install/include/
fi
cd ..
#!/bin/bash
# Make sure we are in the tools/ directory.
if [ `basename $PWD` == extras ]; then
cd ..
fi
! [ `basename $PWD` == tools ] && \
echo "You must call this script from the tools/ directory" && exit 1;
mkdir -p sacc
cd sacc
if [ -s SAcC_GLNXA64.zip ]; then
echo "*SAcC_GLNXA64.zip already exists, not getting it."
else
! wget -t 2 http://labrosa.ee.columbia.edu/projects/SAcC/SAcC_GLNXA64.zip && \
echo "Error wgetting SAcC_GLNXA64.zip" && exit 1;
fi
if [ -d SAcC_GLNXA64 ]; then
echo "*It looks like SAcC_GLNXA64.zip has already been unzipped, not unzipping it."
else
! unzip SAcC_GLNXA64.zip && echo "Error unzipping SAcC_GLNXA64.zip [e.g. unzip not installed?]" \
&& exit 1;
fi
if [ -f MCRInstaller_glnxa64.bin ]; then
echo "*It looks like you already downloaded MCRInstaller_glnxa64.bin, not getting it."
else
! wget -t 2 http://www.ee.columbia.edu/~dpwe/tmp/MCRInstaller_glnxa64.bin && \
echo "Error getting MCRInstaller_glnxa64.bin" && exit 1;
fi
chmod +x ./MCRInstaller_glnxa64.bin
if [ ! -d matlab_runtime ]; then
echo "Running the Matlab runtime installer from the console. Keep entering 1 for next,"
echo "except when it prompts for Destination Directory; then, type: matlab_runtime"
echo "Press enter to run the installer:"
read
./MCRInstaller_glnxa64.bin -console
else
echo "*It looks like the Matlab runtime has already been installed, not installing it."
fi
if [ ! -d matlab_runtime ]; then
echo "*Error: the directory matlab_runtime does not exist, something went wrong in the"
echo "*Matlab runtime installer."
exit 1;
fi
if [ ! -f SAcC_GLNXA64/run_SAcC.sh ]; then
echo "Something went wrong: SAcC_GLNXA64/run_SAcC.sh does not exist."
exit 1;
fi
if ! grep matlab_runtime SAcC_GLNXA64/run_SAcC.sh >/dev/null; then
echo "Replacing the MCRROOT variable in SAcC_GLNXA64/run_SAcC.sh"
cp SAcC_GLNXA64/run_SAcC.sh SAcC_GLNXA64/run_SAcC.sh.bak || exit 1;
! cat SAcC_GLNXA64/run_SAcC.sh.bak | \
awk -v pwd=`pwd` '/^MCRROOT=/{ printf("MCRROOT=%s/matlab_runtime/v714\n", pwd); next; } {print;}' \
> SAcC_GLNXA64/run_SAcC.sh && echo "Error replacing the MCRROOT variable in script, restoring from archive" \
&& unzip -o SAcC_GLNXA64.zip SAcC_GLNXA64/run_SAcC.sh && exit 1;
else
echo "*Not replacing MCRROOT variable in script, it was already done."
fi
echo "Testing SAcC."
cd SAcC_GLNXA64
! ./run_SAcC.sh files.list conf/Babelnet_sr8k_bpo6_sb24_k10.config \
&& echo "**Error testing SAcC-- something went wrong." && exit 1;
echo "Test succeeded."
exit 1;
#!/bin/bash
# http://www.speech.sri.com/projects/srilm/download.html
if [ ! -f srilm.tgz ]; then
echo This script cannot install SRILM in a completely automatic
echo way because you need to put your address in a download form.
echo Please download SRILM from http://www.speech.sri.com/projects/srilm/download.html
echo put it in ./srilm.tgz, then run this script.
fi
! which gawk 2>/dev/null && \
echo "GNU awk is not installed so SRILM will probably not work correctly: refusing to install" && exit 1;
mkdir -p srilm
cd srilm
tar -xvzf ../srilm.tgz
# set the SRILM variable in the top-level Makefile to this directory.
cp Makefile tmpf
cat tmpf | awk -v pwd=`pwd` '/SRILM =/{printf("SRILM = %s\n", pwd); next;} {print;}' \
> Makefile || exit 1;
make
#!/bin/bash
# You would typically only have to run this if the ATLAS libraries are not
# already installed on your system... i.e. only after you have tried to
# do ./configure in ../src and it has failed.
# This script tries to install ATLAS-- the install script is supposed to be
# pretty system independent, but try to run it on the same machine type as the
# one you intend to use the library on-- it may produce binaries that use
# CPU dependent instructions. If you want to use the Kaldi toolkit on a cluster
# that has different machine types, you will probably have to get your sysadmin
# involved-- either to find the "lowest common denominator" machine type, or
# to install dynamic libraries somewhere... but note that the "configure" script
# isn't currently set up to work with dynamically linked libraries. You'd have
# to mess with ../src/kaldi.mk yourself in order to get this to work (adding
# probably -lclapack -lcblas -latalas -lf77blas, or something like that...
# let us know what worked.)
# note: to get this install process to work you have to make
# sure CPU throttling is disabled. To do this, on some systems
# you can edit
# /etc/sysconfig/cpuspeed
# to set GOVERNOR=performance
# On others you can do
# sudo cpufreq-selector performance
# You may under some circumstances have to specify -b 32 to the configure
# script (e.g. if you are compiling Kaldi in 32-bit on a 64-bit CPU).
if [ ! -f atlas3.10.0.tar.bz2 ]; then
wget -T 10 -t 3 http://sourceforge.net/projects/math-atlas/files/Stable/3.10.0/atlas3.10.0.tar.bz2 || exit 1;
fi
tar -xvjf atlas3.10.0.tar.bz2 || exit 1;
cd ATLAS
mkdir build # you should probably have a name that reflects OS, CPU, etc... but this is fine
cd build
# sometimes the -b 32 option can be helpful to "configure"
# when it's on a 64-bit CPU but a 32-bit OS. It won't hurt
# if it's not a 64-bit CPU.
x=`uname -a | awk '{print $(NF-1)}'`
if [ "$x" == "i686" -o "$x" == "x86" ]; then
opt="-b 32"
fi
../configure $opt --prefix=`pwd`/install || exit 1;
make -j 2 || exit 1;
make check -j 2 || exit 1;
make install || exit 1;
extras/install_atlas.sh
\ No newline at end of file
#!/bin/bash
# This was needed for a specific purpose-- some neural net training for the
# BABEL setup that was done by Yajie Miao. We don't expect these tools will
# be used very heavily.
! which pkg-config >/dev/null && \
echo "pkg-config is not installed, this will not work. Ask your sysadmin to install it" && exit 1;
if [ ! -s quicknet.tar.gz ]; then
wget ftp://ftp.icsi.berkeley.edu/pub/real/davidj/quicknet.tar.gz || exit 1
fi
tar -xvzf quicknet.tar.gz
cd quicknet-v3_32/
./configure --prefix=`pwd` || exit 1
make install || exit 1
cd ..
if [ ! -s pfile_utils-v0_51.tar.gz ]; then
wget http://www.icsi.berkeley.edu/ftp/pub/real/davidj/pfile_utils-v0_51.tar.gz || exit 1
fi
tar -xvzf pfile_utils-v0_51.tar.gz || exit 1
cd pfile_utils-v0_51
./configure --prefix=`pwd` --with-quicknet=`pwd`/../quicknet-v3_32/lib || exit 1
make -j 4 || exit 1
make install || exit 1
extras/install_pfile_utils.sh
\ No newline at end of file
#!/bin/bash
#Copyright 2012 Cisco Systems; Matthias Paulik
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#http://www.apache.org/licenses/LICENSE-2.0
#
#THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
#WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
#MERCHANTABLITY OR NON-INFRINGEMENT.
#See the Apache 2 License for the specific language governing permissions and
#limitations under the License.
#
#This script attempts to install port audio, which is needed for the run-on
#decoding stuff. Portaudio enables the decoder to grab a live audio stream
#from the soundcard. I tested portaudio on Linux (RedHat and Suse Linux) and
#on MacOS 10.7. On Linux, it compiles out of the box. For MacOS 10.7,
#it is necessary to edit the Makefile (this script tries to do that).
#The script will remove all occurances of
#
# -Werror (occurs once in the Makefile)
# -arch i386 (occurs twice in the Makefile)
# -arch ppc (occurs twice in the Makefile)
# -isysroot /Developer/SDKs/MacOSX10.4u.sdk
#
#also, it seems that one has to uncomment the inclusion of AudioToolbox in
#include/pa_mac_core.h
#
#All this should make it compile fine for x86_64 under MacOS 10.7
#(always assuming that you installed XCode, wget and
#the Linux environment stuff on MacOS)
echo "****() Installing portaudio"
if [ ! -e pa_stable_v19_20111121.tgz ]; then
echo "Could not find portaudio tarball pa_stable_v19_20111121.tgz"
echo "Trying to download it via wget!"
if ! which wget >&/dev/null; then
echo "This script requires you to first install wget"
echo "You can also just download pa_stable_v19_20111121.tgz from"
echo "http://www.portaudio.com/download.html)"
exit 1;
fi
wget -T 10 -t 3 http://www.portaudio.com/archives/pa_stable_v19_20111121.tgz
if [ ! -e pa_stable_v19_20111121.tgz ]; then
echo "Download of pa_stable_v19_20111121.tgz - failed!"
echo "Aborting script. Please download and install port audio manually!"
exit 1;
fi
fi
tar -xovzf pa_stable_v19_20111121.tgz || exit 1
read -d '' pa_patch << "EOF"
--- portaudio/Makefile.in 2012-08-05 10:42:05.000000000 +0300
+++ portaudio/Makefile_mod.in 2012-08-05 10:41:54.000000000 +0300
@@ -57,6 +57,7 @@
src/common/pa_process.o \\
src/common/pa_stream.o \\
src/common/pa_trace.o \\
+ src/common/pa_ringbuffer.o \\
src/hostapi/skeleton/pa_hostapi_skeleton.o
LOOPBACK_OBJS = \\
@@ -193,6 +194,8 @@
for include in $(INCLUDES); do \\
$(INSTALL_DATA) -m 644 $(top_srcdir)/include/$$include $(DESTDIR)$(includedir)/$$include; \\
done
+ $(INSTALL_DATA) -m 644 $(top_srcdir)/src/common/pa_ringbuffer.h $(DESTDIR)$(includedir)/$$include;
+ $(INSTALL_DATA) -m 644 $(top_srcdir)/src/common/pa_memorybarrier.h $(DESTDIR)$(includedir)/$$include;
$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 portaudio-2.0.pc $(DESTDIR)$(libdir)/pkgconfig/portaudio-2.0.pc
@echo ""
EOF
MACOS=`uname 2>/dev/null | grep Darwin`
cd portaudio
if [ -z "$MACOS" ]; then
echo "Patching Makefile.in to include ring buffer functionality..."
echo "${pa_patch}" | patch -p0 Makefile.in
fi
./configure --prefix=`pwd`/install
if [ "$MACOS" != "" ]; then
echo "detected MacOS operating system ... trying to fix Makefile"
mv Makefile Makefile.bck
cat Makefile.bck | sed 's/\-isysroot\ \/Developer\/SDKs\/MacOSX10\.4u\.sdk//g' | sed 's/-Werror//g' | sed 's/-arch i386//g' | sed 's/-arch ppc//g' > Makefile
mv include/pa_mac_core.h include/pa_mac_core.h.bck
cat include/pa_mac_core.h.bck | sed 's/\/\/\#include \<AudioToolbox\/AudioToolbox.h\>/#include \<AudioToolbox\/AudioToolbox.h\>/g' > include/pa_mac_core.h
fi
make
make install
if [ "$MACOS" != "" ]; then
cp src/common/pa_ringbuffer.h install/include/
fi
cd ..
extras/install_portaudio.sh
\ No newline at end of file
#!/bin/bash
# http://www.speech.sri.com/projects/srilm/download.html
if [ ! -f srilm.tgz ]; then
echo This script cannot install SRILM in a completely automatic
echo way because you need to put your address in a download form.
echo Please download SRILM from http://www.speech.sri.com/projects/srilm/download.html
echo put it in ./srilm.tgz, then run this script.
fi
! which gawk 2>/dev/null && \
echo "GNU awk is not installed so SRILM will probably not work correctly: refusing to install" && exit 1;
mkdir -p srilm
cd srilm
tar -xvzf ../srilm.tgz
# set the SRILM variable in the top-level Makefile to this directory.
cp Makefile tmpf
cat tmpf | awk -v pwd=`pwd` '/SRILM =/{printf("SRILM = %s\n", pwd); next;} {print;}' \
> Makefile || exit 1;
make
extras/install_srilm.sh
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment