buildwin32.sh 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #!/bin/bash
  2. set -e
  3. dir="$( 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. packagedir=$builddir/packages
  12. libdir=$builddir/libs
  13. toolchain_file=$dir/toolchain_mingw.cmake
  14. irrlicht_version=1.8.1
  15. ogg_version=1.2.1
  16. vorbis_version=1.3.3
  17. curl_version=7.38.0
  18. gettext_version=0.14.4
  19. freetype_version=2.3.5
  20. sqlite3_version=3.8.7.4
  21. luajit_version=2.0.1
  22. leveldb_version=1.15
  23. zlib_version=1.2.8
  24. mkdir -p $packagedir
  25. mkdir -p $libdir
  26. cd $builddir
  27. # Get stuff
  28. [ -e $packagedir/irrlicht-$irrlicht_version.zip ] || wget http://minetest.kitsunemimi.pw/irrlicht-$irrlicht_version-win32.zip \
  29. -c -O $packagedir/irrlicht-$irrlicht_version.zip
  30. [ -e $packagedir/zlib-$zlib_version.zip ] || wget http://minetest.kitsunemimi.pw/zlib-$zlib_version-win32.zip \
  31. -c -O $packagedir/zlib-$zlib_version.zip
  32. [ -e $packagedir/libogg-$ogg_version-dev.7z ] || wget http://minetest.kitsunemimi.pw/libogg-$ogg_version-dev.7z \
  33. -c -O $packagedir/libogg-$ogg_version-dev.7z
  34. [ -e $packagedir/libogg-$ogg_version-dll.7z ] || wget http://minetest.kitsunemimi.pw/libogg-$ogg_version-dll.7z \
  35. -c -O $packagedir/libogg-$ogg_version-dll.7z
  36. [ -e $packagedir/libvorbis-$vorbis_version-dev.7z ] || wget http://minetest.kitsunemimi.pw/libvorbis-$vorbis_version-dev.7z \
  37. -c -O $packagedir/libvorbis-$vorbis_version-dev.7z
  38. [ -e $packagedir/libvorbis-$vorbis_version-dll.7z ] || wget http://minetest.kitsunemimi.pw/libvorbis-$vorbis_version-dll.7z \
  39. -c -O $packagedir/libvorbis-$vorbis_version-dll.7z
  40. [ -e $packagedir/libcurl-$curl_version.zip ] || wget http://minetest.kitsunemimi.pw/libcurl-$curl_version-win32.zip \
  41. -c -O $packagedir/libcurl-$curl_version.zip
  42. [ -e $packagedir/gettext-$gettext_version.zip ] || wget http://minetest.kitsunemimi.pw/gettext-$gettext_version.zip \
  43. -c -O $packagedir/gettext-$gettext_version.zip
  44. [ -e $packagedir/libfreetype-$freetype_version.zip ] || wget http://minetest.kitsunemimi.pw/libfreetype-$freetype_version-win32.zip \
  45. -c -O $packagedir/libfreetype-$freetype_version.zip
  46. [ -e $packagedir/sqlite3-$sqlite3_version.zip ] || wget http://minetest.kitsunemimi.pw/sqlite3-$sqlite3_version-win32.zip \
  47. -c -O $packagedir/sqlite3-$sqlite3_version.zip
  48. [ -e $packagedir/luajit-$luajit_version-static-win32.zip ] || wget http://minetest.kitsunemimi.pw/luajit-$luajit_version-static-win32.zip \
  49. -c -O $packagedir/luajit-$luajit_version-static-win32.zip
  50. [ -e $packagedir/libleveldb-$leveldb_version-win32.zip ] || wget http://minetest.kitsunemimi.pw/libleveldb-$leveldb_version-win32.zip \
  51. -c -O $packagedir/libleveldb-$leveldb_version-win32.zip
  52. [ -e $packagedir/openal_stripped.zip ] || wget http://minetest.kitsunemimi.pw/openal_stripped.zip \
  53. -c -O $packagedir/openal_stripped.zip
  54. # Extract stuff
  55. cd $libdir
  56. [ -d irrlicht-$irrlicht_version ] || unzip -o $packagedir/irrlicht-$irrlicht_version.zip
  57. [ -d zlib ] || unzip -o $packagedir/zlib-$zlib_version.zip -d zlib
  58. [ -d libogg/include ] || 7z x -y -olibogg $packagedir/libogg-$ogg_version-dev.7z
  59. [ -d libogg/bin ] || 7z x -y -olibogg $packagedir/libogg-$ogg_version-dll.7z
  60. [ -d libvorbis/include ] || 7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dev.7z
  61. [ -d libvorbis/bin ] || 7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dll.7z
  62. [ -d libcurl ] || unzip -o $packagedir/libcurl-$curl_version.zip -d libcurl
  63. [ -d gettext ] || unzip -o $packagedir/gettext-$gettext_version.zip -d gettext
  64. [ -d freetype ] || unzip -o $packagedir/libfreetype-$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-static-win32.zip -d luajit
  68. [ -d leveldb ] || unzip -o $packagedir/libleveldb-$leveldb_version-win32.zip -d leveldb
  69. # Get minetest
  70. cd $builddir
  71. if [ ! "x$EXISTING_MINETEST_DIR" = "x" ]; then
  72. ln -s $EXISTING_MINETEST_DIR minetest
  73. else
  74. [ -d minetest ] && (cd minetest && git pull) || (git clone https://github.com/minetest/minetest)
  75. fi
  76. cd minetest
  77. git_hash=`git show | head -c14 | tail -c7`
  78. # Get minetest_game
  79. cd games
  80. if [ "x$NO_MINETEST_GAME" = "x" ]; then
  81. [ -d minetest_game ] && (cd minetest_game && git pull) || (git clone https://github.com/minetest/minetest_game)
  82. fi
  83. cd ../..
  84. # Build the thing
  85. cd minetest
  86. [ -d _build ] && rm -Rf _build/
  87. mkdir _build
  88. cd _build
  89. cmake .. \
  90. -DCMAKE_INSTALL_PREFIX=/tmp \
  91. -DVERSION_EXTRA=$git_hash \
  92. -DBUILD_CLIENT=1 -DBUILD_SERVER=0 \
  93. -DCMAKE_TOOLCHAIN_FILE=$toolchain_file \
  94. \
  95. -DENABLE_SOUND=1 \
  96. -DENABLE_CURL=1 \
  97. -DENABLE_GETTEXT=1 \
  98. -DENABLE_FREETYPE=1 \
  99. -DENABLE_LEVELDB=1 \
  100. \
  101. -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht-$irrlicht_version/include \
  102. -DIRRLICHT_LIBRARY=$libdir/irrlicht-$irrlicht_version/lib/Win32-gcc/libIrrlicht.dll.a \
  103. -DIRRLICHT_DLL=$libdir/irrlicht-$irrlicht_version/bin/Win32-gcc/Irrlicht.dll \
  104. \
  105. -DZLIB_INCLUDE_DIR=$libdir/zlib/include \
  106. -DZLIB_LIBRARIES=$libdir/zlib/lib/zlibwapi.dll.a \
  107. -DZLIB_DLL=$libdir/zlib/bin/zlib1.dll \
  108. -DZLIBWAPI_DLL=$libdir/zlib/bin/zlibwapi.dll \
  109. \
  110. -DLUA_INCLUDE_DIR=$libdir/luajit/include \
  111. -DLUA_LIBRARY=$libdir/luajit/libluajit.a \
  112. \
  113. -DOGG_INCLUDE_DIR=$libdir/libogg/include \
  114. -DOGG_LIBRARY=$libdir/libogg/lib/libogg.dll.a \
  115. -DOGG_DLL=$libdir/libogg/bin/libogg-0.dll \
  116. \
  117. -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
  118. -DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \
  119. -DVORBIS_DLL=$libdir/libvorbis/bin/libvorbis-0.dll \
  120. -DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
  121. -DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \
  122. \
  123. -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include/AL \
  124. -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/libOpenAL32.dll.a \
  125. -DOPENAL_DLL=$libdir/openal_stripped/bin/OpenAL32.dll \
  126. \
  127. -DCURL_DLL=$libdir/libcurl/bin/libcurl-4.dll \
  128. -DCURL_INCLUDE_DIR=$libdir/libcurl/include \
  129. -DCURL_LIBRARY=$libdir/libcurl/lib/libcurl.dll.a \
  130. \
  131. -DCUSTOM_GETTEXT_PATH=$libdir/gettext \
  132. -DGETTEXT_MSGFMT=`which msgfmt` \
  133. -DGETTEXT_DLL=$libdir/gettext/bin/libintl3.dll \
  134. -DGETTEXT_ICONV_DLL=$libdir/gettext/bin/libiconv2.dll \
  135. -DGETTEXT_INCLUDE_DIR=$libdir/gettext/include \
  136. -DGETTEXT_LIBRARY=$libdir/gettext/lib/libintl.dll.a \
  137. \
  138. -DFREETYPE_INCLUDE_DIR_freetype2=$libdir/freetype/include/freetype2 \
  139. -DFREETYPE_INCLUDE_DIR_ft2build=$libdir/freetype/include \
  140. -DFREETYPE_LIBRARY=$libdir/freetype/lib/libfreetype.dll.a \
  141. -DFREETYPE_DLL=$libdir/freetype/bin/freetype6.dll \
  142. \
  143. -DSQLITE3_INCLUDE_DIR=$libdir/sqlite3/include \
  144. -DSQLITE3_LIBRARY=$libdir/sqlite3/lib/libsqlite3.dll.a \
  145. -DSQLITE3_DLL=$libdir/sqlite3/bin/libsqlite3-0.dll \
  146. \
  147. -DLEVELDB_INCLUDE_DIR=$libdir/leveldb/include \
  148. -DLEVELDB_LIBRARY=$libdir/leveldb/lib/libleveldb.dll.a \
  149. -DLEVELDB_DLL=$libdir/leveldb/bin/libleveldb.dll
  150. make package -j2
  151. # EOF