File crengine-ng.spec of Package crengine-ng

#
# spec file for package crengine-ng
#
# 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/
#


%define  sover  7
%if 0%{?suse_version} >= 1699
%define build_gtest 1
%else
%define build_gtest 0
%endif
Name:           crengine-ng
Version:        0.9.12
Release:        0
Summary:        Cross-platform library designed to implement text viewers and e-book readers
License:        GPL-2.0-or-later
URL:            https://gitlab.com/coolreader-ng/crengine-ng
Source0:        %{url}/-/archive/%{version}/%{name}-%{version}.tar.gz
Source1:        https://ftp.gnu.org/gnu/freefont/freefont-otf-20120503.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  intltool
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(fribidi)
BuildRequires:  pkgconfig(harfbuzz)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libunibreak)
BuildRequires:  pkgconfig(libutf8proc)
BuildRequires:  pkgconfig(libzstd)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(zlib)
%if %{build_gtest}
BuildRequires:  zip
BuildRequires:  pkgconfig(gtest) >= 1.13
%endif

%description
crengine-ng is cross-platform library designed to implement text viewers
and e-book readers.

%package -n lib%{name}%{sover}
Summary:        Library designed to implement text viewers and e-book readers
Requires:       lib%{name}-data >= %{version}

%description -n lib%{name}%{sover}
Cross-platform library designed to implement text viewers and e-book
readers.

%package -n lib%{name}-devel
Summary:        Development files for lib%{name}
Requires:       lib%{name}%{sover} = %{version}

%description -n lib%{name}-devel
crengine-ng is cross-platform library designed to implement text viewers
and e-book readers.
This package contains development files for lib%{name}

%package -n lib%{name}-data
Summary:        Shared data files for lib%{name}
BuildArch:      noarch

%description -n lib%{name}-data
Cross-platform library designed to implement text viewers and e-book
readers.
This package contains data files needed by lib%{name}.

%prep
%autosetup -p1
mkdir -p build/crengine/tests/fonts
tar -xvzf %{SOURCE1} -C ./build/crengine/tests/fonts/ --strip-components=1 --wildcards '*.otf'

%build
%cmake \
    -DCRE_BUILD_STATIC=OFF \
%if %{build_gtest}
    -DENABLE_UNITTESTING=ON \
    -DOFFLINE_BUILD_MODE=ON
%endif
%nil
%cmake_build

%install
%cmake_install

%if %{build_gtest}
%check
#%%ctest
cd ./build
ctest --output-on-failure --force-new-ctest-process -j1
cd ..
%endif

%ldconfig_scriptlets -n lib%{name}%{sover}

%files -n lib%{name}%{sover}
%doc AUTHORS CONTRIBUTING.md README.md
%{_libdir}/lib%{name}.so.*
%license LICENSE

%files -n lib%{name}-devel
%{_libdir}/lib%{name}.so
%{_includedir}/%{name}
%{_libdir}/cmake/%{name}
%{_libdir}/pkgconfig/%{name}.pc

%files -n lib%{name}-data
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*.css
%dir %{_datadir}/%{name}/hyph
%{_datadir}/%{name}/hyph/hyph-*.pattern

%changelog
openSUSE Build Service is sponsored by