You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
1.4 KiB
26 lines
1.4 KiB
4 years ago
|
#!/bin/bash
|
||
|
|
||
4 years ago
|
set -e
|
||
|
set -x
|
||
|
|
||
|
# need support c++17, so need gcc >= 8
|
||
|
# openfst
|
||
|
openfst=openfst-1.8.1
|
||
|
shared=true
|
||
|
|
||
|
test -e ${openfst}.tar.gz || wget http://www.openfst.org/twiki/pub/FST/FstDownload/${openfst}.tar.gz
|
||
|
test -d ${openfst} || tar -xvf ${openfst}.tar.gz && chown -R root:root ${openfst}
|
||
|
|
||
|
|
||
|
if [ $shared == true ];then
|
||
4 years ago
|
pushd ${openfst} && ./configure --enable-shared --enable-compact-fsts --enable-compress --enable-const-fsts --enable-far --enable-linear-fsts --enable-lookahead-fsts --enable-mpdt --enable-ngram-fsts --enable-pdt --enable-python --enable-special --enable-bin --enable-grm --prefix ${PWD}/install && popd
|
||
4 years ago
|
else
|
||
4 years ago
|
pushd ${openfst} && ./configure --enable-static --enable-compact-fsts --enable-compress --enable-const-fsts --enable-far --enable-linear-fsts --enable-lookahead-fsts --enable-mpdt --enable-ngram-fsts --enable-pdt --enable-python --enable-special --enable-bin --enable-grm --prefix ${PWD}/install && popd
|
||
4 years ago
|
fi
|
||
|
pushd ${openfst} && make -j && make install && popd
|
||
|
|
||
4 years ago
|
|
||
|
suffix_path=$(python3 -c 'import sysconfig; import os; from pathlib import Path; site = sysconfig.get_paths()["purelib"]; site=Path(site); pwd = os.getcwd(); suffix = site.parts[-2:]; print(os.path.join(*suffix));')
|
||
|
wfst_so_path=${PWD}/${openfst}/install/lib/${suffix_path}
|
||
4 years ago
|
cp ${wfst_so_path}/pywrapfst.* $(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')
|