%bcond_with doc

%define name	poppler061
%define version	0.61.1
%define release	2%{?_dist_release}

Summary:	PDF rendering library.
Summary(ja): 	PDF レンダリング用ライブラリ
Name:		%{name}
Version:	%{version}
Release: 	%{release}

Source0:	http://poppler.freedesktop.org/poppler-%{version}.tar.xz

# https://bugzilla.redhat.com/show_bug.cgi?id=1185007
Patch0:  poppler-0.30.0-rotated-words-selection.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1113172
Patch1:  0001-workaround-a-bug-in-nss-header.patch

License:	GPLv2
Group:		System Environment/Libraries
URL:		http://poppler.freedesktop.org/

BuildRequires:	cmake
BuildRequires:	gettext-devel
BuildRequires:	gtk2-devel >= 2.2.0
%if %{with doc}
BuildRequires:	gtk-doc
%endif
BuildRequires:	gtk3-devel
BuildRequires:	zlib-devel
BuildRequires:  libjpeg-devel
BuildRequires:  openjpeg2-devel
BuildRequires:	cairo-devel
BuildRequires:	libXmu-devel
BuildRequires:  lcms2-devel
BuildRequires:  libtiff-devel

Requires:	poppler-data >= 0.3.0
Obsoletes:	poppler < %{version}-%{release}

BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Vendor:		Project Vine
Distribution:	Vine Linux
Packager:	kazutaka, inagaki, daisuke

%description
Poppler is a PDF rendering library based on the xpdf-3.0 code base.

%description -l ja
Popplerは xpdf-3.0 のコードをベースにした PDF レンダリング用ライブラリ
です。

%prep
%autosetup -p1 -n poppler-%{version}

%build
mkdir build
cd build
export CC="gcc -fPIC" # hack to make the cmake call pass
%cmake \
  -DENABLE_CMS=lcms2 \
  -DENABLE_DCTDECODER=libjpeg \
%if %{with doc}
  -DENABLE_GTK_DOC=ON \
%endif
  -DENABLE_LIBOPENJPEG=openjpeg2 \
  -DENABLE_XPDF_HEADERS=ON \
  -DENABLE_ZLIB=OFF \
  -DENABLE_GLIB=OFF \
  -DENABLE_QT4=OFF \
  -DENABLE_QT5=OFF \
  -DENABLE_UTILS=OFF \
  ..
unset CC
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
cd build
%{__make} install DESTDIR=$RPM_BUILD_ROOT

# remove unnecessary files.
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_libdir}/libpoppler.la
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_libdir}/libpoppler-cpp.la
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_libdir}/libpoppler-glib.la
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_libdir}/libpoppler-qt4.la
%{__rm} -rf ${RPM_BUILD_ROOT}/%{_libdir}/libpoppler-qt5.la

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS ChangeLog INSTALL NEWS README* TODO
%{_libdir}/lib*.so.*

%exclude %{_libdir}/libpoppler-cpp.so.*
%exclude %{_libdir}/lib*.so
%exclude %{_libdir}/pkgconfig
%exclude %{_includedir}/poppler
%if %{with doc}
%exclude %{_datadir}/gtk-doc
%endif
%exclude %{_bindir}/pdf*
%exclude %{_mandir}

%changelog
* Mon Oct 14 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.61.1-2
- changed %%name.

* Sun Dec 31 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.61.1-1
- new upstream release.
- imported Patch0 and 1 from rawhide.

* Thu Mar  9 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.43.0-4
- new upstream release.
- fixed qt5 stuff.

* Mon Nov 21 2016 Toshiaki Ara <ara_t@384.jp> 0.43.0-3
- add packages: poppler-qt5 / poppler-qt5-devel

* Wed Jun 29 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 0.43.0-2
- rebuilt with new toolchain.

* Mon May 09 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.43.0-1
- new upstream release

* Sun Nov 01 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.37.0-1
- new upstream release

* Sun Oct 26 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.26.5-1
- new upstream release

* Tue Jul 08 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.26.2-1
- new upstream release

* Wed Apr 30 2014 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 0.24.5-1
- new upstream release with security fixes 

* Sat Jan 04 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.24.2-2
- rebuild with VineSeed environment

* Sat Oct 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.24.2-1
- new upstream release

* Sat Sep 15 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.20.4-1
- new upstream release
- change BuildRequires: lcms2-devel instead of lcms-devel
- add BuildRequires: libtiff-devel

* Wed Apr 11 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.18.4-1
- new upstream release
- remove Patch10
- remove qt, qt-devel sub packages

* Fri Sep 23 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.16.6-2
- add Requires: gtk2-devel (-devel package)

