2014-12-05 06:54:19 -08:00
|
|
|
#!/bin/bash -e
|
2016-10-15 08:59:23 -07:00
|
|
|
. util/travis/common.sh
|
2017-04-06 00:10:59 -07:00
|
|
|
. util/travis/lint.sh
|
2016-10-15 08:59:23 -07:00
|
|
|
|
|
|
|
needs_compile || exit 0
|
2014-12-05 06:54:19 -08:00
|
|
|
|
2017-03-25 11:12:18 -07:00
|
|
|
if [[ "$LINT" == "1" ]]; then
|
|
|
|
# Lint with exit CI
|
|
|
|
perform_lint
|
2017-03-26 05:07:07 -07:00
|
|
|
exit 0
|
2017-03-25 11:12:18 -07:00
|
|
|
fi
|
|
|
|
|
2017-05-26 08:03:46 -07:00
|
|
|
set_linux_compiler_env
|
|
|
|
|
|
|
|
if [[ ${PLATFORM} == "Unix" ]]; then
|
2014-12-05 06:54:19 -08:00
|
|
|
mkdir -p travisbuild
|
2016-03-18 22:21:58 -07:00
|
|
|
cd travisbuild || exit 1
|
2017-03-25 11:12:18 -07:00
|
|
|
|
2016-03-18 22:21:58 -07:00
|
|
|
CMAKE_FLAGS=''
|
2017-03-25 11:12:18 -07:00
|
|
|
|
2017-05-26 08:03:46 -07:00
|
|
|
if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then
|
2016-01-29 06:15:58 -08:00
|
|
|
CMAKE_FLAGS+=' -DCUSTOM_GETTEXT_PATH=/usr/local/opt/gettext'
|
|
|
|
fi
|
2017-03-25 11:12:18 -07:00
|
|
|
|
2016-03-18 22:21:58 -07:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DRUN_IN_PLACE=TRUE \
|
|
|
|
-DENABLE_GETTEXT=TRUE \
|
2017-01-04 05:36:51 -08:00
|
|
|
-DBUILD_SERVER=TRUE \
|
2017-05-26 08:03:46 -07:00
|
|
|
${CMAKE_FLAGS} ..
|
2014-12-05 06:54:19 -08:00
|
|
|
make -j2
|
2017-03-06 11:34:02 -08:00
|
|
|
|
2015-02-27 15:05:29 -08:00
|
|
|
echo "Running unit tests."
|
2017-03-06 11:34:02 -08:00
|
|
|
CMD="../bin/minetest --run-unittests"
|
2017-05-26 08:03:46 -07:00
|
|
|
if [[ "${VALGRIND}" == "1" ]]; then
|
2017-03-06 11:34:02 -08:00
|
|
|
valgrind --leak-check=full --leak-check-heuristics=all --undef-value-errors=no --error-exitcode=9 ${CMD} && exit 0
|
|
|
|
else
|
|
|
|
${CMD} && exit 0
|
|
|
|
fi
|
|
|
|
|
2015-02-27 15:05:29 -08:00
|
|
|
elif [[ $PLATFORM == Win* ]]; then
|
|
|
|
[[ $CC == "clang" ]] && exit 1 # Not supposed to happen
|
2014-12-05 06:54:19 -08:00
|
|
|
# We need to have our build directory outside of the minetest directory because
|
|
|
|
# CMake will otherwise get very very confused with symlinks and complain that
|
|
|
|
# something is not a subdirectory of something even if it actually is.
|
|
|
|
# e.g.:
|
|
|
|
# /home/travis/minetest/minetest/travisbuild/minetest
|
|
|
|
# \/ \/ \/
|
|
|
|
# /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest
|
|
|
|
# \/ \/ \/
|
|
|
|
# /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest
|
|
|
|
# You get the idea.
|
2015-02-27 15:05:29 -08:00
|
|
|
OLDDIR=$(pwd)
|
2014-12-05 06:54:19 -08:00
|
|
|
cd ..
|
2015-02-27 15:05:29 -08:00
|
|
|
export EXISTING_MINETEST_DIR=$OLDDIR
|
|
|
|
export NO_MINETEST_GAME=1
|
|
|
|
if [[ $PLATFORM == "Win32" ]]; then
|
2016-03-18 22:21:58 -07:00
|
|
|
"$OLDDIR/util/buildbot/buildwin32.sh" travisbuild && exit 0
|
2015-02-27 15:05:29 -08:00
|
|
|
elif [[ $PLATFORM == "Win64" ]]; then
|
2016-03-18 22:21:58 -07:00
|
|
|
"$OLDDIR/util/buildbot/buildwin64.sh" travisbuild && exit 0
|
2015-02-27 15:05:29 -08:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Unknown platform \"${PLATFORM}\"."
|
|
|
|
exit 1
|
2014-12-05 06:54:19 -08:00
|
|
|
fi
|
2015-02-27 15:05:29 -08:00
|
|
|
|