2012-04-03 07:48:44 +02:00
|
|
|
#!/bin/bash
|
2014-06-15 15:34:22 +02:00
|
|
|
set -e
|
|
|
|
|
2022-07-21 20:51:02 +02:00
|
|
|
topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
2012-04-03 07:48:44 +02:00
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "Usage: $0 <build directory>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
builddir=$1
|
|
|
|
mkdir -p $builddir
|
|
|
|
builddir="$( cd "$builddir" && pwd )"
|
|
|
|
libdir=$builddir/libs
|
|
|
|
|
2023-04-11 18:17:55 +02:00
|
|
|
source $topdir/common.sh
|
|
|
|
|
2019-06-21 02:43:59 +02:00
|
|
|
# Test which win32 compiler is present
|
2021-10-25 21:56:25 +02:00
|
|
|
command -v i686-w64-mingw32-gcc >/dev/null &&
|
2021-10-25 22:33:13 +02:00
|
|
|
compiler=i686-w64-mingw32-gcc
|
2021-10-25 21:56:25 +02:00
|
|
|
command -v i686-w64-mingw32-gcc-posix >/dev/null &&
|
2021-10-25 22:33:13 +02:00
|
|
|
compiler=i686-w64-mingw32-gcc-posix
|
2019-06-21 02:43:59 +02:00
|
|
|
|
2021-10-25 22:33:13 +02:00
|
|
|
if [ -z "$compiler" ]; then
|
2021-11-07 17:50:57 +01:00
|
|
|
echo "Unable to determine which MinGW compiler to use"
|
2019-06-21 02:43:59 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2022-07-21 20:51:02 +02:00
|
|
|
toolchain_file=$topdir/toolchain_${compiler/-gcc/}.cmake
|
2020-02-11 00:20:40 +01:00
|
|
|
echo "Using $toolchain_file"
|
2019-06-21 02:43:59 +02:00
|
|
|
|
2023-04-11 18:17:55 +02:00
|
|
|
find_runtime_dlls i686-w64-mingw32
|
2021-10-25 22:33:13 +02:00
|
|
|
|
|
|
|
# Get stuff
|
2022-07-21 20:51:02 +02:00
|
|
|
irrlicht_version=$(cat $topdir/../../misc/irrlichtmt_tag.txt)
|
2012-04-03 07:48:44 +02:00
|
|
|
|
|
|
|
mkdir -p $libdir
|
|
|
|
|
2022-02-03 21:34:30 +01:00
|
|
|
# 'dw2' just points to rebuilt versions after a toolchain change
|
|
|
|
# this distinction should be gotten rid of next time
|
|
|
|
|
2014-06-15 15:34:22 +02:00
|
|
|
cd $libdir
|
2022-05-06 14:45:59 +02:00
|
|
|
download "https://github.com/minetest/irrlicht/releases/download/$irrlicht_version/win32.zip" irrlicht-$irrlicht_version.zip
|
2023-04-11 18:17:55 +02:00
|
|
|
download "http://minetest.kitsunemimi.pw/zlib-$zlib_version-win32.zip"
|
2021-09-01 02:32:31 +02:00
|
|
|
download "http://minetest.kitsunemimi.pw/zstd-$zstd_version-win32.zip"
|
2021-04-27 11:50:40 +02:00
|
|
|
download "http://minetest.kitsunemimi.pw/libogg-$ogg_version-win32.zip"
|
2022-02-03 21:34:30 +01:00
|
|
|
download "http://minetest.kitsunemimi.pw/dw2/libvorbis-$vorbis_version-win32.zip"
|
2021-04-27 11:50:40 +02:00
|
|
|
download "http://minetest.kitsunemimi.pw/curl-$curl_version-win32.zip"
|
2023-04-11 18:17:55 +02:00
|
|
|
download "http://minetest.kitsunemimi.pw/gettext-$gettext_version-win32.zip"
|
|
|
|
download "http://minetest.kitsunemimi.pw/freetype-$freetype_version-win32.zip"
|
2021-04-27 11:50:40 +02:00
|
|
|
download "http://minetest.kitsunemimi.pw/sqlite3-$sqlite3_version-win32.zip"
|
2023-04-11 18:17:55 +02:00
|
|
|
download "http://minetest.kitsunemimi.pw/luajit-$luajit_version-win32.zip"
|
2022-02-03 21:34:30 +01:00
|
|
|
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"
|
2012-04-03 07:48:44 +02:00
|
|
|
|
2021-04-11 17:10:06 +02:00
|
|
|
# Set source dir, downloading Minetest as needed
|
2023-04-11 18:17:55 +02:00
|
|
|
get_sources
|
2012-04-03 07:48:44 +02:00
|
|
|
|
2021-04-11 17:10:06 +02:00
|
|
|
git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
# Build the thing
|
|
|
|
cd $builddir
|
|
|
|
[ -d build ] && rm -rf build
|
2012-04-03 07:48:44 +02:00
|
|
|
|
2023-04-11 18:17:55 +02:00
|
|
|
cmake_args=(
|
|
|
|
-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
|
|
|
|
)
|
|
|
|
add_cmake_libs
|
|
|
|
cmake -S $sourcedir -B build "${cmake_args[@]}"
|
2012-04-03 07:48:44 +02:00
|
|
|
|
2022-02-01 01:42:24 +01:00
|
|
|
cmake --build build -j$(nproc)
|
2017-06-08 16:30:30 +02:00
|
|
|
|
2022-02-01 01:42:24 +01:00
|
|
|
[ -z "$NO_PACKAGE" ] && cmake --build build --target package
|
2012-04-03 07:48:44 +02:00
|
|
|
|
2017-06-09 09:40:16 +02:00
|
|
|
exit 0
|
2012-04-03 07:48:44 +02:00
|
|
|
# EOF
|