This repository has been archived by the owner on Aug 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·101 lines (96 loc) · 2.42 KB
/
build.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# Variables
BUILD_CLEAN=false
WITH_DOCKER=false
PPA="valhalla-core/valhalla"
NODE="node_10.x"
for arg in "$@"; do
shift
case "$arg" in
--clean) BUILD_CLEAN=true ;;
--with-docker) WITH_DOCKER=true ;;
--help|-h|*) echo "Usage: ./build.sh [OPTIONS]"
echo "Available options:"
echo " --with-docker Build with docker. False if ommited."
echo " --clean Cleanup build artifacts and ignore docker cache. False if ommited."
echo " --help, -h Show this message"
exit ;;
esac
done
if [ $BUILD_CLEAN = true ]; then
if [ -d "build" ]; then
rm -rf build
fi
if [ -d "node_modules" ]; then
rm -rf node_modules
fi
fi
git submodule update --init --recursive
if [ $WITH_DOCKER = true ]; then
if [ $BUILD_CLEAN = true ]; then
docker build --shm-size 512M --no-cache -t tpportugal/tpp_valhalla:latest .
else
docker build --shm-size 512M -t tpportugal/tpp_valhalla:latest .
fi
else
sudo apt-get install -y software-properties-common curl gnupg
if [ ! grep -q "^deb .*$PPA" /etc/apt/sources.list /etc/apt/sources.list.d/* ]; then
sudo add-apt-repository -y ppa:"$PPA"
fi
if [ ! grep -q "^deb .*$NODE" /etc/apt/sources.list /etc/apt/sources.list.d/* ]; then
sudo curl -sL https://deb.nodesource.com/setup_10.x | bash
fi
sudo apt-get update
sudo apt-get upgrade -y --no-install-recommends
sudo apt-get install -y --no-install-recommends \
cmake \
g++ \
gcc \
jq \
lcov \
libboost1.58-all-dev \
libboost-date-time1.58.0 \
libboost-filesystem1.58.0 \
libboost-program-options1.58.0 \
libboost-regex1.58.0 \
libboost-system1.58.0 \
libboost-thread1.58.0 \
libboost-iostreams1.58.0 \
libcurl4-openssl-dev \
libgeos-3.5.0 \
libgeos-dev \
libgeos++-dev \
liblua5.2 \
liblua5.2-dev \
liblz4-dev \
libprime-server0.6.3-dev \
libprotobuf9v5 \
libprotobuf-dev \
libspatialite-dev \
libsqlite3-0 \
libsqlite3-dev \
libsqlite3-mod-spatialite \
libtool \
lua5.2 \
make \
nodejs \
pkg-config \
prime-server0.6.3-bin \
protobuf-compiler \
vim-common \
python-all-dev \
spatialite-bin \
zlib1g-dev \
unzip \
wget
if [ ! -d "build" ]; then
mkdir build
fi
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON_BINDINGS=Off -DENABLE_NODE_BINDINGS=Off
make -j$(nproc)
make -j$(nproc) tests
make -j$(nproc) check
sudo make install
sudo ldconfig
fi