--- misc/osrm-scripts/start-osrm.sh 2016/12/14 13:26:40 3166 +++ misc/osrm-scripts/start-osrm.sh 2016/12/19 08:16:36 3173 @@ -1,21 +1,54 @@ #!/bin/bash +# Note +# 3 GB memory (ram+swap) MUST be available when compiling +# This amount is plenty for working with denmark - but more may be required on larger areas +# +# DATADIR should have 6 GB free space for denmark + +################################### +# Exit bash if a command fails +set -e +# also exit if a part of a pipe fails +set -o pipefail + + + +######################### + + +TAG="v5.5.1" DATADIR=/mnt/qnap/openstreetmap +if [ ! -d "$DATADIR" ] ; then + echo DATADIR not found + exit +fi + if [ ! -f /usr/local/bin/osrm-extract ] ; then - apt-get install build-essential git cmake pkg-config libprotoc-dev protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl-doc libstxxl1 + apt-get install build-essential git cmake pkg-config libprotoc-dev protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl-doc libstxxl1 apt-get install libxml2-dev libzip-dev libboost-all-dev lua5.1 liblua5.1-0-dev libluabind-dev libtbb-dev cd /root + + if [ ! -d osrm-backend ] ; then + git clone https://github.com/Project-OSRM/osrm-backend.git + cd osrm-backend + git checkout tags/$TAG + else + cd osrm-backend + fi + + if [ ! -d build ] ; then + mkdir -p build + fi - git clone https://github.com/Project-OSRM/osrm-backend.git - cd osrm-backend - mkdir -p build cd build - cmake .. + #If building on Debian8/jessie LTO is apparently broken + cmake -DENABLE_LTO=OFF .. make -j 2 make install fi @@ -38,8 +71,8 @@ osrm-extract $DATADIR/denmark-latest.osm fi -if [ ! -f $DATADIR/denmark-latest.osrm.edges ] ; then - osrm-prepare $DATADIR/denmark-latest.osrm +if [ ! -f $DATADIR/denmark-latest.osrm.hsgr ] ; then + osrm-contract $DATADIR/denmark-latest.osrm fi cd $DATADIR