%define t1vers 1.0.1
Summary: A PDF file viewer for the X Window System.
Name: xpdf
Version: 0.91
Release: 5
Copyright: GPL
Source0: ftp://ftp.foolabs.com/pub/xpdf/%{name}-%{version}.tgz
Source1: ftp://ftp.foolabs.com/pub/xpdf/t1lib-%{t1vers}.tar.gz
Patch0:%{name}-%{version}-strings_h.patch
Url: http://www.foolabs.com.com/xpdf/
Group: Applications/Publishing
BuildRoot: /var/tmp/xpdf-root

%ifarch ia64
%define DEFCCIA cc
%define DEFCCCIA xlC
%define DEFCC %{DEFCCIA}
%define DEFCCC %{DEFCCCIA}
%else
%define DEFCC cc
%define DEFCCC g++
%endif

%description
Xpdf is an X Window System based viewer for Portable Document Format
(PDF) files.  PDF files are sometimes called Acrobat files, after
Adobe Acrobat (Adobe's PDF viewer).  Xpdf is a small and efficient
program which uses standard X fonts.

Install the xpdf package if you need a viewer for PDF files.

%prep
%setup -q -a 1
%patch0 -p1 -b strings_h 

%build
# Use the default compiler for this platform - gcc otherwise
if [[ -z "$CC" ]]
then
    if test "X`type %{DEFCC} 2>/dev/null`" != 'X'; then
       export CC=%{DEFCC}
       export CCC=%{DEFCCC}
    else 
       export CC=gcc
       export CCC=g++
    fi
fi
if test "X$CC" != "Xgcc"
then
       export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's:-fsigned-char::'`
       export CFLAGS="$RPM_OPT_FLAGS"
fi

cd T1-%{t1vers}
./configure --disable-shared --enable-static 
make without_doc
cd ..

#Work around configure bug where it is not finding strings.h on AIX
autoconf
CCC=$CCC ./configure --with-gzip \
	--with-t1-library=`pwd`/T1-%{t1vers}/lib/.libs \
	--with-t1-includes=`pwd`/T1-%{t1vers}/lib
make

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_prefix}/bin
mkdir -p $RPM_BUILD_ROOT%{_prefix}/man/man1
make install prefix=$RPM_BUILD_ROOT%{_prefix}
/usr/bin/strip $RPM_BUILD_ROOT%{_prefix}/bin/*

(cd $RPM_BUILD_ROOT
    mkdir -p usr/bin
    cd usr/bin
    ln -sf ../..%{_prefix}/bin/* .
)

%clean
rm -rf $RPM_BUILD_ROOT

%files
%doc CHANGES README
%{_prefix}/bin/*
/usr/bin/*
%{_prefix}/man/man1/*

%changelog
* Wed Apr 11 2001 Marc Stephenson <marc@austin.ibm.com>
- Rebuild with correct libttf.a setup

* Sun Apr 08 2001 David Clissold <cliss@austin.ibm.com>
- Default C++ on AIX POWER should bc g++, not xlC

* Thu Mar 22 2001 David Clissold <cliss@austin.ibm.com>
- Set up default C++ compiler for AIX

* Mon Mar 19 2001 Marc Stephenson <marc@austin.ibm.com>
- Rebuild against new shared objects

* Fri Oct 27 2000 pkgmgr <pkgmgr@austin.ibm.com>
- Modify for AIX Freeware distribution

* Fri Feb 11 2000 Preston Brown <pbrown@redhat.com>
- build for inclusion in 6.2.

* Wed Feb 09 2000 Jakub Jelinek <jakub@redhat.com>
- include decryption patches

* Mon Feb 07 2000 Presto Brown <pbrown@redhat.com>
- rebuild to gzip man pages

* Mon Aug 30 1999 Preston Brown <pbrown@redhat.com>
- upgrade to xpdf 0.90, include t1lib Type1 rasterizer
- fix zapfdingbats font mapping issue

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 4)

* Wed Mar 17 1999 Preston Brown <pbrown@redhat.com>
- converted wmconfig to desktop entry

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

* Mon Nov 30 1998 Preston Brown <pbrown@redhat.com>
- updated to 0.80

* Fri Nov 06 1998 Preston Brown <pbrown@redhat.com>
- patched to compile with new, stricter egcs

* Tue May 05 1998 Cristian Gafton <gafton@redhat.com>
- updated to 0.7a

* Thu Nov 20 1997 Otto Hammersmith <otto@redhat.com>
- added changelog
- added wmconfig
