2023-08-08 22:22:11 +02:00
|
|
|
#!/bin/bash -e
|
2022-01-13 13:54:19 +01:00
|
|
|
|
2024-05-10 09:30:57 +02:00
|
|
|
VERSION=0.13.3
|
2022-01-13 13:54:19 +01:00
|
|
|
|
2023-09-29 14:58:36 +02:00
|
|
|
cd thirdparty/thorvg/ || true
|
2023-08-08 22:22:11 +02:00
|
|
|
rm -rf AUTHORS LICENSE inc/ src/ *.zip *.tar.gz tmp/
|
2022-01-13 13:54:19 +01:00
|
|
|
|
2023-08-08 22:22:11 +02:00
|
|
|
mkdir tmp/ && pushd tmp/
|
|
|
|
|
2023-09-29 14:58:36 +02:00
|
|
|
# Release
|
2023-08-08 22:22:11 +02:00
|
|
|
curl -L -O https://github.com/thorvg/thorvg/archive/v$VERSION.tar.gz
|
2023-09-29 14:58:36 +02:00
|
|
|
# Current Github main branch tip
|
|
|
|
#curl -L -O https://github.com/thorvg/thorvg/archive/refs/heads/main.tar.gz
|
|
|
|
|
2023-08-08 22:22:11 +02:00
|
|
|
tar --strip-components=1 -xvf *.tar.gz
|
|
|
|
rm *.tar.gz
|
2023-09-29 14:58:36 +02: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 22:22:11 +02:00
|
|
|
find . -type f -name 'meson.build' -delete
|
2022-01-13 13:54:19 +01:00
|
|
|
|
2023-08-08 22:22:11 +02: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 13:54:19 +01:00
|
|
|
|
2023-08-08 22:22:11 +02:00
|
|
|
cp -v AUTHORS LICENSE ..
|
|
|
|
cp -rv inc ../
|
2022-01-13 13:54:19 +01:00
|
|
|
|
2023-08-08 22:22:11 +02: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 13:09:33 +02:00
|
|
|
#define THORVG_PNG_LOADER_SUPPORT
|
|
|
|
#define THORVG_JPG_LOADER_SUPPORT
|
2024-02-07 12:02:57 +01:00
|
|
|
#define THORVG_THREAD_SUPPORT
|
2022-01-13 13:54:19 +01:00
|
|
|
|
2024-05-13 12:55:21 +02:00
|
|
|
// Added conditionally if webp module is enabled.
|
|
|
|
//#define THORVG_WEBP_LOADER_SUPPORT
|
|
|
|
|
2023-09-29 14:58:36 +02:00
|
|
|
// For internal debugging:
|
|
|
|
//#define THORVG_LOG_ENABLED
|
|
|
|
|
2022-01-13 13:54:19 +01:00
|
|
|
#define THORVG_VERSION_STRING "$VERSION"
|
|
|
|
#endif
|
|
|
|
EOF
|
2023-08-08 22:22:11 +02:00
|
|
|
|
|
|
|
mkdir ../src
|
2023-09-29 14:58:36 +02:00
|
|
|
cp -rv src/common ../src
|
|
|
|
cp -rv src/renderer ../src/
|
|
|
|
|
2023-08-08 22:22:11 +02:00
|
|
|
# Only sw_engine is enabled.
|
2023-09-29 14:58:36 +02:00
|
|
|
rm -rfv ../src/renderer/gl_engine
|
2024-01-05 18:01:00 +01:00
|
|
|
rm -rfv ../src/renderer/wg_engine
|
2023-08-08 22:22:11 +02:00
|
|
|
|
2024-05-10 09:30:57 +02:00
|
|
|
# Enabled embedded loaders: raw, JPEG, PNG, WebP.
|
2023-08-08 22:22:11 +02:00
|
|
|
mkdir ../src/loaders
|
|
|
|
cp -rv src/loaders/svg src/loaders/raw ../src/loaders/
|
2024-05-10 09:30:57 +02: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 22:22:11 +02:00
|
|
|
|
|
|
|
popd
|
2023-09-29 14:58:36 +02:00
|
|
|
rm -rf tmp
|
|
|
|
|