| 1 | #!/bin/bash -e |
| 2 | |
| 3 | VERSION=0.15.16 |
| 4 | # Uncomment and set a git hash to use specific commit instead of tag. |
| 5 | #GIT_COMMIT= |
| 6 | |
| 7 | pushd "$(dirname "$0")" |
| 8 | rm -rf AUTHORS LICENSE inc/ src/ *.zip *.tar.gz tmp/ |
| 9 | |
| 10 | mkdir tmp/ && pushd tmp/ |
| 11 | |
| 12 | # Release |
| 13 | if [ ! -z "$GIT_COMMIT" ]; then |
| 14 | echo "Updating ThorVG to commit:" $GIT_COMMIT |
| 15 | curl -L -O https://github.com/thorvg/thorvg/archive/$GIT_COMMIT.tar.gz |
| 16 | else |
| 17 | echo "Updating ThorVG to tagged release:" $VERSION |
| 18 | curl -L -O https://github.com/thorvg/thorvg/archive/v$VERSION.tar.gz |
| 19 | fi |
| 20 | |
| 21 | tar --strip-components=1 -xvf *.tar.gz |
| 22 | rm *.tar.gz |
| 23 | |
| 24 | # Install from local git checkout "thorvg-git" in the same directory |
| 25 | # as godot git checkout. |
| 26 | #d="../../../../thorvg-git" |
| 27 | #cp -r ${d}/AUTHORS ${d}/inc ${d}/LICENSE ${d}/src . |
| 28 | |
| 29 | find . -type f -name 'meson.build' -delete |
| 30 | |
| 31 | # Fix newline at end of file. |
| 32 | for source in $(find ./ -type f \( -iname \*.h -o -iname \*.cpp \)); do |
| 33 | sed -i -e '$a\' $source |
| 34 | done |
| 35 | |
| 36 | cp -v AUTHORS LICENSE .. |
| 37 | cp -rv inc ../ |
| 38 | |
| 39 | cat << EOF > ../inc/config.h |
| 40 | #ifndef THORVG_CONFIG_H |
| 41 | #define THORVG_CONFIG_H |
| 42 | |
| 43 | #define THORVG_SW_RASTER_SUPPORT |
| 44 | #define THORVG_SVG_LOADER_SUPPORT |
| 45 | #define THORVG_PNG_LOADER_SUPPORT |
| 46 | #ifndef WEB_ENABLED |
| 47 | #define THORVG_THREAD_SUPPORT |
| 48 | #endif |
| 49 | |
| 50 | // Added conditionally if respective modules are enabled. |
| 51 | //#define THORVG_WEBP_LOADER_SUPPORT |
| 52 | //#define THORVG_JPG_LOADER_SUPPORT |
| 53 | |
| 54 | // For internal debugging: |
| 55 | //#define THORVG_LOG_ENABLED |
| 56 | |
| 57 | #define THORVG_VERSION_STRING "$VERSION" |
| 58 | #endif |
| 59 | EOF |
| 60 | |
| 61 | mkdir ../src |
| 62 | cp -rv src/common ../src |
| 63 | cp -rv src/renderer ../src/ |
| 64 | |
| 65 | # Only sw_engine is enabled. |
| 66 | rm -rfv ../src/renderer/gl_engine |
| 67 | rm -rfv ../src/renderer/wg_engine |
| 68 | |
| 69 | # Enabled embedded loaders: raw, JPEG, PNG, WebP. |
| 70 | mkdir ../src/loaders |
| 71 | cp -rv src/loaders/svg src/loaders/raw ../src/loaders/ |
| 72 | cp -rv src/loaders/external_png ../src/loaders/ |
| 73 | cp -rv src/loaders/external_webp ../src/loaders/ |
| 74 | cp -rv src/loaders/external_jpg ../src/loaders/ |
| 75 | |
| 76 | popd |
| 77 | rm -rf tmp |
| 78 | popd |