Skip to content

Instantly share code, notes, and snippets.

Last active Jul 16, 2018
What would you like to do?
build valhalla node bindings statically
#!/usr/bin/env bash
: '
Script to build valhalla against mason deps
Intended to be run inside a valhalla checkout of
# put mason on path
mkdir -p ./mason
export MASON_GITSHA="f116d21"
curl -sSfL${MASON_GITSHA}.tar.gz | tar --gunzip --extract --strip-components=1 --exclude="*md" --exclude="test*" --directory=./mason
export PATH=$(pwd)/mason:${PATH}
export CLANG_VERSION="6.0.0"
export CMAKE_VERSION="3.8.2"
export CCACHE_VERSION="3.3.4"
# install boost via mason
function dep {
mason install ${1} ${2}
mason link ${1} ${2}
# Careful: don't update this until you are running latest cmake that
# can understand how to detect latest boost
export BOOST_VERSION="1.63.0"
dep clang++ ${CLANG_VERSION}
dep ccache ${CCACHE_VERSION}
dep boost ${BOOST_VERSION}
dep boost_libprogram_options ${BOOST_VERSION}
dep boost_libdate_time ${BOOST_VERSION}
dep boost_libregex ${BOOST_VERSION}
dep boost_libfilesystem ${BOOST_VERSION}
dep boost_libsystem ${BOOST_VERSION}
dep boost_libiostreams ${BOOST_VERSION}
dep protobuf 3.5.1
dep lz4 1.8.2
# install node-cmake which the build depends on
# without actually trying to build node bindings
npm install --ignore-scripts
export MASON_LINK_PREFIX=$(pwd)/mason_packages/.link
MASON_CLANG=$(mason prefix clang++ ${CLANG_VERSION})
MASON_CCACHE=$(mason prefix ccache ${CCACHE_VERSION})
export CXX="${CUSTOM_CXX:-${MASON_CLANG}/bin/clang++}"
export CC="${CUSTOM_CC:-${MASON_CLANG}/bin/clang}"
echo "using CXX=${CXX}"
echo "using CC=${CC}"
# for protoc
export PATH=$(pwd)/mason_packages/.link/bin:${PATH}
# build valhalla
git submodule sync && git submodule update --init
mkdir -p build
rm -rf build/*
cd build
cmake .. \
VERBOSE=1 make -j4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment