| 1 | #!/bin/bashscip-shell filesystem . . `/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 "$(dirnamescip-shell system . . dirname. "$0")" |
| 8 | rmscip-shell system . . rm. -rf AUTHORS LICENSE inc/ src/ *.zip *.tar.gz tmp/ |
| 9 | |
| 10 | mkdirscip-shell system . . mkdir. tmp/ && pushd tmp/ |
| 11 | |
| 12 | # Release |
| 13 | if [scip-shell system . . `[`. ! -z "$GIT_COMMIT" ]; then |
| 14 | echoscip-shell system . . echo. "Updating ThorVG to commit:" $GIT_COMMIT |
| 15 | curlscip-shell system . . curl. -L -O https://github.com/thorvg/thorvg/archive/$GIT_COMMIT.tar.gz |
| 16 | else |
| 17 | echoscip-shell system . . echo. "Updating ThorVG to tagged release:" $VERSION |
| 18 | curlscip-shell system . . curl. -L -O https://github.com/thorvg/thorvg/archive/v$VERSION.tar.gz |
| 19 | fi |
| 20 | |
| 21 | tarscip-shell system . . tar. --strip-components=1 -xvf *.tar.gz |
| 22 | rmscip-shell system . . 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 | findscip-shell system . . find. . -type f -name 'meson.build' -delete |
| 30 | |
| 31 | # Fix newline at end of file. |
| 32 | for source in $(findscip-shell system . . find. ./ -type f \( -iname \*.h -o -iname \*.cpp \)); do |
| 33 | sedscip-shell system . . sed. -i -e '$a\' $source |
| 34 | done |
| 35 | |
| 36 | cpscip-shell system . . cp. -v AUTHORS LICENSE .. |
| 37 | cpscip-shell system . . cp. -rv inc ../ |
| 38 | |
| 39 | catscip-shell system . . 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 | mkdirscip-shell system . . mkdir. ../src |
| 62 | cpscip-shell system . . cp. -rv src/common ../src |
| 63 | cpscip-shell system . . cp. -rv src/renderer ../src/ |
| 64 | |
| 65 | # Only sw_engine is enabled. |
| 66 | rmscip-shell system . . rm. -rfv ../src/renderer/gl_engine |
| 67 | rmscip-shell system . . rm. -rfv ../src/renderer/wg_engine |
| 68 | |
| 69 | # Enabled embedded loaders: raw, JPEG, PNG, WebP. |
| 70 | mkdirscip-shell system . . mkdir. ../src/loaders |
| 71 | cpscip-shell system . . cp. -rv src/loaders/svg src/loaders/raw ../src/loaders/ |
| 72 | cpscip-shell system . . cp. -rv src/loaders/external_png ../src/loaders/ |
| 73 | cpscip-shell system . . cp. -rv src/loaders/external_webp ../src/loaders/ |
| 74 | cpscip-shell system . . cp. -rv src/loaders/external_jpg ../src/loaders/ |
| 75 | |
| 76 | popd |
| 77 | rmscip-shell system . . rm. -rf tmp |
| 78 | popd |