summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-04-03 15:16:49 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-07 18:01:02 -0700
commitf964e40e7e9220d08751d8607af61ac5a7c0794c (patch)
treed34ca5407188fe3d71396faa8a8acceb52d9bd4b /scripts
parentf5d66f362272db034a311d2077dbdb2937c9bbdf (diff)
downloadqtlocation-mapboxgl-f964e40e7e9220d08751d8607af61ac5a7c0794c.tar.gz
[build] Refactor and simplify build system
* Main gyp files are now standardized as platform/<platform>/platform.gyp. * Each platform gyp file defines appropriate loop_lib and headless_lib variables. * Each platform gyp file includes mbgl.gypi, which defines base targets which may be useful to all platforms. * CI targets are consistent across platforms: `make $(PLATFORM) && make test-$(PLATFORM)`. * Renamed the "linux" test app to "glfw". It's now built in OS X CI. * Android build flakiness is fixed. * iOS CI builds the bench and iosapp targets. * Mesa version is now in one place. * CI scripts use bash "strict mode" and correct error handling. * All build output goes to the build directory. * Removed vestigial iOS/OS X/Android Travis scripts.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clang-tidy.sh2
-rwxr-xr-xscripts/collect-coverage.sh18
-rwxr-xr-xscripts/coveralls.sh37
-rwxr-xr-xscripts/flock.py29
-rw-r--r--scripts/main.mk198
-rwxr-xr-xscripts/run_tests.sh32
-rwxr-xr-xscripts/tidy.sh17
-rwxr-xr-xscripts/travis_setup.sh (renamed from scripts/set_compiler.sh)29
8 files changed, 135 insertions, 227 deletions
diff --git a/scripts/clang-tidy.sh b/scripts/clang-tidy.sh
index a0a0aa20e4..ee3c1193ea 100755
--- a/scripts/clang-tidy.sh
+++ b/scripts/clang-tidy.sh
@@ -13,7 +13,7 @@ command -v ${CLANG_TIDY:-clang-tidy} >/dev/null 2>&1 || {
exit 1
}
-cd build/${HOST}-${HOST_VERSION}/${BUILDTYPE}
+cd build/${PLATFORM}-${SUBPLATFORM}/${BUILDTYPE}
git ls-files '../../../src/mbgl/*.cpp' '../../../platform/*.cpp' '../../../test/*.cpp' | \
xargs -I{} -P ${JOBS} ${CLANG_TIDY:-clang-tidy} -header-filter='\/mbgl\/' {}
diff --git a/scripts/collect-coverage.sh b/scripts/collect-coverage.sh
index 0007eebd5b..2e8ad9550b 100755
--- a/scripts/collect-coverage.sh
+++ b/scripts/collect-coverage.sh
@@ -25,12 +25,12 @@ command -v genhtml >/dev/null 2>&1 || usage
lcov \
--quiet \
--zerocounters \
- --directory "build/${HOST_SLUG}/${BUILDTYPE}" \
- --output-file "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" \
+ --directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \
+ --output-file "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \
>/dev/null 2>&1
# Run all unit tests
-./scripts/run_tests.sh "build/${HOST_SLUG}/${BUILDTYPE}/test"
+make test-*
# Collect coverage data and save it into coverage.info
echo "Collecting coverage data..."
@@ -41,9 +41,9 @@ lcov \
--directory "src/mbgl" \
--directory "platform" \
--directory "include/mbgl" \
- --directory "build/${HOST_SLUG}/${BUILDTYPE}" \
- --base-directory "build/${HOST_SLUG}/${BUILDTYPE}" \
- --output-file "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" \
+ --directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \
+ --base-directory "build/${PLATFORM_SLUG}/${BUILDTYPE}" \
+ --output-file "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \
>/dev/null 2>&1
# Generate HTML report based on coverage.info
@@ -59,8 +59,8 @@ genhtml \
--sort \
--demangle-cpp \
--prefix $(pwd -P) \
- --output-directory "build/${HOST_SLUG}/${BUILDTYPE}/coverage" \
- "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info" \
+ --output-directory "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage" \
+ "build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage.info" \
>/dev/null 2>&1
-echo "Coverage report is now available in build/${HOST_SLUG}/${BUILDTYPE}/coverage/index.html"
+echo "Coverage report is now available in build/${PLATFORM_SLUG}/${BUILDTYPE}/coverage/index.html"
diff --git a/scripts/coveralls.sh b/scripts/coveralls.sh
deleted file mode 100755
index 79e398dc1f..0000000000
--- a/scripts/coveralls.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-set -o pipefail
-
-PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
-
-mapbox_time "install_lcov" \
-mason install lcov 1.12
-
-LCOV="`mason prefix lcov 1.12`/usr/bin/lcov"
-
-mapbox_time "check_mason_lcov" \
-command -v $LCOV > /dev/null 2>&1 || exit 1
-
-mapbox_time "remove_coverage_info" \
-rm -f "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info"
-
-# Run all unit tests
-./scripts/run_tests.sh "build/${HOST_SLUG}/${BUILDTYPE}/test"
-
-# Collect coverage data and save it into coverage.info
-mapbox_time "lcov_capture" \
-$LCOV \
- --quiet \
- --capture \
- --no-external \
- --gcov-tool "gcov-4.9" \
- --directory "src/mbgl" \
- --directory "platform" \
- --directory "include/mbgl" \
- --directory "build/${HOST_SLUG}/${BUILDTYPE}" \
- --base-directory "build/${HOST_SLUG}/${BUILDTYPE}" \
- --output-file "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info"
-
-mapbox_time "coveralls_upload" \
-coveralls-lcov "build/${HOST_SLUG}/${BUILDTYPE}/coverage.info"
diff --git a/scripts/flock.py b/scripts/flock.py
deleted file mode 100755
index 6ceb585cdc..0000000000
--- a/scripts/flock.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-
-import fcntl, os, subprocess, sys, errno
-
-# from http://stackoverflow.com/a/600612
-def mkdir_p(path):
- try:
- os.makedirs(path)
- except OSError as exc: # Python >2.5
- if exc.errno == errno.EEXIST and os.path.isdir(path):
- pass
- else: raise
-
-def flock(lockfile, cmd_list, verbose = False):
- mkdir_p(os.path.dirname(lockfile))
- fd = os.open(lockfile, os.O_RDONLY | os.O_NOCTTY | os.O_CREAT, 0o666)
- fcntl.flock(fd, fcntl.LOCK_EX)
- if verbose:
- print(' '.join(cmd_list))
- return subprocess.call(cmd_list)
-
-if '__main__' == __name__:
- try:
- if sys.argv[1] == '-v':
- sys.exit(flock(sys.argv[2], sys.argv[3:], True))
- else:
- sys.exit(flock(sys.argv[1], sys.argv[2:]))
- except KeyboardInterrupt:
- sys.exit(1)
diff --git a/scripts/main.mk b/scripts/main.mk
index d10fa39d52..a0e6a0d67a 100644
--- a/scripts/main.mk
+++ b/scripts/main.mk
@@ -1,31 +1,39 @@
-ifeq (,$(V))
- QUIET = @
+ifeq ($(shell uname -s), Darwin)
+ export PLATFORM ?= osx
+else ifeq ($(shell uname -s), Linux)
+ export PLATFORM ?= linux
endif
-# Determine host platform
-export HOST ?= $(BUILD)
-
-# Defines host defaults
-include platform/$(HOST)/scripts/defaults.mk
-
-export HOST_VERSION ?= $(BUILD_VERSION)
-
-# Optionally include version-specific host defaults
--include scripts/$(HOST)/$(HOST_VERSION)/defaults.mk
--include platform/$(HOST)/scripts/$(HOST_VERSION)/defaults.mk
-
-export MASON_PLATFORM=$(HOST)
-export MASON_PLATFORM_VERSION=$(HOST_VERSION)
-
-export HOST_SLUG = $(HOST)-$(HOST_VERSION)
-CONFIGURE_FILES = platform/$(HOST)/scripts/configure.sh
-ifneq (,$(wildcard scripts/$(HOST)/$(HOST_VERSION)/configure.sh))
- CONFIGURE_FILES += scripts/$(HOST)/$(HOST_VERSION)/configure.sh
+ifeq ($(PLATFORM),android)
+ export SUBPLATFORM ?= arm-v7
+ GYP_FLAVOR_SUFFIX = -android
+ ENV = $(shell MASON_ANDROID_ABI=$(SUBPLATFORM) ./platform/android/scripts/toolchain.sh)
+else ifeq ($(PLATFORM),ios)
+ export SUBPLATFORM = all
+else ifeq ($(PLATFORM),osx)
+ export SUBPLATFORM = x86_64
+else
+ export SUBPLATFORM ?= $(shell uname -m)
endif
-ifneq (,$(wildcard platform/$(HOST)/scripts/$(HOST_VERSION)/configure.sh))
- CONFIGURE_FILES += platform/$(HOST)/scripts/$(HOST_VERSION)/configure.sh
+
+ifneq ($(PLATFORM),node)
+ export MASON_PLATFORM = $(PLATFORM)
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = $(PLATFORM)-$(SUBPLATFORM)
+else ifeq ($(shell uname -s), Darwin)
+ export MASON_PLATFORM = osx
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = node-osx-$(SUBPLATFORM)
+else ifeq ($(shell uname -s), Linux)
+ export MASON_PLATFORM = linux
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = node-linux-$(SUBPLATFORM)
endif
+export PLATFORM_OUTPUT = ./build/$(PLATFORM_SLUG)
+export PLATFORM_CONFIG_INPUT = platform/$(MASON_PLATFORM)/scripts/configure.sh
+export PLATFORM_CONFIG_OUTPUT = $(PLATFORM_OUTPUT)/config.gypi
+
ifneq (,$(findstring clang,$(CXX)))
CXX_HOST = "clang"
else ifneq (,$(findstring g++,$(CXX)))
@@ -39,155 +47,107 @@ COLOR_CYAN = \033[36m
COLOR_PINK = \033[35m
FORMAT_END = \033[0m
-default: ;
+# Never remove intermediate files
+.SECONDARY:
#### Dependencies ##############################################################
ifneq (,$(wildcard .git/.))
-SUBMODULES += .mason/mason.sh
-.mason/mason.sh:
- ./scripts/flock.py .git/Submodule.lock git submodule update --init .mason
-
-ifeq ($(HOST),ios)
-SUBMODULES += platform/ios/vendor/SMCalloutView/SMCalloutView.h
-platform/ios/vendor/SMCalloutView/SMCalloutView.h:
- ./scripts/flock.py .git/Submodule.lock git submodule update --init platform/ios/vendor/SMCalloutView
-
-SUBMODULES += platform/ios/test/KIF/KIF.xcodeproj
-platform/ios/test/KIF/KIF.xcodeproj:
- ./scripts/flock.py .git/Submodule.lock git submodule update --init platform/ios/test/KIF
+.mason:
+ git submodule update --init
+else
+.mason: ;
endif
-endif
-
-# Wildcard targets get removed after build by default, but we want to preserve the config.
-.PRECIOUS: config/%.gypi
-config/%.gypi: $(SUBMODULES) configure $(CONFIGURE_FILES)
- @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
- $(QUIET)$(ENV) ./scripts/flock.py build/Configure.lock ./configure config/$*.gypi
-.PHONY: config
-config: config/$(HOST_SLUG).gypi
+$(PLATFORM_CONFIG_OUTPUT): .mason configure $(PLATFORM_CONFIG_INPUT)
+ @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Running configure...$(FORMAT_END)\n"
+ $(ENV) ./configure $(PLATFORM_CONFIG_INPUT) $(PLATFORM_CONFIG_OUTPUT)
#### Build files ###############################################################
-GYP_FLAGS += -Dhost=$(HOST)
-GYP_FLAGS += -Iconfig/$(HOST_SLUG).gypi
-GYP_FLAGS += -Dplatform_lib=$(PLATFORM)
-GYP_FLAGS += -Dhttp_lib=$(HTTP)
-GYP_FLAGS += -Dloop_lib=$(LOOP)
-GYP_FLAGS += -Dasset_lib=$(ASSET)
-GYP_FLAGS += -Dheadless_lib=$(HEADLESS)
-GYP_FLAGS += -Dtest=$(BUILD_TEST)
-GYP_FLAGS += -Drender=$(BUILD_RENDER)
-GYP_FLAGS += -Doffline=$(BUILD_OFFLINE)
+GYP_FLAGS += -I$(PLATFORM_CONFIG_OUTPUT)
GYP_FLAGS += -Dcoverage=$(ENABLE_COVERAGE)
GYP_FLAGS += -Dcxx_host=$(CXX_HOST)
-GYP_FLAGS += --depth=.
GYP_FLAGS += -Goutput_dir=.
-GYP_FLAGS += --generator-output=./build/$(HOST_SLUG)
+GYP_FLAGS += --depth=.
+GYP_FLAGS += --generator-output=$(PLATFORM_OUTPUT)
.PHONY: Makefile/__project__
-Makefile/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi
+Makefile/__project__: $(PLATFORM_CONFIG_OUTPUT)
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
- $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) \
- -f make$(GYP_FLAVOR_SUFFIX)
+ $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f make$(GYP_FLAVOR_SUFFIX)
.PHONY: Xcode/__project__
-Xcode/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi
+Xcode/__project__: $(PLATFORM_CONFIG_OUTPUT)
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
- $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) \
- -f xcode$(GYP_FLAVOR_SUFFIX)
+ $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f xcode$(GYP_FLAVOR_SUFFIX)
.PHONY: Ninja/__project__
-Ninja/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi
+Ninja/__project__: $(PLATFORM_CONFIG_OUTPUT)
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n"
- $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp -Gconfig=$(BUILDTYPE) $(GYP_FLAGS) \
- -f ninja
+ $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f ninja
-#### Build individual targets ##################################################
+#### Node targets ##############################################################
NODE_PRE_GYP = $(shell npm bin)/node-pre-gyp
-node/configure:
- $(QUIET)$(ENV) $(NODE_PRE_GYP) configure --clang -- \
- $(GYP_FLAGS) -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs=
-node/xproj: Xcode/__project__ node/configure
- $(QUIET)$(ENV) $(NODE_PRE_GYP) configure --clang -- \
- $(GYP_FLAGS) -f xcode -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs=
- $(QUIET)$(ENV) ./platform/node/scripts/create_node_scheme.sh "node test" "`npm bin tape`/tape platform/node/test/js/**/*.test.js"
- $(QUIET)$(ENV) ./platform/node/scripts/create_node_scheme.sh "npm run test-suite" "platform/node/test/render.test.js"
+Makefile/node: $(PLATFORM_CONFIG_OUTPUT)
+ $(NODE_PRE_GYP) configure --clang -- $(GYP_FLAGS) \
+ -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs=
+ $(NODE_PRE_GYP) build --clang
-Makefile/node: Makefile/__project__ node/configure
- @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target node...$(FORMAT_END)\n"
- $(QUIET)$(ENV) $(NODE_PRE_GYP) build --clang -- \
- -j$(JOBS)
+Xcode/node: $(PLATFORM_CONFIG_OUTPUT)
+ $(NODE_PRE_GYP) configure --clang -- $(GYP_FLAGS) -f xcode \
+ -Dlibuv_cflags= -Dlibuv_ldflags= -Dlibuv_static_libs=
+
+#### Build individual targets ##################################################
Makefile/%: Makefile/__project__
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n"
- $(QUIET)$(ENV) $(MAKE) -C build/$(HOST_SLUG) BUILDTYPE=$(BUILDTYPE) $*
-
-Xcode/node: Xcode/__project__ node/xproj
- @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target node...$(FORMAT_END)\n"
- xcodebuild \
- $(XCODEBUILD_ARGS) \
- -project ./build/binding.xcodeproj \
- -configuration $(BUILDTYPE) \
- -target mapbox-gl-native \
- -jobs $(JOBS)
+ $(ENV) $(MAKE) -j$(JOBS) -C $(PLATFORM_OUTPUT) BUILDTYPE=$(BUILDTYPE) $*
Xcode/%: Xcode/__project__
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n"
xcodebuild \
- PROVISIONING_PROFILE="$(PROVISIONING_PROFILE)" \
- $(XCODEBUILD_ARGS) \
- -project ./build/$(HOST_SLUG)/gyp/$(HOST).xcodeproj \
+ CODE_SIGNING_REQUIRED=NO \
+ CODE_SIGN_IDENTITY= \
+ -project $(PLATFORM_OUTPUT)/platform/$(PLATFORM)/platform.xcodeproj \
-configuration $(BUILDTYPE) \
-target $* \
-jobs $(JOBS)
Ninja/%: Ninja/__project__
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n"
- $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) $*
+ $(ENV) deps/ninja/ninja-$(PLATFORM) -C $(PLATFORM_OUTPUT)/$(BUILDTYPE) $*
+#### Tidy ######################################################################
-Ninja/compdb: OUTPUT=build/$(HOST_SLUG)/$(BUILDTYPE)/compile_commands.json
+Ninja/compdb: OUTPUT=$(PLATFORM_OUTPUT)/$(BUILDTYPE)/compile_commands.json
Ninja/compdb: Ninja/__project__
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Writing to $(OUTPUT)$(FORMAT_END)\n"
- $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) \
+ $(ENV) deps/ninja/ninja-$(PLATFORM) -C $(PLATFORM_OUTPUT)/$(BUILDTYPE) \
-t compdb cc cc_s cxx objc objcxx > $(OUTPUT)
-#### Tidy ######################################################################
-
tidy: Ninja/compdb
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Generating header files...$(FORMAT_END)\n"
- $(QUIET)$(ENV) deps/ninja/ninja-$(BUILD) -C build/$(HOST_SLUG)/$(BUILDTYPE) version shaders
+ $(ENV) deps/ninja/ninja-$(PLATFORM) -C $(PLATFORM_OUTPUT)/$(BUILDTYPE) version shaders
@printf "$(TEXT_BOLD)$(COLOR_GREEN)* Running tidy...$(FORMAT_END)\n"
@./scripts/clang-tidy.sh
#### Run tests #################################################################
-test-%: Makefile/test
- ./scripts/run_tests.sh "build/$(HOST_SLUG)/$(BUILDTYPE)/test" --gtest_filter=$*
+run-glfw-app:
+ $(PLATFORM_OUTPUT)/$(BUILDTYPE)/mapbox-glfw
-check: Makefile/test
- ./scripts/collect-coverage.sh
-
-coveralls: Makefile/test
- ./scripts/coveralls.sh
+run-valgrind-glfw-app:
+ valgrind --leak-check=full --suppressions=../../../scripts/valgrind.sup $(PLATFORM_OUTPUT)/$(BUILDTYPE)/mapbox-glfw
-#### Helper targets ############################################################
+ifneq (,$(shell command -v gdb))
+ GDB = gdb -batch -return-child-result -ex 'set print thread-events off' -ex 'run' -ex 'thread apply all bt' --args
+endif
-.PHONY: print-env
-print-env: $(SUBMODULES)
- @printf "$(COLOR_PINK)build:$(FORMAT_END) $(BUILD)/$(BUILD_VERSION)\n"
- @printf "$(COLOR_PINK)host:$(FORMAT_END) $(HOST)/$(HOST_VERSION)\n"
- @printf "$(COLOR_PINK)libs:$(FORMAT_END) "
- @printf "headless=$(COLOR_CYAN)%s$(FORMAT_END) " $(HEADLESS)
- @printf "platform=$(COLOR_CYAN)%s$(FORMAT_END) " $(PLATFORM)
- @printf "asset=$(COLOR_CYAN)%s$(FORMAT_END) " $(ASSET)
- @printf "http=$(COLOR_CYAN)%s$(FORMAT_END) " $(HTTP)
- @printf "loop=$(COLOR_CYAN)%s$(FORMAT_END) " $(LOOP)
- @printf "\n"
+test-%: Makefile/test
+ $(GDB) $(PLATFORM_OUTPUT)/$(BUILDTYPE)/test --gtest_filter=$*
-# Never remove intermediate files
-.SECONDARY:
+check: Makefile/test
+ ./scripts/collect-coverage.sh
diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh
deleted file mode 100755
index a4af39d5a9..0000000000
--- a/scripts/run_tests.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-set -o pipefail
-
-if [ `uname -s` = 'Darwin' ]; then HOST=${HOST:-osx} ; else HOST=${HOST:-linux} ; fi
-
-CMD=$@
-shift
-
-# allow writing core files
-ulimit -c unlimited -S
-echo 'ulimit -c: '`ulimit -c`
-if [ -f /proc/sys/kernel/core_pattern ]; then
- echo '/proc/sys/kernel/core_pattern: '`cat /proc/sys/kernel/core_pattern`
-fi
-
-if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
- sysctl kernel.core_pattern
-fi
-
-# install test server dependencies
-if [ ! -d "test/node_modules/express" ]; then
- (cd test; npm install express@4.11.1)
-fi
-
-if command -v gdb >/dev/null 2>&1; then
- gdb -batch -return-child-result -ex 'set print thread-events off' \
- -ex 'run' -ex 'thread apply all bt' --args ${CMD} ;
-else
- ${CMD} ;
-fi
diff --git a/scripts/tidy.sh b/scripts/tidy.sh
new file mode 100755
index 0000000000..424c82c3cd
--- /dev/null
+++ b/scripts/tidy.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+# Ensure mason is on the PATH
+export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
+
+BUILDTYPE=${BUILDTYPE:-Release}
+
+export CLANG_TIDY=clang-tidy-3.8
+
+mapbox_time "config" \
+make config
+
+mapbox_time "tidy" \
+make tidy
diff --git a/scripts/set_compiler.sh b/scripts/travis_setup.sh
index 161126f044..e9fa87811f 100755
--- a/scripts/set_compiler.sh
+++ b/scripts/travis_setup.sh
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
+# This script is sourced; do not set -e or -o pipefail here.
if [ ! -z "${_CXX}" ]; then export CXX="${_CXX}" ; fi
if [ ! -z "${_CC}" ]; then export CC="${_CC}" ; fi
@@ -25,3 +26,31 @@ fi
echo "export CXX=\"${CXX}\""
echo "export CC=\"${CC}\""
${CXX} --version
+
+# Ensure mason is on the PATH
+export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason"
+
+# Start the mock X server
+if [ -f /etc/init.d/xvfb ] ; then
+ mapbox_time "start_xvfb" \
+ sh -e /etc/init.d/xvfb start
+ sleep 2 # sometimes, xvfb takes some time to start up
+fi
+
+# Make sure we're connecting to xvfb
+export DISPLAY=:99.0
+
+mapbox_time "checkout_mason" \
+git submodule update --init .mason
+
+# Install and set up to load a more recent version of mesa
+mapbox_time "install_mesa" \
+mason install mesa 10.4.3
+export LD_LIBRARY_PATH="`mason prefix mesa 10.4.3`/lib:${LD_LIBRARY_PATH:-}"
+
+# Install and set up to load awscli
+pip install --user awscli
+export PATH="`python -m site --user-base`/bin:${PATH}"
+
+# Install coveralls gem
+gem install coveralls-lcov --no-rdoc --no-ri