2015-04-28 02:23:47 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
MASON_NAME=mapnik
|
|
|
|
MASON_VERSION=latest
|
|
|
|
MASON_LIB_FILE=lib/libmapnik-wkt.a
|
|
|
|
|
2016-04-11 23:50:09 +00:00
|
|
|
# warning: may break when https://github.com/mapbox/mason/issues/141 lands
|
|
|
|
# hence we are pinned for now to older mason in bootstrap.sh
|
|
|
|
. ./.mason/mason.sh
|
|
|
|
|
|
|
|
set -eu
|
2015-04-28 02:23:47 +00:00
|
|
|
|
|
|
|
function mason_load_source {
|
2015-04-28 17:21:55 +00:00
|
|
|
export MASON_BUILD_PATH=$(pwd)
|
2015-04-28 02:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function mason_compile {
|
|
|
|
HERE=$(pwd)
|
2015-04-28 22:30:18 +00:00
|
|
|
make install
|
2016-03-16 20:49:46 +00:00
|
|
|
# this is to adapt to when mapnik is not installed in MASON_PREFIX
|
|
|
|
# originally (to make it easier to publish locally as a stopgap)
|
2016-03-16 21:44:30 +00:00
|
|
|
MAPNIK_PREFIX=$(mapnik-config --prefix)
|
2016-03-16 22:51:40 +00:00
|
|
|
if [[ ${MAPNIK_PREFIX} != ${MASON_PREFIX} ]]; then
|
2016-03-16 20:49:46 +00:00
|
|
|
mkdir -p ${MASON_PREFIX}/lib
|
|
|
|
mkdir -p ${MASON_PREFIX}/include
|
|
|
|
mkdir -p ${MASON_PREFIX}/bin
|
|
|
|
cp -r ${MAPNIK_PREFIX}/lib/*mapnik* ${MASON_PREFIX}/lib/
|
|
|
|
cp -r ${MAPNIK_PREFIX}/include/mapnik ${MASON_PREFIX}/include/
|
|
|
|
cp -r ${MAPNIK_PREFIX}/bin/mapnik* ${MASON_PREFIX}/bin/
|
|
|
|
cp -r ${MAPNIK_PREFIX}/bin/shapeindex ${MASON_PREFIX}/bin/
|
|
|
|
fi
|
|
|
|
if [[ $(uname -s) == 'Darwin' ]]; then
|
2016-03-16 23:29:48 +00:00
|
|
|
install_name_tool -id @loader_path/lib/libmapnik.dylib ${MASON_PREFIX}"/lib/libmapnik.dylib";
|
2015-05-04 16:35:09 +00:00
|
|
|
PLUGINDIR=${MASON_PREFIX}"/lib/mapnik/input/*.input";
|
|
|
|
for f in $PLUGINDIR; do
|
2015-05-04 14:30:40 +00:00
|
|
|
echo $f;
|
2016-03-16 20:49:46 +00:00
|
|
|
echo $(basename $f);
|
|
|
|
install_name_tool -id plugins/input/$(basename $f) $f;
|
2016-03-16 22:00:54 +00:00
|
|
|
install_name_tool -change "${MAPNIK_PREFIX}/lib/libmapnik.dylib" @loader_path/../../lib/libmapnik.dylib $f;
|
|
|
|
done;
|
|
|
|
BINDIR=${MASON_PREFIX}"/bin/*";
|
|
|
|
for f in $BINDIR; do
|
|
|
|
echo $f;
|
|
|
|
echo $(basename $f);
|
|
|
|
if [[ $(file $f) =~ 'Mach-O' ]]; then
|
|
|
|
install_name_tool -id bin/$(basename $f) $f;
|
|
|
|
install_name_tool -change "${MAPNIK_PREFIX}/lib/libmapnik.dylib" @loader_path/../lib/libmapnik.dylib $f;
|
|
|
|
fi
|
2015-04-30 17:39:23 +00:00
|
|
|
done;
|
2015-04-29 13:51:22 +00:00
|
|
|
fi;
|
2015-04-28 02:23:47 +00:00
|
|
|
python -c "data=open('$MASON_PREFIX/bin/mapnik-config','r').read();open('$MASON_PREFIX/bin/mapnik-config','w').write(data.replace('$HERE','.'))"
|
|
|
|
find ${MASON_PREFIX} -name "*.pyc" -exec rm {} \;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mason_cflags {
|
2016-09-03 16:31:26 +00:00
|
|
|
:
|
2015-04-28 02:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function mason_ldflags {
|
2016-09-03 16:31:26 +00:00
|
|
|
:
|
2015-04-28 02:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function mason_clean {
|
2015-04-28 18:04:34 +00:00
|
|
|
echo "Done"
|
2015-04-28 02:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mason_run "$@"
|