Skip to content

Instantly share code, notes, and snippets.

@blackbeam
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackbeam/2bd52592f87ed4a70619 to your computer and use it in GitHub Desktop.
Save blackbeam/2bd52592f87ed4a70619 to your computer and use it in GitHub Desktop.
poppler-0.30.0-el7
yum install -y yum-utils rpmdevtools make gcc-c++
cd ~
mkdir -p dist/{BUILD,RPMS,SPECS,SOURCES,SRPMS,install}
curl 'https://gist.githubusercontent.com/blackbeam/2bd52592f87ed4a70619/raw/98fb85381f390665645ef5c0d8b30e8030f38658/poppler-data.spec' > dist/SPECS/poppler-data.spec
curl 'https://gist.githubusercontent.com/blackbeam/2bd52592f87ed4a70619/raw/8b7d8314e0f557c5ec25dca1dc2574271ea2b00a/poppler.spec' > dist/SPECS/poppler.spec
curl 'https://gist.githubusercontent.com/blackbeam/2bd52592f87ed4a70619/raw/8f2b08b5c378e4e0342a8bc6e01002607a5cb595/Identity-UTF16-H' > dist/SOURCES/Identity-UTF16-H
yum-builddep -y dist/SPECS/poppler.spec
spectool -g dist/SPECS/poppler.spec
mv poppler-0.30.0.tar.xz dist/SOURCES/
rpmbuild -ba --define "_topdir $(pwd)/dist" --define "buildroot $(pwd)/dist/install" --clean dist/SPECS/poppler.spec
spectool -g dist/SPECS/poppler-data.spec
mv cmapresources_identity0.tar.z dist/SOURCES/
mv poppler-data-0.4.7.tar.gz dist/SOURCES/
yum-builddep -y dist/SPECS/poppler-data.spec
rpmbuild -ba --define "_topdir $(pwd)/dist" --define "buildroot $(pwd)/dist/install" --clean dist/SPECS/poppler-data.spec
% Copyright (C) 2003 Artifex Software. All rights reserved.
%
% This software is provided AS-IS with no warranty, either express or
% implied.
%
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
%
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
% San Rafael, CA 94903, U.S.A., +1(415)492-9861.
%
% $Id$
% Identity-UTF16-H CMap
% An identity mapping of UTF16 codes to CIDs.
/CIDInit /ProcSet findresource begin
12 dict begin
begincmap
/CIDSystemInfo 3 dict dup begin
/Registry (Artifex) def
/Ordering (Unicode) def
/Supplement 0 def
end def
/CMapName /Identity-UTF16-H def
/CMapVersion 1.000 def
/CMapType 1 def
/UIDOffset 0 def
% No XUID yet obtained.
/WMode 0 def
1 begincodespacerange
<0000> <FFFF>
endcodespacerange
1 begincidrange
<0000> <FFFF> 0
endcidrange
endcmap
CMapName currentdict /CMap defineresource pop
end
end
%%EndResource
%%EOF
## to bootstrap and avoid the circular dependency with ghostscript
## define this to be the ghostscript version
#define gs_bootstrap 9.06
Summary: Encoding files
Name: poppler-data
Version: 0.4.7
Release: 3%{?dist}
# The cMap data files installed by the poppler-data package are
# under the COPYING.adobe license
# cidToUnicode, nameToUnicode and unicodeMap data files
# are under the COPYING.gpl2 license
# Identity-UTF16-H is under GPLv3+ license
License: BSD and GPLv2 and GPLv3+
Group: Development/Libraries
URL: http://poppler.freedesktop.org/
Source0: http://poppler.freedesktop.org/poppler-data-%{version}.tar.gz
Source1: http://downloads.sourceforge.net/project/cmap.adobe/cmapresources_identity0.tar.z
# extracted from ghostscript-9.05 tarball
Source2: Identity-UTF16-H
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildArch: noarch
%if ! 0%{?gs_bootstrap:1}
BuildRequires: ghostscript
%endif
%global gs_ver %(gs --version 2>/dev/null || echo %{gs_bootstrap})
%description
This package consists of encoding files for poppler. When installed,
the encoding files enables poppler to correctly render CJK and Cyrillic
properly.
%prep
%setup -q -a 1
%build
# intentionally left blank
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT datadir=%{_datadir}
# manually install Identity-* files
# http://bugzilla.redhat.com/842351
install -m644 -p %{SOURCE2} ai0/CMap/Identity-* $RPM_BUILD_ROOT%{_datadir}/poppler/cMap/
# create cmap symlinks for ghostscript
mkdir -p %{buildroot}%{_datadir}/ghostscript/%{gs_ver}/Resource/CMap/
cmap_files=$(find %{buildroot}%{_datadir}/poppler/cMap/ -type f | sed -e "s|%{buildroot}%{_datadir}|../../../..|g")
pushd %{buildroot}%{_datadir}/ghostscript/%{gs_ver}/Resource/CMap/
for target in ${cmap_files} ; do
ln -s $target
test -f $(basename $target)
done
popd
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc COPYING COPYING.adobe COPYING.gpl2 README
%{_datadir}/poppler/
%dir %{_datadir}/ghostscript/%{gs_ver}
%dir %{_datadir}/ghostscript/%{gs_ver}/Resource
%{_datadir}/ghostscript/%{gs_ver}/Resource/CMap/
%{_datadir}/pkgconfig/poppler-data.pc
Summary: PDF rendering library
Name: poppler
Version: 0.30.0
Release: 6%{?dist}
License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT
Group: Development/Libraries
URL: http://poppler.freedesktop.org/
Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz
Requires: poppler-data >= 0.4.7
BuildRequires: automake libtool
BuildRequires: gettext-devel
BuildRequires: libjpeg-devel
BuildRequires: openjpeg-devel >= 1.3-5
BuildRequires: pkgconfig(cairo) >= 1.10.0
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(lcms2)
BuildRequires: pkgconfig(QtGui) pkgconfig(QtXml)
BuildRequires: pkgconfig(libtiff-4)
%description
Poppler, a PDF rendering library, is a fork of the xpdf PDF
viewer developed by Derek Noonburg of Glyph and Cog, LLC.
%package devel
Summary: Libraries and headers for poppler
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
You should install the poppler-devel package if you would like to
compile applications based on poppler.
%package glib
Summary: Glib wrapper for poppler
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description glib
%{summary}.
%package glib-devel
Summary: Development files for glib wrapper
Group: Development/Libraries
Requires: %{name}-glib%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description glib-devel
%{summary}.
%package qt
Summary: Qt4 wrapper for poppler
Group: System Environment/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%{?_qt4:Requires: qt4%{?_isa} >= %{_qt4_version}}
Obsoletes: poppler-qt4 < 0.16.0-3
Provides: poppler-qt4 = %{version}-%{release}
%description qt
%{summary}.
%package qt-devel
Summary: Development files for Qt4 wrapper
Group: Development/Libraries
Requires: %{name}-qt%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Obsoletes: poppler-qt4-devel < 0.16.0-3
Provides: poppler-qt4-devel = %{version}-%{release}
Requires: qt4-devel
%description qt-devel
%{summary}.
%package cpp
Summary: Pure C++ wrapper for poppler
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
%description cpp
%{summary}.
%package cpp-devel
Summary: Development files for C++ wrapper
Group: Development/Libraries
Requires: %{name}-cpp%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description cpp-devel
%{summary}.
%package utils
Summary: Command line utilities for converting PDF files
Group: Applications/Text
Requires: %{name}%{?_isa} = %{version}-%{release}
%if 0%{?fedora} < 11 && 0%{?rhel} < 6
# last seen in fc8
Provides: pdftohtml = 0.36-11
Obsoletes: pdftohtml < 0.36-11
# last seen in fc7
Provides: xpdf-utils = 1:3.01-27
Obsoletes: xpdf-utils < 1:3.01-27
# even earlier?
Conflicts: xpdf <= 1:3.01-8
%endif
%description utils
Poppler, a PDF rendering library, is a fork of the xpdf PDF
viewer developed by Derek Noonburg of Glyph and Cog, LLC.
This utils package installs a number of command line tools for
converting PDF files to a number of other formats.
%package demos
Summary: Demos for poppler
Group: Applications/Text
Requires: %{name}-glib%{?_isa} = %{version}-%{release}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description demos
%{summary}.
%prep
%setup -q
#%patch0 -p1 -b .CVE-2013-4473
#%patch1 -p1 -b .CVE-2013-4474
#%patch2 -p1 -b .rotated-word-selection
iconv -f iso-8859-1 -t utf-8 < "utils/pdftohtml.1" > "utils/pdftohtml.1.utf8"
mv "utils/pdftohtml.1.utf8" "utils/pdftohtml.1"
# hammer to nuke rpaths, recheck on new releases
autoreconf -i -f
%build
# Hack around borkage, http://cgit.freedesktop.org/poppler/poppler/commit/configure.ac?id=9250449aaa279840d789b3a7cef75d06a0fd88e7
PATH=%{_qt4_bindir}:$PATH; export PATH
%configure \
--disable-static \
--enable-cairo-output \
--enable-libjpeg \
--enable-libopenjpeg \
--enable-poppler-qt4 \
--enable-xpdf-headers \
--disable-zlib \
--enable-introspection=yes
make %{?_smp_mflags}
%install
make install DESTDIR=$RPM_BUILD_ROOT
rm -fv $RPM_BUILD_ROOT%{_libdir}/lib*.la
%check
# verify pkg-config sanity/version
export PKG_CONFIG_PATH=%{buildroot}%{_datadir}/pkgconfig:%{buildroot}%{_libdir}/pkgconfig
test "$(pkg-config --modversion poppler)" = "%{version}"
test "$(pkg-config --modversion poppler-cairo)" = "%{version}"
test "$(pkg-config --modversion poppler-cpp)" = "%{version}"
test "$(pkg-config --modversion poppler-glib)" = "%{version}"
test "$(pkg-config --modversion poppler-qt4)" = "%{version}"
test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%post glib -p /sbin/ldconfig
%postun glib -p /sbin/ldconfig
%post qt -p /sbin/ldconfig
%postun qt -p /sbin/ldconfig
%post cpp -p /sbin/ldconfig
%postun cpp -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%doc COPYING README
%{_libdir}/libpoppler.so.49*
%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/poppler.pc
%{_libdir}/pkgconfig/poppler-splash.pc
%{_libdir}/libpoppler.so
%dir %{_includedir}/poppler/
# xpdf headers
%{_includedir}/poppler/*.h
%{_includedir}/poppler/fofi/
%{_includedir}/poppler/goo/
%{_includedir}/poppler/splash/
%{_datadir}/gtk-doc/
%files glib
%defattr(-,root,root,-)
%{_libdir}/libpoppler-glib.so.8*
%{_libdir}/girepository-1.0/Poppler-0.18.typelib
%files glib-devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/poppler-glib.pc
%{_libdir}/pkgconfig/poppler-cairo.pc
%{_libdir}/libpoppler-glib.so
%{_datadir}/gir-1.0/Poppler-0.18.gir
%{_includedir}/poppler/glib/
%files qt
%defattr(-,root,root,-)
%{_libdir}/libpoppler-qt4.so.4*
%files qt-devel
%defattr(-,root,root,-)
%{_libdir}/libpoppler-qt4.so
%{_libdir}/pkgconfig/poppler-qt4.pc
%{_includedir}/poppler/qt4/
%files cpp
%defattr(-,root,root,-)
%{_libdir}/libpoppler-cpp.so.0*
%files cpp-devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/poppler-cpp.pc
%{_libdir}/libpoppler-cpp.so
%{_includedir}/poppler/cpp
%files utils
%defattr(-,root,root,-)
%{_bindir}/pdf*
%{_mandir}/man1/*
%files demos
%defattr(-,root,root,-)
%{_bindir}/poppler-glib-demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment