File xpdf.spec of Package xpdf

#
# spec file for package xpdf (Version 3.02)
#
# Copyright (c) 2008 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:        138
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
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

%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
* Mon Dec 15 2008 pgajdos@suse.cz
- fixed freeing non allocated memory [bnc#457554]
  * full-screen.patch
* Tue Jun 10 2008 pgajdos@suse.cz
- KP + and - is bound to zoomIn and zoomOut [bnc#395811]
  (add-and-subtract-key-binding.patch)
* Mon May 19 2008 maw@suse.de
- Provide pdftools_any in the -tools subpackage (bnc#378434).
* Fri May 02 2008 nadvornik@suse.cz
- fixed a bug with signed/unsigned type conversion [bnc#385330]
  (xpdf-3.02-stream.patch)
* Tue Apr 15 2008 pcerny@suse.cz
- added type checking suggested in bnc#377838
  (xpdf-3.02-object_type_checking.patch)
* Tue Nov 06 2007 pcerny@suse.cz
- fix for CVE-2007-4352,5392,5393 [#335637]
- correct fix for CVE-2007-3387 [#291690]
* Mon Aug 06 2007 ltinkl@suse.cz
- update to 3.0.2
  * Added anti-aliasing for vector graphics; added the vectorAntialias
  * xpdfrc option; added the "-aaVector" switch to xpdf and pdftoppm.
  * Implemented stroke adjustment (always enabled by default, ignoring the
  * SA parameter, to match Adobe's behavior), and added the strokeAdjust
  * xpdfrc command.
  * Support PDF 1.6 and PDF 1.7.
  * Added support for AES decryption.
  * Added support for OpenType fonts (only tested with 8-bit CFF data so
  far).
  * Added user-configurable key/mouse bindings - the bind/unbind xpdfrc
  commands
  * many bugxfixes
- fixed/redone patches, threw away unused or already merged-in patches
- contains also fix from integer overflow (CVE-2007-3387, #291690)
* Tue Apr 10 2007 bwalle@suse.de
- add check for X11/xpm.h to get an application icon
* Fri Jan 12 2007 nadvornik@suse.cz
- fixed infinite loop in page tree (CVE-2007-0104) [#233113]
* Wed Oct 25 2006 mfabian@suse.de
- Fate #300950: don't call xpdf-cjk-config from SuSEconfig.xpdf
  anymore, make it a plugin script for /usr/sbin/fonts-config
  instead.
* Wed Oct 04 2006 nadvornik@suse.cz
- moved manpages to appropriate subpackage [#201739]
* Tue Aug 15 2006 mfabian@suse.de
- change font paths in xpdfrc-cjk and xpdfrc-cjk.sjis from
  /usr/X11R6/lib/X11/fonts to /usr/share/fonts (move to X11R7).
* Wed Aug 09 2006 anosek@suse.cz
- fixed a crash when searching zero length string caused by
  xpdf-search-non-ascii.patch [#196471]
* Fri Jun 23 2006 nadvornik@suse.cz
- do not use freetype2 internals
* Thu Mar 09 2006 mmarek@suse.cz
- fixed redraw on window resize
  [#155745] (resize.patch)
* Tue Feb 14 2006 mmarek@suse.cz
- fix segfault caused by uninitialised variable
  [#150576] (modified xpdf-font-optimize.dif)
* Thu Feb 09 2006 nadvornik@suse.cz
- fixed xpdf-i18n.patch:
  - do not combine FontLists and RenderTables
  - adjusted font names to avoid missing charset warning [#146996]
- dropped unneeded xpdf-3.01-fonts.patch
* Tue Feb 07 2006 sbrabec@suse.cz
- Fixed SplashXPathScanner heap overflow (#141242, CVE-2006-0301).
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Mon Jan 16 2006 meissner@suse.de
- Added -fno-strict-aliasing.
* Mon Jan 16 2006 meissner@suse.de
- use -fstack-protector.
* Thu Dec 15 2005 sbrabec@suse.cz
- Fixed more overflows and signed integer multiplications
  (Chris Evans, Martin Pitt, #137156).
* Wed Dec 07 2005 sbrabec@suse.cz
- Heap owerflow fixes (#137156, CAN-2005-3191, CAN-2005-3192,
  CAN-2005-3193).
* Fri Nov 25 2005 nadvornik@suse.cz
- updated to 3.01
- subpackage xpdf-config was renamed to xpdf-tools
  and the commandline tools were moved to this subpackage [#135443]
* Tue Oct 25 2005 rguenther@suse.de
- gcc-4.1 compilation fix: remove excess qualification
* Wed Aug 31 2005 nadvornik@suse.cz
- render 'fi' correctly [#113799]
- do not use bytecode interpreter
* Tue Aug 02 2005 nadvornik@suse.cz
- fixed crash on 64bit architectures [#99663]
* Sat Jul 30 2005 dmueller@suse.de
- for mkstemp(), the last 6 characters must be XXXXXX
* Mon May 23 2005 nadvornik@suse.cz
- gcc4 fix: added forward declarations
* Thu Mar 03 2005 meissner@suse.de
- added missing libgoo-sizet security patch.
* Wed Jan 19 2005 nadvornik@suse.cz
- used upstream patch for CAN-2005-0064 [#49840]
* Mon Jan 17 2005 nadvornik@suse.cz
- fixed buffer overflow in Decrypt::makeFileKey2 (CAN-2005-0064) [#49840]
* Thu Jan 06 2005 nadvornik@suse.cz
- fixed buffer overflow: CAN-2004-1125 [#49463]
* Fri Dec 03 2004 nadvornik@suse.cz
- installed correct icon
* Mon Oct 18 2004 meissner@suse.de
- Added yet another sizeof() check that was missed (#44963)
* Fri Oct 15 2004 mfabian@suse.de
- the Novell-ricoh-fonts have lower case font names now because
  .TTF and .TTC don't work in CJK-LaTeX. I changed xpdfrc-cjk
  accordingly.
* Tue Oct 12 2004 nadvornik@suse.cz
- fixed more integer overflows - CESA-2004-002 [#43082]
* Tue Sep 14 2004 nadvornik@suse.cz
- fixed multiple integer overflows [#43082]
* Mon Sep 13 2004 mfabian@suse.de
- add IPA-fonts to xpdfrc-cjk and xpdfrc-cjk.sjis in
  preference over the Sazanami fonts.
* Wed Aug 04 2004 mfabian@suse.de
- add Sazanami fonts to xpdfrc-cjk and xpdfrc-cjk.sjis in
  preference over the Kochi fonts.
* Wed Jun 30 2004 nadvornik@suse.cz
- moved pdfinfo to xpdf-config subpackage as it is needed by new
  version of kdegraphics
* Fri Jun 18 2004 mfabian@suse.de
- Bugzilla 42142: XtSetLanguageProc() also calls setlocale, i.e.
  there are more places where LC_NUMERIC needs to be reset to
  POSIX.
* Thu Jun 17 2004 tiwai@suse.de, mfabian@suse.de
- Bugzilla 42142: LC_NUMERIC should be set to POSIX, otherwise
  xpdf may generate PostScript output using ',' as the decimal
  separator and Ghostscript doesn't like that.
- xpdf segfaulted when clicking on non-existing links
* Thu Jun 03 2004 mfabian@suse.de
- add configuration entries to /etc/xpdfrc-cjk to use the Ricoh
  fonts licensed by Novell if available.
* Tue May 18 2004 tiwai@suse.de
- Bugzilla #39312:
  xpdf sometimes didn't work for embedded CJK fonts.
* Tue May 11 2004 mfabian@suse.de, tiwai@suse.de
- Bugzilla #39312:
  - make cut-and-paste work for non-ASCII characters
  - make output encoding default to "UTF-8" in UTF-8 locales
  instead of defaulting to "Latin1" always.
  - workaround the crash which occurs ja_JP.UTF-8 locale when
  the .pdf file given on the command line doesn't exist.
* Mon May 10 2004 tiwai@suse.de
- process the font rendering without the help of tempfile.
  this will improve the performance quite well with big font
  files and freetype.
* Mon May 10 2004 mfabian@suse.de
- Bugzilla #39312:
  - Comment 11: fix crash which occurs with fonts which have
  embedded bitmaps.
  - add FZSongTi.ttf and FZMingTiB.ttf to xpdfrc-cjk
* Thu May 06 2004 mfabian@suse.de, tiwai@suse.de
- Bugzilla #39312:
  - apply Takashi's patch xpdf-3.00-print-ext-ttf.dif
  (has been forgotten). Takashi has improved the patch to support
  multiple faces in .ttc fonts.
  - silently ignore non-existing font files to be able to
  configure more than one font in /etc/xpdfrc and let the
  last existing one win.
  - add /sbin/conf.d/SuSEconfig.xpdf and /usr/sbin/xpdf-cjk-config
  to automatically create parts of the CJK font setup depending
  on the fonts actually installed.
  - add /etc/xpdf-cjk and /etc/xpdf-cjk.sjis with manual
  refinements
  - xpdf-i18n.patch: make it possible to display non-ASCII
  file names in the file-selector box by using fontsets
  instead of single fonts. Thanks to Gerd Knorr <kraxel@suse.de>
  for help.
  - xpdf-search-non-ascii.patch: Make it possible to search for
  non-ASCII characters
- Bugzilla #39134: don't link against t1lib to avoid crashes
  in t1lib. freetype2 can render Type1 fonts as well, t1lib
  is therefore not needed.
* Wed Apr 21 2004 tiwai@suse.de
- fixed the handling of truetype for CJK (bug #39312).
- replaced tmpnam() with mkstemp().
* Mon Mar 15 2004 mfabian@suse.de
- Add "Provides: xpdf:/etc/xpdfrc" to xpdf-config sub-package.
* Sat Mar 13 2004 mfabian@suse.de
- Bugzilla #33663: Split xpdf-config out of xpdf to make it
  possible for kpdf to require only the character maps and the
  config file /etc/xpdfrc and not the binary. kpdf needs the
  character maps and the config file to be able to display
  CJK .pdf files.
* Wed Mar 10 2004 mfabian@suse.de
- Bugzilla #35524: improve the configuration to make xpdf work
  with Japanese, Korean, and traditional Chinese documents which
  don't embed the CJK fonts. It works only when the
  CID-keyed-fonts-* packages for the needed languages are
  installed.
* Mon Feb 09 2004 nadvornik@suse.cz
- updated to 3.00
  - pdf 1.5 support
* Sat Jan 10 2004 adrian@suse.de
- build as user
* Thu Jan 08 2004 nadvornik@suse.cz
- updated to 2.0.3
- fixed to compile wth new freetype
* Sat Aug 16 2003 adrian@suse.de
- use translated desktop file from kappfinder
* Fri Aug 15 2003 adrian@suse.de
- add desktop file
* Fri Jul 11 2003 nadvornik@suse.cz
- updated to 2.02pl1
* Tue Jun 03 2003 sndirsch@suse.de
- xpdf-2.01-fonts.patch:
  * use 17 pixel font instead of non-existing 16 pixel font
* Tue May 20 2003 mmj@suse.de
- Package all man-files
* Tue Jan 07 2003 nadvornik@suse.cz
- updated to 2.01
  - switched to motif
- fixed possible buffer overflow
* Wed Jun 19 2002 nadvornik@suse.cz
- update to 1.01
  - improved I18N support
* Thu Nov 22 2001 nadvornik@suse.cz
- update to 0.93:
  - support for PDF 1.4
  - support for TTF fonts
- use fonts from ghostscript-fonts-std
* Thu Jun 07 2001 pblaha@suse.cz
- unused autoconf because many problems in old configure.in
* Mon Feb 19 2001 mfabian@suse.de
- update to 0.92
- t1lib is a separate package now, remove it from this package
  and add it to #neededforbuild and Requires: instead.
- add configure options --enable-japanese, --enable-chinese-gb
  and --enable-chinese-cns
* Thu Feb 08 2001 fober@suse.de
- Group Aplications/Text
* Mon Sep 18 2000 bubnikv@suse.cz
- updated to 0.91
* Mon Aug 14 2000 schwab@suse.de
- Add %%suse_update_config.
* Fri May 26 2000 bubnikv@suse.cz
- sorted
* Mon May 15 2000 bubnikv@suse.cz
- xpdf now uses t1 library for rendering fonts
- added buildroot
* Tue Jan 25 2000 ro@suse.de
- fixed to compile
- specfile cleanup
- man to /usr/share using macro
* Wed Oct 27 1999 fehr@suse.de
- changed to version 0.90
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Thu Jan 21 1999 ro@suse.de
- use "const char*" where needed for strict typecheck
* Fri Dec 11 1998 fehr@suse.de
- changed to version 0.80
* Mon Oct 05 1998 ro@suse.de
- added libgpp to neededforbuild
* Mon Jul 06 1998 fehr@suse.de
- New version 0.7a
* Wed Jun 04 1997 fehr@suse.de
- New version 0.7
* Wed Apr 16 1997 fehr@suse.de
- New version 0.6
* Thu Jan 02 1997 fehr@suse.de
- New version 0.5
openSUSE Build Service is sponsored by