xpdf in CentOs

I wanted Xpdf on my Centos machine, but I could not find a binary that had the newest patch level. So I used http://mbrisby.blogspot.com/2007/06/xpdf.html and extended it. I respect poppler and just add the program xpdf. Further I patch some known bugs.
Download the source rpm here : xpdf-3.02-5.src.rpm

Thank you Carl for the nice spec file. Here is my extended one.

%define _prefix /usr
%define _version 3.02

Summary: open source viewer for Portable Document Format (PDF) files
Name: xpdf
Version: %{_version}
Release: 5
Source0: ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.02.tar.gz
URL: http://www.foolabs.com/xpdf/
Group: Applications/Publishing
License: GPLv2
Patch0: ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.02pl1.patch
Patch1: ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.02pl2.patch
Patch2: patch-doc_sample-xpdfrc
Patch3: patch-xpdf_Object_h
BuildRoot: %{_topdir}/BUILD/%{name}-buildroot
Prefix: %{_prefix}



#Requires: t1lib
Requires: freetype > 2.0.5
Requires: htmlview
Requires: urw-fonts
Requires: xdg-utils
Requires: poppler-utils
Requires: xorg-x11-fonts-ISO8859-1-75dpi

BuildRequires: t1lib
BuildRequires: wxGTK
BuildRequires: t1lib-devel
BuildRequires: libpaper-devel
BuildPrereq: openmotif-devel
BuildPrereq: libX11-devel
BuildPrereq: freetype-devel >= 2.1.7
BuildPrereq: fileutils

%description
Xpdf is an open source viewer for Portable Document Format (PDF)
files. (These are also sometimes also called 'Acrobat' files, from
the name of Adobe's PDF software.) The Xpdf project also includes a
PDF text extractor, PDF-to-PostScript converter, and various other
utilities.

Xpdf runs under the X Window System on UNIX, VMS, and OS/2. The non-X
components (pdftops, pdftotext, etc.) also run on Win32 systems and
should run on pretty much any system with a decent C++ compiler.

Xpdf is designed to be small and efficient. It can use Type 1 or
TrueType fonts.

%prep
%setup -q
%patch -p1

%build

./configure --prefix=%{_prefix} --mandir=%{_mandir} --sysconfdir=/etc --with-freetype2-includes=/usr/include/freetype2

# ./configure \
# --prefix=%{_prefix}
# --mandir=%{_mandir}
# --sysconfdir=/etc
# --enable-multithreaded \
# --enable-wordlist \
# --with-x \
# --with-gzip \
# --enable-opi \
# # --with-appdef-dir=%{_datadir}/X11/app-defaults/ \
# --without-Xp-library \
# --with-t1-library \
# --with-freetype2-includes=/usr/include/freetype2/

make

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

#poppler does this now. Stupid but works
rm $RPM_BUILD_ROOT%{_bindir}/pdffonts
rm $RPM_BUILD_ROOT%{_bindir}/pdfimages
rm $RPM_BUILD_ROOT%{_bindir}/pdfinfo
rm $RPM_BUILD_ROOT%{_bindir}/pdftops
rm $RPM_BUILD_ROOT%{_bindir}/pdftotext
rm $RPM_BUILD_ROOT%{_bindir}/pdftoppm

rm $RPM_BUILD_ROOT%{_mandir}/man1/pdffonts.1*
rm $RPM_BUILD_ROOT%{_mandir}/man1/pdfimages.1*
rm $RPM_BUILD_ROOT%{_mandir}/man1/pdfinfo.1*
rm $RPM_BUILD_ROOT%{_mandir}/man1/pdftops.1*
rm $RPM_BUILD_ROOT%{_mandir}/man1/pdftotext.1*
rm $RPM_BUILD_ROOT%{_mandir}/man1/pdftoppm.1*


%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc ANNOUNCE COPYING CHANGES INSTALL README
%{_prefix}/bin/*
%{_mandir}/man1/*
%{_mandir}/man5/xpdfrc*
/etc/xpdfrc

%changelog
* Thu Nov 20 2008 Hoffmann Geerd-Dietger
- added 3.02pl2.patch
* Fri Aug 24 2007 Martin Brisby
- added 3.02pl1 patch
* Sat Jun 16 2007 Martin Brisby
- initial specfile



If you want to avoid the Pdf passwords I recommend to add this patch:

$OpenBSD: patch-xpdf_XRef_cc,v 1.4 2008/04/25 19:19:05 deanna Exp $
--- xpdf/XRef.cc.orig Thu Apr 24 19:13:00 2008
+++ xpdf/XRef.cc Thu Apr 24 19:50:06 2008
@@ -771,19 +771,19 @@ void XRef::setEncryption(int permFlagsA, GBool ownerPa
}

GBool XRef::okToPrint(GBool ignoreOwnerPW) {
- return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permPrint);
+ return (1);
}

GBool XRef::okToChange(GBool ignoreOwnerPW) {
- return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permChange);
+ return (1);
}

GBool XRef::okToCopy(GBool ignoreOwnerPW) {
- return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permCopy);
+ return (1);
}

GBool XRef::okToAddNotes(GBool ignoreOwnerPW) {
- return (!ignoreOwnerPW && ownerPasswordOk) || (permFlags & permNotes);
+ return (1);
}

Object *XRef::fetch(int num, int gen, Object *obj) {

No comments: