From 93fcab952b28f4db39d9326b83f14cbd86c0cf17 Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Fri, 27 Feb 2015 18:05:29 -0500 Subject: Clean up and tweak build system * Combine client and server man pages. * Update unit test options and available databases in man page. * Add `--worldname` to man page. * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`. * Disable server build by default on all operating systems. * Make `ENABLE_FREETYPE` not fail if FreeType isn't found. * Enable LevelDB, Redis, and FreeType detection by default. * Remove the `VERSION_PATCH_ORIG` hack. * Add option to search for and use system JSONCPP. * Remove broken LuaJIT version detection. * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`. * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`. * Clean up style of CMake files. --- util/travis/before_install.sh | 32 ++++++++++++++++---------------- util/travis/script.sh | 36 +++++++++++++++++++++++++----------- util/travis/toolchain_mingw.cmake.in | 23 ++++++++++++----------- 3 files changed, 53 insertions(+), 38 deletions(-) (limited to 'util') diff --git a/util/travis/before_install.sh b/util/travis/before_install.sh index a50d5f370..15f5da023 100755 --- a/util/travis/before_install.sh +++ b/util/travis/before_install.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -if [ $CC = "clang" ]; then +if [[ $CC == "clang" ]]; then export PATH="/usr/bin/:$PATH" sudo sh -c 'echo "deb http://ppa.launchpad.net/eudoxos/llvm-3.1/ubuntu precise main" >> /etc/apt/sources.list' sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 92DE8183 @@ -9,24 +9,24 @@ if [ $CC = "clang" ]; then sudo apt-get install clang fi sudo apt-get install p7zip-full -if [ $WINDOWS = "no" ]; then +if [[ $PLATFORM == "Linux" ]]; then sudo apt-get install libirrlicht-dev cmake libbz2-dev libpng12-dev \ - libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libhiredis-dev \ - libogg-dev libvorbis-dev libopenal-dev gettext + libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \ + libhiredis-dev libogg-dev libvorbis-dev libopenal-dev gettext # Linking to LevelDB is broken, use a custom build wget http://sfan5.pf-control.de/libleveldb-1.18-ubuntu12.04.7z sudo 7z x -o/usr libleveldb-1.18-ubuntu12.04.7z -else - if [ $WINDOWS = "32" ]; then - wget http://sfan5.pf-control.de/mingw_w64_i686_ubuntu12.04_4.9.1.7z -O mingw.7z - sed -e "s|%PREFIX%|i686-w64-mingw32|" \ - -e "s|%ROOTPATH%|/usr/i686-w64-mingw32|" \ - < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw.cmake - elif [ $WINDOWS = "64" ]; then - wget http://sfan5.pf-control.de/mingw_w64_x86_64_ubuntu12.04_4.9.1.7z -O mingw.7z - sed -e "s|%PREFIX%|x86_64-w64-mingw32|" \ - -e "s|%ROOTPATH%|/usr/x86_64-w64-mingw32|" \ - < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw64.cmake - fi +elif [[ $PLATFORM == "Win32" ]]; then + wget http://sfan5.pf-control.de/mingw_w64_i686_ubuntu12.04_4.9.1.7z -O mingw.7z + sed -e "s|%PREFIX%|i686-w64-mingw32|" \ + -e "s|%ROOTPATH%|/usr/i686-w64-mingw32|" \ + < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw.cmake + sudo 7z x -y -o/usr mingw.7z +elif [[ $PLATFORM == "Win64" ]]; then + wget http://sfan5.pf-control.de/mingw_w64_x86_64_ubuntu12.04_4.9.1.7z -O mingw.7z + sed -e "s|%PREFIX%|x86_64-w64-mingw32|" \ + -e "s|%ROOTPATH%|/usr/x86_64-w64-mingw32|" \ + < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw64.cmake sudo 7z x -y -o/usr mingw.7z fi + diff --git a/util/travis/script.sh b/util/travis/script.sh index 35a62f16e..756cc1de8 100755 --- a/util/travis/script.sh +++ b/util/travis/script.sh @@ -1,16 +1,21 @@ #!/bin/bash -e -if [ $WINDOWS = "no" ]; then +if [[ $PLATFORM == "Linux" ]]; then mkdir -p travisbuild cd travisbuild - cmake -DENABLE_GETTEXT=1 -DENABLE_LEVELDB=1 -DENABLE_REDIS=1 -DCMAKE_BUILD_TYPE=Debug .. + CMAKE_FLAGS='-DCMAKE_BUILD_TYPE=Debug \ + -DRUN_IN_PLACE=TRUE \ + -DENABLE_GETTEXT=TRUE' + # Clang builds with FreeType fail on Travis + if [[ $CC == "clang" ]]; then + CMAKE_FLAGS+=' -DENABLE_FREETYPE=FALSE' + fi + cmake $CMAKE_FLAGS .. make -j2 - echo "Running unit tests for minetest" - ../bin/minetest --run-unittests - echo "Running unit tests for minetestserver" - ../bin/minetestserver --run-unittests -else - [ $CC = "clang" ] && exit 1 # Not supposed to happen + echo "Running unit tests." + ../bin/minetest --run-unittests && exit 0 +elif [[ $PLATFORM == Win* ]]; then + [[ $CC == "clang" ]] && exit 1 # Not supposed to happen # 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. @@ -21,8 +26,17 @@ else # \/ \/ \/ # /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest # You get the idea. - OLDDIR=`pwd` + OLDDIR=$(pwd) cd .. - [ $WINDOWS = "32" ] && EXISTING_MINETEST_DIR=$OLDDIR NO_MINETEST_GAME=1 $OLDDIR/util/buildbot/buildwin32.sh travisbuild && exit 0 - [ $WINDOWS = "64" ] && EXISTING_MINETEST_DIR=$OLDDIR NO_MINETEST_GAME=1 $OLDDIR/util/buildbot/buildwin64.sh travisbuild && exit 0 + export EXISTING_MINETEST_DIR=$OLDDIR + export NO_MINETEST_GAME=1 + if [[ $PLATFORM == "Win32" ]]; then + $OLDDIR/util/buildbot/buildwin32.sh travisbuild && exit 0 + elif [[ $PLATFORM == "Win64" ]]; then + $OLDDIR/util/buildbot/buildwin64.sh travisbuild && exit 0 + fi +else + echo "Unknown platform \"${PLATFORM}\"." + exit 1 fi + diff --git a/util/travis/toolchain_mingw.cmake.in b/util/travis/toolchain_mingw.cmake.in index 44830eb60..65f67517e 100644 --- a/util/travis/toolchain_mingw.cmake.in +++ b/util/travis/toolchain_mingw.cmake.in @@ -1,17 +1,18 @@ -# name of the target operating system -SET(CMAKE_SYSTEM_NAME Windows) +# Target operating system name +set(CMAKE_SYSTEM_NAME Windows) -# which compilers to use for C and C++ -SET(CMAKE_C_COMPILER %PREFIX%-gcc) -SET(CMAKE_CXX_COMPILER %PREFIX%-g++) -SET(CMAKE_RC_COMPILER %PREFIX%-windres) +# Compilers to use +set(CMAKE_C_COMPILER %PREFIX%-gcc) +set(CMAKE_CXX_COMPILER %PREFIX%-g++) +set(CMAKE_RC_COMPILER %PREFIX%-windres) -# here is the target environment located -SET(CMAKE_FIND_ROOT_PATH %ROOTPATH%) +# Location of the target environment +set(CMAKE_FIND_ROOT_PATH %ROOTPATH%) -# adjust the default behaviour of the FIND_XXX() commands: -# search headers and libraries in the target environment, search -# programs in the host environment +# Adjust the default behaviour of the FIND_XXX() commands: +# search for headers and libraries in the target environment, +# search for programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + -- cgit v1.2.3