buildwin64.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/bash
  2. set -e
  3. topdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  4. if [ $# -ne 1 ]; then
  5. echo "Usage: $0 <build directory>"
  6. exit 1
  7. fi
  8. builddir=$1
  9. mkdir -p $builddir
  10. builddir="$( cd "$builddir" && pwd )"
  11. libdir=$builddir/libs
  12. source $topdir/common.sh
  13. # Test which win64 compiler is present
  14. command -v x86_64-w64-mingw32-gcc >/dev/null &&
  15. compiler=x86_64-w64-mingw32-gcc
  16. command -v x86_64-w64-mingw32-gcc-posix >/dev/null &&
  17. compiler=x86_64-w64-mingw32-gcc-posix
  18. if [ -z "$compiler" ]; then
  19. echo "Unable to determine which MinGW compiler to use"
  20. exit 1
  21. fi
  22. toolchain_file=$topdir/toolchain_${compiler/-gcc/}.cmake
  23. echo "Using $toolchain_file"
  24. find_runtime_dlls x86_64-w64-mingw32
  25. # Get stuff
  26. irrlicht_version=$(cat $topdir/../../misc/irrlichtmt_tag.txt)
  27. mkdir -p $libdir
  28. cd $libdir
  29. download "https://github.com/minetest/irrlicht/releases/download/$irrlicht_version/win64.zip" irrlicht-$irrlicht_version.zip
  30. download "http://minetest.kitsunemimi.pw/zlib-$zlib_version-win64.zip"
  31. download "http://minetest.kitsunemimi.pw/zstd-$zstd_version-win64.zip"
  32. download "http://minetest.kitsunemimi.pw/libogg-$ogg_version-win64.zip"
  33. download "http://minetest.kitsunemimi.pw/libvorbis-$vorbis_version-win64.zip"
  34. download "http://minetest.kitsunemimi.pw/curl-$curl_version-win64.zip"
  35. download "http://minetest.kitsunemimi.pw/gettext-$gettext_version-win64.zip"
  36. download "http://minetest.kitsunemimi.pw/freetype-$freetype_version-win64.zip"
  37. download "http://minetest.kitsunemimi.pw/sqlite3-$sqlite3_version-win64.zip"
  38. download "http://minetest.kitsunemimi.pw/luajit-$luajit_version-win64.zip"
  39. download "http://minetest.kitsunemimi.pw/libleveldb-$leveldb_version-win64.zip" leveldb-$leveldb_version.zip
  40. download "http://minetest.kitsunemimi.pw/openal-soft-$openal_version-win64.zip"
  41. # Set source dir, downloading Minetest as needed
  42. get_sources
  43. git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
  44. # Build the thing
  45. cd $sourcedir
  46. [ -d build ] && rm -rf build
  47. cmake_args=(
  48. -DCMAKE_TOOLCHAIN_FILE=$toolchain_file
  49. -DCMAKE_INSTALL_PREFIX=/tmp
  50. -DVERSION_EXTRA=$git_hash
  51. -DBUILD_CLIENT=1 -DBUILD_SERVER=0
  52. -DEXTRA_DLL="$runtime_dlls"
  53. -DENABLE_SOUND=1
  54. -DENABLE_CURL=1
  55. -DENABLE_GETTEXT=1
  56. -DENABLE_LEVELDB=1
  57. )
  58. add_cmake_libs
  59. cmake -S $sourcedir -B build "${cmake_args[@]}"
  60. cmake --build build -j$(nproc)
  61. [ -z "$NO_PACKAGE" ] && cmake --build build --target package
  62. exit 0
  63. # EOF