Last active
June 1, 2016 21:53
-
-
Save springmeyer/e0b4a8b05553e03257b5 to your computer and use it in GitHub Desktop.
setting up mapnik vector tile stack for development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
: ' | |
Usage: | |
source vtile-stack-setup.sh | |
setup_all | |
Works on either Ubuntu Linux or OS X | |
Make sure to run `sudo apt-get update` or `brew update` before continuing. | |
Will run for ~30-50 minutes depending on your hardware. | |
Depends: | |
- git | |
- python | |
- xcode (on osx) | |
- homebrew (on osx) | |
- apt-get install python-nose (on ubuntu) | |
- pip install nose (on osx) | |
' | |
# where we will build the mapnik sdk | |
MAPNIK_PACKAGING=~/projects/mapnik/mapnik-packaging | |
MAPNIK_PACKAGING_ROOT=$(dirname $MAPNIK_PACKAGING) | |
# what branches to target | |
MAPNIK_BRANCH=master | |
NODE_MAPNIK_BRANCH=master | |
MAPNIK_VECTOR_TILE_BRANCH=master | |
#default to clang compiler and c++11 | |
export CXX11=true | |
export CXX=clang++ | |
function setup_nvm() { | |
# install latest stable node.js version | |
# fine to install via other methods if you prefer | |
if [[ ! -d ~/.nvm ]]; then | |
git clone https://github.com/creationix/nvm.git ~/.nvm | |
source ~/.nvm/nvm.sh | |
nvm install 0.10 | |
fi | |
source ~/.nvm/nvm.sh | |
nvm use 0.10 | |
} | |
export -f setup_nvm | |
function setup_mapnik_sdk() { | |
mkdir -p ${MAPNIK_PACKAGING_ROOT} | |
cd ${MAPNIK_PACKAGING_ROOT} | |
# install mapnik and deps from source | |
# only need to do this once - will take ~20 min | |
if [[ ! -d ./mapnik-packaging ]]; then | |
git clone https://github.com/mapnik/mapnik-packaging.git | |
fi | |
cd mapnik-packaging | |
source build.sh | |
} | |
export -f setup_mapnik_sdk | |
function build_mapnik() { | |
source ${MAPNIK_PACKAGING}/mapnikenv.sh | |
if [ ! -d ${MAPNIK_SOURCE} ]; then | |
git clone https://github.com/mapnik/mapnik.git ${MAPNIK_SOURCE} -b ${MAPNIK_BRANCH} | |
fi | |
cd ${MAPNIK_SOURCE} | |
git checkout ${MAPNIK_BRANCH} | |
git pull | |
git branch -v | |
cd ../ | |
./scripts/build_mapnik.sh | |
./scripts/post_build_fix.sh | |
./scripts/test_mapnik.sh | |
./scripts/package_mobile_sdk.sh | |
} | |
export -f build_mapnik | |
function rebuild_mapnik() { | |
source ${MAPNIK_PACKAGING}/mapnikenv.sh | |
cd ${MAPNIK_SOURCE} | |
git pull | |
make install | |
../scripts/post_build_fix.sh | |
../scripts/test_mapnik.sh | |
} | |
export -f rebuild_mapnik | |
function build_node_mapnik() { | |
cd ${MAPNIK_PACKAGING_ROOT} | |
if [[ ! -d ./mapnik-vector-tile ]]; then | |
git clone https://github.com/mapnik/node-mapnik.git -b ${NODE_MAPNIK_BRANCH} | |
fi | |
cd node-mapnik | |
git checkout ${NODE_MAPNIK_BRANCH} | |
git pull | |
git branch -v | |
source ${MAPNIK_PACKAGING}/mapnikenv.sh | |
make | |
make test | |
} | |
export -f build_node_mapnik | |
function build_mapnik_vector_tile() { | |
cd ${MAPNIK_PACKAGING_ROOT} | |
if [[ ! -d mapnik-vector-tile ]]; then | |
git clone https://github.com/mapbox/mapnik-vector-tile.git | |
fi | |
cd mapnik-vector-tile | |
git checkout ${MAPNIK_VECTOR_TILE_BRANCH} | |
git pull | |
source ${MAPNIK_PACKAGING}/mapnikenv.sh | |
make test | |
} | |
export -f build_mapnik_vector_tile | |
function setup_all() { | |
setup_nvm | |
setup_mapnik_sdk | |
build_mapnik | |
build_node_mapnik | |
build_mapnik_vector_tile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment