-
Notifications
You must be signed in to change notification settings - Fork 0
/
mason_latest.sh
executable file
·67 lines (58 loc) · 2.18 KB
/
mason_latest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
MASON_NAME=mapnik
MASON_VERSION=latest
MASON_LIB_FILE=lib/libmapnik-wkt.a
# 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
function mason_load_source {
export MASON_BUILD_PATH=$(pwd)
}
function mason_compile {
HERE=$(pwd)
make install
# this is to adapt to when mapnik is not installed in MASON_PREFIX
# originally (to make it easier to publish locally as a stopgap)
MAPNIK_PREFIX=$(mapnik-config --prefix)
if [[ ${MAPNIK_PREFIX} != ${MASON_PREFIX} ]]; then
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
install_name_tool -id @loader_path/lib/libmapnik.dylib ${MASON_PREFIX}"/lib/libmapnik.dylib";
PLUGINDIR=${MASON_PREFIX}"/lib/mapnik/input/*.input";
for f in $PLUGINDIR; do
echo $f;
echo $(basename $f);
install_name_tool -id plugins/input/$(basename $f) $f;
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
done;
fi;
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 {
:
}
function mason_ldflags {
:
}
function mason_clean {
echo "Done"
}
mason_run "$@"