-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux_before_all.sh
executable file
·50 lines (42 loc) · 1.6 KB
/
linux_before_all.sh
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
set -e -x
git submodule init
git submodule update
if [ -x "$(command -v dnf)" ]; then
PM=dnf
${PM} install -y gcc-toolset-12-libatomic-devel
elif [ -x "$(command -v yum)" ]; then
PM=yum
else
echo "Neither dnf or yum found. Exiting."
exit 1
fi
${PM} install -y autoconf automake bison flex libicu-devel libtool pkgconfig readline-devel swig zlib-devel
git clone https://github.com/apertium/packaging.git
# build foma
git clone https://github.com/mhulden/foma.git
pushd foma/foma/
cmake -DCMAKE_INSTALL_LIBDIR=lib .
make && make install
# foma installs to the wrong local folder, so fix that
cp -av /usr/local/lib64/* /usr/local/lib/ || true # allow this command to fail
ldconfig
popd
# build openfst
curl https://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.7.9.tar.gz -o openfst-1.7.9.tar.gz
tar -xzf openfst-1.7.9.tar.gz
pushd openfst-1.7.9/
patch -p1 <../packaging/tools/openfst/debian/patches/openfst-cxx17.diff
patch -p1 <../packaging/tools/openfst/debian/patches/openfst-sse.diff
grep c++17 configure.ac # check that patches applied correctly
autoreconf -fvi
./configure --enable-bin --enable-compact-fsts --enable-compress --enable-const-fsts --enable-far --enable-fsts --enable-grm --enable-linear-fsts --enable-lookahead-fsts --enable-mpdt --enable-ngram-fsts --enable-pdt --enable-special --disable-static
make && make install
popd
# build libhfst
pushd libhfst_src/
autoreconf -fvi
./configure --disable-static --with-unicode-handler=icu --with-openfst-upstream --with-foma-upstream
make && make install
popd
# generate SWIG bindings
swig -c++ -cppext cpp -python -Wall src/hfst/libhfst.i