File xpdf.spec of Package xpdf

#
# spec file for package xpdf (Version 3.02)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

# norootforbuild


Name:           xpdf
BuildRequires:  freetype2-devel gcc-c++ ghostscript-fonts-std openmotif-devel update-desktop-files xorg-x11
License:        GPL v2 only
Group:          Productivity/Publishing/PDF
Version:        3.02
Release:        97.<RELEASE83>
AutoReqProv:    on
Requires:       ghostscript-fonts-std, xpdf-tools = %{version}
Summary:        A PDF File Viewer for the X Window System
Source:         xpdf-%{version}.tar.bz2
Source1:        xpdf-chinese-simplified.tar.bz2
Source2:        xpdf-chinese-traditional.tar.bz2
Source3:        xpdf-cyrillic.tar.bz2
Source4:        xpdf-greek.tar.bz2
Source5:        xpdf-japanese.tar.bz2
Source6:        xpdf-korean.tar.bz2
Source7:        xpdf-latin2.tar.bz2
Source8:        xpdf-thai.tar.bz2
Source9:        xpdf-turkish.tar.bz2
Source10:       xpdf-hebrew.tar.bz2
Source20:       50-xpdf
Source21:       xpdf-cjk-config
Source22:       xpdfrc-cjk
Source23:       xpdfrc-cjk.sjis
Source24:       xpdf.desktop
Source25:       xpdf.png
Patch3:         xpdf-%{version}-autoconf.patch
Patch5:         xpdf-config-cjk.patch
Patch6:         xpdf-%{version}-ttf-cid-fix.dif
Patch7:         xpdf-%{version}-mkstemp.dif
Patch8:         xpdf-%{version}-print-ext-ttf.dif
Patch9:         xpdf-i18n.patch
Patch10:        xpdf-settitle.patch
Patch11:        xpdf-search-non-ascii.patch
Patch14:        xpdf-fix-cut-and-paste-and-default-output-encoding.patch
Patch15:        xpdf-fix-crash-in-japanese-locale.patch
Patch17:        xpdf-postscript-lc-numeric.patch
Patch21:        libgoo-sizet.diff
Patch23:        xpdf-%{version}-crash-JPXStream.patch
Patch24:        xpdf-disable-byte-code-interpreter.patch
Patch25:        xpdf-cid-ttf-unicode-fix2.diff
Patch26:        xpdf-gcc41.patch
Patch27:        xpdf-3.02pl1-CVE-2007-3387.patch
Patch28:        xpdf-3.02pl2-CVE-2007-4352,5392,5393.patch
Patch29:        xpdf-3.02-object_type_checking.patch
Patch30:        xpdf-3.02-stream.patch
Patch31:        %{name}-%{version}-add-and-subtract-key-binding.patch
Patch32:        %{name}-%{version}-full-screen.patch
Patch33:        %{name}-%{version}pl3-CVE-2009-JBIG2-multiple-vulnerabilities.patch
Patch34:        xpdf-safe-int.patch
Patch35:        xpdf-no-alloc-bitmap-data.patch
Patch36:        xpdf-3.02pl4-CVE-2009-1187,1188,3608.patch
Patch37:        xpdf-no-goto-when-fullscreen.patch
Patch38:        xpdf-pimage-null.patch
Patch39:        xpdf-CVE-2010-3702,3704.patch
Url:            http://www.foolabs.com/xpdf/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This tool is used for viewing PDF (Portable Document Format) files. It
is designed to be small and efficient.



Authors:
--------
    Derek B. Noonburg <derekn@foolabs.com>

%package -n xpdf-tools
License:        GPL v2 only
Summary:        Character maps and config files required by xpdf
Group:          Productivity/Publishing/PDF
Provides:       xpdf:/etc/xpdfrc xpdf-config
Provides:       pdftools_any
Obsoletes:      xpdf-config

%description -n xpdf-tools
Character maps and config files required by xpdf



