Initial commit
This commit is contained in:
190
util/buildbot/buildwin32.sh
Normal file
190
util/buildbot/buildwin32.sh
Normal file
@@ -0,0 +1,190 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CORE_GIT=https://github.com/minetest/minetest
|
||||
CORE_BRANCH=master
|
||||
CORE_NAME=minetest
|
||||
GAME_GIT=https://github.com/minetest/minetest_game
|
||||
GAME_BRANCH=master
|
||||
GAME_NAME=minetest_game
|
||||
|
||||
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <build directory>"
|
||||
exit 1
|
||||
fi
|
||||
builddir=$1
|
||||
mkdir -p $builddir
|
||||
builddir="$( cd "$builddir" && pwd )"
|
||||
libdir=$builddir/libs
|
||||
|
||||
# Test which win32 compiler is present
|
||||
command -v i686-w64-mingw32-gcc >/dev/null &&
|
||||
compiler=i686-w64-mingw32-gcc
|
||||
command -v i686-w64-mingw32-gcc-posix >/dev/null &&
|
||||
compiler=i686-w64-mingw32-gcc-posix
|
||||
|
||||
if [ -z "$compiler" ]; then
|
||||
echo "Unable to determine which MinGW compiler to use"
|
||||
exit 1
|
||||
fi
|
||||
toolchain_file=$topdir/toolchain_${compiler/-gcc/}.cmake
|
||||
echo "Using $toolchain_file"
|
||||
|
||||
# Try to find runtime DLLs in various paths (varies by distribution, sigh)
|
||||
tmp=$(dirname "$(command -v $compiler)")/..
|
||||
runtime_dlls=
|
||||
for name in lib{gcc_,stdc++-,winpthread-}'*'.dll; do
|
||||
for dir in $tmp/i686-w64-mingw32/{bin,lib} $tmp/lib/gcc/i686-w64-mingw32/*; do
|
||||
[ -d "$dir" ] || continue
|
||||
file=$(echo $dir/$name)
|
||||
[ -f "$file" ] && { runtime_dlls+="$file;"; break; }
|
||||
done
|
||||
done
|
||||
[ -z "$runtime_dlls" ] &&
|
||||
echo "The compiler runtime DLLs could not be found, they might be missing in the final package."
|
||||
|
||||
# Get stuff
|
||||
irrlicht_version=$(cat $topdir/../../misc/irrlichtmt_tag.txt)
|
||||
ogg_version=1.3.5
|
||||
openal_version=1.21.1
|
||||
vorbis_version=1.3.7
|
||||
curl_version=7.81.0
|
||||
gettext_version=0.20.1
|
||||
freetype_version=2.11.1
|
||||
sqlite3_version=3.37.2
|
||||
luajit_version=2.1.0-beta3
|
||||
leveldb_version=1.23
|
||||
zlib_version=1.2.11
|
||||
zstd_version=1.5.2
|
||||
|
||||
mkdir -p $libdir
|
||||
|
||||
download () {
|
||||
local url=$1
|
||||
local filename=$2
|
||||
[ -z "$filename" ] && filename=${url##*/}
|
||||
local foldername=${filename%%[.-]*}
|
||||
local extract=$3
|
||||
[ -z "$extract" ] && extract=unzip
|
||||
|
||||
[ -d "./$foldername" ] && return 0
|
||||
wget "$url" -c -O "./$filename"
|
||||
if [ "$extract" = "unzip" ]; then
|
||||
unzip -o "$filename" -d "$foldername"
|
||||
elif [ "$extract" = "unzip_nofolder" ]; then
|
||||
unzip -o "$filename"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 'dw2' just points to rebuilt versions after a toolchain change
|
||||
# this distinction should be gotten rid of next time
|
||||
|
||||
cd $libdir
|
||||
download "https://github.com/minetest/irrlicht/releases/download/$irrlicht_version/win32.zip" irrlicht-$irrlicht_version.zip
|
||||
download "http://minetest.kitsunemimi.pw/dw2/zlib-$zlib_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/zstd-$zstd_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/libogg-$ogg_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/dw2/libvorbis-$vorbis_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/curl-$curl_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/dw2/gettext-$gettext_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/freetype2-$freetype_version-win32.zip" freetype-$freetype_version.zip
|
||||
download "http://minetest.kitsunemimi.pw/sqlite3-$sqlite3_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/dw2/luajit-$luajit_version-win32.zip"
|
||||
download "http://minetest.kitsunemimi.pw/dw2/libleveldb-$leveldb_version-win32.zip" leveldb-$leveldb_version.zip
|
||||
download "http://minetest.kitsunemimi.pw/openal-soft-$openal_version-win32.zip"
|
||||
|
||||
# Set source dir, downloading Minetest as needed
|
||||
if [ -n "$EXISTING_MINETEST_DIR" ]; then
|
||||
sourcedir="$( cd "$EXISTING_MINETEST_DIR" && pwd )"
|
||||
else
|
||||
cd $builddir
|
||||
sourcedir=$PWD/$CORE_NAME
|
||||
[ -d $CORE_NAME ] && { pushd $CORE_NAME; git pull; popd; } || \
|
||||
git clone -b $CORE_BRANCH $CORE_GIT $CORE_NAME
|
||||
if [ -z "$NO_MINETEST_GAME" ]; then
|
||||
cd $sourcedir
|
||||
[ -d games/$GAME_NAME ] && { pushd games/$GAME_NAME; git pull; popd; } || \
|
||||
git clone -b $GAME_BRANCH $GAME_GIT games/$GAME_NAME
|
||||
fi
|
||||
fi
|
||||
|
||||
git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
|
||||
|
||||
# Build the thing
|
||||
cd $builddir
|
||||
[ -d build ] && rm -rf build
|
||||
|
||||
irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';')
|
||||
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
|
||||
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')
|
||||
|
||||
cmake -S $sourcedir -B build \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
|
||||
-DCMAKE_INSTALL_PREFIX=/tmp \
|
||||
-DVERSION_EXTRA=$git_hash \
|
||||
-DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
|
||||
-DEXTRA_DLL="$runtime_dlls" \
|
||||
\
|
||||
-DENABLE_SOUND=1 \
|
||||
-DENABLE_CURL=1 \
|
||||
-DENABLE_GETTEXT=1 \
|
||||
-DENABLE_LEVELDB=1 \
|
||||
\
|
||||
-DCMAKE_PREFIX_PATH=$libdir/irrlicht \
|
||||
-DIRRLICHT_DLL="$irr_dlls" \
|
||||
\
|
||||
-DZLIB_INCLUDE_DIR=$libdir/zlib/include \
|
||||
-DZLIB_LIBRARY=$libdir/zlib/lib/libz.dll.a \
|
||||
-DZLIB_DLL=$libdir/zlib/bin/zlib1.dll \
|
||||
\
|
||||
-DZSTD_INCLUDE_DIR=$libdir/zstd/include \
|
||||
-DZSTD_LIBRARY=$libdir/zstd/lib/libzstd.dll.a \
|
||||
-DZSTD_DLL=$libdir/zstd/bin/libzstd.dll \
|
||||
\
|
||||
-DLUA_INCLUDE_DIR=$libdir/luajit/include \
|
||||
-DLUA_LIBRARY=$libdir/luajit/libluajit.a \
|
||||
\
|
||||
-DOGG_INCLUDE_DIR=$libdir/libogg/include \
|
||||
-DOGG_LIBRARY=$libdir/libogg/lib/libogg.dll.a \
|
||||
-DOGG_DLL=$libdir/libogg/bin/libogg-0.dll \
|
||||
\
|
||||
-DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
|
||||
-DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \
|
||||
-DVORBIS_DLL="$vorbis_dlls" \
|
||||
-DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
|
||||
\
|
||||
-DOPENAL_INCLUDE_DIR=$libdir/openal/include/AL \
|
||||
-DOPENAL_LIBRARY=$libdir/openal/lib/libOpenAL32.dll.a \
|
||||
-DOPENAL_DLL=$libdir/openal/bin/OpenAL32.dll \
|
||||
\
|
||||
-DCURL_DLL=$libdir/curl/bin/libcurl-4.dll \
|
||||
-DCURL_INCLUDE_DIR=$libdir/curl/include \
|
||||
-DCURL_LIBRARY=$libdir/curl/lib/libcurl.dll.a \
|
||||
\
|
||||
-DGETTEXT_MSGFMT=`command -v msgfmt` \
|
||||
-DGETTEXT_DLL="$gettext_dlls" \
|
||||
-DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \
|
||||
-DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \
|
||||
\
|
||||
-DFREETYPE_INCLUDE_DIR_freetype2=$libdir/freetype/include/freetype2 \
|
||||
-DFREETYPE_INCLUDE_DIR_ft2build=$libdir/freetype/include/freetype2 \
|
||||
-DFREETYPE_LIBRARY=$libdir/freetype/lib/libfreetype.dll.a \
|
||||
-DFREETYPE_DLL=$libdir/freetype/bin/libfreetype-6.dll \
|
||||
\
|
||||
-DSQLITE3_INCLUDE_DIR=$libdir/sqlite3/include \
|
||||
-DSQLITE3_LIBRARY=$libdir/sqlite3/lib/libsqlite3.dll.a \
|
||||
-DSQLITE3_DLL=$libdir/sqlite3/bin/libsqlite3-0.dll \
|
||||
\
|
||||
-DLEVELDB_INCLUDE_DIR=$libdir/leveldb/include \
|
||||
-DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
|
||||
-DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
|
||||
|
||||
cmake --build build -j$(nproc)
|
||||
|
||||
[ -z "$NO_PACKAGE" ] && cmake --build build --target package
|
||||
|
||||
exit 0
|
||||
# EOF
|
||||
187
util/buildbot/buildwin64.sh
Normal file
187
util/buildbot/buildwin64.sh
Normal file
@@ -0,0 +1,187 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
CORE_GIT=https://github.com/minetest/minetest
|
||||
CORE_BRANCH=master
|
||||
CORE_NAME=minetest
|
||||
GAME_GIT=https://github.com/minetest/minetest_game
|
||||
GAME_BRANCH=master
|
||||
GAME_NAME=minetest_game
|
||||
|
||||
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Usage: $0 <build directory>"
|
||||
exit 1
|
||||
fi
|
||||
builddir=$1
|
||||
mkdir -p $builddir
|
||||
builddir="$( cd "$builddir" && pwd )"
|
||||
libdir=$builddir/libs
|
||||
|
||||
# Test which win64 compiler is present
|
||||
command -v x86_64-w64-mingw32-gcc >/dev/null &&
|
||||
compiler=x86_64-w64-mingw32-gcc
|
||||
command -v x86_64-w64-mingw32-gcc-posix >/dev/null &&
|
||||
compiler=x86_64-w64-mingw32-gcc-posix
|
||||
|
||||
if [ -z "$compiler" ]; then
|
||||
echo "Unable to determine which MinGW compiler to use"
|
||||
exit 1
|
||||
fi
|
||||
toolchain_file=$topdir/toolchain_${compiler/-gcc/}.cmake
|
||||
echo "Using $toolchain_file"
|
||||
|
||||
# Try to find runtime DLLs in various paths (varies by distribution, sigh)
|
||||
tmp=$(dirname "$(command -v $compiler)")/..
|
||||
runtime_dlls=
|
||||
for name in lib{gcc_,stdc++-,winpthread-}'*'.dll; do
|
||||
for dir in $tmp/x86_64-w64-mingw32/{bin,lib} $tmp/lib/gcc/x86_64-w64-mingw32/*; do
|
||||
[ -d "$dir" ] || continue
|
||||
file=$(echo $dir/$name)
|
||||
[ -f "$file" ] && { runtime_dlls+="$file;"; break; }
|
||||
done
|
||||
done
|
||||
[ -z "$runtime_dlls" ] &&
|
||||
echo "The compiler runtime DLLs could not be found, they might be missing in the final package."
|
||||
|
||||
# Get stuff
|
||||
irrlicht_version=$(cat $topdir/../../misc/irrlichtmt_tag.txt)
|
||||
ogg_version=1.3.5
|
||||
openal_version=1.21.1
|
||||
vorbis_version=1.3.7
|
||||
curl_version=7.81.0
|
||||
gettext_version=0.20.1
|
||||
freetype_version=2.11.1
|
||||
sqlite3_version=3.37.2
|
||||
luajit_version=2.1.0-beta3
|
||||
leveldb_version=1.23
|
||||
zlib_version=1.2.11
|
||||
zstd_version=1.5.2
|
||||
|
||||
mkdir -p $libdir
|
||||
|
||||
download () {
|
||||
local url=$1
|
||||
local filename=$2
|
||||
[ -z "$filename" ] && filename=${url##*/}
|
||||
local foldername=${filename%%[.-]*}
|
||||
local extract=$3
|
||||
[ -z "$extract" ] && extract=unzip
|
||||
|
||||
[ -d "./$foldername" ] && return 0
|
||||
wget "$url" -c -O "./$filename"
|
||||
if [ "$extract" = "unzip" ]; then
|
||||
unzip -o "$filename" -d "$foldername"
|
||||
elif [ "$extract" = "unzip_nofolder" ]; then
|
||||
unzip -o "$filename"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
cd $libdir
|
||||
download "https://github.com/minetest/irrlicht/releases/download/$irrlicht_version/win64.zip" irrlicht-$irrlicht_version.zip
|
||||
download "http://minetest.kitsunemimi.pw/zlib-$zlib_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/zstd-$zstd_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/libogg-$ogg_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/libvorbis-$vorbis_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/curl-$curl_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/gettext-$gettext_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/freetype2-$freetype_version-win64.zip" freetype-$freetype_version.zip
|
||||
download "http://minetest.kitsunemimi.pw/sqlite3-$sqlite3_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/luajit-$luajit_version-win64.zip"
|
||||
download "http://minetest.kitsunemimi.pw/libleveldb-$leveldb_version-win64.zip" leveldb-$leveldb_version.zip
|
||||
download "http://minetest.kitsunemimi.pw/openal-soft-$openal_version-win64.zip"
|
||||
|
||||
# Set source dir, downloading Minetest as needed
|
||||
if [ -n "$EXISTING_MINETEST_DIR" ]; then
|
||||
sourcedir="$( cd "$EXISTING_MINETEST_DIR" && pwd )"
|
||||
else
|
||||
cd $builddir
|
||||
sourcedir=$PWD/$CORE_NAME
|
||||
[ -d $CORE_NAME ] && { pushd $CORE_NAME; git pull; popd; } || \
|
||||
git clone -b $CORE_BRANCH $CORE_GIT $CORE_NAME
|
||||
if [ -z "$NO_MINETEST_GAME" ]; then
|
||||
cd $sourcedir
|
||||
[ -d games/$GAME_NAME ] && { pushd games/$GAME_NAME; git pull; popd; } || \
|
||||
git clone -b $GAME_BRANCH $GAME_GIT games/$GAME_NAME
|
||||
fi
|
||||
fi
|
||||
|
||||
git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
|
||||
|
||||
# Build the thing
|
||||
cd $builddir
|
||||
[ -d build ] && rm -rf build
|
||||
|
||||
irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';')
|
||||
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
|
||||
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')
|
||||
|
||||
cmake -S $sourcedir -B build \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
|
||||
-DCMAKE_INSTALL_PREFIX=/tmp \
|
||||
-DVERSION_EXTRA=$git_hash \
|
||||
-DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
|
||||
-DEXTRA_DLL="$runtime_dlls" \
|
||||
\
|
||||
-DENABLE_SOUND=1 \
|
||||
-DENABLE_CURL=1 \
|
||||
-DENABLE_GETTEXT=1 \
|
||||
-DENABLE_LEVELDB=1 \
|
||||
\
|
||||
-DCMAKE_PREFIX_PATH=$libdir/irrlicht \
|
||||
-DIRRLICHT_DLL="$irr_dlls" \
|
||||
\
|
||||
-DZLIB_INCLUDE_DIR=$libdir/zlib/include \
|
||||
-DZLIB_LIBRARY=$libdir/zlib/lib/libz.dll.a \
|
||||
-DZLIB_DLL=$libdir/zlib/bin/zlib1.dll \
|
||||
\
|
||||
-DZSTD_INCLUDE_DIR=$libdir/zstd/include \
|
||||
-DZSTD_LIBRARY=$libdir/zstd/lib/libzstd.dll.a \
|
||||
-DZSTD_DLL=$libdir/zstd/bin/libzstd.dll \
|
||||
\
|
||||
-DLUA_INCLUDE_DIR=$libdir/luajit/include \
|
||||
-DLUA_LIBRARY=$libdir/luajit/libluajit.a \
|
||||
\
|
||||
-DOGG_INCLUDE_DIR=$libdir/libogg/include \
|
||||
-DOGG_LIBRARY=$libdir/libogg/lib/libogg.dll.a \
|
||||
-DOGG_DLL=$libdir/libogg/bin/libogg-0.dll \
|
||||
\
|
||||
-DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
|
||||
-DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \
|
||||
-DVORBIS_DLL="$vorbis_dlls" \
|
||||
-DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
|
||||
\
|
||||
-DOPENAL_INCLUDE_DIR=$libdir/openal/include/AL \
|
||||
-DOPENAL_LIBRARY=$libdir/openal/lib/libOpenAL32.dll.a \
|
||||
-DOPENAL_DLL=$libdir/openal/bin/OpenAL32.dll \
|
||||
\
|
||||
-DCURL_DLL=$libdir/curl/bin/libcurl-4.dll \
|
||||
-DCURL_INCLUDE_DIR=$libdir/curl/include \
|
||||
-DCURL_LIBRARY=$libdir/curl/lib/libcurl.dll.a \
|
||||
\
|
||||
-DGETTEXT_MSGFMT=`command -v msgfmt` \
|
||||
-DGETTEXT_DLL="$gettext_dlls" \
|
||||
-DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \
|
||||
-DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \
|
||||
\
|
||||
-DFREETYPE_INCLUDE_DIR_freetype2=$libdir/freetype/include/freetype2 \
|
||||
-DFREETYPE_INCLUDE_DIR_ft2build=$libdir/freetype/include/freetype2 \
|
||||
-DFREETYPE_LIBRARY=$libdir/freetype/lib/libfreetype.dll.a \
|
||||
-DFREETYPE_DLL=$libdir/freetype/bin/libfreetype-6.dll \
|
||||
\
|
||||
-DSQLITE3_INCLUDE_DIR=$libdir/sqlite3/include \
|
||||
-DSQLITE3_LIBRARY=$libdir/sqlite3/lib/libsqlite3.dll.a \
|
||||
-DSQLITE3_DLL=$libdir/sqlite3/bin/libsqlite3-0.dll \
|
||||
\
|
||||
-DLEVELDB_INCLUDE_DIR=$libdir/leveldb/include \
|
||||
-DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
|
||||
-DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
|
||||
|
||||
cmake --build build -j$(nproc)
|
||||
|
||||
[ -z "$NO_PACKAGE" ] && cmake --build build --target package
|
||||
|
||||
exit 0
|
||||
# EOF
|
||||
19
util/buildbot/toolchain_i686-w64-mingw32-posix.cmake
Normal file
19
util/buildbot/toolchain_i686-w64-mingw32-posix.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
# *-posix is Ubuntu's naming for the MinGW variant that comes with support
|
||||
# for pthreads / std::thread (required by MT)
|
||||
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc-posix)
|
||||
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++-posix)
|
||||
SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# 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)
|
||||
17
util/buildbot/toolchain_i686-w64-mingw32.cmake
Normal file
17
util/buildbot/toolchain_i686-w64-mingw32.cmake
Normal file
@@ -0,0 +1,17 @@
|
||||
# name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
|
||||
SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
|
||||
SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# 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)
|
||||
19
util/buildbot/toolchain_x86_64-w64-mingw32-posix.cmake
Normal file
19
util/buildbot/toolchain_x86_64-w64-mingw32-posix.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
# *-posix is Ubuntu's naming for the MinGW variant that comes with support
|
||||
# for pthreads / std::thread (required by MT)
|
||||
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix)
|
||||
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix)
|
||||
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# 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)
|
||||
17
util/buildbot/toolchain_x86_64-w64-mingw32.cmake
Normal file
17
util/buildbot/toolchain_x86_64-w64-mingw32.cmake
Normal file
@@ -0,0 +1,17 @@
|
||||
# name of the target operating system
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
# 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)
|
||||
144
util/bump_version.sh
Normal file
144
util/bump_version.sh
Normal file
@@ -0,0 +1,144 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
prompt_for_number() {
|
||||
local prompt_text=$1
|
||||
local default_value=$2
|
||||
local tmp=""
|
||||
while true; do
|
||||
read -p "$prompt_text [$default_value]: " tmp
|
||||
if [ "$tmp" = "" ]; then
|
||||
echo "$default_value"; return
|
||||
elif echo "$tmp" | grep -q -E '^[0-9]+$'; then
|
||||
echo "$tmp"; return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# On a release the following actions are performed
|
||||
# * DEVELOPMENT_BUILD is set to false
|
||||
# * android versionCode is bumped
|
||||
# * appdata release version and date are updated
|
||||
# * Commit the changes
|
||||
# * Tag with current version
|
||||
perform_release() {
|
||||
RELEASE_DATE=$(date +%Y-%m-%d)
|
||||
|
||||
sed -i -re "s/^set\(DEVELOPMENT_BUILD TRUE\)$/set(DEVELOPMENT_BUILD FALSE)/" CMakeLists.txt
|
||||
|
||||
sed -i 's/project.ext.set("versionExtra", "-dev")/project.ext.set("versionExtra", "")/' android/build.gradle
|
||||
sed -i 's/project.ext.set("developmentBuild", 1)/project.ext.set("developmentBuild", 0)/' android/build.gradle
|
||||
sed -i -re "s/\"versionCode\", [0-9]+/\"versionCode\", $NEW_ANDROID_VERSION_CODE/" android/build.gradle
|
||||
|
||||
sed -i '/\<release/s/\(version\)="[^"]*"/\1="'"$RELEASE_VERSION"'"/' misc/net.minetest.minetest.appdata.xml
|
||||
sed -i 's/\(<release date\)="[^"]*"/\1="'"$RELEASE_DATE"'"/' misc/net.minetest.minetest.appdata.xml
|
||||
|
||||
git add -f CMakeLists.txt android/build.gradle misc/net.minetest.minetest.appdata.xml
|
||||
|
||||
git commit -m "Bump version to $RELEASE_VERSION"
|
||||
|
||||
echo "Tagging $RELEASE_VERSION"
|
||||
|
||||
git tag -a "$RELEASE_VERSION" -m "$RELEASE_VERSION"
|
||||
}
|
||||
|
||||
# After release
|
||||
# * Set DEVELOPMENT_BUILD to true
|
||||
# * Bump version in CMakeLists and docs
|
||||
# * Commit the changes
|
||||
back_to_devel() {
|
||||
echo 'Creating "return back to development" commit'
|
||||
|
||||
# Update CMakeList.txt versions
|
||||
sed -i -re 's/^set\(DEVELOPMENT_BUILD FALSE\)$/set(DEVELOPMENT_BUILD TRUE)/' CMakeLists.txt
|
||||
sed -i -re "s/^set\(VERSION_MAJOR [0-9]+\)$/set(VERSION_MAJOR $NEXT_VERSION_MAJOR)/" CMakeLists.txt
|
||||
sed -i -re "s/^set\(VERSION_MINOR [0-9]+\)$/set(VERSION_MINOR $NEXT_VERSION_MINOR)/" CMakeLists.txt
|
||||
sed -i -re "s/^set\(VERSION_PATCH [0-9]+\)$/set(VERSION_PATCH $NEXT_VERSION_PATCH)/" CMakeLists.txt
|
||||
|
||||
# Update Android versions
|
||||
sed -i 's/set("versionExtra", "")/set("versionExtra", "-dev")/' android/build.gradle
|
||||
sed -i 's/project.ext.set("developmentBuild", 0)/project.ext.set("developmentBuild", 1)/' android/build.gradle
|
||||
sed -i -re "s/set\(\"versionMajor\", [0-9]+\)/set(\"versionMajor\", $NEXT_VERSION_MAJOR)/" android/build.gradle
|
||||
sed -i -re "s/set\(\"versionMinor\", [0-9]+\)/set(\"versionMinor\", $NEXT_VERSION_MINOR)/" android/build.gradle
|
||||
sed -i -re "s/set\(\"versionPatch\", [0-9]+\)/set(\"versionPatch\", $NEXT_VERSION_PATCH)/" android/build.gradle
|
||||
|
||||
# Update doc versions
|
||||
sed -i -re "1s/[0-9]+\.[0-9]+\.[0-9]+/$NEXT_VERSION/g" doc/menu_lua_api.txt
|
||||
sed -i -re "1s/[0-9]+\.[0-9]+\.[0-9]+/$NEXT_VERSION/g" doc/client_lua_api.txt
|
||||
|
||||
# Commit
|
||||
git add -f CMakeLists.txt android/build.gradle doc/menu_lua_api.txt doc/client_lua_api.txt
|
||||
git commit -m "Continue with $NEXT_VERSION-dev"
|
||||
}
|
||||
##################################
|
||||
# Switch to top minetest directory
|
||||
##################################
|
||||
|
||||
cd ${0%/*}/..
|
||||
|
||||
|
||||
#######################
|
||||
# Determine old version
|
||||
#######################
|
||||
|
||||
# Make sure all the files we need exist
|
||||
grep -q -E '^set\(VERSION_MAJOR [0-9]+\)$' CMakeLists.txt
|
||||
grep -q -E '^set\(VERSION_MINOR [0-9]+\)$' CMakeLists.txt
|
||||
grep -q -E '^set\(VERSION_PATCH [0-9]+\)$' CMakeLists.txt
|
||||
grep -q -E '\("versionCode", [0-9]+\)' android/build.gradle
|
||||
|
||||
VERSION_MAJOR=$(grep -E '^set\(VERSION_MAJOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
|
||||
VERSION_MINOR=$(grep -E '^set\(VERSION_MINOR [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
|
||||
VERSION_PATCH=$(grep -E '^set\(VERSION_PATCH [0-9]+\)$' CMakeLists.txt | tr -dC 0-9)
|
||||
ANDROID_VERSION_CODE=$(grep -E '"versionCode", [0-9]+' android/build.gradle | tr -dC 0-9)
|
||||
|
||||
RELEASE_VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
|
||||
|
||||
echo "Current Minetest version: $RELEASE_VERSION"
|
||||
echo "Current Android version code: $ANDROID_VERSION_CODE"
|
||||
|
||||
# +1 for ARM and +1 for ARM64 APKs
|
||||
NEW_ANDROID_VERSION_CODE=$(expr $ANDROID_VERSION_CODE + 2)
|
||||
NEW_ANDROID_VERSION_CODE=$(prompt_for_number "Set android version code" $NEW_ANDROID_VERSION_CODE)
|
||||
|
||||
echo
|
||||
echo "New android version code: $NEW_ANDROID_VERSION_CODE"
|
||||
|
||||
########################
|
||||
# Perform release
|
||||
########################
|
||||
|
||||
perform_release
|
||||
|
||||
########################
|
||||
# Prompt for next version
|
||||
########################
|
||||
|
||||
NEXT_VERSION_MAJOR=$VERSION_MAJOR
|
||||
NEXT_VERSION_MINOR=$VERSION_MINOR
|
||||
NEXT_VERSION_PATCH=$(expr $VERSION_PATCH + 1)
|
||||
|
||||
NEXT_VERSION_MAJOR=$(prompt_for_number "Set next major" $NEXT_VERSION_MAJOR)
|
||||
|
||||
if [ "$NEXT_VERSION_MAJOR" != "$VERSION_MAJOR" ]; then
|
||||
NEXT_VERSION_MINOR=0
|
||||
NEXT_VERSION_PATCH=0
|
||||
fi
|
||||
|
||||
NEXT_VERSION_MINOR=$(prompt_for_number "Set next minor" $NEXT_VERSION_MINOR)
|
||||
|
||||
if [ "$NEXT_VERSION_MINOR" != "$VERSION_MINOR" ]; then
|
||||
NEXT_VERSION_PATCH=0
|
||||
fi
|
||||
|
||||
NEXT_VERSION_PATCH=$(prompt_for_number "Set next patch" $NEXT_VERSION_PATCH)
|
||||
|
||||
NEXT_VERSION="$NEXT_VERSION_MAJOR.$NEXT_VERSION_MINOR.$NEXT_VERSION_PATCH"
|
||||
|
||||
echo
|
||||
echo "New version: $NEXT_VERSION"
|
||||
|
||||
########################
|
||||
# Return back to devel
|
||||
########################
|
||||
|
||||
back_to_devel
|
||||
10
util/ci/build.sh
Normal file
10
util/ci/build.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#! /bin/bash -e
|
||||
|
||||
cmake -B build \
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \
|
||||
-DRUN_IN_PLACE=TRUE \
|
||||
-DENABLE_GETTEXT=${CMAKE_ENABLE_GETTEXT:-TRUE} \
|
||||
-DBUILD_SERVER=${CMAKE_BUILD_SERVER:-TRUE} \
|
||||
${CMAKE_FLAGS}
|
||||
|
||||
cmake --build build --parallel $(($(nproc) + 1))
|
||||
13
util/ci/build_prometheus_cpp.sh
Normal file
13
util/ci/build_prometheus_cpp.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
cd /tmp
|
||||
git clone --recursive https://github.com/jupp0r/prometheus-cpp
|
||||
mkdir prometheus-cpp/build
|
||||
cd prometheus-cpp/build
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr/local \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DENABLE_TESTING=0
|
||||
make -j$(nproc)
|
||||
sudo make install
|
||||
|
||||
500
util/ci/clang-format-whitelist.txt
Normal file
500
util/ci/clang-format-whitelist.txt
Normal file
@@ -0,0 +1,500 @@
|
||||
src/activeobject.h
|
||||
src/ban.cpp
|
||||
src/camera.cpp
|
||||
src/camera.h
|
||||
src/chat.cpp
|
||||
src/chat.h
|
||||
src/chat_interface.h
|
||||
src/client/clientlauncher.cpp
|
||||
src/client/clientlauncher.h
|
||||
src/client/sound_openal.cpp
|
||||
src/client.cpp
|
||||
src/clientenvironment.cpp
|
||||
src/clientenvironment.h
|
||||
src/client/gameui.cpp
|
||||
src/client.h
|
||||
src/client/hud.cpp
|
||||
src/client/hud.h
|
||||
src/clientiface.cpp
|
||||
src/clientiface.h
|
||||
src/client/joystick_controller.cpp
|
||||
src/client/joystick_controller.h
|
||||
src/clientmap.cpp
|
||||
src/clientmap.h
|
||||
src/clientmedia.cpp
|
||||
src/clientmedia.h
|
||||
src/clientobject.cpp
|
||||
src/clientobject.h
|
||||
src/client/render/core.cpp
|
||||
src/client/renderingengine.cpp
|
||||
src/client/render/interlaced.cpp
|
||||
src/client/render/plain.cpp
|
||||
src/client/render/sidebyside.cpp
|
||||
src/client/render/stereo.cpp
|
||||
src/client/tile.cpp
|
||||
src/client/tile.h
|
||||
src/client/fontengine.h
|
||||
src/client/clientenvironment.cpp
|
||||
src/client/mapblock_mesh.cpp
|
||||
src/client/sound_openal.h
|
||||
src/client/clouds.cpp
|
||||
src/client/fontengine.cpp
|
||||
src/client/camera.h
|
||||
src/client/hud.cpp
|
||||
src/client/clientmap.cpp
|
||||
src/client/sound_openal.cpp
|
||||
src/client/minimap.h
|
||||
src/client/content_cao.cpp
|
||||
src/client/localplayer.h
|
||||
src/client/mapblock_mesh.h
|
||||
src/client/mesh.cpp
|
||||
src/client/sound.cpp
|
||||
src/client/guiscalingfilter.cpp
|
||||
src/client/content_cso.cpp
|
||||
src/client/gameui.cpp
|
||||
src/client/wieldmesh.cpp
|
||||
src/client/clientmedia.h
|
||||
src/client/game.cpp
|
||||
src/client/keys.h
|
||||
src/client/client.h
|
||||
src/client/shader.cpp
|
||||
src/client/clientmap.h
|
||||
src/client/inputhandler.h
|
||||
src/client/content_mapblock.h
|
||||
src/client/game.h
|
||||
src/client/mesh.h
|
||||
src/client/camera.cpp
|
||||
src/client/sky.h
|
||||
src/client/mesh_generator_thread.cpp
|
||||
src/client/guiscalingfilter.h
|
||||
src/client/clientobject.cpp
|
||||
src/client/tile.cpp
|
||||
src/client/hud.h
|
||||
src/client/inputhandler.cpp
|
||||
src/client/clientevent.h
|
||||
src/client/gameui.h
|
||||
src/client/content_cso.h
|
||||
src/client/sky.cpp
|
||||
src/client/localplayer.cpp
|
||||
src/client/content_mapblock.cpp
|
||||
src/client/clientobject.h
|
||||
src/client/filecache.cpp
|
||||
src/client/particles.h
|
||||
src/client/clientenvironment.h
|
||||
src/client/imagefilters.h
|
||||
src/client/renderingengine.cpp
|
||||
src/client/tile.h
|
||||
src/client/clientmedia.cpp
|
||||
src/client/event_manager.h
|
||||
src/client/joystick_controller.h
|
||||
src/client/clouds.h
|
||||
src/client/clientlauncher.h
|
||||
src/client/content_cao.h
|
||||
src/client/minimap.cpp
|
||||
src/client/sound.h
|
||||
src/client/keycode.cpp
|
||||
src/client/particles.cpp
|
||||
src/client/joystick_controller.cpp
|
||||
src/client/keycode.h
|
||||
src/client/wieldmesh.h
|
||||
src/client/filecache.h
|
||||
src/client/shader.h
|
||||
src/client/mesh_generator_thread.h
|
||||
src/client/renderingengine.h
|
||||
src/client/client.cpp
|
||||
src/client/imagefilters.cpp
|
||||
src/client/clientlauncher.cpp
|
||||
src/clouds.cpp
|
||||
src/clouds.h
|
||||
src/collision.cpp
|
||||
src/collision.h
|
||||
src/config.h
|
||||
src/content_cao.cpp
|
||||
src/content_cao.h
|
||||
src/content_cso.cpp
|
||||
src/content_cso.h
|
||||
src/content_mapblock.cpp
|
||||
src/content_mapblock.h
|
||||
src/content_mapnode.cpp
|
||||
src/content_nodemeta.cpp
|
||||
src/content_nodemeta.h
|
||||
src/convert_json.cpp
|
||||
src/convert_json.h
|
||||
src/craftdef.cpp
|
||||
src/craftdef.h
|
||||
src/database/database.cpp
|
||||
src/database/database-dummy.cpp
|
||||
src/database/database-files.cpp
|
||||
src/database/database-leveldb.cpp
|
||||
src/database/database-postgresql.cpp
|
||||
src/database/database-postgresql.h
|
||||
src/database/database-redis.cpp
|
||||
src/database/database-sqlite3.cpp
|
||||
src/database/database-sqlite3.h
|
||||
src/daynightratio.h
|
||||
src/debug.cpp
|
||||
src/debug.h
|
||||
src/defaultsettings.cpp
|
||||
src/emerge.cpp
|
||||
src/emerge.h
|
||||
src/environment.cpp
|
||||
src/exceptions.h
|
||||
src/face_position_cache.cpp
|
||||
src/face_position_cache.h
|
||||
src/filecache.cpp
|
||||
src/filesys.cpp
|
||||
src/filesys.h
|
||||
src/fontengine.cpp
|
||||
src/fontengine.h
|
||||
src/game.cpp
|
||||
src/gamedef.h
|
||||
src/game.h
|
||||
src/gettext.cpp
|
||||
src/gettext.h
|
||||
src/gui/guiAnimatedImage.cpp
|
||||
src/gui/guiAnimatedImage.h
|
||||
src/gui/guiBackgroundImage.cpp
|
||||
src/gui/guiBackgroundImage.h
|
||||
src/gui/guiBox.cpp
|
||||
src/gui/guiBox.h
|
||||
src/gui/guiButton.cpp
|
||||
src/gui/guiButton.h
|
||||
src/gui/guiButtonImage.cpp
|
||||
src/gui/guiButtonImage.h
|
||||
src/gui/guiButtonItemImage.cpp
|
||||
src/gui/guiButtonItemImage.h
|
||||
src/gui/guiChatConsole.cpp
|
||||
src/gui/guiChatConsole.h
|
||||
src/gui/guiConfirmRegistration.cpp
|
||||
src/gui/guiEditBoxWithScrollbar.cpp
|
||||
src/gui/guiEditBoxWithScrollbar.h
|
||||
src/gui/guiEngine.cpp
|
||||
src/gui/guiEngine.h
|
||||
src/gui/guiFormSpecMenu.cpp
|
||||
src/gui/guiFormSpecMenu.h
|
||||
src/gui/guiKeyChangeMenu.cpp
|
||||
src/gui/guiHyperText.cpp
|
||||
src/gui/guiHyperText.h
|
||||
src/gui/guiInventoryList.cpp
|
||||
src/gui/guiInventoryList.h
|
||||
src/gui/guiItemImage.cpp
|
||||
src/gui/guiItemImage.h
|
||||
src/gui/guiMainMenu.h
|
||||
src/gui/guiPasswordChange.cpp
|
||||
src/gui/guiPathSelectMenu.cpp
|
||||
src/gui/guiPathSelectMenu.h
|
||||
src/gui/guiScene.cpp
|
||||
src/gui/guiScene.h
|
||||
src/gui/guiScrollBar.cpp
|
||||
src/gui/guiSkin.cpp
|
||||
src/gui/guiSkin.h
|
||||
src/gui/guiTable.cpp
|
||||
src/gui/guiTable.h
|
||||
src/gui/guiVolumeChange.cpp
|
||||
src/gui/guiVolumeChange.h
|
||||
src/gui/mainmenumanager.h
|
||||
src/gui/modalMenu.h
|
||||
src/guiscalingfilter.cpp
|
||||
src/guiscalingfilter.h
|
||||
src/gui/StyleSpec.h
|
||||
src/gui/touchscreengui.cpp
|
||||
src/httpfetch.cpp
|
||||
src/hud.cpp
|
||||
src/hud.h
|
||||
src/imagefilters.cpp
|
||||
src/imagefilters.h
|
||||
src/inventory.cpp
|
||||
src/inventory.h
|
||||
src/inventorymanager.cpp
|
||||
src/inventorymanager.h
|
||||
src/irrlicht_changes/CGUITTFont.cpp
|
||||
src/irrlicht_changes/CGUITTFont.h
|
||||
src/irrlicht_changes/irrUString.h
|
||||
src/irrlicht_changes/static_text.cpp
|
||||
src/irrlicht_changes/static_text.h
|
||||
src/irrlichttypes.h
|
||||
src/itemdef.cpp
|
||||
src/itemdef.h
|
||||
src/itemstackmetadata.cpp
|
||||
src/keycode.cpp
|
||||
src/light.cpp
|
||||
src/localplayer.cpp
|
||||
src/log.cpp
|
||||
src/log.h
|
||||
src/main.cpp
|
||||
src/mapblock.cpp
|
||||
src/mapblock.h
|
||||
src/mapblock_mesh.cpp
|
||||
src/mapblock_mesh.h
|
||||
src/map.cpp
|
||||
src/mapgen/cavegen.cpp
|
||||
src/mapgen/cavegen.h
|
||||
src/mapgen/dungeongen.cpp
|
||||
src/mapgen/dungeongen.h
|
||||
src/mapgen/mapgen.cpp
|
||||
src/mapgen/mapgen.h
|
||||
src/mapgen/mapgen_carpathian.cpp
|
||||
src/mapgen/mapgen_carpathian.h
|
||||
src/mapgen/mapgen_flat.cpp
|
||||
src/mapgen/mapgen_flat.h
|
||||
src/mapgen/mapgen_fractal.cpp
|
||||
src/mapgen/mapgen_fractal.h
|
||||
src/mapgen/mapgen_singlenode.cpp
|
||||
src/mapgen/mapgen_singlenode.h
|
||||
src/mapgen/mapgen_v5.cpp
|
||||
src/mapgen/mapgen_v5.h
|
||||
src/mapgen/mapgen_v6.cpp
|
||||
src/mapgen/mapgen_v6.h
|
||||
src/mapgen/mapgen_v7.cpp
|
||||
src/mapgen/mapgen_v7.h
|
||||
src/mapgen/mapgen_valleys.cpp
|
||||
src/mapgen/mapgen_valleys.h
|
||||
src/mapgen/mg_biome.cpp
|
||||
src/mapgen/mg_biome.h
|
||||
src/mapgen/mg_decoration.cpp
|
||||
src/mapgen/mg_decoration.h
|
||||
src/mapgen/mg_ore.cpp
|
||||
src/mapgen/mg_ore.h
|
||||
src/mapgen/mg_schematic.cpp
|
||||
src/mapgen/mg_schematic.h
|
||||
src/mapgen/treegen.cpp
|
||||
src/mapgen/treegen.h
|
||||
src/map.h
|
||||
src/mapnode.cpp
|
||||
src/mapnode.h
|
||||
src/mapsector.cpp
|
||||
src/mapsector.h
|
||||
src/map_settings_manager.cpp
|
||||
src/map_settings_manager.h
|
||||
src/mesh.cpp
|
||||
src/mesh_generator_thread.cpp
|
||||
src/mesh.h
|
||||
src/metadata.h
|
||||
src/minimap.cpp
|
||||
src/minimap.h
|
||||
src/mods.cpp
|
||||
src/mods.h
|
||||
src/network/address.cpp
|
||||
src/network/clientopcodes.cpp
|
||||
src/network/clientopcodes.h
|
||||
src/network/clientpackethandler.cpp
|
||||
src/network/connection.cpp
|
||||
src/network/connection.h
|
||||
src/network/connectionthreads.cpp
|
||||
src/network/networkpacket.cpp
|
||||
src/network/networkprotocol.h
|
||||
src/network/serveropcodes.cpp
|
||||
src/network/serveropcodes.h
|
||||
src/network/serverpackethandler.cpp
|
||||
src/nodedef.cpp
|
||||
src/nodedef.h
|
||||
src/nodemetadata.cpp
|
||||
src/nodemetadata.h
|
||||
src/nodetimer.cpp
|
||||
src/nodetimer.h
|
||||
src/noise.cpp
|
||||
src/noise.h
|
||||
src/objdef.cpp
|
||||
src/objdef.h
|
||||
src/object_properties.cpp
|
||||
src/object_properties.h
|
||||
src/particles.cpp
|
||||
src/particles.h
|
||||
src/pathfinder.cpp
|
||||
src/pathfinder.h
|
||||
src/player.cpp
|
||||
src/player.h
|
||||
src/porting_android.cpp
|
||||
src/porting_android.h
|
||||
src/porting.cpp
|
||||
src/porting.h
|
||||
src/profiler.h
|
||||
src/raycast.cpp
|
||||
src/raycast.h
|
||||
src/reflowscan.cpp
|
||||
src/reflowscan.h
|
||||
src/remoteplayer.cpp
|
||||
src/rollback.cpp
|
||||
src/rollback.h
|
||||
src/rollback_interface.cpp
|
||||
src/rollback_interface.h
|
||||
src/script/common/c_content.cpp
|
||||
src/script/common/c_content.h
|
||||
src/script/common/c_converter.cpp
|
||||
src/script/common/c_converter.h
|
||||
src/script/common/c_internal.cpp
|
||||
src/script/common/c_internal.h
|
||||
src/script/common/c_types.cpp
|
||||
src/script/common/c_types.h
|
||||
src/script/cpp_api/s_async.cpp
|
||||
src/script/cpp_api/s_async.h
|
||||
src/script/cpp_api/s_base.cpp
|
||||
src/script/cpp_api/s_base.h
|
||||
src/script/cpp_api/s_client.cpp
|
||||
src/script/cpp_api/s_entity.cpp
|
||||
src/script/cpp_api/s_entity.h
|
||||
src/script/cpp_api/s_env.cpp
|
||||
src/script/cpp_api/s_env.h
|
||||
src/script/cpp_api/s_internal.h
|
||||
src/script/cpp_api/s_inventory.cpp
|
||||
src/script/cpp_api/s_inventory.h
|
||||
src/script/cpp_api/s_item.cpp
|
||||
src/script/cpp_api/s_item.h
|
||||
src/script/cpp_api/s_mainmenu.h
|
||||
src/script/cpp_api/s_node.cpp
|
||||
src/script/cpp_api/s_node.h
|
||||
src/script/cpp_api/s_nodemeta.cpp
|
||||
src/script/cpp_api/s_nodemeta.h
|
||||
src/script/cpp_api/s_player.cpp
|
||||
src/script/cpp_api/s_player.h
|
||||
src/script/cpp_api/s_security.cpp
|
||||
src/script/cpp_api/s_security.h
|
||||
src/script/cpp_api/s_server.cpp
|
||||
src/script/cpp_api/s_server.h
|
||||
src/script/lua_api/l_areastore.cpp
|
||||
src/script/lua_api/l_base.cpp
|
||||
src/script/lua_api/l_base.h
|
||||
src/script/lua_api/l_client.cpp
|
||||
src/script/lua_api/l_craft.cpp
|
||||
src/script/lua_api/l_craft.h
|
||||
src/script/lua_api/l_env.cpp
|
||||
src/script/lua_api/l_env.h
|
||||
src/script/lua_api/l_http.cpp
|
||||
src/script/lua_api/l_http.h
|
||||
src/script/lua_api/l_internal.h
|
||||
src/script/lua_api/l_inventory.cpp
|
||||
src/script/lua_api/l_inventory.h
|
||||
src/script/lua_api/l_item.cpp
|
||||
src/script/lua_api/l_item.h
|
||||
src/script/lua_api/l_itemstackmeta.cpp
|
||||
src/script/lua_api/l_itemstackmeta.h
|
||||
src/script/lua_api/l_localplayer.cpp
|
||||
src/script/lua_api/l_mainmenu.cpp
|
||||
src/script/lua_api/l_mainmenu.h
|
||||
src/script/lua_api/l_mapgen.cpp
|
||||
src/script/lua_api/l_mapgen.h
|
||||
src/script/lua_api/l_metadata.cpp
|
||||
src/script/lua_api/l_minimap.cpp
|
||||
src/script/lua_api/l_nodemeta.cpp
|
||||
src/script/lua_api/l_nodemeta.h
|
||||
src/script/lua_api/l_nodetimer.cpp
|
||||
src/script/lua_api/l_noise.cpp
|
||||
src/script/lua_api/l_object.cpp
|
||||
src/script/lua_api/l_object.h
|
||||
src/script/lua_api/l_particles.cpp
|
||||
src/script/lua_api/l_particles.h
|
||||
src/script/lua_api/l_particles_local.cpp
|
||||
src/script/lua_api/l_rollback.cpp
|
||||
src/script/lua_api/l_rollback.h
|
||||
src/script/lua_api/l_server.cpp
|
||||
src/script/lua_api/l_settings.cpp
|
||||
src/script/lua_api/l_sound.cpp
|
||||
src/script/lua_api/l_storage.cpp
|
||||
src/script/lua_api/l_util.cpp
|
||||
src/script/lua_api/l_vmanip.cpp
|
||||
src/script/scripting_client.cpp
|
||||
src/script/scripting_client.h
|
||||
src/script/scripting_mainmenu.cpp
|
||||
src/script/scripting_mainmenu.h
|
||||
src/script/scripting_server.cpp
|
||||
src/script/scripting_server.h
|
||||
src/serialization.cpp
|
||||
src/serialization.h
|
||||
src/server.cpp
|
||||
src/serverenvironment.cpp
|
||||
src/serverenvironment.h
|
||||
src/server.h
|
||||
src/serverlist.cpp
|
||||
src/serverlist.h
|
||||
src/server/luaentity_sao.cpp
|
||||
src/server/player_sao.cpp
|
||||
src/server/serveractiveobject.cpp
|
||||
src/server/serveractiveobject.h
|
||||
src/settings.cpp
|
||||
src/settings.h
|
||||
src/settings_translation_file.cpp
|
||||
src/shader.cpp
|
||||
src/shader.h
|
||||
src/sky.cpp
|
||||
src/sound.cpp
|
||||
src/staticobject.cpp
|
||||
src/staticobject.h
|
||||
src/subgame.cpp
|
||||
src/subgame.h
|
||||
src/terminal_chat_console.cpp
|
||||
src/terminal_chat_console.h
|
||||
src/texture_override.cpp
|
||||
src/threading/atomic.h
|
||||
src/threading/event.cpp
|
||||
src/threading/mutex_auto_lock.h
|
||||
src/threading/mutex.cpp
|
||||
src/threading/mutex.h
|
||||
src/threading/semaphore.cpp
|
||||
src/threading/thread.cpp
|
||||
src/threading/thread.h
|
||||
src/threads.h
|
||||
src/tileanimation.cpp
|
||||
src/tileanimation.h
|
||||
src/tool.cpp
|
||||
src/tool.h
|
||||
src/translation.cpp
|
||||
src/unittest/test_areastore.cpp
|
||||
src/unittest/test_collision.cpp
|
||||
src/unittest/test_compression.cpp
|
||||
src/unittest/test_connection.cpp
|
||||
src/unittest/test.cpp
|
||||
src/unittest/test_filepath.cpp
|
||||
src/unittest/test.h
|
||||
src/unittest/test_inventory.cpp
|
||||
src/unittest/test_keycode.cpp
|
||||
src/unittest/test_map_settings_manager.cpp
|
||||
src/unittest/test_noderesolver.cpp
|
||||
src/unittest/test_noise.cpp
|
||||
src/unittest/test_random.cpp
|
||||
src/unittest/test_schematic.cpp
|
||||
src/unittest/test_serialization.cpp
|
||||
src/unittest/test_settings.cpp
|
||||
src/unittest/test_socket.cpp
|
||||
src/unittest/test_threading.cpp
|
||||
src/unittest/test_utilities.cpp
|
||||
src/unittest/test_voxelalgorithms.cpp
|
||||
src/unittest/test_voxelmanipulator.cpp
|
||||
src/util/areastore.cpp
|
||||
src/util/areastore.h
|
||||
src/util/auth.cpp
|
||||
src/util/auth.h
|
||||
src/util/base64.cpp
|
||||
src/util/base64.h
|
||||
src/util/basic_macros.h
|
||||
src/util/container.h
|
||||
src/util/directiontables.cpp
|
||||
src/util/directiontables.h
|
||||
src/util/enriched_string.cpp
|
||||
src/util/enriched_string.h
|
||||
src/util/md32_common.h
|
||||
src/util/numeric.cpp
|
||||
src/util/numeric.h
|
||||
src/util/pointedthing.cpp
|
||||
src/util/pointedthing.h
|
||||
src/util/pointer.h
|
||||
src/util/quicktune.h
|
||||
src/util/quicktune_shortcutter.h
|
||||
src/util/quicktune.cpp
|
||||
src/util/serialize.cpp
|
||||
src/util/serialize.h
|
||||
src/util/sha1.cpp
|
||||
src/util/srp.cpp
|
||||
src/util/srp.h
|
||||
src/util/strfnd.h
|
||||
src/util/string.cpp
|
||||
src/util/string.h
|
||||
src/util/thread.h
|
||||
src/util/timetaker.cpp
|
||||
src/util/timetaker.h
|
||||
src/version.cpp
|
||||
src/version.h
|
||||
src/voxelalgorithms.cpp
|
||||
src/voxelalgorithms.h
|
||||
src/voxel.cpp
|
||||
src/voxel.h
|
||||
src/wieldmesh.cpp
|
||||
64
util/ci/clang-format.sh
Normal file
64
util/ci/clang-format.sh
Normal file
@@ -0,0 +1,64 @@
|
||||
#! /bin/bash
|
||||
|
||||
function setup_for_format() {
|
||||
if [ -z "${CLANG_FORMAT}" ]; then
|
||||
CLANG_FORMAT=clang-format
|
||||
fi
|
||||
echo "LINT: Using binary $CLANG_FORMAT"
|
||||
CLANG_FORMAT_WHITELIST="util/ci/clang-format-whitelist.txt"
|
||||
|
||||
files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
|
||||
}
|
||||
|
||||
function check_format() {
|
||||
echo "Checking format..."
|
||||
|
||||
setup_for_format
|
||||
|
||||
local errorcount=0
|
||||
local fail=0
|
||||
for f in ${files_to_lint}; do
|
||||
d=$(diff -u "$f" <(${CLANG_FORMAT} "$f") || true)
|
||||
|
||||
if ! [ -z "$d" ]; then
|
||||
whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
|
||||
|
||||
# If file is not whitelisted, mark a failure
|
||||
if [ -z "${whitelisted}" ]; then
|
||||
errorcount=$((errorcount+1))
|
||||
|
||||
printf "The file %s is not compliant with the coding style" "$f"
|
||||
if [ ${errorcount} -gt 50 ]; then
|
||||
printf "\nToo many errors encountered previously, this diff is hidden.\n"
|
||||
else
|
||||
printf ":\n%s\n" "$d"
|
||||
fi
|
||||
|
||||
fail=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$fail" = 1 ]; then
|
||||
echo "LINT reports failure."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "LINT OK"
|
||||
}
|
||||
|
||||
|
||||
|
||||
function fix_format() {
|
||||
echo "Fixing format..."
|
||||
|
||||
setup_for_format
|
||||
|
||||
for f in ${files_to_lint}; do
|
||||
whitelisted=$(awk '$1 == "'$f'" { print 1 }' "$CLANG_FORMAT_WHITELIST")
|
||||
if [ -z "${whitelisted}" ]; then
|
||||
echo "$f"
|
||||
$CLANG_FORMAT -i "$f"
|
||||
fi
|
||||
done
|
||||
}
|
||||
13
util/ci/clang-tidy.sh
Normal file
13
util/ci/clang-tidy.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#! /bin/bash -eu
|
||||
|
||||
cmake -B build -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DRUN_IN_PLACE=TRUE \
|
||||
-DENABLE_{GETTEXT,SOUND}=FALSE \
|
||||
-DBUILD_SERVER=TRUE
|
||||
cmake --build build --target GenerateVersion
|
||||
|
||||
./util/ci/run-clang-tidy.py \
|
||||
-clang-tidy-binary=clang-tidy-9 -p build \
|
||||
-quiet -config="$(cat .clang-tidy)" \
|
||||
'src/.*'
|
||||
34
util/ci/common.sh
Normal file
34
util/ci/common.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Linux build only
|
||||
install_linux_deps() {
|
||||
local pkgs=(
|
||||
cmake gettext
|
||||
libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev
|
||||
libsqlite3-dev libhiredis-dev libogg-dev libgmp-dev libvorbis-dev
|
||||
libopenal-dev libpq-dev libleveldb-dev libcurl4-openssl-dev libzstd-dev
|
||||
)
|
||||
|
||||
if [[ "$1" == "--no-irr" ]]; then
|
||||
shift
|
||||
else
|
||||
local ver=$(cat misc/irrlichtmt_tag.txt)
|
||||
wget "https://github.com/minetest/irrlicht/releases/download/$ver/ubuntu-bionic.tar.gz"
|
||||
sudo tar -xaf ubuntu-bionic.tar.gz -C /usr/local
|
||||
fi
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends "${pkgs[@]}" "$@"
|
||||
}
|
||||
|
||||
# macOS build only
|
||||
install_macos_deps() {
|
||||
local pkgs=(
|
||||
cmake gettext freetype gmp jpeg-turbo jsoncpp leveldb
|
||||
libogg libpng libvorbis luajit zstd
|
||||
)
|
||||
brew update
|
||||
brew install "${pkgs[@]}"
|
||||
brew unlink $(brew ls --formula)
|
||||
brew link "${pkgs[@]}"
|
||||
}
|
||||
321
util/ci/run-clang-tidy.py
Normal file
321
util/ci/run-clang-tidy.py
Normal file
@@ -0,0 +1,321 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
#===- run-clang-tidy.py - Parallel clang-tidy runner ---------*- python -*--===#
|
||||
#
|
||||
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
# See https://llvm.org/LICENSE.txt for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
#===------------------------------------------------------------------------===#
|
||||
# FIXME: Integrate with clang-tidy-diff.py
|
||||
|
||||
"""
|
||||
Parallel clang-tidy runner
|
||||
==========================
|
||||
|
||||
Runs clang-tidy over all files in a compilation database. Requires clang-tidy
|
||||
and clang-apply-replacements in $PATH.
|
||||
|
||||
Example invocations.
|
||||
- Run clang-tidy on all files in the current working directory with a default
|
||||
set of checks and show warnings in the cpp files and all project headers.
|
||||
run-clang-tidy.py $PWD
|
||||
|
||||
- Fix all header guards.
|
||||
run-clang-tidy.py -fix -checks=-*,llvm-header-guard
|
||||
|
||||
- Fix all header guards included from clang-tidy and header guards
|
||||
for clang-tidy headers.
|
||||
run-clang-tidy.py -fix -checks=-*,llvm-header-guard extra/clang-tidy \
|
||||
-header-filter=extra/clang-tidy
|
||||
|
||||
Compilation database setup:
|
||||
http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import json
|
||||
import multiprocessing
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
yaml = None
|
||||
|
||||
is_py2 = sys.version[0] == '2'
|
||||
|
||||
if is_py2:
|
||||
import Queue as queue
|
||||
else:
|
||||
import queue as queue
|
||||
|
||||
def find_compilation_database(path):
|
||||
"""Adjusts the directory until a compilation database is found."""
|
||||
result = './'
|
||||
while not os.path.isfile(os.path.join(result, path)):
|
||||
if os.path.realpath(result) == '/':
|
||||
print('Error: could not find compilation database.')
|
||||
sys.exit(1)
|
||||
result += '../'
|
||||
return os.path.realpath(result)
|
||||
|
||||
|
||||
def make_absolute(f, directory):
|
||||
if os.path.isabs(f):
|
||||
return f
|
||||
return os.path.normpath(os.path.join(directory, f))
|
||||
|
||||
|
||||
def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
|
||||
header_filter, extra_arg, extra_arg_before, quiet,
|
||||
config):
|
||||
"""Gets a command line for clang-tidy."""
|
||||
start = [clang_tidy_binary]
|
||||
if header_filter is not None:
|
||||
start.append('-header-filter=' + header_filter)
|
||||
if checks:
|
||||
start.append('-checks=' + checks)
|
||||
if tmpdir is not None:
|
||||
start.append('-export-fixes')
|
||||
# Get a temporary file. We immediately close the handle so clang-tidy can
|
||||
# overwrite it.
|
||||
(handle, name) = tempfile.mkstemp(suffix='.yaml', dir=tmpdir)
|
||||
os.close(handle)
|
||||
start.append(name)
|
||||
for arg in extra_arg:
|
||||
start.append('-extra-arg=%s' % arg)
|
||||
for arg in extra_arg_before:
|
||||
start.append('-extra-arg-before=%s' % arg)
|
||||
start.append('-p=' + build_path)
|
||||
if quiet:
|
||||
start.append('-quiet')
|
||||
if config:
|
||||
start.append('-config=' + config)
|
||||
start.append(f)
|
||||
return start
|
||||
|
||||
|
||||
def merge_replacement_files(tmpdir, mergefile):
|
||||
"""Merge all replacement files in a directory into a single file"""
|
||||
# The fixes suggested by clang-tidy >= 4.0.0 are given under
|
||||
# the top level key 'Diagnostics' in the output yaml files
|
||||
mergekey="Diagnostics"
|
||||
merged=[]
|
||||
for replacefile in glob.iglob(os.path.join(tmpdir, '*.yaml')):
|
||||
content = yaml.safe_load(open(replacefile, 'r'))
|
||||
if not content:
|
||||
continue # Skip empty files.
|
||||
merged.extend(content.get(mergekey, []))
|
||||
|
||||
if merged:
|
||||
# MainSourceFile: The key is required by the definition inside
|
||||
# include/clang/Tooling/ReplacementsYaml.h, but the value
|
||||
# is actually never used inside clang-apply-replacements,
|
||||
# so we set it to '' here.
|
||||
output = { 'MainSourceFile': '', mergekey: merged }
|
||||
with open(mergefile, 'w') as out:
|
||||
yaml.safe_dump(output, out)
|
||||
else:
|
||||
# Empty the file:
|
||||
open(mergefile, 'w').close()
|
||||
|
||||
|
||||
def check_clang_apply_replacements_binary(args):
|
||||
"""Checks if invoking supplied clang-apply-replacements binary works."""
|
||||
try:
|
||||
subprocess.check_call([args.clang_apply_replacements_binary, '--version'])
|
||||
except:
|
||||
print('Unable to run clang-apply-replacements. Is clang-apply-replacements '
|
||||
'binary correctly specified?', file=sys.stderr)
|
||||
traceback.print_exc()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def apply_fixes(args, tmpdir):
|
||||
"""Calls clang-apply-fixes on a given directory."""
|
||||
invocation = [args.clang_apply_replacements_binary]
|
||||
if args.format:
|
||||
invocation.append('-format')
|
||||
if args.style:
|
||||
invocation.append('-style=' + args.style)
|
||||
invocation.append(tmpdir)
|
||||
subprocess.call(invocation)
|
||||
|
||||
|
||||
def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
|
||||
"""Takes filenames out of queue and runs clang-tidy on them."""
|
||||
while True:
|
||||
name = queue.get()
|
||||
invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
|
||||
tmpdir, build_path, args.header_filter,
|
||||
args.extra_arg, args.extra_arg_before,
|
||||
args.quiet, args.config)
|
||||
|
||||
proc = subprocess.Popen(invocation)
|
||||
proc.wait()
|
||||
if proc.returncode != 0:
|
||||
failed_files.append(name)
|
||||
queue.task_done()
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Runs clang-tidy over all files '
|
||||
'in a compilation database. Requires '
|
||||
'clang-tidy and clang-apply-replacements in '
|
||||
'$PATH.')
|
||||
parser.add_argument('-clang-tidy-binary', metavar='PATH',
|
||||
default='clang-tidy',
|
||||
help='path to clang-tidy binary')
|
||||
parser.add_argument('-clang-apply-replacements-binary', metavar='PATH',
|
||||
default='clang-apply-replacements',
|
||||
help='path to clang-apply-replacements binary')
|
||||
parser.add_argument('-checks', default=None,
|
||||
help='checks filter, when not specified, use clang-tidy '
|
||||
'default')
|
||||
parser.add_argument('-config', default=None,
|
||||
help='Specifies a configuration in YAML/JSON format: '
|
||||
' -config="{Checks: \'*\', '
|
||||
' CheckOptions: [{key: x, '
|
||||
' value: y}]}" '
|
||||
'When the value is empty, clang-tidy will '
|
||||
'attempt to find a file named .clang-tidy for '
|
||||
'each source file in its parent directories.')
|
||||
parser.add_argument('-header-filter', default=None,
|
||||
help='regular expression matching the names of the '
|
||||
'headers to output diagnostics from. Diagnostics from '
|
||||
'the main file of each translation unit are always '
|
||||
'displayed.')
|
||||
if yaml:
|
||||
parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes',
|
||||
help='Create a yaml file to store suggested fixes in, '
|
||||
'which can be applied with clang-apply-replacements.')
|
||||
parser.add_argument('-j', type=int, default=0,
|
||||
help='number of tidy instances to be run in parallel.')
|
||||
parser.add_argument('files', nargs='*', default=['.*'],
|
||||
help='files to be processed (regex on path)')
|
||||
parser.add_argument('-fix', action='store_true', help='apply fix-its')
|
||||
parser.add_argument('-format', action='store_true', help='Reformat code '
|
||||
'after applying fixes')
|
||||
parser.add_argument('-style', default='file', help='The style of reformat '
|
||||
'code after applying fixes')
|
||||
parser.add_argument('-p', dest='build_path',
|
||||
help='Path used to read a compile command database.')
|
||||
parser.add_argument('-extra-arg', dest='extra_arg',
|
||||
action='append', default=[],
|
||||
help='Additional argument to append to the compiler '
|
||||
'command line.')
|
||||
parser.add_argument('-extra-arg-before', dest='extra_arg_before',
|
||||
action='append', default=[],
|
||||
help='Additional argument to prepend to the compiler '
|
||||
'command line.')
|
||||
parser.add_argument('-quiet', action='store_true',
|
||||
help='Run clang-tidy in quiet mode')
|
||||
args = parser.parse_args()
|
||||
|
||||
db_path = 'compile_commands.json'
|
||||
|
||||
if args.build_path is not None:
|
||||
build_path = args.build_path
|
||||
else:
|
||||
# Find our database
|
||||
build_path = find_compilation_database(db_path)
|
||||
|
||||
try:
|
||||
invocation = [args.clang_tidy_binary, '-list-checks']
|
||||
invocation.append('-p=' + build_path)
|
||||
if args.checks:
|
||||
invocation.append('-checks=' + args.checks)
|
||||
invocation.append('-')
|
||||
if args.quiet:
|
||||
# Even with -quiet we still want to check if we can call clang-tidy.
|
||||
with open(os.devnull, 'w') as dev_null:
|
||||
subprocess.check_call(invocation, stdout=dev_null)
|
||||
else:
|
||||
subprocess.check_call(invocation)
|
||||
except:
|
||||
print("Unable to run clang-tidy.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Load the database and extract all files.
|
||||
database = json.load(open(os.path.join(build_path, db_path)))
|
||||
files = [make_absolute(entry['file'], entry['directory'])
|
||||
for entry in database]
|
||||
|
||||
max_task = args.j
|
||||
if max_task == 0:
|
||||
max_task = multiprocessing.cpu_count()
|
||||
|
||||
tmpdir = None
|
||||
if args.fix or (yaml and args.export_fixes):
|
||||
check_clang_apply_replacements_binary(args)
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
|
||||
# Build up a big regexy filter from all command line arguments.
|
||||
file_name_re = re.compile('|'.join(args.files))
|
||||
|
||||
return_code = 0
|
||||
try:
|
||||
# Spin up a bunch of tidy-launching threads.
|
||||
task_queue = queue.Queue(max_task)
|
||||
# List of files with a non-zero return code.
|
||||
failed_files = []
|
||||
lock = threading.Lock()
|
||||
for _ in range(max_task):
|
||||
t = threading.Thread(target=run_tidy,
|
||||
args=(args, tmpdir, build_path, task_queue, lock, failed_files))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
||||
# Fill the queue with files.
|
||||
for name in files:
|
||||
if file_name_re.search(name):
|
||||
task_queue.put(name)
|
||||
|
||||
# Wait for all threads to be done.
|
||||
task_queue.join()
|
||||
if len(failed_files):
|
||||
return_code = 1
|
||||
|
||||
except KeyboardInterrupt:
|
||||
# This is a sad hack. Unfortunately subprocess goes
|
||||
# bonkers with ctrl-c and we start forking merrily.
|
||||
print('\nCtrl-C detected, goodbye.')
|
||||
if tmpdir:
|
||||
shutil.rmtree(tmpdir)
|
||||
os.kill(0, 9)
|
||||
|
||||
if yaml and args.export_fixes:
|
||||
print('Writing fixes to ' + args.export_fixes + ' ...')
|
||||
try:
|
||||
merge_replacement_files(tmpdir, args.export_fixes)
|
||||
except:
|
||||
print('Error exporting fixes.\n', file=sys.stderr)
|
||||
traceback.print_exc()
|
||||
return_code=1
|
||||
|
||||
if args.fix:
|
||||
print('Applying fixes ...')
|
||||
try:
|
||||
apply_fixes(args, tmpdir)
|
||||
except:
|
||||
print('Error applying fixes.\n', file=sys.stderr)
|
||||
traceback.print_exc()
|
||||
return_code=1
|
||||
|
||||
if tmpdir:
|
||||
shutil.rmtree(tmpdir)
|
||||
sys.exit(return_code)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
5
util/fix_format.sh
Normal file
5
util/fix_format.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
. ./util/ci/clang-format.sh
|
||||
|
||||
fix_format
|
||||
67
util/gather_git_credits.py
Normal file
67
util/gather_git_credits.py
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
import subprocess
|
||||
import re
|
||||
from collections import defaultdict
|
||||
|
||||
codefiles = r"(\.[ch](pp)?|\.lua|\.md|\.cmake|\.java|\.gradle|Makefile|CMakeLists\.txt)$"
|
||||
|
||||
# two minor versions back, for "Active Contributors"
|
||||
REVS_ACTIVE = "5.2.0..HEAD"
|
||||
# all time, for "Previous Contributors"
|
||||
REVS_PREVIOUS = "HEAD"
|
||||
|
||||
CUTOFF_ACTIVE = 3
|
||||
CUTOFF_PREVIOUS = 21
|
||||
|
||||
# For a description of the points system see:
|
||||
# https://github.com/minetest/minetest/pull/9593#issue-398677198
|
||||
|
||||
def load(revs):
|
||||
points = defaultdict(int)
|
||||
p = subprocess.Popen(["git", "log", "--mailmap", "--pretty=format:%h %aN <%aE>", revs],
|
||||
stdout=subprocess.PIPE, universal_newlines=True)
|
||||
for line in p.stdout:
|
||||
hash, author = line.strip().split(" ", 1)
|
||||
n = 0
|
||||
|
||||
p2 = subprocess.Popen(["git", "show", "--numstat", "--pretty=format:", hash],
|
||||
stdout=subprocess.PIPE, universal_newlines=True)
|
||||
for line in p2.stdout:
|
||||
added, deleted, filename = re.split(r"\s+", line.strip(), 2)
|
||||
if re.search(codefiles, filename) and added != "-":
|
||||
n += int(added)
|
||||
p2.wait()
|
||||
|
||||
if n == 0:
|
||||
continue
|
||||
if n > 1200:
|
||||
n = 8
|
||||
elif n > 700:
|
||||
n = 4
|
||||
elif n > 100:
|
||||
n = 2
|
||||
else:
|
||||
n = 1
|
||||
points[author] += n
|
||||
p.wait()
|
||||
|
||||
# Some authors duplicate? Don't add manual workarounds here, edit the .mailmap!
|
||||
for author in ("updatepo.sh <script@mt>", "Weblate <42@minetest.ru>"):
|
||||
points.pop(author, None)
|
||||
return points
|
||||
|
||||
points_active = load(REVS_ACTIVE)
|
||||
points_prev = load(REVS_PREVIOUS)
|
||||
|
||||
with open("results.txt", "w") as f:
|
||||
for author, points in sorted(points_active.items(), key=(lambda e: e[1]), reverse=True):
|
||||
if points < CUTOFF_ACTIVE: break
|
||||
points_prev.pop(author, None) # active authors don't appear in previous
|
||||
f.write("%d\t%s\n" % (points, author))
|
||||
f.write('\n---------\n\n')
|
||||
once = True
|
||||
for author, points in sorted(points_prev.items(), key=(lambda e: e[1]), reverse=True):
|
||||
if points < CUTOFF_PREVIOUS and once:
|
||||
f.write('\n---------\n\n')
|
||||
once = False
|
||||
f.write("%d\t%s\n" % (points, author))
|
||||
51
util/helper_mod/init.lua
Normal file
51
util/helper_mod/init.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
local mode = core.settings:get("helper_mode")
|
||||
|
||||
if mode == "devtest" then
|
||||
|
||||
-- Provide feedback to script by creating files in world path
|
||||
core.after(0, function()
|
||||
io.close(io.open(core.get_worldpath() .. "/startup", "w"))
|
||||
end)
|
||||
local function callback(test_ok)
|
||||
if not test_ok then
|
||||
io.close(io.open(core.get_worldpath() .. "/test_failure", "w"))
|
||||
end
|
||||
io.close(io.open(core.get_worldpath() .. "/done", "w"))
|
||||
core.request_shutdown("", false, 2)
|
||||
end
|
||||
-- If tests are enabled exit when they're done, otherwise exit on player join
|
||||
if core.settings:get_bool("devtest_unittests_autostart") and core.global_exists("unittests") then
|
||||
unittests.on_finished = callback
|
||||
else
|
||||
core.register_on_joinplayer(function() callback(true) end)
|
||||
end
|
||||
|
||||
elseif mode == "mapgen" then
|
||||
|
||||
-- Stress-test mapgen by constantly generating new area
|
||||
local csize = tonumber(core.settings:get("chunksize")) * core.MAP_BLOCKSIZE
|
||||
local MINP, MAXP = vector.new(0, -csize, 0), vector.new(csize*3, csize*2, csize)
|
||||
local DIR = "x"
|
||||
local pstart = vector.new(0, 0, 0)
|
||||
local next_, callback
|
||||
next_ = function(arg)
|
||||
print("emerging " .. core.pos_to_string(pstart))
|
||||
core.emerge_area(
|
||||
vector.add(pstart, MINP), vector.add(pstart, MAXP),
|
||||
callback, arg
|
||||
)
|
||||
end
|
||||
local trig = {}
|
||||
callback = function(blockpos, action, calls_rem, n)
|
||||
if action == core.EMERGE_CANCELLED or action == core.EMERGE_ERRORED then
|
||||
return
|
||||
end
|
||||
if calls_rem <= 20 and not trig[n] then
|
||||
trig[n] = true
|
||||
pstart[DIR] = pstart[DIR] + (MAXP[DIR] - MINP[DIR])
|
||||
next_(n + 1)
|
||||
end
|
||||
end
|
||||
core.after(0, next_, 1)
|
||||
|
||||
end
|
||||
3
util/helper_mod/mod.conf
Normal file
3
util/helper_mod/mod.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
name = helper_mod
|
||||
description = Helper used by various test scripts
|
||||
optional_depends = unittests
|
||||
33
util/reorder_translation_commits.py
Normal file
33
util/reorder_translation_commits.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
ret = subprocess.run(["git", "config", "rebase.instructionFormat"], capture_output=True)
|
||||
if ret.returncode != 0 or ret.stdout.decode('ascii').strip() != "(%an <%ae>) %s":
|
||||
print("Git is using the wrong rebase instruction format, reconfigure it.")
|
||||
exit(1)
|
||||
|
||||
try:
|
||||
f = open(".git/rebase-merge/git-rebase-todo", "r")
|
||||
except:
|
||||
print("Initiate the rebase first!")
|
||||
exit(1)
|
||||
lines = list(s.strip("\r\n") for s in f.readlines())
|
||||
f.close()
|
||||
|
||||
for i in range(len(lines)):
|
||||
line = lines[i]
|
||||
if line.startswith("#") or " Translated using Weblate " not in line: continue
|
||||
pos = line.rfind("(")
|
||||
lang = line[pos:]
|
||||
author = line[line.find("("):line.rfind(")", 0, pos)+1]
|
||||
# try to grab the next commit by the same author for the same language
|
||||
for j in range(i+1, len(lines)):
|
||||
if lines[j].startswith("#") or not lines[j].endswith(lang): continue
|
||||
if author in lines[j]:
|
||||
lines.insert(i+1, "f " + lines.pop(j)[5:])
|
||||
break
|
||||
|
||||
with open(".git/rebase-merge/git-rebase-todo", "w") as f:
|
||||
f.write("\n".join(lines) + "\n")
|
||||
print("You can now continue with the rebase.")
|
||||
30
util/stress_mapgen.sh
Normal file
30
util/stress_mapgen.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
gameid=${gameid:-devtest}
|
||||
minetest=$dir/../bin/minetest
|
||||
testspath=$dir/../tests
|
||||
conf_server=$testspath/server.conf
|
||||
worldpath=$testspath/world
|
||||
|
||||
run () {
|
||||
if [ -n "$PERF" ]; then
|
||||
perf record -z --call-graph dwarf -- "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
[ -e "$minetest" ] || { echo "executable $minetest missing"; exit 1; }
|
||||
|
||||
rm -rf "$worldpath"
|
||||
mkdir -p "$worldpath/worldmods"
|
||||
|
||||
settings=(sqlite_synchronous=0 helper_mode=mapgen)
|
||||
[ -n "$PROFILER" ] && settings+=(profiler_print_interval=15)
|
||||
printf '%s\n' "${settings[@]}" >"$testspath/server.conf" \
|
||||
|
||||
ln -s "$dir/helper_mod" "$worldpath/worldmods/"
|
||||
|
||||
args=(--config "$conf_server" --world "$worldpath" --gameid $gameid)
|
||||
[ -n "$PROFILER" ] && args+=(--verbose)
|
||||
run "$minetest" --server "${args[@]}"
|
||||
57
util/test_multiplayer.sh
Normal file
57
util/test_multiplayer.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
gameid=${gameid:-devtest}
|
||||
minetest=$dir/../bin/minetest
|
||||
testspath=$dir/../tests
|
||||
conf_client1=$testspath/client1.conf
|
||||
conf_server=$testspath/server.conf
|
||||
worldpath=$testspath/world
|
||||
|
||||
waitfor () {
|
||||
n=30
|
||||
while [ $n -gt 0 ]; do
|
||||
[ -f "$1" ] && return 0
|
||||
sleep 0.5
|
||||
((n-=1))
|
||||
done
|
||||
echo "Waiting for ${1##*/} timed out"
|
||||
pkill -P $$
|
||||
exit 1
|
||||
}
|
||||
|
||||
gdbrun () {
|
||||
gdb -q -batch -ex 'set confirm off' -ex 'r' -ex 'bt' --args "$@"
|
||||
}
|
||||
|
||||
[ -e "$minetest" ] || { echo "executable $minetest missing"; exit 1; }
|
||||
|
||||
rm -rf "$worldpath"
|
||||
mkdir -p "$worldpath/worldmods"
|
||||
|
||||
printf '%s\n' >"$testspath/client1.conf" \
|
||||
video_driver=null name=client1 viewing_range=10 \
|
||||
enable_{sound,minimap,shaders}=false
|
||||
|
||||
printf '%s\n' >"$testspath/server.conf" \
|
||||
max_block_send_distance=1 devtest_unittests_autostart=true \
|
||||
helper_mode=devtest
|
||||
|
||||
ln -s "$dir/helper_mod" "$worldpath/worldmods/"
|
||||
|
||||
echo "Starting server"
|
||||
gdbrun "$minetest" --server --config "$conf_server" --world "$worldpath" --gameid $gameid 2>&1 | sed -u 's/^/(server) /' &
|
||||
waitfor "$worldpath/startup"
|
||||
|
||||
echo "Starting client"
|
||||
gdbrun "$minetest" --config "$conf_client1" --go --address 127.0.0.1 2>&1 | sed -u 's/^/(client) /' &
|
||||
waitfor "$worldpath/done"
|
||||
|
||||
echo "Waiting for client and server to exit"
|
||||
wait
|
||||
|
||||
if [ -f "$worldpath/test_failure" ]; then
|
||||
echo "There were test failures."
|
||||
exit 1
|
||||
fi
|
||||
echo "Success"
|
||||
exit 0
|
||||
82
util/updatepo.sh
Normal file
82
util/updatepo.sh
Normal file
@@ -0,0 +1,82 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Update/create minetest po files
|
||||
|
||||
# an auxiliary function to abort processing with an optional error
|
||||
# message
|
||||
abort() {
|
||||
test -n "$1" && echo >&2 "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The po/ directory is assumed to be parallel to the directory where
|
||||
# this script is. Relative paths are fine for us so we can just
|
||||
# use the following trick (works both for manual invocations and for
|
||||
# script found from PATH)
|
||||
scriptisin="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# The script is executed from the parent of po/, which is also the
|
||||
# parent of the script directory and of the src/ directory.
|
||||
# We go through $scriptisin so that it can be executed from whatever
|
||||
# directory and still work correctly
|
||||
cd "$scriptisin/.."
|
||||
|
||||
test -e po || abort "po/ directory not found"
|
||||
test -d po || abort "po/ is not a directory!"
|
||||
|
||||
# Get a list of the languages we have to update/create
|
||||
|
||||
cd po || abort "couldn't change directory to po!"
|
||||
|
||||
# This assumes that we won't have dirnames with space, which is
|
||||
# the case for language codes, which are the only subdirs we expect to
|
||||
# find in po/ anyway. If you put anything else there, you need to suffer
|
||||
# the consequences of your actions, so we don't do sanity checks
|
||||
langs=""
|
||||
|
||||
for lang in * ; do
|
||||
if test ! -d $lang; then
|
||||
continue
|
||||
fi
|
||||
langs="$langs $lang"
|
||||
done
|
||||
|
||||
# go back
|
||||
cd ..
|
||||
|
||||
# First thing first, update the .pot template. We place it in the po/
|
||||
# directory at the top level. You a recent enough xgettext that supports
|
||||
# --package-name
|
||||
potfile=po/minetest.pot
|
||||
xgettext --package-name=minetest \
|
||||
--add-comments='~' \
|
||||
--sort-by-file \
|
||||
--add-location=file \
|
||||
--keyword=N_ \
|
||||
--keyword=wgettext \
|
||||
--keyword=fwgettext \
|
||||
--keyword=fgettext \
|
||||
--keyword=fgettext_ne \
|
||||
--keyword=strgettext \
|
||||
--keyword=wstrgettext \
|
||||
--keyword=core.gettext \
|
||||
--keyword=showTranslatedStatusText \
|
||||
--keyword=fmtgettext \
|
||||
--output $potfile \
|
||||
--from-code=utf-8 \
|
||||
`find src/ -name '*.cpp' -o -name '*.h'` \
|
||||
`find builtin/ -name '*.lua'`
|
||||
|
||||
# Now iterate on all languages and create the po file if missing, or update it
|
||||
# if it exists already
|
||||
for lang in $langs ; do # note the missing quotes around $langs
|
||||
pofile=po/$lang/minetest.po
|
||||
if test -e $pofile; then
|
||||
echo "[$lang]: updating strings"
|
||||
msgmerge --update --sort-by-file $pofile $potfile
|
||||
else
|
||||
# This will ask for the translator identity
|
||||
echo "[$lang]: NEW strings"
|
||||
msginit --locale=$lang --output-file=$pofile --input=$potfile
|
||||
fi
|
||||
done
|
||||
1415
util/wireshark/minetest.lua
Normal file
1415
util/wireshark/minetest.lua
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user