File pdfmm.spec of Package pdfmm

#
# spec file for package pdfmm
#
# Copyright (c) 2021 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 libver  0_9_20
%define basever 0.9.20
Name:           pdfmm
Version:        0~git20211116.5282a135
Release:        0
Summary:        Tools to work with PDF files
License:        GPL-2.0-or-later
Group:          Productivity/Publishing/PDF
URL:            https://pdfmm.github.io/
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  cmake >= 3.16
BuildRequires:  dos2unix
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(freetype2)
# build fails with this one
#BuildRequires:  pkgconfig(libidn)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libtiff-4)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(lua)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(zlib)

%description
Command line tools for working with PDF files.

%package -n libpdfmm%{libver}
Summary:        PDF parsing and creation library
License:        LGPL-2.1-or-later

%description -n libpdfmm%{libver}
A cross platform PDF parsing and creation library.

%package -n libpdfmm-devel
Summary:        Development files for pdfmm
License:        LGPL-2.1-or-later
Group:          Development/Libraries/Other
Requires:       libpdfmm%{libver} = %{version}
Requires:       pkgconfig(fmt)

%description -n libpdfmm-devel
This package contains development files for pdfmm library.

%prep
%autosetup -p1
dos2unix TODO.md
# Remove build time references so build-compare can do its work
echo "HTML_TIMESTAMP = NO" >> Doxyfile

%build
%cmake \
  -DPDFMM_BUILD_LIB_ONLY=ON \
  -DPDFMM_BUILD_STATIC=OFF \
  -DPDFMM_USE_VISIBILITY=ON
%cmake_build

# Build devel doc
cd ..
doxygen

%install
%cmake_install

# Install devel docs (do it manually to fix also rpmlint warning "files-duplicate" with %%fdupes)
mkdir -p %{buildroot}%{_docdir}/libpdfmm-devel
install -pm 0644 AUTHORS.md CHANGELOG.md TODO.md %{buildroot}%{_docdir}/libpdfmm-devel/
cp -a doc/html/ %{buildroot}%{_docdir}/libpdfmm-devel/

# tell upstream about this
install -m0644 src/pdfmm/pdfmm-contrib.h %{buildroot}%{_includedir}/pdfmm/

%post -n libpdfmm%{libver} -p /sbin/ldconfig
%postun -n libpdfmm%{libver} -p /sbin/ldconfig

%files -n libpdfmm%{libver}
%license COPYING
%{_libdir}/libpdfmm.so.%{basever}

%files -n libpdfmm-devel
%license COPYING
%doc %{_docdir}/libpdfmm-devel/
%{_includedir}/pdfmm
%{_libdir}/libpdfmm.so
%{_libdir}/pkgconfig/libpdfmm.pc

%changelog
openSUSE Build Service is sponsored by