update-thorvg.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash -e
  2. VERSION=0.12.10
  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. #define THORVG_THREAD_SUPPORT
  31. // For internal debugging:
  32. //#define THORVG_LOG_ENABLED
  33. #define THORVG_VERSION_STRING "$VERSION"
  34. #endif
  35. EOF
  36. mkdir ../src
  37. cp -rv src/common ../src
  38. cp -rv src/renderer ../src/
  39. # Only sw_engine is enabled.
  40. rm -rfv ../src/renderer/gl_engine
  41. rm -rfv ../src/renderer/wg_engine
  42. # Enabled embedded loaders: raw, JPEG, PNG.
  43. mkdir ../src/loaders
  44. cp -rv src/loaders/svg src/loaders/raw ../src/loaders/
  45. cp -rv src/loaders/jpg ../src/loaders/
  46. cp -rv src/loaders/png src/loaders/external_png ../src/loaders/
  47. popd
  48. rm -rf tmp