From 5a87fb337dc034c6d96ff74d20c5c257c0a65b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Mon, 20 Oct 2014 17:55:49 +0200 Subject: [PATCH 01/25] first attempt at using mason to install packages [skip ci] --- Makefile | 1 + configure | 181 ++++++++--------------------- include/mbgl/map/map.hpp | 7 +- include/mbgl/util/uv_detail.hpp | 20 +++- src/map/map.cpp | 16 ++- src/storage/file_request_baton.cpp | 26 ++++- src/storage/http_request.cpp | 9 ++ src/util/uv.cpp | 6 + 8 files changed, 119 insertions(+), 147 deletions(-) diff --git a/Makefile b/Makefile index 584fe2a2e..a29e30cab 100644 --- a/Makefile +++ b/Makefile @@ -109,3 +109,4 @@ distclean: clean -find ./mapnik-packaging/osx/out/packages -type d ! -name 'packages' -maxdepth 1 -exec rm -rf {} \; .PHONY: mbgl test linux build/test/Makefile +# DO NOT DELETE diff --git a/configure b/configure index b92f97758..d8a5e08ed 100755 --- a/configure +++ b/configure @@ -1,144 +1,55 @@ -#!/usr/bin/env python -import optparse -import os -import pprint -import re -import shlex -import subprocess -import sys +#!/usr/bin/env bash -root_dir = os.path.dirname(__file__) +set -e +set -o pipefail -# parse our options -parser = optparse.OptionParser() +. ~/.nvm/nvm.sh +nvm use 0.10 -parser.add_option("--debug", - action="store_true", - dest="debug", - help="Also build debug build") +LIBCURL_VERSION=system +GLFW_VERSION=a21f2377 +LIBPNG_VERSION=1.6.13 +SQLITE_VERSION=system +LIBUV_VERSION=0.10.28 -parser.add_option("--node", - action="store", - dest="node", - help="Name of the node executable (defaults to node)") +mason install libcurl ${LIBCURL_VERSION} +mason install glfw ${GLFW_VERSION} +mason install libpng ${LIBPNG_VERSION} +mason install sqlite ${SQLITE_VERSION} +mason install libuv ${LIBUV_VERSION} -parser.add_option("--npm", - action="store", - dest="npm", - help="Name of the npm executable (defaults to npm)") +BOOST_ROOT=/usr +if [ -d '/usr/local/boost' ]; then BOOST_ROOT='/usr/local' ; fi -parser.add_option("--pkg-config-root", - action="store", - dest="pkgconfig_root", - help="Path to pkg-config directory") - -parser.add_option("--boost", - action="store", - dest="boost_root", - help="Path to boost (defaults to /usr/local)") - -(options, args) = parser.parse_args() - -def pkg_config(pkg, pkgconfig_root): - env = os.environ.copy() - if pkgconfig_root: - env["PKG_CONFIG_PATH"] = pkgconfig_root - env["PKG_CONFIG_ALLOW_SYSTEM_CFLAGS"] = "1" - env["PKG_CONFIG_ALLOW_SYSTEM_LIBS"] = "1" - cmd = subprocess.Popen(['pkg-config', '--static', '--libs', pkg], stdout=subprocess.PIPE, env=env) - libs, ret = cmd.communicate() - if (ret): return None - - cmd = subprocess.Popen(['pkg-config', '--static', '--cflags', pkg], stdout=subprocess.PIPE, env=env) - cflags, ret = cmd.communicate() - if (ret): return None - - return (libs, cflags) - -def configure_mbgl(o): - if options.boost_root: - o['variables']['boost_root'] = options.boost_root - else: - o['variables']['boost_root'] = '/usr/local' - if options.node: - o['variables']['node'] = options.node - else: - o['variables']['node'] = 'node' - if options.npm: - o['variables']['npm'] = options.npm - else: - o['variables']['npm'] = 'npm' - o['target_defaults']['default_configuration'] = 'Debug' if options.debug else 'Release' - - -def fix_frameworks(libs): - # don't split "-framework Foo" - return re.split('(? config.gypi - write('config.gypi', "# Do not edit. Generated by the configure script.\n" + - pprint.pformat(output, indent=2) + "\n") +cat config.gypi diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index a69943aa7..bea82e6b4 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -143,10 +143,15 @@ public: private: // uv async callbacks +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + static void render(uv_async_t *async, int status); + static void terminate(uv_async_t *async, int status); + static void cleanup(uv_async_t *async, int status); +#else static void render(uv_async_t *async); static void terminate(uv_async_t *async); static void cleanup(uv_async_t *async); - static void delete_async(uv_handle_t *handle); +#endif // Setup void setup(); diff --git a/include/mbgl/util/uv_detail.hpp b/include/mbgl/util/uv_detail.hpp index e0a57ce65..f80ca1bff 100644 --- a/include/mbgl/util/uv_detail.hpp +++ b/include/mbgl/util/uv_detail.hpp @@ -24,17 +24,31 @@ private: class loop { public: inline loop() { +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + l = uv_loop_new(); + if (l == nullptr) { +#else + l = new uv_loop_t; if (uv_loop_init(&l) != 0) { +#endif throw std::runtime_error("failed to initialize loop"); } } - inline ~loop() { uv_loop_close(&l); } + inline ~loop() { +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + uv_loop_delete(l); +#else + uv_loop_close(l); + delete l; +#endif - inline uv_loop_t *operator*() { return &l; } + } + + inline uv_loop_t *operator*() { return l; } private: - uv_loop_t l; + uv_loop_t *l = nullptr; }; class mutex { diff --git a/src/map/map.cpp b/src/map/map.cpp index a1543dbda..f255c3ff6 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -145,10 +145,6 @@ void Map::stop(stop_callback cb, void *data) { async = false; } -void Map::delete_async(uv_handle_t *handle) { - delete (uv_async_t *)handle; -} - void Map::run() { #ifndef NDEBUG if (!async) { @@ -203,7 +199,11 @@ void Map::cleanup() { } } +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +void Map::cleanup(uv_async_t *async, int) { +#else void Map::cleanup(uv_async_t *async) { +#endif Map *map = static_cast(async->data); map->view.make_active(); @@ -221,7 +221,11 @@ void Map::setReachability(bool reachable) { } } +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +void Map::render(uv_async_t *async, int) { +#else void Map::render(uv_async_t *async) { +#endif Map *map = static_cast(async->data); assert(uv_thread_self() == map->map_thread); @@ -241,7 +245,11 @@ void Map::render(uv_async_t *async) { } } +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +void Map::terminate(uv_async_t *async, int) { +#else void Map::terminate(uv_async_t *async) { +#endif // Closes all open handles on the loop. This means that the loop will automatically terminate. Map *map = static_cast(async->data); assert(uv_thread_self() == map->map_thread); diff --git a/src/storage/file_request_baton.cpp b/src/storage/file_request_baton.cpp index 127c78f3e..d4c135fd7 100644 --- a/src/storage/file_request_baton.cpp +++ b/src/storage/file_request_baton.cpp @@ -29,7 +29,11 @@ void FileRequestBaton::notify_error(uv_fs_t *req) { if (ptr->request && req->result < 0 && !ptr->canceled && req->result != UV_ECANCELED) { ptr->request->response = std::unique_ptr(new Response); ptr->request->response->code = req->result == UV_ENOENT ? 404 : 500; +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + ptr->request->response->message = uv_strerror(uv_last_error(req->loop)); +#else ptr->request->response->message = uv_strerror(int(req->result)); +#endif ptr->request->notify(); } } @@ -54,7 +58,8 @@ void FileRequestBaton::file_opened(uv_fs_t *req) { uv_fs_close(req->loop, req, fd, file_closed); } else { ptr->fd = fd; - uv_fs_fstat(req->loop, req, fd, file_stated); + const int r = uv_fs_fstat(req->loop, req, fd, file_stated); + assert(r == 0); } } } @@ -63,7 +68,7 @@ void FileRequestBaton::file_stated(uv_fs_t *req) { FileRequestBaton *ptr = (FileRequestBaton *)req->data; assert(ptr->thread_id == uv_thread_self()); - if (req->result < 0 || ptr->canceled || !ptr->request) { + if (req->result != 0 || ptr->canceled || !ptr->request) { // Stating failed or was canceled. We already have an open file handle // though, which we'll have to close. notify_error(req); @@ -71,13 +76,22 @@ void FileRequestBaton::file_stated(uv_fs_t *req) { uv_fs_req_cleanup(req); uv_fs_close(req->loop, req, ptr->fd, file_closed); } else { - if (static_cast(req->ptr)->st_size > std::numeric_limits::max()) { +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + const uv_statbuf_t *stat = static_cast(req->ptr); +#else + const uv_stat_t *stat = static_cast(req->ptr); +#endif + if (stat->st_size > std::numeric_limits::max()) { // File is too large for us to open this way because uv_buf's only support unsigned // ints as maximum size. if (ptr->request) { ptr->request->response = std::unique_ptr(new Response); ptr->request->response->code = UV_EFBIG; +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + ptr->request->response->message = uv_strerror(uv_err_t {UV_EFBIG, 0}); +#else ptr->request->response->message = uv_strerror(UV_EFBIG); +#endif ptr->request->notify(); } @@ -85,11 +99,15 @@ void FileRequestBaton::file_stated(uv_fs_t *req) { uv_fs_close(req->loop, req, ptr->fd, file_closed); } else { const unsigned int size = - (unsigned int)(static_cast(req->ptr)->st_size); + (unsigned int)(stat->st_size); ptr->body.resize(size); ptr->buffer = uv_buf_init(const_cast(ptr->body.data()), size); uv_fs_req_cleanup(req); +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + uv_fs_read(req->loop, req, ptr->fd, ptr->buffer.base, ptr->buffer.len, -1, file_read); +#else uv_fs_read(req->loop, req, ptr->fd, &ptr->buffer, 1, 0, file_read); +#endif } } } diff --git a/src/storage/http_request.cpp b/src/storage/http_request.cpp index 1b799d489..ca1412fd9 100644 --- a/src/storage/http_request.cpp +++ b/src/storage/http_request.cpp @@ -77,7 +77,11 @@ void HTTPRequest::startHTTPRequest(std::unique_ptr &&res) { http_baton->response = std::move(res); http_baton->async->data = new util::ptr(http_baton); +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + uv_async_init(loop, http_baton->async, [](uv_async_t *async, int) { +#else uv_async_init(loop, http_baton->async, [](uv_async_t *async) { +#endif util::ptr &http_baton = *(util::ptr *)async->data; if (http_baton->request) { @@ -193,7 +197,12 @@ void HTTPRequest::retryHTTPRequest(std::unique_ptr &&res, uint64_t tim backoff_timer = new uv_timer_t(); uv_timer_init(loop, backoff_timer); backoff_timer->data = new RetryBaton(this, std::move(res)); + +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + uv_timer_start(backoff_timer, [](uv_timer_t *timer, int) { +#else uv_timer_start(backoff_timer, [](uv_timer_t *timer) { +#endif std::unique_ptr pair { static_cast(timer->data) }; pair->first->startHTTPRequest(std::move(pair->second)); pair->first->backoff_timer = nullptr; diff --git a/src/util/uv.cpp b/src/util/uv.cpp index b97074f05..03a885d30 100644 --- a/src/util/uv.cpp +++ b/src/util/uv.cpp @@ -5,6 +5,11 @@ namespace uv { std::string cwd() { +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + char dir[512]; + uv_cwd(dir, 512); + return dir; +#else size_t max = 0; std::string dir; do { @@ -14,6 +19,7 @@ std::string cwd() { } while (max == dir.size()); dir.resize(max - 1); return dir; +#endif } void deleter::operator()(uv_async_t *async) { From 1da471abba1a64b691b8c90ac13bae81daa1c698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Mon, 20 Oct 2014 18:21:21 +0200 Subject: [PATCH 02/25] curl fixes [skip ci] --- common/http_request_baton_curl.cpp | 23 ++-- linux/mapboxgl-app.gyp | 2 + mapboxgl.gyp | 8 -- setup-libraries-cross.sh | 62 ---------- setup-libraries.sh | 178 ----------------------------- 5 files changed, 18 insertions(+), 255 deletions(-) delete mode 100755 setup-libraries-cross.sh delete mode 100755 setup-libraries.sh diff --git a/common/http_request_baton_curl.cpp b/common/http_request_baton_curl.cpp index 772aeb86e..d4753266c 100644 --- a/common/http_request_baton_curl.cpp +++ b/common/http_request_baton_curl.cpp @@ -52,7 +52,7 @@ // Handles the request thread + messaging to the thread. static uv_once_t once; -static uv_loop_t loop; +static uv_loop_t *loop = nullptr; static uv_messenger_t start_messenger; static uv_messenger_t stop_messenger; static uv_thread_t thread; @@ -228,7 +228,7 @@ int handle_socket(CURL *handle, curl_socket_t sockfd, int action, void *, void * context->sockfd = sockfd; assert(!context->poll_handle); context->poll_handle = new uv_poll_t; - uv_poll_init_socket(&loop, context->poll_handle, sockfd); + uv_poll_init_socket(loop, context->poll_handle, sockfd); context->poll_handle->data = context; curl_multi_assign(multi, sockfd, context); } @@ -253,7 +253,11 @@ int handle_socket(CURL *handle, curl_socket_t sockfd, int action, void *, void * return 0; } +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +void on_timeout(uv_timer_t *, int = 0) { +#else void on_timeout(uv_timer_t *) { +#endif int running_handles; CURLMcode error = curl_multi_socket_action(multi, CURL_SOCKET_TIMEOUT, 0, &running_handles); if (error != CURLM_OK) { @@ -275,7 +279,7 @@ void thread_init(void *) { #endif thread_id = uv_thread_self(); - uv_timer_init(&loop, &timeout); + uv_timer_init(loop, &timeout); CURLSHcode share_error; share = curl_share_init(); @@ -305,7 +309,7 @@ void thread_init(void *) { } // Main event loop. This will not return until the request loop is terminated. - uv_run(&loop, UV_RUN_DEFAULT); + uv_run(loop, UV_RUN_DEFAULT); curl_multi_cleanup(multi); multi = nullptr; @@ -442,9 +446,14 @@ void stop_request(void *const ptr) { void create_thread() { uv_mutex_init(&share_mutex); - uv_loop_init(&loop); - uv_messenger_init(&loop, &start_messenger, start_request); - uv_messenger_init(&loop, &stop_messenger, stop_request); +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 + loop = uv_loop_new(); +#else + loop = new uv_loop_t; + uv_loop_init(loop); +#endif + uv_messenger_init(loop, &start_messenger, start_request); + uv_messenger_init(loop, &stop_messenger, stop_request); uv_thread_create(&thread, thread_init, nullptr); } diff --git a/linux/mapboxgl-app.gyp b/linux/mapboxgl-app.gyp index dac1934d3..05716dd11 100644 --- a/linux/mapboxgl-app.gyp +++ b/linux/mapboxgl-app.gyp @@ -33,6 +33,7 @@ ], 'OTHER_LDFLAGS': [ '<@(glfw3_libraries)', + '<@(curl_libraries)', ], } }, @@ -46,6 +47,7 @@ 'link_settings': { 'libraries': [ '<@(glfw3_libraries)', + '<@(curl_libraries)', '-lboost_regex' ], }, diff --git a/mapboxgl.gyp b/mapboxgl.gyp index 68434bf2b..05569d82c 100644 --- a/mapboxgl.gyp +++ b/mapboxgl.gyp @@ -139,7 +139,6 @@ 'OTHER_CPLUSPLUSFLAGS': [ '<@(png_cflags)', '<@(uv_cflags)', - '<@(curl_cflags)', '<@(sqlite3_cflags)', '-I<(boost_root)/include', ], @@ -151,7 +150,6 @@ 'cflags': [ '<@(png_cflags)', '<@(uv_cflags)', - '<@(curl_cflags)', '<@(sqlite3_cflags)', '-I<(boost_root)/include', ], @@ -166,26 +164,22 @@ 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(uv_cflags)', - '<@(curl_cflags)', '-I<(boost_root)/include', ], 'OTHER_LDFLAGS': [ '<@(png_libraries)', '<@(uv_libraries)', - '<@(curl_libraries)', '<@(sqlite3_libraries)', ] } }, { 'cflags': [ '<@(uv_cflags)', - '<@(curl_cflags)', '-I<(boost_root)/include', ], 'libraries': [ '<@(png_libraries)', '<@(uv_libraries)', - '<@(curl_libraries)', '<@(sqlite3_libraries)', ] }] @@ -222,7 +216,6 @@ 'OTHER_CPLUSPLUSFLAGS': [ '<@(png_cflags)', '<@(uv_cflags)', - '<@(curl_cflags)', '<@(sqlite3_cflags)', '-I<(boost_root)/include', ], @@ -238,7 +231,6 @@ 'OTHER_LDFLAGS': [ '<@(png_libraries)', '<@(uv_libraries)', - '<@(curl_libraries)', '<@(sqlite3_libraries)', ], 'OTHER_CPLUSPLUSFLAGS': [ diff --git a/setup-libraries-cross.sh b/setup-libraries-cross.sh deleted file mode 100755 index 4f3a5bfbe..000000000 --- a/setup-libraries-cross.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -set -e -u - -UNAME=$(uname -s); - -MISSING_DEPS="" - -function ensure_dep { - if [[ ! `which $1` ]]; then - MISSING_DEPS="$MISSING_DEPS $1" - fi -} - -ensure_dep aclocal -ensure_dep cmake -ensure_dep automake -ensure_dep autoconf -ensure_dep pkg-config -ensure_dep node -ensure_dep libtool -ensure_dep gccmakedep - -if [[ $MISSING_DEPS != "" ]]; then - if [ ${UNAME} = 'Darwin' ]; then - echo "Missing build deps: ${MISSING_DEPS}" - echo 'Please run "brew install autoconf automake libtool makedepend cmake pkg-config node"' - echo 'and then re-run ./setup-libraries.sh' - elif [ ${UNAME} = 'Linux' ]; then - echo "Missing build deps: ${MISSING_DEPS}" - echo 'Please run "sudo apt-get install git build-essential zlib1g-dev automake libtool xutils-dev make cmake pkg-config nodejs-legacy libxi-dev libglu1-mesa-dev x11proto-randr-dev x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxcursor-dev"' - echo 'and then re-run ./setup-libraries.sh' - fi - exit 1 -fi - -export SYSROOT=`pwd`/../rootfs -export SDK_PATH=`pwd`/../arm-linux-gnueabi-linaro_4.8.3-2014.04 -export V=1 - -if [ ! -d 'mapnik-packaging/.git' ]; then - git clone --depth=1 https://github.com/mapnik/mapnik-packaging.git -fi - -cd mapnik-packaging/osx/ -# git pull - -export CXX11=true - -source Linaro-softfp.sh - if [ ! -f out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp/lib/libglfw3.a ] ; then ./scripts/build_glfw.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp/lib/libssl.a ] ; then ./scripts/build_openssl.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp/lib/libboost_regex.a ] ; then ./scripts/build_boost.sh --with-regex ; fi - -cd ../../ -./configure \ ---pkg-config-root=`pwd`/mapnik-packaging/osx/out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp/lib/pkgconfig \ ---boost=`pwd`/mapnik-packaging/osx/out/build-cpp11-libstdcpp-gcc-arm-linux-gnueabi-linaro-softfp \ ---node=`which node` - diff --git a/setup-libraries.sh b/setup-libraries.sh deleted file mode 100755 index c049e88a1..000000000 --- a/setup-libraries.sh +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/bash -set -e -u - -UNAME=$(uname -s); - -MISSING_DEPS="" - -function ensure_dep { - if [[ ! `which $1` ]]; then - MISSING_DEPS="$MISSING_DEPS $1" - fi -} - -ensure_dep aclocal -ensure_dep cmake -ensure_dep automake -ensure_dep autoconf -ensure_dep pkg-config -if [ ${UNAME} = 'Darwin' ]; then - ensure_dep makedepend - if [[ ! `which libtool` ]] && [[ ! `which glibtool` ]]; then - MISSING_DEPS="$MISSING_DEPS libtool" - fi -elif [ ${UNAME} = 'Linux' ]; then - ensure_dep libtool - ensure_dep gccmakedep -fi - -if [[ $MISSING_DEPS != "" ]]; then - if [ ${UNAME} = 'Darwin' ]; then - echo "Missing build deps: ${MISSING_DEPS}" - echo 'Please run "brew install autoconf automake libtool makedepend cmake pkg-config"' - echo 'and then re-run ./setup-libraries.sh' - elif [ ${UNAME} = 'Linux' ]; then - echo "Missing build deps: ${MISSING_DEPS}" - echo 'Please run "sudo apt-get install git build-essential zlib1g-dev automake libtool xutils-dev make cmake pkg-config libxi-dev libglu1-mesa-dev x11proto-randr-dev x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxcursor-dev"' - echo 'and then re-run ./setup-libraries.sh' - fi - exit 1 -fi - -# bootstrap node install -if [[ ! -d ~/.nvm ]]; then - git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm -fi -set +u -source ~/.nvm/nvm.sh -nvm install 0.10 -set -u - -NODE=$(which node) -NPM=$(which npm) - -MP_HASH="f543fecbeb0982983593aa0847715d26c323b990" -DIR_HASH=$(echo `pwd` | git hash-object --stdin) - -if [ ! -d 'mapnik-packaging/' ]; then - git clone https://github.com/mapnik/mapnik-packaging.git -fi - -cd mapnik-packaging -git fetch -git checkout ${MP_HASH} -cd ./osx/ - -export CXX11=true - -if [ ${UNAME} = 'Darwin' ]; then - -if [[ -n ${TRAVIS:-} ]]; then - if aws s3 cp s3://mapbox-gl-testing/dependencies/build-cpp11-libcpp-osx_${MP_HASH}_${DIR_HASH}.tar.gz ./out/ ; then - if aws s3 cp s3://mapbox-gl-testing/dependencies/build-cpp11-libcpp-ios_${MP_HASH}_${DIR_HASH}.tar.gz ./out/ ; then - rm -rf out/build-cpp11-libcpp-x86_64-macosx - rm -rf out/build-cpp11-libcpp-universal - tar -xzf out/build-cpp11-libcpp-osx_${MP_HASH}_${DIR_HASH}.tar.gz - tar -xzf out/build-cpp11-libcpp-ios_${MP_HASH}_${DIR_HASH}.tar.gz - fi - fi -fi - -if test -z "${TRAVIS:-}" || ! test -d out/build-cpp11-libcpp-universal; then - -source iPhoneOS.sh - if [ ! -f out/build-cpp11-libcpp-armv7-iphoneos/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libcpp-armv7-iphoneos/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libcpp-armv7-iphoneos/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -f out/build-cpp11-libcpp-armv7-iphoneos/lib/libsqlite3.a ] ; then ./scripts/build_sqlite.sh ; fi - echo ' ...done' - -source iPhoneOSs.sh - if [ ! -f out/build-cpp11-libcpp-armv7s-iphoneoss/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libcpp-armv7s-iphoneoss/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libcpp-armv7s-iphoneoss/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -f out/build-cpp11-libcpp-armv7s-iphoneoss/lib/libsqlite3.a ] ; then ./scripts/build_sqlite.sh ; fi - echo ' ...done' - -source iPhoneOS64.sh - if [ ! -f out/build-cpp11-libcpp-arm64-iphoneos64/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libcpp-arm64-iphoneos64/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libcpp-arm64-iphoneos64/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -f out/build-cpp11-libcpp-arm64-iphoneos64/lib/libsqlite3.a ] ; then ./scripts/build_sqlite.sh ; fi - echo ' ...done' - -source iPhoneSimulator.sh - if [ ! -f out/build-cpp11-libcpp-i386-iphonesimulator/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libcpp-i386-iphonesimulator/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libcpp-i386-iphonesimulator/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -f out/build-cpp11-libcpp-i386-iphonesimulator/lib/libsqlite3.a ] ; then ./scripts/build_sqlite.sh ; fi - echo ' ...done' - -source iPhoneSimulator64.sh - if [ ! -f out/build-cpp11-libcpp-x86_64-iphonesimulator/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-iphonesimulator/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-iphonesimulator/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-iphonesimulator/lib/libsqlite3.a ] ; then ./scripts/build_sqlite.sh ; fi - echo ' ...done' - -source MacOSX.sh - if [ ! -f out/build-cpp11-libcpp-x86_64-macosx/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-macosx/lib/libglfw3.a ] ; then ./scripts/build_glfw.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-macosx/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-macosx/lib/libsqlite3.a ] ; then ./scripts/build_sqlite.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-macosx/lib/libssl.a ] ; then ./scripts/build_openssl.sh ; fi - if [ ! -f out/build-cpp11-libcpp-x86_64-macosx/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -d out/build-cpp11-libcpp-x86_64-macosx/include/boost ] ; then ./scripts/build_boost.sh `pwd`/../../src/ `pwd`/../../include/ `pwd`/../../linux/ `pwd`/../../common/ ; fi - echo ' ...done' - -# setup iOS universal libs -./scripts/make_universal.sh -patch -p0 --forward < patches/curl-ios.diff || true -echo "NOTE: One patch FAILURE is expected. The other should have been applied or ignored." - -if [[ ${TRAVIS:-} && ${AWS_ACCESS_KEY_ID:-} && ${AWS_SECRET_ACCESS_KEY:-} ]] ; then - tar -zcf out/build-cpp11-libcpp-ios_${MP_HASH}_${DIR_HASH}.tar.gz out/build-cpp11-libcpp-universal - aws s3 cp --acl public-read out/build-cpp11-libcpp-ios_${MP_HASH}_${DIR_HASH}.tar.gz s3://mapbox-gl-testing/dependencies/ - tar -zcf out/build-cpp11-libcpp-osx_${MP_HASH}_${DIR_HASH}.tar.gz out/build-cpp11-libcpp-x86_64-macosx - aws s3 cp --acl public-read out/build-cpp11-libcpp-osx_${MP_HASH}_${DIR_HASH}.tar.gz s3://mapbox-gl-testing/dependencies/ -fi - -fi - -cd ../../ - -# default to OS X build product symlinking -./mapnik-packaging/osx/darwin_configure.sh osx - -elif [ ${UNAME} = 'Linux' ]; then - -if [[ ${TRAVIS:-} ]]; then - if aws s3 cp s3://mapbox-gl-testing/dependencies/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz ./out/ ; then - rm -rf out/build-cpp11-libstdcpp-gcc-x86_64-linux - tar -xzf out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz - fi -fi - -source Linux.sh - if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libglfw3.a ] ; then ./scripts/build_glfw.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libpng.a ] ; then ./scripts/build_png.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libuv.a ] ; then ./scripts/build_libuv.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libsqlite3.a ] ; then ./scripts/build_sqlite.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libssl.a ] ; then ./scripts/build_openssl.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libcurl.a ] ; then ./scripts/build_curl.sh ; fi - if [ ! -f out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/libboost_regex.a ] ; then ./scripts/build_boost.sh --with-regex ; fi - -if [[ ${TRAVIS:-} && ${AWS_ACCESS_KEY_ID:-} && ${AWS_SECRET_ACCESS_KEY:-} ]] ; then - if ! tar --compare -zf out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz ; then - tar -zcf out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz out/build-cpp11-libstdcpp-gcc-x86_64-linux - aws s3 cp --acl public-read out/build-cpp11-libstdcpp-gcc-x86_64-linux.tar.gz s3://mapbox-gl-testing/dependencies/ - fi -fi - -cd ../../ -./configure \ ---pkg-config-root=`pwd`/mapnik-packaging/osx/out/build-cpp11-libstdcpp-gcc-x86_64-linux/lib/pkgconfig \ ---boost=`pwd`/mapnik-packaging/osx/out/build-cpp11-libstdcpp-gcc-x86_64-linux \ ---npm=$NPM \ ---node=$NODE -fi From 9103d84acebdc8bc3065d09f786881cd3f1ead15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 21 Oct 2014 11:41:30 +0200 Subject: [PATCH 03/25] ios build system fixes [skip ci] --- Makefile | 7 ++-- configure | 75 ++++++++++++++++++++++++++++++----------- src/util/uv-messenger.c | 5 +++ 3 files changed, 63 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index a29e30cab..a9c24ffdb 100644 --- a/Makefile +++ b/Makefile @@ -6,14 +6,11 @@ all: setup setup: config.gypi -config.gypi: - ./setup-libraries.sh - xlibs: @./mapnik-packaging/osx/darwin_configure.sh osx ilibs: - @./mapnik-packaging/osx/darwin_configure.sh ios + MASON_PLATFORM=ios ./configure # Builds the regular library mbgl: config.gypi mapboxgl.gyp node @@ -84,7 +81,7 @@ xproj: xproj-cli open ./build/macosx/mapboxgl-app.xcodeproj # build iOS project for Xcode -iproj-cli: config.gypi ilibs ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node +iproj-cli: ilibs config.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode iproj: iproj-cli diff --git a/configure b/configure index d8a5e08ed..d02972d0a 100755 --- a/configure +++ b/configure @@ -12,11 +12,21 @@ LIBPNG_VERSION=1.6.13 SQLITE_VERSION=system LIBUV_VERSION=0.10.28 -mason install libcurl ${LIBCURL_VERSION} -mason install glfw ${GLFW_VERSION} -mason install libpng ${LIBPNG_VERSION} -mason install sqlite ${SQLITE_VERSION} -mason install libuv ${LIBUV_VERSION} +case $MASON_PLATFORM in + 'ios') + SQLITE_VERSION=system + LIBPNG_VERSION=1.6.13 + LIBUV_VERSION=0.10.28 + ;; + *) + GLFW_VERSION=a21f2377 + SQLITE_VERSION=system + LIBPNG_VERSION=system + LIBCURL_VERSION=system + LIBUV_VERSION=0.10.28 + ;; +esac + BOOST_ROOT=/usr if [ -d '/usr/local/boost' ]; then BOOST_ROOT='/usr/local' ; fi @@ -25,7 +35,9 @@ function quote_flags { python -c "import sys, re; print re.split('(? config.gypi + 'boost_root': '${BOOST_ROOT}', +" + +if [ ! -z ${LIBCURL_VERSION} ]; then + mason install libcurl ${LIBCURL_VERSION} + CONFIG+=$" 'curl_cflags': $(quote_flags $(mason cflags libcurl ${LIBCURL_VERSION})),"$LN + CONFIG+=$" 'curl_libraries': $(quote_flags $(mason ldflags libcurl ${LIBCURL_VERSION})),"$LN +fi + +if [ ! -z ${GLFW_VERSION} ]; then + mason install glfw ${GLFW_VERSION} + CONFIG+=$" 'glfw3_cflags': $(quote_flags $(mason cflags glfw ${GLFW_VERSION})),"$LN + CONFIG+=$" 'glfw3_libraries': $(quote_flags $(mason ldflags glfw ${GLFW_VERSION})),"$LN +fi + +if [ ! -z ${LIBPNG_VERSION} ]; then + mason install libpng ${LIBPNG_VERSION} + CONFIG+=$" 'png_cflags': $(quote_flags $(mason cflags libpng ${LIBPNG_VERSION})),"$LN + CONFIG+=$" 'png_libraries': $(quote_flags $(mason ldflags libpng ${LIBPNG_VERSION})),"$LN +fi + +if [ ! -z ${SQLITE_VERSION} ]; then + mason install sqlite ${SQLITE_VERSION} + CONFIG+=$" 'sqlite3_cflags': $(quote_flags $(mason cflags sqlite ${SQLITE_VERSION})),"$LN + CONFIG+=$" 'sqlite3_libraries': $(quote_flags $(mason ldflags sqlite ${SQLITE_VERSION})),"$LN +fi + +if [ ! -z ${LIBUV_VERSION} ]; then + mason install libuv ${LIBUV_VERSION} + CONFIG+=$" 'uv_cflags': $(quote_flags $(mason cflags libuv ${LIBUV_VERSION})),"$LN + CONFIG+=$" 'uv_libraries': $(quote_flags $(mason ldflags libuv ${LIBUV_VERSION})),"$LN +fi + +CONFIG+=" } +} +" + +echo "${CONFIG}" > config.gypi cat config.gypi diff --git a/src/util/uv-messenger.c b/src/util/uv-messenger.c index a25c84dc5..9457cc378 100644 --- a/src/util/uv-messenger.c +++ b/src/util/uv-messenger.c @@ -8,7 +8,12 @@ typedef struct { void *queue[2]; } uv__messenger_item_t; + +#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +void uv__messenger_callback(uv_async_t *async, int) { +#else void uv__messenger_callback(uv_async_t *async) { +#endif uv_messenger_t *msgr = (uv_messenger_t *)async->data; uv__messenger_item_t *item; From a1c5e0cdc1ab89bd78953fe4c9d87b08ad8c652d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 21 Oct 2014 03:06:11 -0700 Subject: [PATCH 04/25] don't omit parameter name [skip ci] --- src/util/uv-messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/uv-messenger.c b/src/util/uv-messenger.c index 9457cc378..cb3c3ca99 100644 --- a/src/util/uv-messenger.c +++ b/src/util/uv-messenger.c @@ -10,7 +10,7 @@ typedef struct { #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 -void uv__messenger_callback(uv_async_t *async, int) { +void uv__messenger_callback(uv_async_t *async, int status) { #else void uv__messenger_callback(uv_async_t *async) { #endif From ef1792fe470a6b280aa2864ae988561c4784ddb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 21 Oct 2014 12:08:04 +0200 Subject: [PATCH 05/25] properly detect boost root [skip ci] --- configure | 31 +++++++++++++++++++++++-------- mapboxgl.gyp | 6 ++++++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/configure b/configure index d02972d0a..dc32be135 100755 --- a/configure +++ b/configure @@ -6,17 +6,12 @@ set -o pipefail . ~/.nvm/nvm.sh nvm use 0.10 -LIBCURL_VERSION=system -GLFW_VERSION=a21f2377 -LIBPNG_VERSION=1.6.13 -SQLITE_VERSION=system -LIBUV_VERSION=0.10.28 - case $MASON_PLATFORM in 'ios') SQLITE_VERSION=system LIBPNG_VERSION=1.6.13 LIBUV_VERSION=0.10.28 + ZLIB_VERSION=system ;; *) GLFW_VERSION=a21f2377 @@ -24,12 +19,26 @@ case $MASON_PLATFORM in LIBPNG_VERSION=system LIBCURL_VERSION=system LIBUV_VERSION=0.10.28 + ZLIB_VERSION=system ;; esac +if [ -z "${BOOST_ROOT}" ]; then + if [ -d '/usr/local/include/boost' ]; then + BOOST_ROOT='/usr/local' + elif [ -d '/usr/include/boost' ]; then + BOOST_ROOT='/usr' + else + >&2 echo -e "\033[1m\033[31mCannot find Boost\033[0m"; + fi +fi + +if [ ! -d "${BOOST_ROOT}/include/boost" ]; then + >&2 echo -e "\033[1m\033[31mCannot find Boost at ${BOOST_ROOT}\033[0m"; +else + >&2 echo -e "\033[1m\033[32m* Using Boost installation at ${BOOST_ROOT}\033[0m"; +fi -BOOST_ROOT=/usr -if [ -d '/usr/local/boost' ]; then BOOST_ROOT='/usr/local' ; fi function quote_flags { python -c "import sys, re; print re.split('(? Date: Tue, 21 Oct 2014 12:49:19 +0200 Subject: [PATCH 06/25] cleanup makefile [skip ci] --- .travis.yml | 7 ++---- Makefile | 22 ++++++++----------- configure | 4 ++++ ...nstall.sh => travis_install_test_suite.sh} | 0 4 files changed, 15 insertions(+), 18 deletions(-) rename scripts/{travis_install.sh => travis_install_test_suite.sh} (100%) diff --git a/.travis.yml b/.travis.yml index 42cca837c..3e34bace7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,11 +28,8 @@ before_install: - ./scripts/travis_before_install.sh install: -- make setup -- ./scripts/travis_install.sh - -before_script: -- rm -rf mapnik-packaging/out/packages +- make config.gypi +- ./scripts/travis_install_test_suite.sh script: - ./scripts/travis_script.sh diff --git a/Makefile b/Makefile index a9c24ffdb..2e740f38e 100644 --- a/Makefile +++ b/Makefile @@ -2,15 +2,13 @@ BUILDTYPE ?= Release PYTHON ?= python V ?= 1 -all: setup +all: mbgl -setup: config.gypi +config.gypi: + ./configure -xlibs: - @./mapnik-packaging/osx/darwin_configure.sh osx - -ilibs: - MASON_PLATFORM=ios ./configure +config-ios.gypi: + MASON_PLATFORM=ios ./configure config-ios.gypi # Builds the regular library mbgl: config.gypi mapboxgl.gyp node @@ -74,14 +72,14 @@ clear_xcode_cache: fi # build Mac OS X project for Xcode -xproj-cli: config.gypi xlibs macosx/mapboxgl-app.gyp clear_xcode_cache node +xproj-cli: config.gypi macosx/mapboxgl-app.gyp clear_xcode_cache node deps/run_gyp macosx/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode xproj: xproj-cli open ./build/macosx/mapboxgl-app.xcodeproj # build iOS project for Xcode -iproj-cli: ilibs config.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node +iproj-cli: config-ios.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode iproj: iproj-cli @@ -98,12 +96,10 @@ lproj: config.gypi linux/mapboxgl-app.gyp clear_xcode_cache node clean: clear_xcode_cache -find ./deps/gyp -name "*.pyc" -exec rm {} \; -rm -rf ./build/ - -rm -rf ./config.gypi + -rm -rf ./config.gypi ./config-ios.gypi distclean: clean - -rm -rf ./mapnik-packaging/osx/out/build-* - -rm -rf ./mapnik-packaging/osx/out/universal - -find ./mapnik-packaging/osx/out/packages -type d ! -name 'packages' -maxdepth 1 -exec rm -rf {} \; + -rm -rf ./mason_packages .PHONY: mbgl test linux build/test/Makefile # DO NOT DELETE diff --git a/configure b/configure index dc32be135..e94369051 100755 --- a/configure +++ b/configure @@ -3,6 +3,8 @@ set -e set -o pipefail +CONFIG_FILE=${1:-config.gypi} + . ~/.nvm/nvm.sh nvm use 0.10 @@ -30,11 +32,13 @@ if [ -z "${BOOST_ROOT}" ]; then BOOST_ROOT='/usr' else >&2 echo -e "\033[1m\033[31mCannot find Boost\033[0m"; + exit 1 fi fi if [ ! -d "${BOOST_ROOT}/include/boost" ]; then >&2 echo -e "\033[1m\033[31mCannot find Boost at ${BOOST_ROOT}\033[0m"; + exit 1 else >&2 echo -e "\033[1m\033[32m* Using Boost installation at ${BOOST_ROOT}\033[0m"; fi diff --git a/scripts/travis_install.sh b/scripts/travis_install_test_suite.sh similarity index 100% rename from scripts/travis_install.sh rename to scripts/travis_install_test_suite.sh From e98b3e5d86f4108075e8814155ed9b684f99439c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 21 Oct 2014 13:04:22 +0200 Subject: [PATCH 07/25] install nvm and node [skip ci] --- configure | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/configure b/configure index e94369051..3e26c7e42 100755 --- a/configure +++ b/configure @@ -5,8 +5,18 @@ set -o pipefail CONFIG_FILE=${1:-config.gypi} +# Install node +if [[ ! -d ~/.nvm ]]; then + git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm +fi +set +u . ~/.nvm/nvm.sh -nvm use 0.10 +if [ ! `nvm use 0.10 > /dev/null; echo $?` = 0 ]; then + >&2 echo -e "\033[1m\033[32m* $(nvm install 0.10)\033[0m"; +else + >&2 echo -e "\033[1m\033[32m* $(nvm use 0.10)\033[0m"; +fi + case $MASON_PLATFORM in 'ios') From dddd1c275ce01244efef3d591e0efde449d648b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 21 Oct 2014 15:45:27 +0200 Subject: [PATCH 08/25] add libraries and make configure script more robust [skip ci] --- .travis.yml | 1 + configure | 80 ++++++++++++++++++-------------- scripts/travis_before_install.sh | 7 ++- 3 files changed, 51 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3e34bace7..058d4e8c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ env: before_install: - source ./scripts/flags.sh +- (git clone https://github.com/mapbox/mason.git ~/.mason ; sudo ln -s ~/.mason/mason /usr/local/bin/mason) - ./scripts/travis_before_install.sh install: diff --git a/configure b/configure index 3e26c7e42..2dc78dfc3 100755 --- a/configure +++ b/configure @@ -5,6 +5,11 @@ set -o pipefail CONFIG_FILE=${1:-config.gypi} +function finish { + >&2 echo -en "\033[0m"; +} +trap finish EXIT + # Install node if [[ ! -d ~/.nvm ]]; then git clone --depth 1 https://github.com/creationix/nvm.git ~/.nvm @@ -12,9 +17,13 @@ fi set +u . ~/.nvm/nvm.sh if [ ! `nvm use 0.10 > /dev/null; echo $?` = 0 ]; then - >&2 echo -e "\033[1m\033[32m* $(nvm install 0.10)\033[0m"; + >&2 echo -en "\033[1m\033[32m* " + nvm install 0.10 + >&2 echo -en "\033[0m"; else - >&2 echo -e "\033[1m\033[32m* $(nvm use 0.10)\033[0m"; + >&2 echo -en "\033[1m\033[32m* " + nvm use 0.10 + >&2 echo -en "\033[0m"; fi @@ -24,6 +33,7 @@ case $MASON_PLATFORM in LIBPNG_VERSION=1.6.13 LIBUV_VERSION=0.10.28 ZLIB_VERSION=system + BOOST_VERSION=system ;; *) GLFW_VERSION=a21f2377 @@ -32,30 +42,26 @@ case $MASON_PLATFORM in LIBCURL_VERSION=system LIBUV_VERSION=0.10.28 ZLIB_VERSION=system + BOOST_VERSION=system ;; esac -if [ -z "${BOOST_ROOT}" ]; then - if [ -d '/usr/local/include/boost' ]; then - BOOST_ROOT='/usr/local' - elif [ -d '/usr/include/boost' ]; then - BOOST_ROOT='/usr' - else - >&2 echo -e "\033[1m\033[31mCannot find Boost\033[0m"; - exit 1 - fi -fi +function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } -if [ ! -d "${BOOST_ROOT}/include/boost" ]; then - >&2 echo -e "\033[1m\033[31mCannot find Boost at ${BOOST_ROOT}\033[0m"; - exit 1 -else - >&2 echo -e "\033[1m\033[32m* Using Boost installation at ${BOOST_ROOT}\033[0m"; -fi +NODE=`which node || abort 'Cannot find node'` +NPM=`which npm || abort 'Cannot find npm'` +PYTHON=`which python || abort 'Cannot find python'` +>&2 echo -en "\033[1m\033[32m* Using npm " +>&2 ${NPM} --version +>&2 echo -en "\033[0m"; + +>&2 echo -en "\033[1m\033[32m* Using " +>&2 ${PYTHON} --version +>&2 echo -en "\033[0m"; function quote_flags { - python -c "import sys, re; print re.split('(? Date: Tue, 21 Oct 2014 06:57:44 -0700 Subject: [PATCH 09/25] use ppa for more recent boost --- scripts/flags.sh | 3 ++- scripts/travis_before_install.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/flags.sh b/scripts/flags.sh index 58aee18a0..c3c36a640 100755 --- a/scripts/flags.sh +++ b/scripts/flags.sh @@ -6,7 +6,8 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then # use g++ that supports c++11 if [[ ${CXX} == "g++" ]]; then - export CXX="g++-4.8" ; + export CXX="g++-4.8" + export CXX="gcc-4.8" fi # If building in debug then turn on sanitizers. diff --git a/scripts/travis_before_install.sh b/scripts/travis_before_install.sh index a77aa703e..31315dce3 100755 --- a/scripts/travis_before_install.sh +++ b/scripts/travis_before_install.sh @@ -10,11 +10,12 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then if [[ `lsb_release -r` =~ "12.04" ]]; then sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test fi + sudo add-apt-repository --yes ppa:boost-latest/ppa sudo apt-get update -y sudo apt-get -y install gcc-4.8 g++-4.8 sudo apt-get -y install git build-essential zlib1g-dev automake \ libtool xutils-dev make cmake pkg-config python-pip \ - libboost-dev libboost-regex-dev libcurl4-openssl-dev \ + libboost1.55-dev libboost-regex1.55-dev libcurl4-openssl-dev \ libpng-dev libsqlite3-dev sudo apt-get -y install libxi-dev libglu1-mesa-dev x11proto-randr-dev \ x11proto-xext-dev libxrandr-dev \ From b6a42afe7e0eb77c7f8a4a79a9fdf81b0603f2f1 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Tue, 21 Oct 2014 11:44:23 -0700 Subject: [PATCH 10/25] correctly set CC --- scripts/flags.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/flags.sh b/scripts/flags.sh index c3c36a640..b1de8f3c7 100755 --- a/scripts/flags.sh +++ b/scripts/flags.sh @@ -7,7 +7,7 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then # use g++ that supports c++11 if [[ ${CXX} == "g++" ]]; then export CXX="g++-4.8" - export CXX="gcc-4.8" + export CC="gcc-4.8" fi # If building in debug then turn on sanitizers. From 3a39d69504c3a8d87015908424e4ee199ef0c215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 21 Oct 2014 17:02:07 +0200 Subject: [PATCH 11/25] link boost when the boost variable is set --- configure | 2 +- include/mbgl/text/collision.hpp | 1 + include/mbgl/util/uv-worker.h | 3 +-- src/storage/file_request_baton.cpp | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 2dc78dfc3..441629921 100755 --- a/configure +++ b/configure @@ -81,7 +81,7 @@ CONFIG="# Do not edit. Generated by the configure script. 'python': '${PYTHON}', " -if [ ! -z ${LIBCURL_VERSION} ]; then +if [ ! -z ${BOOST_VERSION} ]; then mason install boost ${BOOST_VERSION} CONFIG+=" 'boost_root': '$(mason prefix boost ${BOOST_VERSION})',"$LN fi diff --git a/include/mbgl/text/collision.hpp b/include/mbgl/text/collision.hpp index 8eec30f21..b7ee6b452 100644 --- a/include/mbgl/text/collision.hpp +++ b/include/mbgl/text/collision.hpp @@ -5,6 +5,7 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wunused-variable" #ifdef __clang__ #pragma GCC diagnostic ignored "-Wdeprecated-register" #else diff --git a/include/mbgl/util/uv-worker.h b/include/mbgl/util/uv-worker.h index 451b6fb04..cb2075d1c 100644 --- a/include/mbgl/util/uv-worker.h +++ b/include/mbgl/util/uv-worker.h @@ -5,8 +5,7 @@ extern "C" { #endif -typedef struct uv_messenger_s uv_messenger_t; - +#include #include #include diff --git a/src/storage/file_request_baton.cpp b/src/storage/file_request_baton.cpp index d4c135fd7..64c6c13b1 100644 --- a/src/storage/file_request_baton.cpp +++ b/src/storage/file_request_baton.cpp @@ -58,8 +58,7 @@ void FileRequestBaton::file_opened(uv_fs_t *req) { uv_fs_close(req->loop, req, fd, file_closed); } else { ptr->fd = fd; - const int r = uv_fs_fstat(req->loop, req, fd, file_stated); - assert(r == 0); + uv_fs_fstat(req->loop, req, fd, file_stated); } } } @@ -135,8 +134,7 @@ void FileRequestBaton::file_read(uv_fs_t *req) { } void FileRequestBaton::file_closed(uv_fs_t *req) { - FileRequestBaton *ptr = (FileRequestBaton *)req->data; - assert(ptr->thread_id == uv_thread_self()); + assert(((FileRequestBaton *)req->data)->thread_id == uv_thread_self()); if (req->result < 0) { // Closing the file failed. But there isn't anything we can do. From b9d422ebc3d48ff91e8f2eda071a0596ada36233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Tue, 21 Oct 2014 17:02:22 +0200 Subject: [PATCH 12/25] use glfw3 libs instead of manually linking OpenGL frameworks on OS X [skip ci] --- test/test.gyp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test.gyp b/test/test.gyp index fd7725bb0..bd13ad7fd 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -12,12 +12,12 @@ ['OS == "mac"', { 'link_settings': { 'libraries': [ - '-framework OpenGL', + '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW ], }, 'xcode_settings': { 'OTHER_LDFLAGS': [ - '-framework OpenGL', + '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW ], }, }, { From 2f3952b30541d5bbb3579c39a36052c02b47b37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 10:45:42 +0200 Subject: [PATCH 13/25] fix compile warnings --- include/mbgl/platform/event.hpp | 6 ++++-- include/mbgl/platform/log.hpp | 2 +- macosx/main.mm | 2 +- src/util/compression.cpp | 4 ++-- src/util/parsedate.c | 2 +- test/fixtures/fixture_request.cpp | 14 ++++++++++---- test/headless.cpp | 16 ++++++++-------- test/test.gyp | 32 ------------------------------- 8 files changed, 27 insertions(+), 51 deletions(-) diff --git a/include/mbgl/platform/event.hpp b/include/mbgl/platform/event.hpp index d2a06618a..0405cddfa 100644 --- a/include/mbgl/platform/event.hpp +++ b/include/mbgl/platform/event.hpp @@ -57,11 +57,13 @@ struct EventPermutation { } }; -constexpr EventSeverity disabledEventSeverities[] = { #if !DEBUG +constexpr EventSeverity disabledEventSeverities[] = { EventSeverity::Debug, -#endif }; +#else +constexpr EventSeverity *disabledEventSeverities = nullptr; +#endif constexpr Event disabledEvents[] = { diff --git a/include/mbgl/platform/log.hpp b/include/mbgl/platform/log.hpp index dc000b4d5..bcb6d7922 100644 --- a/include/mbgl/platform/log.hpp +++ b/include/mbgl/platform/log.hpp @@ -21,7 +21,7 @@ class Log { private: template constexpr static bool includes(const T e, T const *l, const size_t i = 0) { - return i >= sizeof l ? false : *(l + i) == e ? true : includes(e, l, i + 1); + return l == nullptr ? false : i >= sizeof l ? false : *(l + i) == e ? true : includes(e, l, i + 1); } public: diff --git a/macosx/main.mm b/macosx/main.mm index aeb49225c..8cf3cc81c 100644 --- a/macosx/main.mm +++ b/macosx/main.mm @@ -85,7 +85,7 @@ int main() { // Notify map object when network reachability status changes. Reachability* reachability = [Reachability reachabilityForInternetConnection]; - reachability.reachableBlock = ^(Reachability *reachability) { + reachability.reachableBlock = ^(Reachability *) { map_ptr->setReachability(true); }; [reachability startNotifier]; diff --git a/src/util/compression.cpp b/src/util/compression.cpp index de4e09764..d6d637054 100644 --- a/src/util/compression.cpp +++ b/src/util/compression.cpp @@ -18,7 +18,7 @@ std::string compress(const std::string &raw) { } deflate_stream.next_in = (Bytef *)raw.data(); - deflate_stream.avail_in = raw.size(); + deflate_stream.avail_in = uInt(raw.size()); std::string result; char out[16384]; @@ -53,7 +53,7 @@ std::string decompress(const std::string &raw) { } inflate_stream.next_in = (Bytef *)raw.data(); - inflate_stream.avail_in = raw.size(); + inflate_stream.avail_in = uInt(raw.size()); std::string result; char out[15384]; diff --git a/src/util/parsedate.c b/src/util/parsedate.c index 123c5c4e5..f888def85 100644 --- a/src/util/parsedate.c +++ b/src/util/parsedate.c @@ -208,7 +208,7 @@ int raw_equal(const char *first, const char *second) int clamp_to_int(long slnum) { - return slnum > INT_MAX ? INT_MAX : slnum < INT_MIN ? INT_MIN : slnum; + return slnum > INT_MAX ? INT_MAX : slnum < INT_MIN ? INT_MIN : (int)slnum; } diff --git a/test/fixtures/fixture_request.cpp b/test/fixtures/fixture_request.cpp index 3f72b890d..9d2971c73 100644 --- a/test/fixtures/fixture_request.cpp +++ b/test/fixtures/fixture_request.cpp @@ -35,11 +35,17 @@ void HTTPRequestBaton::start(const util::ptr &baton) { const size_t size = ftell(file); fseek(file, 0, SEEK_SET); baton->response->data.resize(size); - fread(&baton->response->data[0], size, 1, file); + const size_t read = fread(&baton->response->data[0], 1, size, file); fclose(file); - baton->response->code = 200; - baton->type = HTTPResponseType::Successful; + if (read == size) { + baton->response->code = 200; + baton->type = HTTPResponseType::Successful; + } else { + baton->response->code = 500; + baton->type = HTTPResponseType::PermanentError; + baton->response->message = "Read bytes differed from file size"; + } } else { baton->type = HTTPResponseType::PermanentError; baton->response->code = 404; @@ -48,7 +54,7 @@ void HTTPRequestBaton::start(const util::ptr &baton) { uv_async_send(baton->async); } -void HTTPRequestBaton::stop(const util::ptr &baton) { +void HTTPRequestBaton::stop(const util::ptr &) { fprintf(stderr, "HTTP request cannot be canceled because it is answered immediately"); abort(); } diff --git a/test/headless.cpp b/test/headless.cpp index 3cc2607e4..3255cff06 100644 --- a/test/headless.cpp +++ b/test/headless.cpp @@ -35,8 +35,8 @@ TEST_P(HeadlessTest, render) { // Parse style. rapidjson::Document styleDoc; styleDoc.Parse<0>((const char *const)style.c_str()); - ASSERT_EQ(false, styleDoc.HasParseError()); - ASSERT_EQ(true, styleDoc.IsObject()); + ASSERT_FALSE(styleDoc.HasParseError()); + ASSERT_TRUE(styleDoc.IsObject()); rapidjson::StringBuffer buffer; rapidjson::Writer writer(buffer); @@ -46,16 +46,16 @@ TEST_P(HeadlessTest, render) { // Parse settings. rapidjson::Document infoDoc; infoDoc.Parse<0>((const char *const)info.c_str()); - ASSERT_EQ(false, infoDoc.HasParseError()); - ASSERT_EQ(true, infoDoc.IsObject()); + ASSERT_FALSE(infoDoc.HasParseError()); + ASSERT_TRUE(infoDoc.IsObject()); Log::Set(); for (auto it = infoDoc.MemberBegin(), end = infoDoc.MemberEnd(); it != end; it++) { const std::string name { it->name.GetString(), it->name.GetStringLength() }; const rapidjson::Value &value = it->value; - ASSERT_EQ(true, value.IsObject()); - if (value.HasMember("center")) ASSERT_EQ(true, value["center"].IsArray()); + ASSERT_TRUE(value.IsObject()); + if (value.HasMember("center")) ASSERT_TRUE(value["center"].IsArray()); const std::string actual_image = base_directory + "tests/" + base + "/" + name + "/actual.png"; @@ -70,10 +70,10 @@ TEST_P(HeadlessTest, render) { std::vector classes; if (value.HasMember("classes")) { const rapidjson::Value &js_classes = value["classes"]; - ASSERT_EQ(true, js_classes.IsArray()); + ASSERT_TRUE(js_classes.IsArray()); for (rapidjson::SizeType i = 0; i < js_classes.Size(); i++) { const rapidjson::Value &js_class = js_classes[i]; - ASSERT_EQ(true, js_class.IsString()); + ASSERT_TRUE(js_class.IsString()); classes.push_back({ js_class.GetString(), js_class.GetStringLength() }); } } diff --git a/test/test.gyp b/test/test.gyp index bd13ad7fd..1f63756e7 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -10,11 +10,6 @@ 'direct_dependent_settings': { 'conditions': [ ['OS == "mac"', { - 'link_settings': { - 'libraries': [ - '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW - ], - }, 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW @@ -62,9 +57,6 @@ "target_name": "rotation_range", "product_name": "test_rotation_range", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./rotation_range.cpp", @@ -78,9 +70,6 @@ "target_name": "clip_ids", "product_name": "test_clip_ids", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./clip_ids.cpp", @@ -94,9 +83,6 @@ "target_name": "enums", "product_name": "test_enums", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./enums.cpp", @@ -110,9 +96,6 @@ "target_name": "style_parser", "product_name": "test_style_parser", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./style_parser.cpp", @@ -129,9 +112,6 @@ "target_name": "variant", "product_name": "test_variant", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./variant.cpp", @@ -145,9 +125,6 @@ "target_name": "comparisons", "product_name": "test_comparisons", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./comparisons.cpp", @@ -161,9 +138,6 @@ "target_name": "tile", "product_name": "test_tile", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./tile.cpp", @@ -177,9 +151,6 @@ "target_name": "functions", "product_name": "test_functions", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./functions.cpp", @@ -193,9 +164,6 @@ "target_name": "headless", "product_name": "test_headless", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./headless.cpp", From 326af8a332d45cc7f68c1c493b6c530c039d079b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 10:46:15 +0200 Subject: [PATCH 14/25] install boost on osx --- scripts/travis_before_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/travis_before_install.sh b/scripts/travis_before_install.sh index 31315dce3..59bd15d3b 100755 --- a/scripts/travis_before_install.sh +++ b/scripts/travis_before_install.sh @@ -26,6 +26,6 @@ elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then # # install OS X dependencies # - brew install autoconf automake libtool makedepend cmake pkg-config node git + brew install autoconf automake libtool makedepend cmake pkg-config node git boost sudo pip install awscli fi From 159130a058a3051dacecf0e956bc1113874dfabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 10:59:38 +0200 Subject: [PATCH 15/25] silence warning; GCC needs this parameter, but Clang says its unused --- src/util/uv-messenger.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/uv-messenger.c b/src/util/uv-messenger.c index cb3c3ca99..82df1cae7 100644 --- a/src/util/uv-messenger.c +++ b/src/util/uv-messenger.c @@ -10,7 +10,10 @@ typedef struct { #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" void uv__messenger_callback(uv_async_t *async, int status) { +#pragma clang diagnostic pop #else void uv__messenger_callback(uv_async_t *async) { #endif From baa684eb9861d83c350a4acbc58d00568817b0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 11:18:48 +0200 Subject: [PATCH 16/25] make gyp generate newer project files patch from https://groups.google.com/forum/#!msg/gyp-developer/0JiSNtsKc30/xYxQFqRfrTcJ --- deps/gyp/pylib/gyp/generator/xcode.py | 6 +++++- deps/gyp/pylib/gyp/xcodeproj_file.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deps/gyp/pylib/gyp/generator/xcode.py b/deps/gyp/pylib/gyp/generator/xcode.py index 797245936..a6faa4c06 100644 --- a/deps/gyp/pylib/gyp/generator/xcode.py +++ b/deps/gyp/pylib/gyp/generator/xcode.py @@ -604,7 +604,11 @@ def GenerateOutput(target_list, target_dicts, data, params): if parallel_builds: pbxp.SetProperty('attributes', - {'BuildIndependentTargetsInParallel': 'YES'}) + { + 'BuildIndependentTargetsInParallel': 'YES', + 'LastUpgradeCheck': '0500' + } + ) if project_version: xcp.project_file.SetXcodeVersion(project_version) diff --git a/deps/gyp/pylib/gyp/xcodeproj_file.py b/deps/gyp/pylib/gyp/xcodeproj_file.py index 79c3abcf0..fc40fcb2d 100644 --- a/deps/gyp/pylib/gyp/xcodeproj_file.py +++ b/deps/gyp/pylib/gyp/xcodeproj_file.py @@ -2158,6 +2158,7 @@ class XCTarget(XCRemoteObject): if configs.HasBuildSetting('PRODUCT_NAME') == 0: configs.SetBuildSetting('PRODUCT_NAME', self._properties['productName']) + configs.SetBuildSetting('COMBINE_HIDPI_IMAGES', 'YES') def AddDependency(self, other): pbxproject = self.PBXProjectAncestor() @@ -2811,7 +2812,7 @@ class XCProjectFile(XCObject): _schema.update({ 'archiveVersion': [0, int, 0, 1, 1], 'classes': [0, dict, 0, 1, {}], - 'objectVersion': [0, int, 0, 1, 45], + 'objectVersion': [0, int, 0, 1, 46], 'rootObject': [0, PBXProject, 1, 1], }) From 13c698fa26eaa91cc9310aac52ee5c45cf3f60f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 11:55:34 +0200 Subject: [PATCH 17/25] fix more xcode upgrade warnings --- deps/gyp/pylib/gyp/generator/xcode.py | 6 ++++++ mapboxgl.gyp | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deps/gyp/pylib/gyp/generator/xcode.py b/deps/gyp/pylib/gyp/generator/xcode.py index a6faa4c06..783dafa0b 100644 --- a/deps/gyp/pylib/gyp/generator/xcode.py +++ b/deps/gyp/pylib/gyp/generator/xcode.py @@ -31,6 +31,10 @@ _intermediate_var = 'INTERMEDIATE_DIR' # targets that share the same BUILT_PRODUCTS_DIR. _shared_intermediate_var = 'SHARED_INTERMEDIATE_DIR' +# ONLY_ACTIVE_ARCH means that only the active architecture should be build for +# Debugging purposes to shorten the build time +_only_active_arch = 'ONLY_ACTIVE_ARCH' + _library_search_paths_var = 'LIBRARY_SEARCH_PATHS' generator_default_variables = { @@ -168,6 +172,8 @@ class XcodeProject(object): xccl.SetBuildSetting(_shared_intermediate_var, '$(SYMROOT)/DerivedSources/$(CONFIGURATION)') + xccl.ConfigurationNamed('Debug').SetBuildSetting(_only_active_arch, 'YES') + # Set user-specified project-wide build settings and config files. This # is intended to be used very sparingly. Really, almost everything should # go into target-specific build settings sections. The project-wide diff --git a/mapboxgl.gyp b/mapboxgl.gyp index d0356194d..339e819fa 100644 --- a/mapboxgl.gyp +++ b/mapboxgl.gyp @@ -210,8 +210,7 @@ ], 'xcode_settings': { 'SDKROOT': 'iphoneos', - 'SUPPORTED_PLATFORMS': ['iphonesimulator','iphoneos'], - 'ARCHS': [ "armv7", "armv7s", "arm64", "i386", "x86_64" ], + 'SUPPORTED_PLATFORMS': 'iphonesimulator iphoneos', 'TARGETED_DEVICE_FAMILY': '1,2', 'CODE_SIGN_IDENTITY': 'iPhone Developer', 'IPHONEOS_DEPLOYMENT_TARGET': '7.0', From 2dbe9edb06abfa7a0127344c6f5bb616b6654160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 12:01:04 +0200 Subject: [PATCH 18/25] write to correct file and add to gitignore --- .gitignore | 3 ++- configure | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 23dbb0f8f..04eb4ad88 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,11 @@ *.actual.png *.diff.png /node_modules -/mapnik-packaging +/mason_packages /macosx/build /ios/build /config.gypi +/config-ios.gypi /config/constants_local.cpp /build /bin/node_modules diff --git a/configure b/configure index 441629921..2fffd5920 100755 --- a/configure +++ b/configure @@ -126,6 +126,6 @@ CONFIG+=" } } " -echo "${CONFIG}" > config.gypi +echo "${CONFIG}" > ${CONFIG_FILE} -cat config.gypi +cat ${CONFIG_FILE} From 8df906e2bcc6eed8968b37068317f7bfb1ab33f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 12:40:30 +0200 Subject: [PATCH 19/25] use correct configuration file --- Makefile | 16 ++++++++-------- mapboxgl.gyp | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 2e740f38e..c74a32806 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ config-ios.gypi: # Builds the regular library mbgl: config.gypi mapboxgl.gyp node - deps/run_gyp mapboxgl.gyp --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make + deps/run_gyp mapboxgl.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mapboxgl node: @@ -21,7 +21,7 @@ node: ##### Test cases ############################################################### build/test/Makefile: src common config.gypi test/test.gyp - deps/run_gyp test/test.gyp --depth=. -Goutput_dir=.. --generator-output=./build/test -f make + deps/run_gyp test/test.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/test -f make test: build/test/Makefile $(MAKE) -C build/test BUILDTYPE=$(BUILDTYPE) V=$(V) test @@ -32,7 +32,7 @@ test_%: build/test/Makefile # build Mac OS X project for Xcode xtest: config.gypi clear_xcode_cache node - deps/run_gyp test/test.gyp --depth=. -Goutput_dir=.. --generator-output=./build -f xcode + deps/run_gyp test/test.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build -f xcode open ./build/test/test.xcodeproj ##### Makefile builds ########################################################## @@ -40,7 +40,7 @@ xtest: config.gypi clear_xcode_cache node # Builds the linux app with make. linux: config.gypi linux/mapboxgl-app.gyp node - deps/run_gyp linux/mapboxgl-app.gyp --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make + deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make $(MAKE) -C build/linux BUILDTYPE=$(BUILDTYPE) V=$(V) linuxapp # Executes the Linux binary @@ -51,7 +51,7 @@ run-linux: linux # Builds the OS X app with make. osx: config.gypi macosx/mapboxgl-app.gyp node - deps/run_gyp macosx/mapboxgl-app.gyp --depth=. -Goutput_dir=.. --generator-output=./build/macosx -f make + deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/macosx -f make $(MAKE) -C build/macosx BUILDTYPE=$(BUILDTYPE) V=$(V) osxapp # Executes the OS X binary @@ -73,21 +73,21 @@ clear_xcode_cache: # build Mac OS X project for Xcode xproj-cli: config.gypi macosx/mapboxgl-app.gyp clear_xcode_cache node - deps/run_gyp macosx/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode + deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi --depth=. --generator-output=./build -f xcode xproj: xproj-cli open ./build/macosx/mapboxgl-app.xcodeproj # build iOS project for Xcode iproj-cli: config-ios.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node - deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode + deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp -Iconfig-ios.gypi --depth=. --generator-output=./build -f xcode iproj: iproj-cli open ./build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj # build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code) lproj: config.gypi linux/mapboxgl-app.gyp clear_xcode_cache node - deps/run_gyp linux/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode + deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi --depth=. --generator-output=./build -f xcode open ./build/linux/mapboxgl-app.xcodeproj diff --git a/mapboxgl.gyp b/mapboxgl.gyp index 339e819fa..a0ad3212d 100644 --- a/mapboxgl.gyp +++ b/mapboxgl.gyp @@ -1,7 +1,6 @@ { 'includes': [ './common.gypi', - './config.gypi', ], 'targets': [ { From 5d6748f8fee0fe9d7aa0da0d9ff26de1c8044815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 12:41:10 +0200 Subject: [PATCH 20/25] fix compile warnings in libtess2 --- src/libtess2/bucketalloc.c | 2 +- src/libtess2/priorityq.c | 8 ++++---- src/libtess2/sweep.c | 3 +++ src/libtess2/tess.c | 14 +++----------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/libtess2/bucketalloc.c b/src/libtess2/bucketalloc.c index ce64e579e..df1a83c76 100755 --- a/src/libtess2/bucketalloc.c +++ b/src/libtess2/bucketalloc.c @@ -59,7 +59,7 @@ struct BucketAlloc static int CreateBucket( struct BucketAlloc* ba ) { - size_t size; + unsigned int size; Bucket* bucket; void* freelist; unsigned char* head; diff --git a/src/libtess2/priorityq.c b/src/libtess2/priorityq.c index 2af5f347b..49e1c012f 100755 --- a/src/libtess2/priorityq.c +++ b/src/libtess2/priorityq.c @@ -209,13 +209,13 @@ PQhandle pqHeapInsert( TESSalloc* alloc, PriorityQHeap *pq, PQkey keyNew ) // If the heap overflows, double its size. pq->max <<= 1; pq->nodes = (PQnode *)alloc->memrealloc( alloc->userData, pq->nodes, - (size_t)((pq->max + 1) * sizeof( pq->nodes[0] ))); + (unsigned int)((pq->max + 1) * sizeof( pq->nodes[0] ))); if (pq->nodes == NULL) { pq->nodes = saveNodes; // restore ptr to free upon return return INV_HANDLE; } pq->handles = (PQhandleElem *)alloc->memrealloc( alloc->userData, pq->handles, - (size_t) ((pq->max + 1) * sizeof( pq->handles[0] ))); + (unsigned int) ((pq->max + 1) * sizeof( pq->handles[0] ))); if (pq->handles == NULL) { pq->handles = saveHandles; // restore ptr to free upon return return INV_HANDLE; @@ -351,7 +351,7 @@ int pqInit( TESSalloc* alloc, PriorityQ *pq ) (pq->size * sizeof(pq->order[0])) ); */ pq->order = (PQkey **)alloc->memalloc( alloc->userData, - (size_t)((pq->size+1) * sizeof(pq->order[0])) ); + (unsigned int)((pq->size+1) * sizeof(pq->order[0])) ); /* the previous line is a patch to compensate for the fact that IBM */ /* machines return a null on a malloc of zero bytes (unlike SGI), */ /* so we have to put in this defense to guard against a memory */ @@ -438,7 +438,7 @@ PQhandle pqInsert( TESSalloc* alloc, PriorityQ *pq, PQkey keyNew ) // If the heap overflows, double its size. pq->max <<= 1; pq->keys = (PQkey *)alloc->memrealloc( alloc->userData, pq->keys, - (size_t)(pq->max * sizeof( pq->keys[0] ))); + (unsigned int)(pq->max * sizeof( pq->keys[0] ))); if (pq->keys == NULL) { pq->keys = saveKey; // restore ptr to free upon return return INV_HANDLE; diff --git a/src/libtess2/sweep.c b/src/libtess2/sweep.c index 0204d3e8a..49559fa12 100755 --- a/src/libtess2/sweep.c +++ b/src/libtess2/sweep.c @@ -428,9 +428,12 @@ static void VertexWeights( TESSvertex *isect, TESSvertex *org, TESSvertex *dst, } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" static void GetIntersectData( TESStesselator *tess, TESSvertex *isect, TESSvertex *orgUp, TESSvertex *dstUp, TESSvertex *orgLo, TESSvertex *dstLo ) +#pragma GCC diagnostic pop /* * We've computed a new intersection point, now we need a "data" pointer * from the user so that we can refer to this new vertex in the diff --git a/src/libtess2/tess.c b/src/libtess2/tess.c index ad7147837..80c5b70f4 100755 --- a/src/libtess2/tess.c +++ b/src/libtess2/tess.c @@ -46,17 +46,6 @@ #define Dot(u,v) (u[0]*v[0] + u[1]*v[1] + u[2]*v[2]) -static void Normalize( TESSreal v[3] ) -{ - TESSreal len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - - assert( len > 0 ); - len = sqrtf( len ); - v[0] /= len; - v[1] /= len; - v[2] /= len; -} - #define ABS(x) ((x) < 0 ? -(x) : (x)) static int LongAxis( TESSreal v[3] ) @@ -436,6 +425,8 @@ int tessMeshSetWindingNumber( TESSmesh *mesh, int value, return 1; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" void* heapAlloc( void* userData, unsigned int size ) { return malloc( size ); @@ -450,6 +441,7 @@ void heapFree( void* userData, void* ptr ) { free( ptr ); } +#pragma GCC diagnostic pop static TESSalloc defaulAlloc = { From fd5b07d353bbf4b108eb986a3066304a12411ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 12:45:42 +0200 Subject: [PATCH 21/25] don't pass on boost path; it's unneeded --- mapboxgl.gyp | 2 -- 1 file changed, 2 deletions(-) diff --git a/mapboxgl.gyp b/mapboxgl.gyp index a0ad3212d..bdecb94d0 100644 --- a/mapboxgl.gyp +++ b/mapboxgl.gyp @@ -165,7 +165,6 @@ 'xcode_settings': { 'OTHER_CPLUSPLUSFLAGS': [ '<@(uv_cflags)', - '-I<(boost_root)/include', ], 'OTHER_LDFLAGS': [ '<@(png_libraries)', @@ -177,7 +176,6 @@ }, { 'cflags': [ '<@(uv_cflags)', - '-I<(boost_root)/include', ], 'libraries': [ '<@(png_libraries)', From 352bd095d46d09e7d47bcb52874f23c4bd8faa51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 04:17:43 -0700 Subject: [PATCH 22/25] GCC doesn't like #pragmas between the function declaration and definition --- src/libtess2/sweep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libtess2/sweep.c b/src/libtess2/sweep.c index 49559fa12..be3ee561c 100755 --- a/src/libtess2/sweep.c +++ b/src/libtess2/sweep.c @@ -433,7 +433,6 @@ static void VertexWeights( TESSvertex *isect, TESSvertex *org, TESSvertex *dst, static void GetIntersectData( TESStesselator *tess, TESSvertex *isect, TESSvertex *orgUp, TESSvertex *dstUp, TESSvertex *orgLo, TESSvertex *dstLo ) -#pragma GCC diagnostic pop /* * We've computed a new intersection point, now we need a "data" pointer * from the user so that we can refer to this new vertex in the @@ -447,6 +446,7 @@ static void GetIntersectData( TESStesselator *tess, TESSvertex *isect, VertexWeights( isect, orgUp, dstUp, &weights[0] ); VertexWeights( isect, orgLo, dstLo, &weights[2] ); } +#pragma GCC diagnostic pop static int CheckForRightSplice( TESStesselator *tess, ActiveRegion *regUp ) /* From f701fb340fb01e0561ca77559473bc4aa09dc6d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 04:18:05 -0700 Subject: [PATCH 23/25] GCC doesn't like {} initialization --- src/style/function_properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/style/function_properties.cpp b/src/style/function_properties.cpp index 346efe65b..69466c1f6 100644 --- a/src/style/function_properties.cpp +++ b/src/style/function_properties.cpp @@ -18,10 +18,10 @@ template T StopsFunction::evaluate(float z) const { bool smaller = false; float smaller_z = 0.0f; - T smaller_val {}; + T smaller_val = T(); bool larger = false; float larger_z = 0.0f; - T larger_val {}; + T larger_val = T(); for (uint32_t i = 0; i < values.size(); i++) { float stop_z = values[i].first; From c6e4cf2f80216c7139b6587dcd6d919080aef20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 04:20:35 -0700 Subject: [PATCH 24/25] use ASSERT_FALSE for boolean comparisons --- test/enums.cpp | 4 ++-- test/style_parser.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/enums.cpp b/test/enums.cpp index dce20ca59..67ff0aa7e 100644 --- a/test/enums.cpp +++ b/test/enums.cpp @@ -31,7 +31,7 @@ TEST(Enums, StyleLayerType) { ASSERT_EQ(StyleLayerTypeClass(StyleLayerType::Raster), StyleLayerTypeClass(StyleLayerType::Raster)); ASSERT_EQ(StyleLayerTypeClass(StyleLayerType::Background), StyleLayerTypeClass(StyleLayerType::Background)); - ASSERT_EQ(false, StyleLayerTypeClass("").valid()); - ASSERT_EQ(false, StyleLayerTypeClass("Backgrund").valid()); + ASSERT_FALSE(StyleLayerTypeClass("").valid()); + ASSERT_FALSE(StyleLayerTypeClass("Backgrund").valid()); } diff --git a/test/style_parser.cpp b/test/style_parser.cpp index d530fe1f8..fe237b788 100644 --- a/test/style_parser.cpp +++ b/test/style_parser.cpp @@ -34,8 +34,8 @@ TEST_P(StyleParserTest, ParseStyle) { // Parse settings. rapidjson::Document doc; doc.Parse<0>((const char *const)info.c_str()); - ASSERT_EQ(false, doc.HasParseError()); - ASSERT_EQ(true, doc.IsObject()); + ASSERT_FALSE(doc.HasParseError()); + ASSERT_TRUE(doc.IsObject()); std::ifstream stylefile(style_path); ASSERT_TRUE(stylefile.good()); From 251fafe2bf6dff34868a4e32953adcb73cb20db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 22 Oct 2014 15:05:33 +0200 Subject: [PATCH 25/25] don't check for node in the current bash. we are using our own anyway --- Makefile | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c74a32806..06b38ec34 100644 --- a/Makefile +++ b/Makefile @@ -11,13 +11,10 @@ config-ios.gypi: MASON_PLATFORM=ios ./configure config-ios.gypi # Builds the regular library -mbgl: config.gypi mapboxgl.gyp node +mbgl: config.gypi mapboxgl.gyp deps/run_gyp mapboxgl.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mapboxgl -node: - @if [ ! `which node` ]; then echo 'error: depends on node.js. please make sure node is on your PATH'; exit 1; fi; - ##### Test cases ############################################################### build/test/Makefile: src common config.gypi test/test.gyp @@ -31,7 +28,7 @@ test_%: build/test/Makefile (cd build/$(BUILDTYPE) && exec ./test_$*) # build Mac OS X project for Xcode -xtest: config.gypi clear_xcode_cache node +xtest: config.gypi clear_xcode_cache deps/run_gyp test/test.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build -f xcode open ./build/test/test.xcodeproj @@ -39,7 +36,7 @@ xtest: config.gypi clear_xcode_cache node # Builds the linux app with make. -linux: config.gypi linux/mapboxgl-app.gyp node +linux: config.gypi linux/mapboxgl-app.gyp deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make $(MAKE) -C build/linux BUILDTYPE=$(BUILDTYPE) V=$(V) linuxapp @@ -50,7 +47,7 @@ run-linux: linux # Builds the OS X app with make. -osx: config.gypi macosx/mapboxgl-app.gyp node +osx: config.gypi macosx/mapboxgl-app.gyp deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi --depth=. -Goutput_dir=.. --generator-output=./build/macosx -f make $(MAKE) -C build/macosx BUILDTYPE=$(BUILDTYPE) V=$(V) osxapp @@ -72,21 +69,21 @@ clear_xcode_cache: fi # build Mac OS X project for Xcode -xproj-cli: config.gypi macosx/mapboxgl-app.gyp clear_xcode_cache node +xproj-cli: config.gypi macosx/mapboxgl-app.gyp clear_xcode_cache deps/run_gyp macosx/mapboxgl-app.gyp -Iconfig.gypi --depth=. --generator-output=./build -f xcode xproj: xproj-cli open ./build/macosx/mapboxgl-app.xcodeproj # build iOS project for Xcode -iproj-cli: config-ios.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node +iproj-cli: config-ios.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp -Iconfig-ios.gypi --depth=. --generator-output=./build -f xcode iproj: iproj-cli open ./build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj # build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code) -lproj: config.gypi linux/mapboxgl-app.gyp clear_xcode_cache node +lproj: config.gypi linux/mapboxgl-app.gyp clear_xcode_cache deps/run_gyp linux/mapboxgl-app.gyp -Iconfig.gypi --depth=. --generator-output=./build -f xcode open ./build/linux/mapboxgl-app.xcodeproj