buildwin32.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 win32 compiler is present
  14. command -v i686-w64-mingw32-gcc >/dev/null &&
  15. compiler=i686-w64-mingw32-gcc
  16. command -v i686-w64-mingw32-gcc-posix >/dev/null &&
  17. compiler=i686-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 i686-w64-mingw32
  25. # Get stuff
  26. irrlicht_version=$(cat $topdir/../../misc/irrlichtmt_tag.txt)
  27. mkdir -p $libdir
  28. # 'dw2' just points to rebuilt versions after a toolchain change
  29. # this distinction should be gotten rid of next time
  30. cd $libdir
  31. download "https://github.com/minetest/irrlicht/releases/download/$irrlicht_version/win32.zip" irrlicht-$irrlicht_version.zip
  32. download "http://minetest.kitsunemimi.pw/zlib-$zlib_version-win32.zip"
  33. download "http://minetest.kitsunemimi.pw/zstd-$zstd_version-win32.zip"
  34. download "http://minetest.kitsunemimi.pw/libogg-$ogg_version-win32.zip"
  35. download "http://minetest.kitsunemimi.pw/dw2/libvorbis-$vorbis_version-win32.zip"
  36. download "http://minetest.kitsunemimi.pw/curl-$curl_version-win32.zip"
  37. download "http://minetest.kitsunemimi.pw/gettext-$gettext_version-win32.zip"
  38. download "http://minetest.kitsunemimi.pw/freetype-$freetype_version-win32.zip"
  39. download "http://minetest.kitsunemimi.pw/sqlite3-$sqlite3_version-win32.zip"
  40. download "http://minetest.kitsunemimi.pw/luajit-$luajit_version-win32.zip"
  41. download "http://minetest.kitsunemimi.pw/dw2/libleveldb-$leveldb_version-win32.zip" leveldb-$leveldb_version.zip
  42. download "http://minetest.kitsunemimi.pw/openal-soft-$openal_version-win32.zip"
  43. # Set source dir, downloading Minetest as needed
  44. get_sources
  45. git_hash=$(cd $sourcedir && git rev-parse --short HEAD)
  46. # Build the thing
  47. cd $builddir
  48. [ -d build ] && rm -rf build
  49. cmake_args=(
  50. -DCMAKE_TOOLCHAIN_FILE=$toolchain_file
  51. -DCMAKE_INSTALL_PREFIX=/tmp
  52. -DVERSION_EXTRA=$git_hash
  53. -DBUILD_CLIENT=1 -DBUILD_SERVER=0
  54. -DEXTRA_DLL="$runtime_dlls"
  55. -DENABLE_SOUND=1
  56. -DENABLE_CURL=1
  57. -DENABLE_GETTEXT=1
  58. -DENABLE_LEVELDB=1
  59. )
  60. add_cmake_libs
  61. cmake -S $sourcedir -B build "${cmake_args[@]}"
  62. cmake --build build -j$(nproc)
  63. [ -z "$NO_PACKAGE" ] && cmake --build build --target package
  64. exit 0
  65. # EOF