## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:           thorvg
Version:        0.15.11
Release:        %{autorelease}
Summary:        Lightweight vector-based scenes and animation drawing library

License:        MIT
URL:            https://www.thorvg.org/
Source:         https://github.com/thorvg/thorvg/archive/v%{version}/thorvg-%{version}.tar.gz
# Use system rapidjson library
Patch:          systemrapidjson.patch
# Give binaries names that are not generic to prevent conflicts
Patch:          binarynameconflicts.patch

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-turbo-devel 
BuildRequires:  libpng-devel
BuildRequires:  libwebp-devel
BuildRequires:  mesa-libGL-devel
BuildRequires:  rapidjson-devel
BuildRequires:  SDL2-devel
BuildRequires:  meson
BuildRequires:  ninja-build

%global _description %{expand:
ThorVG is an open-source graphics library designed for creating vector-based
scenes and animations. It combines immense power with remarkable lightweight
efficiency, as Thor embodies a dual meaning—symbolizing both thunderous
strength and lightning-fast agility. Embracing the philosophy of simpler is
better, the ThorVG project provides intuitive, user-friendly interfaces while
maintaining a compact footprint and minimal overhead.

The following list shows primitives that are supported by ThorVG:
- Lines & Shapes: rectangles, circles, and paths with coordinate control
- Filling: solid colors, linear & radial gradients, and path clipping
- Stroking: stroke width, joins, caps, dash patterns, and trimming
- Scene Management: retainable scene graph and object transformations
- Composition: various blending and masking
- Text: unicode characters with horizontal text layout using scalable fonts (TTF)
- Images: SVG, JPG, PNG, WebP, and raw bitmaps
- Effects: blur, drop shadow, fill, tint, tritone and color replacement
- Animations: Lottie}

%description %_description

%package devel
Summary: Development headres and libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
Development headers and libraries for ThorVG.


%prep
%autosetup -n thorvg-%{version} -p1
# Ensure use system library
rm -r src/loaders/lottie/rapidjson

%build
%meson -Dengines=all \
       -Dexamples=true \
       -Dloaders=all \
       -Dsavers=all \
       -Dbindings=capi \
       -Dtools=all \
       -Dstrip=false
%meson_build


%install
%meson_install

%check
%meson_test

%files
%license LICENSE
%doc README.md
%doc AUTHORS
%doc CONTRIBUTING.md
%{_libdir}/libthorvg.so.0
%{_libdir}/libthorvg.so.0.*
%{_bindir}/thorvgsvg2png
%{_bindir}/thorvgsvg2tvg
%{_bindir}/thorvglottie2gif

%files devel
%{_includedir}/thorvg.h
%{_includedir}/thorvg_capi.h
%{_includedir}/thorvg_lottie.h
%{_libdir}/libthorvg.so
%{_libdir}/pkgconfig/thorvg.pc


%changelog
## START: Generated by rpmautospec
* Sat Mar 29 2025 John Doe <packager@example.com> - 0.15.11-1
- Uncommitted changes
## END: Generated by rpmautospec