From 34b685db40c32d52a4830a5f5844da84783386ab Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 23 Jan 2015 14:04:32 -0800 Subject: [PATCH] travis: try bootstraping deps with mason --- .travis.yml | 27 ++-------- bootstrap.sh | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 22 deletions(-) create mode 100755 bootstrap.sh diff --git a/.travis.yml b/.travis.yml index e0a579db1..d793c5488 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,6 @@ compiler: - clang - gcc -env: - matrix: - - DEBUG=False PLUGIN_LINKING=static ENABLE_LOG=True DEFAULT_LOG_SEVERITY=debug XMLPARSER="libxml2" DEMO=False BENCHMARK=False CUSTOM_CXXFLAGS="" CUSTOM_LDFLAGS="" - - DEBUG=False ENABLE_LOG=False DEFAULT_LOG_SEVERITY=none XMLPARSER="ptree" DEMO=False BENCHMARK=True CUSTOM_CXXFLAGS="" CUSTOM_LDFLAGS="" - # travis + ubuntugis with gdal and postggis leads to many potential dead-end conflicts # the below is thanks to https://github.com/CartoDB/Windshaft/blob/d82fe08b32fc7907bbe907ab290f8a082215ae26/.travis.yml#L1 before_install: @@ -16,38 +11,26 @@ before_install: - sudo mv /etc/apt/sources.list.d/pgdg-source.list* /tmp - sudo apt-get -qq purge postgis* postgresql* - sudo apt-add-repository -y ppa:cartodb/postgresql-9.3 - - sudo apt-add-repository -y ppa:cartodb/gis - # grab harfbuzz from ppa - - sudo apt-add-repository -y ppa:fontforge/fontforge - # we need at least g++-4.7 for c++11 features - - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test # enable to test against latest boost rather that v1.48 #- sudo add-apt-repository -y ppa:boost-latest/ppa - sudo rm -Rf /var/lib/postgresql /etc/postgresql - sudo apt-get update -qq - - sudo apt-get install -q libharfbuzz-dev postgresql-9.3-postgis-2.1 postgresql-contrib-9.3 gdal-bin libgdal-dev + - sudo apt-get install -q postgresql-9.3-postgis-2.1 postgresql-contrib-9.3 - echo -e "local\tall\tall\ttrust\nhost\tall\tall\t127.0.0.1/32\ttrust\nhost\tall\tall\t::1/128\ttrust" |sudo tee /etc/postgresql/9.3/main/pg_hba.conf - sudo service postgresql restart install: # enable to test against boost ppa - #- sudo apt-get install -y boost1.55 - - sudo apt-get install -y libboost-python1.48-dev libboost-thread1.48-dev libboost-filesystem1.48-dev libboost-regex1.48-dev libboost-program-options1.48-dev - - sudo apt-get install -y ttf-wqy-microhei make libstdc++6 libstdc++-4.8-dev valgrind python-nose libicu-dev libproj-dev libcairo-dev python-cairo-dev libcairo-dev python-cairo-dev libpng-dev libjpeg-dev libtiff-dev libwebp-dev libz-dev libfreetype6-dev libxml2-dev libsqlite3-dev + - sudo apt-get install -y ttf-wqy-microhei make valgrind python-nose before_script: - psql -U postgres -c 'create database template_postgis' - psql -U postgres -c 'create extension postgis' -d template_postgis - - if [[ "${CXX}" == 'g++' ]]; then export JOBS=2; sudo apt-get install gcc-4.8 g++-4.8; export CXX="$(which g++-4.8)"; export CC="$(which gcc-4.8)"; fi; - - if [[ "${CXX}" == 'clang++' ]]; then export JOBS=4; export CXX="$(which clang++)"; export CC="$(which clang)"; fi; script: - - rm -rf ./git - - ./configure CXX="${CXX}" CC="${CC}" CUSTOM_CXXFLAGS="${CUSTOM_CXXFLAGS}" CUSTOM_LDFLAGS="${CUSTOM_LDFLAGS}" XML_PARSER="${XML_PARSER}" ENABLE_LOG="${ENABLE_LOG}" DEBUG="${DEBUG}" DEMO="${DEMO}" BENCHMARK="${BENCHMARK}" CPP_TESTS=True CAIRO=True FAST=True || cat config.log - - if [[ "${DEBUG}" == True ]]; then export JOBS=$((JOBS/2)); fi; - - make + - source bootstrap.sh + - JOBS=2 make - git clone --depth=1 https://github.com/mapbox/mapnik-test-data tests/data/mapnik-test-data - make test - source localize.sh && make grind - - if [[ ${BENCHMARK} != False ]]; then make bench; fi; - - if [[ ${BENCHMARK} != False ]]; then for i in $(ls tests/visual_tests/styles/*xml); do echo $i;./benchmark/out/test_rendering --name "text rendering" --map $i --width 1024 --height 1024 --iterations 2 --threads 5;done;fi + - make bench diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 000000000..f970f6daf --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,145 @@ +#!/usr/bin/env bash + +#set -eu + +# NOTE: requires at least bash >= 4.0 +# brew install bash + +: ' + +todo + +- switch to clang +- gdal shared lib +- boost_python_patch +- shrink icu data +- cairo +' + +TOOLCHAIN="$(pwd)/toolchain" +PPA="https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+files" + +function setup_linux_cpp11_toolchain() { + if [[ ! -d ${TOOLCHAIN} ]]; then + wget ${PPA}/libstdc%2B%2B6_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x libstdc++6_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/gcc-4.8_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x gcc-4.8_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/g%2B%2B-4.8_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x g++-4.8_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/libisl10_0.12.2-2~12.04_amd64.deb + dpkg -x libisl10_0.12.2-2~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/libcloog-isl4_0.18.2-1~12.04_amd64.deb + dpkg -x libcloog-isl4_0.18.2-1~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/libstdc%2B%2B-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x libstdc++-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + ${PPA}/gcc-4.8-base_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x gcc-4.8-base_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/libgcc-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x libgcc-4.8-dev_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/libgcc1_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x libgcc1_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + wget ${PPA}/cpp-4.8_4.8.1-2ubuntu1~12.04_amd64.deb + dpkg -x cpp-4.8_4.8.1-2ubuntu1~12.04_amd64.deb ${TOOLCHAIN} + fi + export CPLUS_INCLUDE_PATH="${TOOLCHAIN}/usr/include/c++/4.8:${TOOLCHAIN}/usr/include/x86_64-linux-gnu/c++/4.8:${CPLUS_INCLUDE_PATH}" + export LD_LIBRARY_PATH="${TOOLCHAIN}/usr/lib/x86_64-linux-gnu" +} + +declare -A DEPS +DEPS["freetype"]="2.5.4" +DEPS["harfbuzz"]="2cd5323" +DEPS["jpeg"]="v8d" +DEPS["libxml2"]="2.9.2" +DEPS["libpng"]="1.6.13" +DEPS["webp"]="0.4.2" +DEPS["icu"]="54.1" +DEPS["proj"]="4.8.0" +DEPS["libtiff"]="dev" +DEPS["boost"]="1.57.0" +DEPS["boost_libsystem"]="1.57.0" +DEPS["boost_libthread"]="1.57.0" +DEPS["boost_libfilesystem"]="1.57.0" +DEPS["boost_libprogram_options"]="1.57.0" +DEPS["boost_libregex"]="1.57.0" +DEPS["boost_libpython"]="1.57.0" +DEPS["gdal"]="1.11.1" +DEPS["libpq"]="9.4.0" + +if [[ -d ~/.mason ]]; then + export PATH=~/.mason:$PATH +else + if [[ ! -d mason ]]; then + git clone --depth 1 https://github.com/mapbox/mason.git + fi + export MASON_DIR=$(PWD) + export PATH=$(pwd)/mason:$PATH +fi + +for DEP in "${!DEPS[@]}"; do + mason install ${DEP} ${DEPS[$DEP]} +done + +for DEP in "${!DEPS[@]}"; do + mason link ${DEP} ${DEPS[$DEP]} +done + +MASON_LINKED=$(pwd)/mason_packages/.link + +export PROJ_LIB=${MASON_LINKED}/share/proj/ +export ICU_DATA=${MASON_LINKED}/share/icu/54.1/ +export GDAL_DATA=${MASON_LINKED}/share/gdal +export PKG_CONFIG_PATH="${MASON_LINKED}/lib/pkgconfig" +export C_INCLUDE_PATH="${MASON_LINKED}/include" +export CPLUS_INCLUDE_PATH="${MASON_LINKED}/include" +export LIBRARY_PATH="${MASON_LINKED}/lib" + +if [[ $(uname -s) == 'Linux' ]]; then + setup_linux_cpp11_toolchain + #sudo apt-get -y install zlib1g-dev python-dev make git python-dev python-nose +fi + +CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden -DU_CHARSET_IS_UTF8=1" +MASON_LIBS="${MASON_LINKED}/lib" +MASON_INCLUDES="${MASON_LINKED}/include" + +./configure \ + CC=${TOOLCHAIN}/usr/bin/g++-4.8 \ + CXX=${TOOLCHAIN}/usr/bin/g++-4.8 \ + INPUT_PLUGINS=all \ + SAMPLE_INPUT_PLUGINS=True \ + SVG2PNG=True \ + BENCHMARK=True \ + SVG_RENDERER=True \ + PATH_REMOVE=/usr:/usr/local \ + RUNTIME_LINK=static \ + CUSTOM_LDFLAGS="-L${MASON_LIBS}" \ + CUSTOM_CXXFLAGS="${CXXFLAGS}" \ + BOOST_INCLUDES="${MASON_INCLUDES}" \ + BOOST_LIBS="${MASON_LIBS}" \ + ICU_INCLUDES="${MASON_INCLUDES}" \ + ICU_LIBS="${MASON_LIBS}" \ + FREETYPE_INCLUDES="${MASON_INCLUDES}/freetype2" \ + FREETYPE_LIBS="${MASON_LIBS}" \ + XML2_INCLUDES="${MASON_INCLUDES}/libxml2" \ + XML2_LIBS="${MASON_LIBS}" \ + PNG_INCLUDES="${MASON_INCLUDES}/libpng16" \ + PNG_LIBS="${MASON_LIBS}" \ + JPEG_INCLUDES="${MASON_INCLUDES}" \ + JPEG_LIBS="${MASON_LIBS}" \ + WEBP_INCLUDES="${MASON_INCLUDES}" \ + WEBP_LIBS="${MASON_LIBS}" \ + TIFF_INCLUDES="${MASON_INCLUDES}" \ + TIFF_LIBS="${MASON_LIBS}" \ + PROJ_INCLUDES="${MASON_INCLUDES}" \ + PROJ_LIBS="${MASON_LIBS}" \ + CAIRO_INCLUDES="${MASON_INCLUDES}" \ + CAIRO_LIBS="${MASON_LIBS}" \ + SQLITE_INCLUDES="${MASON_INCLUDES}" \ + SQLITE_LIBS="${MASON_LIBS}" \ + HB_INCLUDES="${MASON_INCLUDES}" \ + HB_LIBS="${MASON_LIBS}" \ + SQLITE_INCLUDES="${MASON_INCLUDES}" \ + SQLITE_LIBS="${MASON_LIBS}" \ + SQLITE_INCLUDES="${MASON_INCLUDES}" \ + SQLITE_LIBS="${MASON_LIBS}" \