/
cppbuild.sh
executable file
·75 lines (67 loc) · 2.49 KB
/
cppbuild.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# This file is meant to be included by the parent cppbuild.sh script
if [[ -z "$PLATFORM" ]]; then
pushd ..
bash cppbuild.sh "$@" libpostal
popd
exit
fi
LIBPOSTAL_VERSION=1.1
download https://github.com/openvenues/libpostal/archive/refs/tags/v$LIBPOSTAL_VERSION.tar.gz libpostal-$LIBPOSTAL_VERSION.tar.gz
mkdir -p $PLATFORM
cd $PLATFORM
INSTALL_PATH=$(pwd)
echo "Decompressing archives..."
tar --totals -xf ../libpostal-$LIBPOSTAL_VERSION.tar.gz
cd libpostal-$LIBPOSTAL_VERSION
if [[ "${ACLOCAL_PATH:-}" == C:\\msys64\\* ]]; then
export ACLOCAL_PATH=/mingw64/share/aclocal:/usr/share/aclocal
fi
# Work around build issues on Mac and Windows
sedinplace 's/-Werror=format-security/-Wno-implicit-function-declaration/g' src/Makefile.am
sedinplace '/_rand48_/d' src/klib/drand48.h
case $PLATFORM in
linux-arm64)
./bootstrap.sh
./configure --prefix=$INSTALL_PATH --disable-data-download --disable-sse2 --host=aarch64-linux-gnu
#./configure --prefix=$INSTALL_PATH --datadir=[...some dir with a few GB of space...]
make -j $MAKEJ V=0
make install
;;
linux-x86_64)
./bootstrap.sh
./configure --prefix=$INSTALL_PATH --disable-data-download
#./configure --prefix=$INSTALL_PATH --datadir=[...some dir with a few GB of space...]
make -j $MAKEJ V=0
make install
;;
macosx-arm64)
./bootstrap.sh
sedinplace 's/\\\$rpath/@rpath/g' configure
CC="clang -arch arm64 -fPIC" ./configure --prefix=$INSTALL_PATH --disable-data-download --disable-sse2 --host="aarch64-apple-darwin"
#./configure --prefix=$INSTALL_PATH --datadir=[...some dir with a few GB of space...]
make -j $MAKEJ V=0
make install
;;
macosx-x86_64)
./bootstrap.sh
sed -i="" 's/-install_name \\$rpath/-install_name @rpath/g' configure
./configure --prefix=$INSTALL_PATH --disable-data-download
#./configure --prefix=$INSTALL_PATH --datadir=[...some dir with a few GB of space...]
make -j $MAKEJ V=0
make install
;;
windows-x86_64)
cp -rf windows/* ./
CC="gcc -m64 -Duint=int -static-libgcc"
./bootstrap.sh
./configure --prefix=$INSTALL_PATH --disable-data-download
#./configure --prefix=$INSTALL_PATH --datadir=/c/[...some dir with a few GB of space...]
make -j $MAKEJ V=0
make install
;;
*)
echo "Error: Platform \"$PLATFORM\" is not supported"
;;
esac
cd ../..