Authors:
--------
    Derek B. Noonburg <derekn@foolabs.com>

%prep
%setup -q -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10
%patch3 -p1
%patch5 -p1
%patch6 -p1
%patch7
%patch8 -p0
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch14 -p1
%patch15 -p1
%patch17 -p1
%patch21 -p1
%patch23
%patch24 -p1
%patch25
%patch26
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30
%patch31
%patch32
%patch33 -p1
%patch34 -p1
%patch35
%patch36 -p1
%patch37
%patch38 -p1
%patch39 -p1

%build
%{?suse_update_config:%{suse_update_config -f }}
#autoreconf -f -i
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --mandir=%{_mandir} \
    --enable-a4 \
    --with-freetype2-library \
    --without-t1-library \
    --with-freetype2-includes=/usr/include/freetype2
make

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}/usr/share/xpdf
for file in xpdf-*/add-to-xpdfrc ; do
  sed -e "s|/usr/local/share/xpdf|/usr/share/xpdf|" -e "s|^displayCIDFontX|#displayCIDFontX|" $file >$file.new
  mv -f $file.new $file
  dir=`dirname $file`
  lang=`echo $dir|sed -e "s|xpdf-||"`
  cp -r $dir %{buildroot}/usr/share/xpdf/$lang
  echo >>%{buildroot}/etc/xpdfrc
  cat $file >>%{buildroot}/etc/xpdfrc
done
echo "# include font setup for CJK languages" >> %{buildroot}/etc/xpdfrc
echo "include /etc/xpdfrc-cjk-auto" >> %{buildroot}/etc/xpdfrc
echo "include /etc/xpdfrc-cjk" >> %{buildroot}/etc/xpdfrc
echo "include /etc/xpdfrc-cjk.sjis" >> %{buildroot}/etc/xpdfrc
touch %{buildroot}/etc/xpdfrc-cjk-auto
install -m 644 $RPM_SOURCE_DIR/xpdfrc-cjk %{buildroot}/etc/xpdfrc-cjk
install -m 644 $RPM_SOURCE_DIR/xpdfrc-cjk.sjis %{buildroot}/etc/xpdfrc-cjk.sjis
mkdir -p %{buildroot}/usr/lib/fonts-config/conf.d/
install -m 755 $RPM_SOURCE_DIR/50-xpdf %{buildroot}/usr/lib/fonts-config/conf.d/
mkdir -p %{buildroot}/usr/sbin/
install -m 755 $RPM_SOURCE_DIR/xpdf-cjk-config %{buildroot}/usr/sbin/
mkdir -p %{buildroot}/usr/share/applications/
install -m 644 %{S:24} %{buildroot}/usr/share/applications/
mkdir -p %{buildroot}/usr/share/pixmaps/
install -m 644 %{S:25} %{buildroot}/usr/share/pixmaps/
%suse_update_desktop_file -i %name Office Viewer

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc doc/*.hlp ANNOUNCE COPYING README CHANGES
/usr/bin/xpdf
/usr/share/applications/*.desktop
/usr/share/pixmaps/*
%doc %{_mandir}/man1/xpdf.1*

%files -n xpdf-tools
%defattr(-,root,root)
/usr/bin/pdfinfo
/usr/bin/pdftotext
/usr/bin/pdffonts
/usr/bin/pdfimages
/usr/bin/pdftoppm
/usr/bin/pdftops
/usr/sbin/xpdf-cjk-config
%dir /usr/lib/fonts-config/
%dir /usr/lib/fonts-config/conf.d/
/usr/lib/fonts-config/conf.d/50-xpdf
%config(noreplace) /etc/xpdfrc
%config %verify(not md5 size mtime) /etc/xpdfrc-cjk-auto
%config /etc/xpdfrc-cjk
%config /etc/xpdfrc-cjk.sjis
%doc %{_mandir}/man5/*
%doc %{_mandir}/man1/pdf*.1*
/usr/share/xpdf

%changelog
openSUSE Build Service is sponsored by