2015-01-23 22:04:32 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#set -eu
|
|
|
|
|
|
|
|
: '
|
|
|
|
|
|
|
|
todo
|
|
|
|
|
2015-04-24 07:04:00 +00:00
|
|
|
- docs for base setup: sudo apt-get -y install zlib1g-dev make git
|
2015-01-23 22:04:32 +00:00
|
|
|
- shrink icu data
|
|
|
|
'
|
|
|
|
|
2015-01-24 18:05:58 +00:00
|
|
|
function setup_mason() {
|
2015-01-29 17:09:43 +00:00
|
|
|
if [[ ! -d ./.mason ]]; then
|
|
|
|
git clone --depth 1 https://github.com/mapbox/mason.git ./.mason
|
2015-01-24 18:05:58 +00:00
|
|
|
else
|
2015-01-29 17:09:43 +00:00
|
|
|
echo "Updating to latest mason"
|
|
|
|
(cd ./.mason && git pull)
|
2015-01-24 18:05:58 +00:00
|
|
|
fi
|
2015-01-29 17:09:43 +00:00
|
|
|
export MASON_DIR=$(pwd)/.mason
|
|
|
|
export PATH=$(pwd)/.mason:$PATH
|
2015-01-28 23:05:59 +00:00
|
|
|
export CXX=${CXX:-clang++}
|
|
|
|
export CC=${CC:-clang}
|
2015-01-24 18:05:58 +00:00
|
|
|
}
|
|
|
|
|
2015-05-23 17:30:49 +00:00
|
|
|
if [[ $(uname -s) == 'Darwin' ]]; then
|
|
|
|
FIND_PATTERN="\/Users\/travis\/build\/mapbox\/mason"
|
|
|
|
else
|
|
|
|
FIND_PATTERN="\/home\/travis\/build\/mapbox\/mason"
|
|
|
|
fi
|
|
|
|
|
|
|
|
REPLACE="$(pwd)"
|
|
|
|
REPLACE=${REPLACE////\\/}
|
|
|
|
|
2015-02-03 06:08:52 +00:00
|
|
|
function install() {
|
|
|
|
MASON_PLATFORM_ID=$(mason env MASON_PLATFORM_ID)
|
2015-04-29 22:41:09 +00:00
|
|
|
if [[ ! -d ./mason_packages/${MASON_PLATFORM_ID}/${1}/${2} ]]; then
|
2015-01-27 07:38:22 +00:00
|
|
|
mason install $1 $2
|
|
|
|
mason link $1 $2
|
2015-05-23 17:30:49 +00:00
|
|
|
if [[ $3 ]]; then
|
|
|
|
LA_FILE=$(${MASON_DIR:-~/.mason}/mason prefix $1 $2)/lib/$3.la
|
|
|
|
if [[ -f ${LA_FILE} ]]; then
|
|
|
|
perl -i -p -e "s/${FIND_PATTERN}/${REPLACE}/g;" ${LA_FILE}
|
|
|
|
else
|
|
|
|
echo "$LA_FILE not found"
|
|
|
|
fi
|
|
|
|
fi
|
2015-01-27 07:38:22 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-01-24 18:05:58 +00:00
|
|
|
function install_mason_deps() {
|
2015-05-23 17:30:49 +00:00
|
|
|
install gdal 1.11.2 libgdal &
|
2015-05-04 07:37:34 +00:00
|
|
|
install boost 1.57.0 &
|
|
|
|
install boost_libsystem 1.57.0 &
|
|
|
|
install boost_libthread 1.57.0 &
|
|
|
|
install boost_libfilesystem 1.57.0 &
|
|
|
|
install boost_libprogram_options 1.57.0 &
|
|
|
|
install boost_libregex 1.57.0 &
|
|
|
|
install boost_libpython 1.57.0 &
|
2015-05-23 17:30:49 +00:00
|
|
|
install freetype 2.5.5 libfreetype &
|
|
|
|
install harfbuzz 0.9.40 libharfbuzz &
|
|
|
|
install jpeg_turbo 1.4.0 libjpeg &
|
2015-07-06 19:43:22 +00:00
|
|
|
install libpng 1.6.17 libpng &
|
2015-05-23 17:30:49 +00:00
|
|
|
install webp 0.4.2 libwebp &
|
2015-05-04 07:37:34 +00:00
|
|
|
install icu 54.1 &
|
2015-05-23 17:30:49 +00:00
|
|
|
install proj 4.8.0 libproj &
|
|
|
|
install libtiff 4.0.4beta libtiff &
|
2015-05-04 07:37:34 +00:00
|
|
|
install libpq 9.4.0 &
|
2015-05-23 17:30:49 +00:00
|
|
|
install sqlite 3.8.8.1 libsqlite3 &
|
|
|
|
install expat 2.1.0 libexpat &
|
|
|
|
install pixman 0.32.6 libpixman-1 &
|
|
|
|
install cairo 1.12.18 libcairo &
|
2015-05-04 07:37:34 +00:00
|
|
|
wait
|
2015-01-24 18:05:58 +00:00
|
|
|
}
|
|
|
|
|
2015-02-20 20:56:08 +00:00
|
|
|
MASON_LINKED_ABS=$(pwd)/mason_packages/.link
|
|
|
|
MASON_LINKED_REL=./mason_packages/.link
|
2015-04-27 21:14:10 +00:00
|
|
|
export C_INCLUDE_PATH="${MASON_LINKED_ABS}/include"
|
|
|
|
export CPLUS_INCLUDE_PATH="${MASON_LINKED_ABS}/include"
|
|
|
|
export LIBRARY_PATH="${MASON_LINKED_ABS}/lib"
|
2015-02-20 20:56:08 +00:00
|
|
|
|
2015-01-24 18:05:58 +00:00
|
|
|
function make_config() {
|
2015-02-11 07:49:00 +00:00
|
|
|
if [[ $(uname -s) == 'Darwin' ]]; then
|
2015-02-20 20:56:08 +00:00
|
|
|
local PATH_REPLACE="/Users/travis/build/mapbox/mason/mason_packages:./mason_packages"
|
2015-02-11 07:49:00 +00:00
|
|
|
else
|
2015-02-20 20:56:08 +00:00
|
|
|
local PATH_REPLACE="/home/travis/build/mapbox/mason/mason_packages:./mason_packages"
|
2015-02-11 07:49:00 +00:00
|
|
|
fi
|
2015-01-24 18:05:58 +00:00
|
|
|
|
|
|
|
echo "
|
2015-01-24 18:10:07 +00:00
|
|
|
CXX = '$CXX'
|
|
|
|
CC = '$CC'
|
2015-01-24 18:05:58 +00:00
|
|
|
CUSTOM_CXXFLAGS = '-fvisibility=hidden -fvisibility-inlines-hidden -DU_CHARSET_IS_UTF8=1'
|
|
|
|
RUNTIME_LINK = 'static'
|
2015-01-27 22:06:52 +00:00
|
|
|
INPUT_PLUGINS = 'all'
|
2015-01-24 18:18:32 +00:00
|
|
|
PATH = '${MASON_LINKED_REL}/bin'
|
2015-02-03 06:08:52 +00:00
|
|
|
PKG_CONFIG_PATH = '${MASON_LINKED_REL}/lib/pkgconfig'
|
2015-01-24 18:05:58 +00:00
|
|
|
PATH_REMOVE = '/usr:/usr/local'
|
2015-02-11 07:49:00 +00:00
|
|
|
PATH_REPLACE = '${PATH_REPLACE}'
|
2015-01-24 18:18:32 +00:00
|
|
|
BOOST_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
BOOST_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
ICU_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
ICU_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
HB_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
HB_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
PNG_INCLUDES = '${MASON_LINKED_REL}/include/libpng16'
|
|
|
|
PNG_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
JPEG_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
JPEG_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
TIFF_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
TIFF_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
WEBP_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
WEBP_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
PROJ_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
PROJ_LIBS = '${MASON_LINKED_REL}/lib'
|
2015-02-20 21:22:23 +00:00
|
|
|
PG_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
PG_LIBS = '${MASON_LINKED_REL}/lib'
|
2015-01-24 18:18:32 +00:00
|
|
|
FREETYPE_INCLUDES = '${MASON_LINKED_REL}/include/freetype2'
|
|
|
|
FREETYPE_LIBS = '${MASON_LINKED_REL}/lib'
|
2015-01-24 18:05:58 +00:00
|
|
|
SVG_RENDERER = True
|
2015-01-24 18:18:32 +00:00
|
|
|
CAIRO_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
CAIRO_LIBS = '${MASON_LINKED_REL}/lib'
|
|
|
|
SQLITE_INCLUDES = '${MASON_LINKED_REL}/include'
|
|
|
|
SQLITE_LIBS = '${MASON_LINKED_REL}/lib'
|
2015-02-02 18:30:24 +00:00
|
|
|
BENCHMARK = True
|
2015-01-28 23:05:59 +00:00
|
|
|
CPP_TESTS = True
|
|
|
|
PGSQL2SQLITE = True
|
2015-01-24 18:05:58 +00:00
|
|
|
XMLPARSER = 'ptree'
|
|
|
|
SVG2PNG = True
|
|
|
|
SAMPLE_INPUT_PLUGINS = True
|
|
|
|
" > ./config.py
|
|
|
|
}
|
|
|
|
|
2015-04-30 14:42:32 +00:00
|
|
|
# NOTE: the `mapnik-settings.env` is used by test/run (which is run by `make test`)
|
2015-01-24 18:18:32 +00:00
|
|
|
function setup_runtime_settings() {
|
2015-04-26 18:32:20 +00:00
|
|
|
echo "export PROJ_LIB=${MASON_LINKED_ABS}/share/proj" > mapnik-settings.env
|
|
|
|
echo "export ICU_DATA=${MASON_LINKED_ABS}/share/icu/54.1" >> mapnik-settings.env
|
|
|
|
echo "export GDAL_DATA=${MASON_LINKED_ABS}/share/gdal" >> mapnik-settings.env
|
|
|
|
source mapnik-settings.env
|
2015-01-24 18:18:32 +00:00
|
|
|
}
|
|
|
|
|
2015-01-24 18:05:58 +00:00
|
|
|
function main() {
|
|
|
|
setup_mason
|
|
|
|
install_mason_deps
|
|
|
|
make_config
|
2015-01-24 18:18:32 +00:00
|
|
|
setup_runtime_settings
|
2015-01-29 17:09:43 +00:00
|
|
|
echo "Ready, now run:"
|
|
|
|
echo ""
|
|
|
|
echo " ./configure && make"
|
2015-01-24 18:05:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|