2
0

buildwin64.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. compiler=x86_64-w64-mingw32-clang
  14. if ! command -v "$compiler" >/dev/null; then
  15. echo "Unable to find $compiler"
  16. exit 1
  17. fi
  18. toolchain_file=$topdir/toolchain_${compiler%-*}.cmake
  19. echo "Using $toolchain_file"
  20. find_runtime_dlls ${compiler%-*}
  21. # Get stuff
  22. mkdir -p $libdir
  23. cd $libdir
  24. libhost="http://minetest.kitsunemimi.pw"
  25. download "$libhost/llvm/zlib-$zlib_version-win64.zip"
  26. download "$libhost/llvm/zstd-$zstd_version-win64.zip"
  27. download "$libhost/llvm/libogg-$ogg_version-win64.zip"
  28. download "$libhost/llvm/libvorbis-$vorbis_version-win64.zip"
  29. download "$libhost/llvm/curl-$curl_version-win64.zip"
  30. download "$libhost/ucrt/gettext-$gettext_version-win64.zip"
  31. download "$libhost/llvm/freetype-$freetype_version-win64.zip"
  32. download "$libhost/llvm/sqlite3-$sqlite3_version-win64.zip"
  33. download "$libhost/llvm/luajit-$luajit_version-win64.zip"
  34. download "$libhost/llvm/libleveldb-$leveldb_version-win64.zip"
  35. download "$libhost/llvm/openal-soft-$openal_version-win64.zip"
  36. download "$libhost/llvm/libjpeg-$libjpeg_version-win64.zip"
  37. download "$libhost/llvm/libpng-$libpng_version-win64.zip"
  38. download "$libhost/llvm/sdl2-$sdl2_version-win64.zip"
  39. # Set source dir, downloading Minetest as needed
  40. get_sources
  41. # Build the thing
  42. cd $builddir
  43. [ -d build ] && rm -rf build
  44. cmake_args=(
  45. -DCMAKE_TOOLCHAIN_FILE=$toolchain_file
  46. -DCMAKE_INSTALL_PREFIX=/tmp
  47. -DBUILD_CLIENT=1 -DBUILD_SERVER=0
  48. -DEXTRA_DLL="$runtime_dlls"
  49. -DENABLE_SOUND=1
  50. -DENABLE_CURL=1
  51. -DENABLE_GETTEXT=1
  52. -DENABLE_LEVELDB=1
  53. )
  54. add_cmake_libs
  55. cmake -S $sourcedir -B build "${cmake_args[@]}"
  56. cmake --build build -j$(nproc)
  57. [ -z "$NO_PACKAGE" ] && cmake --build build --target package
  58. exit 0
  59. # EOF