update-thorvg.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash -e
  2. VERSION=0.13.7
  3. cd thirdparty/thorvg/ || true
  4. rm -rf AUTHORS LICENSE inc/ src/ *.zip *.tar.gz tmp/
  5. mkdir tmp/ && pushd tmp/
  6. # Release
  7. curl -L -O https://github.com/thorvg/thorvg/archive/v$VERSION.tar.gz
  8. # Current Github main branch tip
  9. #curl -L -O https://github.com/thorvg/thorvg/archive/refs/heads/main.tar.gz
  10. tar --strip-components=1 -xvf *.tar.gz
  11. rm *.tar.gz
  12. # Install from local git checkout "thorvg-git" in the same directory
  13. # as godot git checkout.
  14. #d="../../../../thorvg-git"
  15. #cp -r ${d}/AUTHORS ${d}/inc ${d}/LICENSE ${d}/src .
  16. find . -type f -name 'meson.build' -delete
  17. # Fix newline at end of file.
  18. for source in $(find ./ -type f \( -iname \*.h -o -iname \*.cpp \)); do
  19. sed -i -e '$a\' $source
  20. done
  21. cp -v AUTHORS LICENSE ..
  22. cp -rv inc ../
  23. cat << EOF > ../inc/config.h
  24. #ifndef THORVG_CONFIG_H
  25. #define THORVG_CONFIG_H
  26. #define THORVG_SW_RASTER_SUPPORT
  27. #define THORVG_SVG_LOADER_SUPPORT
  28. #define THORVG_PNG_LOADER_SUPPORT
  29. #define THORVG_JPG_LOADER_SUPPORT
  30. #ifndef WEB_ENABLED
  31. #define THORVG_THREAD_SUPPORT
  32. #endif
  33. // Added conditionally if webp module is enabled.
  34. //#define THORVG_WEBP_LOADER_SUPPORT
  35. // For internal debugging:
  36. //#define THORVG_LOG_ENABLED
  37. #define THORVG_VERSION_STRING "$VERSION"
  38. #endif
  39. EOF
  40. mkdir ../src
  41. cp -rv src/common ../src
  42. cp -rv src/renderer ../src/
  43. # Only sw_engine is enabled.
  44. rm -rfv ../src/renderer/gl_engine
  45. rm -rfv ../src/renderer/wg_engine
  46. # Enabled embedded loaders: raw, JPEG, PNG, WebP.
  47. mkdir ../src/loaders
  48. cp -rv src/loaders/svg src/loaders/raw ../src/loaders/
  49. cp -rv src/loaders/external_png ../src/loaders/
  50. cp -rv src/loaders/external_webp ../src/loaders/
  51. # Not using external jpg as it's turbojpeg, which we don't have.
  52. cp -rv src/loaders/jpg ../src/loaders/
  53. popd
  54. rm -rf tmp