Name:           qpdf
Version:        8.4.2
Release:        2
Summary:        A command-line program to transform PDF files
License:        (Artistic 2.0 or ASL 2.0) and MIT
URL:            http://qpdf.sourceforge.net/
Source0:        http://downloads.sourceforge.net/sourceforge/qpdf/qpdf-%{version}.tar.gz

Patch0000:      qpdf-doc.patch
%ifarch aarch64
Patch0001:      qpdf-erase-tests-with-generated-object-stream.patch
%endif

BuildRequires:  gcc gcc-c++ zlib-devel libjpeg-turbo-devel pcre-devel
BuildRequires:  perl-interpreter perl-generators perl(Digest::MD5)
BuildRequires:  autoconf automake libtool

Provides:       %{name}-libs = %{version}-%{release}
Obsoletes:      %{name}-libs < %{version}-%{release}

%description
QPDF is a command-line program that does structural, content-preserving transformations
on PDF files. It could have been called something like pdf-to-pdf. It also provides many
useful capabilities to developers of PDF-producing software or for people who just want
to look at the innards of a PDF file to learn more about how they work.


%package devel
Summary:        Development package for %{name}
Requires:       %{name} = %{version}-%{release}

%description devel
This package contains some header and library files for the development of %{name}.

%package help
Summary:        Help package for %{name}
BuildArch:      noarch
Provides:       %{name}-doc = %{version}-%{release}
Obsoletes:      %{name}-doc < %{version}-%{release}

%description help
This package contains some man help and other files for %{name}.

%prep
%autosetup -p1

sed -i '1c#!/usr/bin/perl' qpdf/fix-qdf

%build
autoreconf --verbose --force --install
./autogen.sh

%configure --disable-static --enable-show-failed-test-output

%make_build

%install
%make_install

%delete_la

%check
make check

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%doc README.md TODO ChangeLog
%license Artistic-2.0
%{_bindir}/*
%{_libdir}/libqpdf.so.*

%files devel
%doc examples/*.cc examples/*.c
%{_includedir}/qpdf/
%{_libdir}/libqpdf.so
%{_libdir}/pkgconfig/libqpdf.pc

%files help
%{_pkgdocdir}
%{_mandir}/man1/*

%changelog
* Wed Dec 16 2019 catastrowings <jianghuhao1994@163.com> - 8.4.2-2
- fix build fail

* Wed Dec 11 2019 catastrowings <jianghuhao1994@163.com> - 8.2.1-2
- openEuler init