* Tue May 31 2011 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.16.6-1
- new upstream release

* Tue Apr 19 2011 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 0.16.4-2
- rebuild again on ppc with openjpeg-1.4

* Thu Apr 14 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.16.4-1
- new upstream release
- built with openjpeg-1.4

* Sat Mar 12 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.16.3-1
- new upstream release
- added utils subpackage

* Sun Oct 03 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.14.2-1
- new upstream release
- add BuildRequires: libXmu-devel

* Sun Mar 21 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.12.4-1
- new upstream release (including security fix CVE-2009-3607)
- built with new toolchain
- changed --enable-gtk-doc to --disable-gtk-doc

* Mon Nov  2 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.12.1-1
- new upstream release (including security fix based xpdf 3.02pl4)
- added BR: openjpeg-devel

* Sun Aug 16 2009 NAKAMURA Kenta <kenta@vinelinux.org> 0.10.7-3
- added qt4 wrapper subpackage
- added BuildRequires: qt4-devel

* Mon Jul 20 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.10.7-2
- add Patch10 to support otf font with TrueType format. (<BTS:0727>)
  (thanks to tomop)

* Mon May 18 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.10.7-1
- new upstream release

* Sun May 10 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.10.6-3
- added qt3 wrapper subpackage

* Fri May 01 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.10.6-2
- add configure option --enable-shared and --disable-static
- drop *.a from devel sub package 

* Fri Apr 24 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.10.6-1
- new upstream release
- add Packager: kazutaka

* Sun Mar 15 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.10.5-1
- new upstream release

* Mon Feb 23 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.10.4-1
- new upstream release

* Sun Feb 01 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.10.3-1
- new upstream release

* Sat Dec 13 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.10.2-1
- new upstream release

* Fri Oct 10 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.8.7-1
- new upstream release
- built with cairo-1.8.0

* Sat Aug 30 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.8.6-1
- new upstream release

* Tue Jul 29 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.8.5-1
- new upstream release

* Tue Jul 01 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.8.4-1
- new upstream release

* Thu Jun  5 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.8.3-1
- new upstream release
- spec in UTF-8

* Tue Apr  1 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.8.2-1
- new upstream release.
- rebuilt with cairo-1.6.4

* Mon Mar 31 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.8.0-1
- new upstream release.
- apply new versioning policy.

* Sun Mar 02 2008 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.6.4-0vl1
- new upstream release.

* Sun Dec 30 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.6.3-0vl1
- new upstream release.

* Tue Dec 11 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.6.2-0vl1
- new upstream release.

* Sat Oct 27 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.6.1-0vl1
- new upstream release.

* Sun Sep 09 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.6-0vl1
- new upstream release.
- add Requires to poppler-data.

* Mon Jun 18 2007 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.5.9-0vl1
- new upstream release.
- drop Patch100. (Fixed in upstream)

* Fri May 11 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 0.5.4-0vl3
- rebuild with new environment/toolchain

* Mon Feb 05 2007 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 0.5.4-0vl2
- rebuilt for VineSeed

* Sat Jan 20 2007 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 0.5.4-0vl1.1
- add patch100 for fix CVE-2007-0104 (Catalog Dictionary Handling Dos)
- add Vendor/Distribution Tag

* Tue Sep 26 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.5.4-0vl1
- source update.
- remove unnecessary .la files in %%install section.

* Thu Jun 22 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 0.5.3-0vl2
- add Requires: xpdf-common >= 3.01
- fix Url

* Sat Jun 17 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.5.3-0vl1
- source update.
- add BuildRequires gtk-doc.

* Sun May 28 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.5.2-0vl1
- source update.

* Sat Mar 11 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.5.1-0vl2
- add --enable-xpdf-headers configure option.

* Wed Mar 01 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.5.1-0vl1
- source update.
- add %%{_datadir}/gtk-doc/html/poppler in %%files section.
- add --disable-utils and --enable-zlib configure option.
  (--disable-utis needed to aboid conflict with xpdf)
- delete --enable-a4-paper configure option.(no longer supported)

* Wed Jan 25 2006 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.4.4-0vl1
- source update.

* Wed Sep 21 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.4.2-0vl1
- source update.
- add configure option --disable-poppler-{qt.qt4}, --enable-a4-paper.
- del BuildReq: libpixman-devel.(Obsolete by cairo)

* Thu Aug 18 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.4.0-0vl1
- source update.

* Sat Jun 25 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.3.3-0vl1
- source update.

* Thu May 19 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.3.2-0vl1
- source update.

* Thu May 05 2005 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 0.3.1-0vl1
- initial build for VineSeed Plus.
