buildwin32.sh 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #!/bin/bash
  2. dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  3. if [ $# -ne 1 ]; then
  4. echo "Usage: $0 <build directory>"
  5. exit 1
  6. fi
  7. builddir=$1
  8. mkdir -p $builddir
  9. builddir="$( cd "$builddir" && pwd )"
  10. packagedir=$builddir/packages
  11. libdir=$builddir/libs
  12. toolchain_file=$dir/toolchain_mingw.cmake
  13. openal_stripped_file=$dir/openal_stripped.zip
  14. mingwm10_dll_file=$dir/mingwm10.dll
  15. irrlicht_version=1.7.2
  16. ogg_version=1.2.1
  17. vorbis_version=1.3.3
  18. curl_version=7.18.0
  19. # unzip -l $openal_stripped_file:
  20. # 0 2012-04-03 00:25 openal_stripped/
  21. # 0 2012-04-03 00:25 openal_stripped/bin/
  22. # 109080 2012-04-03 00:03 openal_stripped/bin/OpenAL32.dll
  23. # 0 2012-04-03 00:29 openal_stripped/include/
  24. # 26443 2006-12-08 17:30 openal_stripped/include/al.h
  25. # 8282 2007-04-13 17:02 openal_stripped/include/alc.h
  26. # 0 2012-04-03 00:07 openal_stripped/lib/
  27. # 20552 2005-08-02 08:53 openal_stripped/lib/OpenAL32.lib
  28. mkdir -p $packagedir
  29. mkdir -p $libdir
  30. cd $builddir
  31. # Get stuff
  32. [ -e $packagedir/irrlicht-$irrlicht_version.zip ] || wget http://downloads.sourceforge.net/irrlicht/irrlicht-$irrlicht_version.zip \
  33. -c -O $packagedir/irrlicht-$irrlicht_version.zip || exit 1
  34. [ -e $packagedir/zlib125.zip ] || wget http://www.winimage.com/zLibDll/zlib125.zip \
  35. -c -O $packagedir/zlib125.zip || exit 1
  36. [ -e $packagedir/zlib125dll.zip ] || wget http://www.winimage.com/zLibDll/zlib125dll.zip \
  37. -c -O $packagedir/zlib125dll.zip || exit 1
  38. [ -e $packagedir/libogg-$ogg_version-dev.7z ] || wget http://mirror.transact.net.au/sourceforge/w/project/wi/winlibs/libogg/libogg-$ogg_version-dev.7z \
  39. -c -O $packagedir/libogg-$ogg_version-dev.7z || exit 1
  40. [ -e $packagedir/libogg-$ogg_version-dll.7z ] || wget http://mirror.transact.net.au/sourceforge/w/project/wi/winlibs/libogg/libogg-$ogg_version-dll.7z \
  41. -c -O $packagedir/libogg-$ogg_version-dll.7z || exit 1
  42. [ -e $packagedir/libvorbis-$vorbis_version-dev.7z ] || wget http://minetest.ru/bin/libvorbis-$vorbis_version-dev.7z \
  43. -c -O $packagedir/libvorbis-$vorbis_version-dev.7z || exit 1
  44. [ -e $packagedir/libvorbis-$vorbis_version-dll.7z ] || wget http://minetest.ru/bin/libvorbis-$vorbis_version-dll.7z \
  45. -c -O $packagedir/libvorbis-$vorbis_version-dll.7z || exit 1
  46. [ -e $packagedir/libcurl-$curl_version-win32-msvc.zip ] || wget http://curl.haxx.se/download/libcurl-$curl_version-win32-msvc.zip \
  47. -c -O $packagedir/libcurl-$curl_version-win32-msvc.zip || exit 1
  48. wget http://github.com/minetest/minetest/zipball/master \
  49. -c -O $packagedir/minetest.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest/zipball/master manually and save it as $packagedir/minetest.zip"; read -s)
  50. [ -e $packagedir/minetest.zip ] || (echo "minetest.zip not found"; exit 1)
  51. wget http://github.com/minetest/minetest_game/zipball/master \
  52. -c -O $packagedir/minetest_game.zip --tries=3 || (echo "Please download http://github.com/minetest/minetest_game/zipball/master manually and save it as $packagedir/minetest_game.zip"; read -s)
  53. [ -e $packagedir/minetest_game.zip ] || (echo "minetest_game.zip not found"; exit 1)
  54. [ -e $packagedir/openal_stripped.zip ] || wget http://minetest.ru/bin/openal_stripped.zip \
  55. -c -O $packagedir/openal_stripped.zip || exit 1
  56. [ -e $packagedir/mingwm10.dll ] || wget http://minetest.ru/bin/mingwm10.dll \
  57. -c -O $packagedir/mingwm10.dll || exit 1
  58. # Figure out some path names from the packages
  59. minetestdirname=`unzip -l $packagedir/minetest.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
  60. minetestdir=$builddir/$minetestdirname || exit 1
  61. git_hash=`echo $minetestdirname | sed -e 's/minetest-minetest-//'`
  62. minetest_gamedirname=`unzip -l $packagedir/minetest_game.zip | head -n 7 | tail -n 1 | sed -e 's/^[^m]*//' -e 's/\/.*$//'`
  63. # Extract stuff
  64. cd $libdir || exit 1
  65. unzip -o $packagedir/irrlicht-$irrlicht_version.zip || exit 1
  66. unzip -o $packagedir/zlib125.zip || exit 1
  67. unzip -o $packagedir/zlib125dll.zip -d zlib125dll || exit 1
  68. 7z x -y -olibogg $packagedir/libogg-$ogg_version-dev.7z || exit 1
  69. 7z x -y -olibogg $packagedir/libogg-$ogg_version-dll.7z || exit 1
  70. 7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dev.7z || exit 1
  71. 7z x -y -olibvorbis $packagedir/libvorbis-$vorbis_version-dll.7z || exit 1
  72. unzip -o $packagedir/libcurl-$curl_version-win32-msvc.zip -d libcurl || exit 1
  73. unzip -o $packagedir/openal_stripped.zip || exit 1
  74. cd $builddir || exit 1
  75. unzip -o $packagedir/minetest.zip || exit 1
  76. # Symlink minetestdir
  77. rm -rf $builddir/minetest
  78. ln -s $minetestdir $builddir/minetest
  79. # Extract minetest_game
  80. cd $minetestdir/games || exit 1
  81. rm -rf minetest_game || exit 1
  82. unzip -o $packagedir/minetest_game.zip || exit 1
  83. minetest_gamedir=$minetestdir/games/$minetest_gamedirname || exit 1
  84. mv $minetest_gamedir $minetestdir/games/minetest_game || exit 1
  85. # Build the thing
  86. cd $minetestdir || exit 1
  87. mkdir -p build || exit 1
  88. cd build || exit 1
  89. cmake $minetestdir -DCMAKE_TOOLCHAIN_FILE=$toolchain_file -DENABLE_SOUND=1 \
  90. -DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht-$irrlicht_version/include \
  91. -DIRRLICHT_LIBRARY=$libdir/irrlicht-$irrlicht_version/lib/Win32-gcc/libIrrlicht.dll.a \
  92. -DIRRLICHT_DLL=$libdir/irrlicht-$irrlicht_version/bin/Win32-gcc/Irrlicht.dll \
  93. -DZLIB_INCLUDE_DIR=$libdir/zlib-1.2.5 \
  94. -DZLIB_LIBRARIES=$libdir/zlib125dll/dll32/zlibwapi.lib \
  95. -DZLIB_DLL=$libdir/zlib125dll/dll32/zlibwapi.dll \
  96. -DOGG_INCLUDE_DIR=$libdir/libogg/include \
  97. -DOGG_LIBRARY=$libdir/libogg/lib/libogg.dll.a \
  98. -DOGG_DLL=$libdir/libogg/bin/libogg-0.dll \
  99. -DVORBIS_INCLUDE_DIR=$libdir/libvorbis/include \
  100. -DVORBIS_LIBRARY=$libdir/libvorbis/lib/libvorbis.dll.a \
  101. -DVORBIS_DLL=$libdir/libvorbis/bin/libvorbis-0.dll \
  102. -DVORBISFILE_LIBRARY=$libdir/libvorbis/lib/libvorbisfile.dll.a \
  103. -DVORBISFILE_DLL=$libdir/libvorbis/bin/libvorbisfile-3.dll \
  104. -DOPENAL_INCLUDE_DIR=$libdir/openal_stripped/include \
  105. -DOPENAL_LIBRARY=$libdir/openal_stripped/lib/OpenAL32.lib \
  106. -DOPENAL_DLL=$libdir/openal_stripped/bin/OpenAL32.dll \
  107. -DENABLE_CURL=1 \
  108. -DCURL_DLL=$libdir/libcurl/libcurl.dll \
  109. -DCURL_INCLUDE_DIR=$libdir/libcurl/include \
  110. -DCURL_LIBRARY=$libdir/libcurl/libcurl.lib \
  111. -DMINGWM10_DLL=$packagedir/mingwm10.dll \
  112. -DCMAKE_INSTALL_PREFIX=/tmp \
  113. -DVERSION_EXTRA=$git_hash \
  114. || exit 1
  115. make -j2 package || exit 1
  116. #pubdir=/home/celeron55/public_html/random/`date +%Y-%m` || exit 1
  117. #mkdir -p $pubdir || exit 1
  118. #cp *autobuild*.zip $pubdir/ || exit 1
  119. # EOF