2018-03-11 12:15:30 -07:00
|
|
|
_stat() {
|
|
|
|
if test "${TRAVIS_OS_NAME}" = osx ; then
|
|
|
|
stat -f %Sm "${@}"
|
|
|
|
else
|
|
|
|
stat -c %y "${@}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2017-03-31 06:02:53 -07:00
|
|
|
top_make() {
|
2018-03-09 12:55:10 -07:00
|
|
|
echo '================================================================================'
|
|
|
|
# Travis has 1.5 virtual cores according to:
|
|
|
|
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
|
|
|
|
ninja "$@"
|
2017-03-31 06:02:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
build_make() {
|
|
|
|
top_make -C "${BUILD_DIR}" "$@"
|
|
|
|
}
|
|
|
|
|
2015-07-05 00:52:36 -07:00
|
|
|
build_deps() {
|
2017-04-24 13:11:13 -07:00
|
|
|
if test "${BUILD_32BIT}" = ON ; then
|
2015-07-05 00:52:36 -07:00
|
|
|
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
|
|
|
|
fi
|
2017-05-08 05:43:45 -07:00
|
|
|
if test "${FUNCTIONALTEST}" = "functionaltest-lua" \
|
|
|
|
|| test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then
|
2016-03-06 22:18:44 -07:00
|
|
|
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
|
|
|
|
fi
|
2015-07-05 00:52:36 -07:00
|
|
|
|
2018-03-11 12:15:30 -07:00
|
|
|
mkdir -p "${DEPS_BUILD_DIR}"
|
2018-03-15 23:29:43 -07:00
|
|
|
mkdir -p "${DEPS_DOWNLOAD_DIR}"
|
2015-07-05 00:52:36 -07:00
|
|
|
|
2018-03-11 05:31:10 -07:00
|
|
|
# Use cached dependencies if $CACHE_MARKER exists.
|
2018-05-01 04:02:11 -07:00
|
|
|
if test "${CACHE_ENABLE}" = "false" ; then
|
|
|
|
export CCACHE_RECACHE=1
|
|
|
|
elif test -f "${CACHE_MARKER}" ; then
|
2018-03-11 12:15:30 -07:00
|
|
|
echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
|
2018-04-24 12:43:13 -07:00
|
|
|
cp -r "${HOME}/.cache/nvim-deps"/. "${DEPS_BUILD_DIR}"
|
2018-03-15 23:29:43 -07:00
|
|
|
cp -r "${HOME}/.cache/nvim-deps-downloads" "${DEPS_DOWNLOAD_DIR}"
|
2015-07-05 00:52:36 -07:00
|
|
|
fi
|
|
|
|
|
2015-09-08 03:48:04 -07:00
|
|
|
# Even if we're using cached dependencies, run CMake and make to
|
|
|
|
# update CMake configuration and update to newer deps versions.
|
2015-07-05 00:52:36 -07:00
|
|
|
cd "${DEPS_BUILD_DIR}"
|
|
|
|
echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
|
2018-03-09 12:55:10 -07:00
|
|
|
CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"
|
2015-07-05 00:52:36 -07:00
|
|
|
|
2017-03-31 06:02:53 -07:00
|
|
|
if ! top_make; then
|
2015-07-05 00:52:36 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "${TRAVIS_BUILD_DIR}"
|
|
|
|
}
|
|
|
|
|
2016-09-10 12:48:45 -07:00
|
|
|
prepare_build() {
|
2017-04-24 12:14:32 -07:00
|
|
|
if test -n "${CLANG_SANITIZER}" ; then
|
2015-07-05 00:52:36 -07:00
|
|
|
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
|
|
|
|
fi
|
2017-04-24 13:11:13 -07:00
|
|
|
if test "${BUILD_32BIT}" = ON ; then
|
2015-07-05 00:52:36 -07:00
|
|
|
CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${BUILD_DIR}"
|
|
|
|
cd "${BUILD_DIR}"
|
2016-09-10 12:48:45 -07:00
|
|
|
echo "Configuring with '${CMAKE_FLAGS} $@'."
|
2018-03-09 12:55:10 -07:00
|
|
|
cmake -G Ninja ${CMAKE_FLAGS} "$@" "${TRAVIS_BUILD_DIR}"
|
2016-09-10 12:48:45 -07:00
|
|
|
}
|
2015-07-05 00:52:36 -07:00
|
|
|
|
2016-09-10 12:48:45 -07:00
|
|
|
build_nvim() {
|
2015-07-05 00:52:36 -07:00
|
|
|
echo "Building nvim."
|
2017-04-24 12:14:32 -07:00
|
|
|
if ! top_make nvim ; then
|
2015-07-05 00:52:36 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-04-24 13:11:13 -07:00
|
|
|
if test "$CLANG_SANITIZER" != "TSAN" ; then
|
2015-08-28 08:29:15 -07:00
|
|
|
echo "Building libnvim."
|
2017-04-24 12:14:32 -07:00
|
|
|
if ! top_make libnvim ; then
|
2015-08-28 08:29:15 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
2015-07-05 00:52:36 -07:00
|
|
|
|
2018-02-01 11:27:51 -07:00
|
|
|
if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
|
|
|
|
echo "Building nvim-test."
|
|
|
|
if ! top_make nvim-test ; then
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-08-28 08:29:15 -07:00
|
|
|
fi
|
2015-07-05 00:52:36 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Invoke nvim to trigger *San early.
|
2017-04-24 12:14:32 -07:00
|
|
|
if ! (bin/nvim --version && bin/nvim -u NONE -e -c ':qall') ; then
|
2015-08-28 08:29:15 -07:00
|
|
|
asan_check "${LOG_DIR}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
asan_check "${LOG_DIR}"
|
2015-09-08 03:48:04 -07:00
|
|
|
|
2015-07-05 00:52:36 -07:00
|
|
|
|
|
|
|
cd "${TRAVIS_BUILD_DIR}"
|
|
|
|
}
|
2018-01-06 09:56:43 -07:00
|
|
|
|
|
|
|
macos_rvm_dance() {
|
|
|
|
# neovim-ruby gem requires a ruby newer than the macOS default.
|
|
|
|
source ~/.rvm/scripts/rvm
|
|
|
|
rvm get stable --auto-dotfiles
|
|
|
|
rvm reload
|
|
|
|
rvm use 2.2.5
|
|
|
|
rvm use
|
|
|
|
}
|