2023-08-08 20:22:11 +00:00
|
|
|
#!/bin/bash -e
|
2022-01-13 12:54:19 +00:00
|
|
|
|
2024-07-12 10:12:13 +00:00
|
|
|
VERSION=0.14.2
|
2022-01-13 12:54:19 +00:00
|
|
|
|
2023-09-29 12:58:36 +00:00
|
|
|
cd thirdparty/thorvg/ || true
|
2023-08-08 20:22:11 +00:00
|
|
|
rm -rf AUTHORS LICENSE inc/ src/ *.zip *.tar.gz tmp/
|
2022-01-13 12:54:19 +00:00
|
|
|
|
2023-08-08 20:22:11 +00:00
|
|
|
mkdir tmp/ && pushd tmp/
|
|
|
|
|
2023-09-29 12:58:36 +00:00
|
|
|
# Release
|
2023-08-08 20:22:11 +00:00
|
|
|
curl -L -O https://github.com/thorvg/thorvg/archive/v$VERSION.tar.gz
|
2023-09-29 12:58:36 +00:00
|
|
|
# Current Github main branch tip
|
|
|
|
#curl -L -O https://github.com/thorvg/thorvg/archive/refs/heads/main.tar.gz
|
|
|
|
|
2023-08-08 20:22:11 +00:00
|
|
|
tar --strip-components=1 -xvf *.tar.gz
|
|
|
|
rm *.tar.gz
|
2023-09-29 12:58:36 +00:00
|
|
|
|
|
|
|
# Install from local git checkout "thorvg-git" in the same directory
|
|
|
|
# as godot git checkout.
|
|
|
|
#d="../../../../thorvg-git"
|
|
|
|
#cp -r ${d}/AUTHORS ${d}/inc ${d}/LICENSE ${d}/src .
|
|
|
|
|
2023-08-08 20:22:11 +00:00
|
|
|
find . -type f -name 'meson.build' -delete
|
2022-01-13 12:54:19 +00:00
|
|
|
|
2023-08-08 20:22:11 +00:00
|
|
|
# Fix newline at end of file.
|
|
|
|
for source in $(find ./ -type f \( -iname \*.h -o -iname \*.cpp \)); do
|
|
|
|
sed -i -e '$a\' $source
|
|
|
|
done
|
2022-01-13 12:54:19 +00:00
|
|
|
|
2023-08-08 20:22:11 +00:00
|
|
|
cp -v AUTHORS LICENSE ..
|
|
|
|
cp -rv inc ../
|
2022-01-13 12:54:19 +00:00
|
|
|
|
2023-08-08 20:22:11 +00:00
|
|
|
cat << EOF > ../inc/config.h
|
|
|
|
#ifndef THORVG_CONFIG_H
|
|
|
|
#define THORVG_CONFIG_H
|
|
|
|
|
|
|
|
#define THORVG_SW_RASTER_SUPPORT
|
|
|
|
#define THORVG_SVG_LOADER_SUPPORT
|
2023-10-13 11:09:33 +00:00
|
|
|
#define THORVG_PNG_LOADER_SUPPORT
|
|
|
|
#define THORVG_JPG_LOADER_SUPPORT
|
2024-06-13 21:54:59 +00:00
|
|
|
#ifndef WEB_ENABLED
|
2024-02-07 11:02:57 +00:00
|
|
|
#define THORVG_THREAD_SUPPORT
|
2024-06-13 21:54:59 +00:00
|
|
|
#endif
|
2022-01-13 12:54:19 +00:00
|
|
|
|
2024-05-13 10:55:21 +00:00
|
|
|
// Added conditionally if webp module is enabled.
|
|
|
|
//#define THORVG_WEBP_LOADER_SUPPORT
|
|
|
|
|
2023-09-29 12:58:36 +00:00
|
|
|
// For internal debugging:
|
|
|
|
//#define THORVG_LOG_ENABLED
|
|
|
|
|
2022-01-13 12:54:19 +00:00
|
|
|
#define THORVG_VERSION_STRING "$VERSION"
|
|
|
|
#endif
|
|
|
|
EOF
|
2023-08-08 20:22:11 +00:00
|
|
|
|
|
|
|
mkdir ../src
|
2023-09-29 12:58:36 +00:00
|
|
|
cp -rv src/common ../src
|
|
|
|
cp -rv src/renderer ../src/
|
|
|
|
|
2023-08-08 20:22:11 +00:00
|
|
|
# Only sw_engine is enabled.
|
2023-09-29 12:58:36 +00:00
|
|
|
rm -rfv ../src/renderer/gl_engine
|
2024-01-05 17:01:00 +00:00
|
|
|
rm -rfv ../src/renderer/wg_engine
|
2023-08-08 20:22:11 +00:00
|
|
|
|
2024-05-10 07:30:57 +00:00
|
|
|
# Enabled embedded loaders: raw, JPEG, PNG, WebP.
|
2023-08-08 20:22:11 +00:00
|
|
|
mkdir ../src/loaders
|
|
|
|
cp -rv src/loaders/svg src/loaders/raw ../src/loaders/
|
2024-05-10 07:30:57 +00:00
|
|
|
cp -rv src/loaders/external_png ../src/loaders/
|
|
|
|
cp -rv src/loaders/external_webp ../src/loaders/
|
|
|
|
# Not using external jpg as it's turbojpeg, which we don't have.
|
|
|
|
cp -rv src/loaders/jpg ../src/loaders/
|
2023-08-08 20:22:11 +00:00
|
|
|
|
|
|
|
popd
|
2023-09-29 12:58:36 +00:00
|
|
|
rm -rf tmp
|
|
|
|
|