update tools/extras/install_cffi.sh and small fixes

git-svn-id: https://svn.code.sf.net/p/kaldi/code/sandbox/sharedlibs@2627 5e6a8d80-dfce-4ca6-a32a-6e07a63d50c8
This commit is contained in:
Ondrej Platek 2013-07-02 09:32:18 +00:00
Родитель 439e3c9275
Коммит a58d1d766f
2 изменённых файлов: 46 добавлений и 10 удалений

Просмотреть файл

@ -13,7 +13,7 @@ SUBDIRS_LIB = $(filter-out %bin, $(SUBDIRS))
# Optional subdirectories
EXT_SUBDIRS = online onlinebin #python-kaldi-decoding
EXT_SUBDIRS = online onlinebin # python-kaldi-decoding
EXT_SUBDIRS_LIB = $(filter-out %bin, $(EXT_SUBDIRS))
include kaldi.mk
@ -39,7 +39,7 @@ endif
biglibext: $(EXT_SUBDIRS_LIB)
ifneq ($(KALDI_FLAVOR), dynamic)
$(warning the following command will probably fail, in that case add -fPIC to your CXXFLAGS and remake all)
$(warning The following command will probably fail, in that case add -fPIC to your CXXFLAGS and remake all.)
endif
-gcc -shared -o $(KALDILIBDIR)/libkaldi_ext.so -Wl,-soname=libkaldi_ext.so,--whole-archive $(EXT_SUBDIRS_LIB:=/kaldi-*.a) -Wl,--no-whole-archive
@ -66,6 +66,8 @@ clean: rmlibdir
# the part after the expands to "base/test matrix/test util/test ...."
test: $(addsuffix /test, $(SUBDIRS))
ext_test: $(addsuffix /test, $(EXT_SUBDIRS))
# Define an implicit rule, expands to e.g.:
# base/test: base
# $(MAKE) -C base test
@ -119,6 +121,6 @@ nnet: base util matrix cudamatrix
nnet-cpu: base util matrix thread
#3)Dependencies for optional parts of Kaldi
onlinebin: base matrix util feat tree optimization gmm tied transform sgmm sgmm2 fstext hmm lm decoder lat cudamatrix nnet nnet-cpu online
#python-kaldi-decoding: base matrix util feat tree optimization thread gmm tied transform sgmm sgmm2 fstext hmm decoder lat online
# python-kaldi-decoding: base matrix util feat tree optimization thread gmm tied transform sgmm sgmm2 fstext hmm decoder lat online
online: decoder
kwsbin: fstext lat base util

Просмотреть файл

@ -41,12 +41,45 @@ if [ ! -e $(python -c 'from distutils.sysconfig import get_makefile_filename as
exit 1
fi
echo "Check that you have python-libffi-dev YOURSELF!"
echo "I do not know how to check it effectively!"
echo "Example commands how to intall ffi library"
echo "Debian/Ubuntu: sudo apt-get install libffi-dev"
echo "Fedora: sudo yum libffi-devel"
echo "Mac OS: brew install libffi"
echo "Checking for libffi-dev"
exe_ffi=test_ffi
src_ffi=$exe_ffi.c
cat > $src_ffi <<CCODE
#include <stdio.h>
#include <ffi.h>
int main() {
ffi_cif cif; ffi_type *args[1]; void *values[1]; char *s; int rc;
/* Initialize the argument info vectors */
args[0] = &ffi_type_pointer;
values[0] = &s;
/* Initialize the cif */
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) {
s = "Hello World!- YOU HAVE ffi INSTALLED";
ffi_call(&cif, puts, &rc, values);
/* rc now holds the result of the call to puts */
/* values holds a pointer to the function's arg, so to
call puts() again all we need to do is change the
value of s */
s = "FFI works!";
ffi_call(&cif, puts, &rc, values);
}
return 0;
}
CCODE
rm -f $exe_ffi # clean previous attempts
gcc -o $exe_ffi $src_ffi -lffi # build
chmod u+x $exe_ffi # make it executable (gcc usually does it too)
# checking the exit status = ffi installed?
./$exe_ffi
if [ $? -ne 0 ] ; then
echo "You have not ffi installed!"
echo "On Debian/Ubuntu: sudo apt-get install libffi-dev"
echo "Fedora: sudo yum libffi-devel"
echo "Mac OS: brew install libffi"
exit 1
fi
# names of the extracted directories
cffiname=cffi-0.6
@ -96,7 +129,8 @@ tar -xovzf $pytesttar || exit 1
# Installing
prefix="$PWD/python"
new_ppath="$prefix/lib/python2.7/site-packages"
python_version=`python -c 'import sys; p1, p2, _, _ , _= sys.version_info; print "python%d.%d" % (p1, p2)'`
new_ppath="$prefix/lib/$python_version/site-packages"
mkdir -p "$new_ppath"
export PYTHONPATH="$PYTHONPATH:$new_ppath"
echo; echo "Adding the $new_ppath to PYTHONPATH"