Add script to fall back to source build

This commit is contained in:
Patrick Niklaus 2017-04-07 07:18:16 +00:00 committed by Daniel J. Hofmann
parent 56bcb491d3
commit 7e49b36198
2 changed files with 29 additions and 1 deletions

View File

@ -19,7 +19,7 @@
"test": "npm run lint && node ./node_modules/cucumber/bin/cucumber.js features/ -p verify && node ./node_modules/cucumber/bin/cucumber.js features/ -p mld",
"clean": "rm -rf test/cache",
"docs": "./scripts/build_api_docs.sh",
"install": "node-pre-gyp install --fallback-to-build=false",
"install": "node-pre-gyp install --fallback-to-build=false || ./scripts/node_install.sh",
"nodejs-tests": "make -C test/data && ./lib/binding/osrm-datastore test/data/ch/monaco.osrm && node test/nodejs/index.js | faucet"
},
"repository": {

28
scripts/node_install.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
set -e
CMAKE_OPTIONS=${CMAKE_OPTIONS:-"-DCMAKE_BUILD_TYPE=Release -DENABLE_NODE_BINDINGS=On -DENABLE_MASON=On"}
if [[ ! -f $(which cmake) ]]; then
echo "Needs cmake to build from source"
exit 1
fi
if [[ ! -f $(which clang) ]]; then
echo "Needs clang to build from source"
exit 1
fi
if [[ ! -f $(which clang++) ]]; then
echo "Needs clang++ to build from source"
exit 1
fi
if [[ -d build ]]; then
echo "Detected existing build directory, skipping compiling."
exit 0
else
mkdir -p build
pushd build
CXX=clang++ CC=clang cmake .. $CMAKE_OPTIONS
popd
fi