buildwin64.sh 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #!/bin/bash
  2. set -e
  3. CORE_GIT=https://github.com/minetest/minetest
  4. CORE_BRANCH=master
  5. CORE_NAME=minetest
  6. GAME_GIT=https://github.com/minetest/minetest_game
  7. GAME_BRANCH=master
  8. GAME_NAME=minetest_game
  9. dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  10. if [ $# -ne 1 ]; then
  11. echo "Usage: $0 <build directory>"
  12. exit 1
  13. fi
  14. builddir=$1
  15. mkdir -p $builddir
  16. builddir="$( cd "$builddir" && pwd )"
  17. packagedir=$builddir/packages
  18. libdir=$builddir/libs
  19. toolchain_file=$dir/toolchain_x86_64-w64-mingw32.cmake
  20. irrlicht_version=1.8.4
  21. ogg_version=1.3.2
  22. vorbis_version=1.3.5
  23. curl_version=7.65.3
  24. gettext_version=0.20.1
  25. freetype_version=2.10.1
  26. sqlite3_version=3.27.2
  27. luajit_version=2.1.0-beta3
  28. leveldb_version=1.22
  29. zlib_version=1.2.11
  30. mkdir -p $packagedir
  31. mkdir -p $libdir
  32. cd $builddir
  33. # Get stuff
  34. [ -e $packagedir/irrlicht-$irrlicht_version.zip ] || wget http://minetest.kitsunemimi.pw/irrlicht-$irrlicht_version-win64.zip \
  35. -c -O $packagedir/irrlicht-$irrlicht_version.zip
  36. [ -e $packagedir/zlib-$zlib_version.zip ] || wget http://minetest.kitsunemimi.pw/zlib-$zlib_version-win64.zip \
  37. -c -O $packagedir/zlib-$zlib_version.zip
  38. [ -e $packagedir/libogg-$ogg_version.zip ] || wget http://minetest.kitsunemimi.pw/libogg-$ogg_version-win64.zip \
  39. -c -O $packagedir/libogg-$ogg_version.zip
  40. [ -e $packagedir/libvorbis-$vorbis_version.zip ] || wget http://minetest.kitsunemimi.pw/libvorbis-$vorbis_version-win64.zip \
  41. -c -O $packagedir/libvorbis-$vorbis_version.zip
  42. [ -e $packagedir/curl-$curl_version.zip ] || wget http://minetest.kitsunemimi.pw/curl-$curl_version-win64.zip \
  43. -c -O $packagedir/curl-$curl_version.zip
  44. [ -e $packagedir/gettext-$gettext_version.zip ] || wget http://minetest.kitsunemimi.pw/gettext-$gettext_version-win64.zip \
  45. -c -O $packagedir/gettext-$gettext_version.zip
  46. [ -e $packagedir/freetype2-$freetype_version.zip ] || wget http://minetest.kitsunemimi.pw/freetype2-$freetype_version-win64.zip \
  47. -c -O $packagedir/freetype2-$freetype_version.zip
  48. [ -e $packagedir/sqlite3-$sqlite3_version.zip ] || wget http://minetest.kitsunemimi.pw/sqlite3-$sqlite3_version-win64.zip \
  49. -c -O $packagedir/sqlite3-$sqlite3_version.zip
  50. [ -e $packagedir/luajit-$luajit_version.zip ] || wget http://minetest.kitsunemimi.pw/luajit-$luajit_version-win64.zip \
  51. -c -O $packagedir/luajit-$luajit_version.zip
  52. [ -e $packagedir/libleveldb-$leveldb_version.zip ] || wget http://minetest.kitsunemimi.pw/libleveldb-$leveldb_version-win64.zip \
  53. -c -O $packagedir/libleveldb-$leveldb_version.zip
  54. [ -e $packagedir/openal_stripped.zip ] || wget http://minetest.kitsunemimi.pw/openal_stripped64.zip \
  55. -c -O $packagedir/openal_stripped.zip
  56. # Extract stuff
  57. cd $libdir
  58. [ -d irrlicht ] || unzip -o $packagedir/irrlicht-$irrlicht_version.zip -d irrlicht
  59. [ -d zlib ] || unzip -o $packagedir/zlib-$zlib_version.zip -d zlib
  60. [ -d libogg ] || unzip -o $packagedir/libogg-$ogg_version.zip -d libogg
  61. [ -d libvorbis ] || unzip -o $packagedir/libvorbis-$vorbis_version.zip -d libvorbis
  62. [ -d libcurl ] || unzip -o $packagedir/curl-$curl_version.zip -d libcurl
  63. [ -d gettext ] || unzip -o $packagedir/gettext-$gettext_version.zip -d gettext
  64. [ -d freetype ] || unzip -o $packagedir/freetype2-$freetype_version.zip -d freetype
  65. [ -d sqlite3 ] || unzip -o $packagedir/sqlite3-$sqlite3_version.zip -d sqlite3
  66. [ -d openal_stripped ] || unzip -o $packagedir/openal_stripped.zip
  67. [ -d luajit ] || unzip -o $packagedir/luajit-$luajit_version.zip -d luajit
  68. [ -d leveldb ] || unzip -o $packagedir/libleveldb-$leveldb_version.zip -d leveldb
  69. # Get minetest
  70. cd $builddir
  71. if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
  72. cd /$EXISTING_MINETEST_DIR # must be absolute path
  73. else
  74. [ -d $CORE_NAME ] && (cd $CORE_NAME && git pull) || (git clone -b $CORE_BRANCH $CORE_GIT)
  75. cd $CORE_NAME
  76. fi
  77. git_hash=$(git rev-parse --short HEAD)
  78. # Get minetest_game
  79. if [ "x$NO_MINETEST_GAME" = "x" ]; then
  80. cd games
  81. [ -d $GAME_NAME ] && (cd $GAME_NAME && git pull) || (git clone -b $GAME_BRANCH $GAME_GIT)
  82. cd ..
  83. fi
  84. # Build the thing
  85. [ -d _build ] && rm -Rf _build/
  86. mkdir _build
  87. cd _build
  88. cmake .. \
  89. -DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
  90. -DCMAKE_INSTALL_PREFIX=/tmp \
  91. -DVERSION_EXTRA=$git_hash \
  92. -DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
  93. \
  94. -DENABLE_SOUND=1 \
  95. -DENABLE_CURL=1 \
  96. -DENABLE_GETTEXT=1 \
  97. -DENABLE_FREETYPE=1 \
  98. -DENABLE_LEVELDB=1 \
  99. \
  100. -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht/include \
  101. -DIRRLICHT_LIBRARY=$libdir/irrlicht/lib/Win64-gcc/libIrrlicht.dll.a \
  102. -DIRRLICHT_DLL=$libdir/irrlicht/bin/Win64-gcc/Irrlicht.dll \
  103. \
  104. -DZLIB_INCLUDE_DIR=$libdir/zlib/include \
  105. -DZLIB_LIBRARIES=$libdir/zlib/lib/libz.dll.a \
  106. -DZLIB_DLL=$libdir/zlib/bin/zlib1.dll \
  107. \
  108. -DLUA_INCLUDE_DIR=$libdir/luajit/include \
  109. -DLUA_LIBRARY=$libdir/luajit/libluajit.a \
  110. \
  111. -DOGG_INCLUDE_DIR=$libdir/libogg/include \
  112. -DOGG_LIBRARY=$libdir/libogg/lib/libogg.dll.a \
  113. -DOGG_DLL=$libdir/libogg/bin/libogg-0.dll \
  114. \
  115. -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
  116. -DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \
  117. -DVORBIS_DLL=$libdir/libvorbis/bin/libvorbis-0.dll \
  118. -DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
  119. -DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \
  120. \
  121. -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \
  122. -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \
  123. -DOPENAL_DLL=$libdir/openal_stripped/bin/OpenAL32.dll \
  124. \
  125. -DCURL_DLL=$libdir/libcurl/bin/libcurl-4.dll \
  126. -DCURL_INCLUDE_DIR=$libdir/libcurl/include \
  127. -DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \
  128. \
  129. -DGETTEXT_MSGFMT=`which msgfmt` \
  130. -DGETTEXT_DLL=$libdir/gettext/bin/libintl-8.dll \
  131. -DGETTEXT_ICONV_DLL=$libdir/gettext/bin/libiconv-2.dll \
  132. -DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \
  133. -DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \
  134. \
  135. -DFREETYPE_INCLUDE_DIR_freetype2=$libdir/freetype/include/freetype2 \
  136. -DFREETYPE_INCLUDE_DIR_ft2build=$libdir/freetype/include/freetype2 \
  137. -DFREETYPE_LIBRARY=$libdir/freetype/lib/libfreetype.dll.a \
  138. -DFREETYPE_DLL=$libdir/freetype/bin/libfreetype-6.dll \
  139. \
  140. -DSQLITE3_INCLUDE_DIR=$libdir/sqlite3/include \
  141. -DSQLITE3_LIBRARY=$libdir/sqlite3/lib/libsqlite3.dll.a \
  142. -DSQLITE3_DLL=$libdir/sqlite3/bin/libsqlite3-0.dll \
  143. \
  144. -DLEVELDB_INCLUDE_DIR=$libdir/leveldb/include \
  145. -DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
  146. -DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
  147. make -j$(nproc)
  148. [ "x$NO_PACKAGE" = "x" ] && make package
  149. exit 0
  150. # EOF