File lunasvg.spec of Package lunasvg

#
# spec file for package lunasvg
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           lunasvg
Version:        2.4.0
Release:        0
Summary:        Standalone SVG rendering library in C++
License:        MIT AND FTL
URL:            https://github.com/sammycage/lunasvg
Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Add soversion
Patch0:         %{url}/pull/92.patch
BuildRequires:  chrpath
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  sed
###BuildRequires:  stb_image_write-devel
BuildRequires: pkgconfig(stb)
# Vendored copy under 3rdparty/plutovg
# License: FTL
Provides:       bundled(plutovg)

%description
LunaSVG is a standalone SVG rendering library in C++.

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

%description    devel
This package contains development headers and libraries for %{name}.

%prep
%autosetup -p1

# Replace bundled libraries with the system ones
ln -sf %{_includedir}/stb/stb_image_write.h 3rdparty/stb/

# Do not hardcode libdir
sed -i '/set(LUNASVG_LIBDIR/d' CMakeLists.txt

%build
%cmake \
  -DLUNASVG_LIBDIR="%{_libdir}" \
  -DLUNASVG_BUILD_EXAMPLES=ON \

%cmake_build

%install
%cmake_install

chrpath -d build/svg2png
install -Dpm0755 -t %{buildroot}%{_bindir} build/svg2png

%check
%ctest

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%license LICENSE 3rdparty/plutovg/FTL.TXT
%doc README.md
%{_bindir}/svg2png
%{_libdir}/lib%{name}.so.2{,.*}

%files devel
%{_includedir}/%{name}.h
%{_libdir}/lib%{name}.so

%changelog
openSUSE Build Service is sponsored by