build-godot-windows.sh 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/bash
  2. set -e
  3. if [ -z $1 ]; then
  4. echo "Usage: $0 <mono version"
  5. exit 1
  6. fi
  7. MONO_VERSION=$1
  8. sudo rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
  9. sudo curl https://download.mono-project.com/repo/centos7-stable.repo | sudo tee /etc/yum.repos.d/mono-centos7-stable.repo
  10. sudo dnf -y install gcc gcc-c++ scons cmake mingw32-gcc mingw32-gcc-c++ mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static mingw32-winpthreads-static msbuild
  11. export BUILD_NAME=official
  12. export OPTIONS="builtin_libpng=yes builtin_openssl=yes builtin_zlib=yes gdnative_wrapper=yes debug_symbols=no"
  13. export SCONS="scons -j8 verbose=no warnings=no progress=no"
  14. export TERM=xterm
  15. export MONO64_PREFIX=${HOME}/dependencies/mono-${MONO_VERSION}-64
  16. export MONO32_PREFIX=${HOME}/dependencies/mono-${MONO_VERSION}-32
  17. if [ ! -e ${MONO64_PREFIX} ]; then
  18. mkdir -p ${HOME}/dependencies
  19. mkdir -p ${HOME}/src
  20. mkdir -p ${HOME}/Downloads
  21. wget -c https://download.mono-project.com/sources/mono/mono-${MONO_VERSION}.tar.bz2 -O ${HOME}/Downloads/mono-${MONO_VERSION}.tar.bz2
  22. cd ${HOME}/src
  23. rm -rf mono-${MONO_VERSION}
  24. tar xf ${HOME}/Downloads/mono-${MONO_VERSION}.tar.bz2
  25. cd mono-${MONO_VERSION}
  26. ./configure --prefix=${MONO64_PREFIX} --disable-boehm
  27. make -j 8
  28. make install
  29. make distclean
  30. ./configure --prefix=${MONO64_PREFIX} --host=x86_64-w64-mingw32 --disable-boehm
  31. make -j 8 || /bin/true
  32. make install -i
  33. fi
  34. if [ ! -e ${MONO32_PREFIX} ]; then
  35. mkdir -p ${HOME}/dependencies
  36. mkdir -p ${HOME}/src
  37. mkdir -p ${HOME}/Downloads
  38. wget -c https://download.mono-project.com/sources/mono/mono-${MONO_VERSION}.tar.bz2 -O ${HOME}/Downloads/mono-${MONO_VERSION}.tar.bz2
  39. cd ${HOME}/src
  40. rm -rf mono-${MONO_VERSION}
  41. tar xf ${HOME}/Downloads/mono-${MONO_VERSION}.tar.bz2
  42. cd mono-${MONO_VERSION}
  43. ./configure --prefix=${MONO32_PREFIX} --disable-boehm
  44. make -j 8
  45. make install
  46. make distclean
  47. ./configure --prefix=${MONO32_PREFIX} --host=i686-w64-mingw32 --disable-boehm
  48. make -j 8 || /bin/true
  49. make install -i
  50. fi
  51. rm -rf godot
  52. git clone https://github.com/godotengine/godot.git
  53. cd godot
  54. git config --global user.email "you@example.com"
  55. git config --global user.name "Your Name"
  56. git checkout -b 3.0 origin/3.0
  57. git branch --set-upstream-to=origin/3.0 3.0
  58. git reset --hard
  59. git pull
  60. cp ../mono-glue/* modules/mono/glue
  61. $SCONS platform=windows bits=32 $options tools=yes target=release_debug use_static_cpp=yes use_lto=yes
  62. $SCONS platform=windows bits=32 $options tools=no target=release_debug use_static_cpp=yes use_lto=yes
  63. $SCONS platform=windows bits=32 $options tools=no target=release use_static_cpp=yes use_lto=yes
  64. $SCONS platform=windows bits=32 $options tools=yes target=release_debug use_static_cpp=yes module_mono_enabled=yes mono_static=yes use_lto=yes
  65. $SCONS platform=windows bits=32 $options tools=no target=release_debug use_static_cpp=yes module_mono_enabled=yes mono_static=yes use_lto=yes
  66. $SCONS platform=windows bits=32 $options tools=no target=release use_static_cpp=yes module_mono_enabled=yes mono_static=yes use_lto=yes
  67. $SCONS platform=windows bits=64 $options tools=yes target=release_debug use_static_cpp=yes use_lto=yes
  68. $SCONS platform=windows bits=64 $options tools=no target=release_debug use_static_cpp=yes use_lto=yes
  69. $SCONS platform=windows bits=64 $options tools=no target=release use_static_cpp=yes use_lto=yes
  70. $SCONS platform=windows bits=64 $options tools=yes target=release_debug use_static_cpp=yes module_mono_enabled=yes mono_static=yes use_lto=yes
  71. $SCONS platform=windows bits=64 $options tools=no target=release_debug use_static_cpp=yes module_mono_enabled=yes mono_static=yes use_lto=yes
  72. $SCONS platform=windows bits=64 $options tools=no target=release use_static_cpp=yes module_mono_enabled=yes mono_static=yes use_lto=yes