setup.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/bash
  2. set -e
  3. dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
  4. pushd "$dir" > /dev/null
  5. if [ $# -lt 2 ] || [ $# -gt 4 ]; then
  6. echo "Usage: ./setup.sh <Godot branch or tag> <dev:true|false> <mono:true|false>? <godot-repository>?"
  7. echo
  8. echo "e.g.:"
  9. echo " ./setup.sh 4.2.1-stable true"
  10. echo " ./setup.sh master false true"
  11. echo " ./setup.sh master false false https://github.com/my-github-username/godot.git"
  12. echo
  13. echo "Note: the 'mono' parameter only works for Godot 4.x+!"
  14. exit 1
  15. fi
  16. branch=${1%/}
  17. dev=${2%/}
  18. mono=false
  19. repo=https://github.com/godotengine/godot.git
  20. version=$(echo $branch | cut -d. -f1-2)
  21. echo $version > version.txt
  22. if [[ $# -eq 3 && "$branch" != 3* ]]; then
  23. mono=${3%/}
  24. fi
  25. if [ "$dev" != "true" ] && [ "$dev" != "false" ]; then
  26. echo "Invalid value for the 'dev' argument. It should be either 'true' or 'false'."
  27. exit 1
  28. fi
  29. if [ "$mono" != "true" ] && [ "$mono" != "false" ]; then
  30. echo "Invalid value for the 'mono' argument. It should be either 'true' or 'false'."
  31. exit 1
  32. fi
  33. if [ $# -eq 4 ]; then
  34. repo=${4%/}
  35. fi
  36. pushd ..
  37. rm -rf godot
  38. git clone --depth 1 $repo -b $branch
  39. if [ $dev = "true" ]; then
  40. cp build/custom.py godot
  41. if [ "$mono" = "true" ]; then
  42. echo "" >> godot/custom.py
  43. echo "module_mono_enabled=\"yes\"" >> godot/custom.py
  44. fi
  45. cp ../formatters/.clang-format .
  46. rm -rf example/.import
  47. rm -rf example/.godot
  48. if [ `uname` == 'Darwin' ] && [ ! -d "$HOME/VulkanSDK" ]; then
  49. ./build/install-macos-vulkan-sdk.sh
  50. fi
  51. fi
  52. cp -r ../spine-cpp/spine-cpp spine_godot
  53. # Apply patch for 4.3-stable, see https://github.com/godotengine/godot/issues/95861/#issuecomment-2486021565
  54. if [ "$branch" = "4.3-stable" ]; then
  55. pushd godot
  56. cp ../build/4.3-stable/tvgLock.h thirdparty/thorvg/src/common/tvgLock.h
  57. cp ../build/4.3-stable/tvgTaskScheduler.h thirdparty/thorvg/src/renderer/tvgTaskScheduler.h
  58. popd
  59. fi
  60. popd
  61. popd > /dev/null