Summary: The AbiWord word processor
Name: abiword
Version: 0.7.14
Release: 1
Epoch: 1
Group: Applications/Editors
Copyright: GPL
Source0: http://download.abisource.com/releases/%{version}/src/abi-%{version}.tar.bz2
Source1: http://download.abisource.com/releases/%{version}/src/abidistfiles-%{version}.tar.bz2
Source2: http://download.abisource.com/releases/%{version}/src/expat-%{version}.tar.bz2
Source3: http://download.abisource.com/releases/%{version}/src/libiconv-%{version}.tar.bz2
Source4: http://download.abisource.com/releases/%{version}/src/unixfonts-%{version}.tar.bz2
Source5: http://download.abisource.com/releases/%{version}/src/wv-%{version}.tar.bz2
Patch: wv-0.7.12-broken.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: libpng >= 1.0.5
Prefix: /usr
Prereq: chkfontpath
%define Abi_prefix %{_prefix}/share

%description
AbiWord is a cross-platform Open Source word processor. The goal is to make
AbiWord full-featured, and remain lean.

%prep
%setup -q -n abi-%{version} -b 1 -b 2 -b 3 -b 4 -b 5
cd ../wv
%patch -p1 -b .broken

%build
make prefix=%{_prefix} ABI_OPT_GNOME=1 OPTIMIZER="$RPM_OPT_FLAGS"

%install
rm -rf $RPM_BUILD_ROOT
rm -f file.list.%{name}
make install prefix=$RPM_BUILD_ROOT%{Abi_prefix} ABI_OPT_GNOME=1
cp $RPM_BUILD_ROOT/%{Abi_prefix}/AbiSuite/fonts/fonts.dir $RPM_BUILD_ROOT/%{Abi_prefix}/AbiSuite/fonts/fonts.scale
mkdir -p $RPM_BUILD_ROOT%{prefix}/bin

mv $RPM_BUILD_ROOT%{Abi_prefix}/bin/AbiWord $RPM_BUILD_ROOT%{prefix}/bin

perl -p -i -e "s|$RPM_BUILD_ROOT||" $RPM_BUILD_ROOT%{prefix}/bin/AbiWord $RPM_BUILD_ROOT%{Abi_prefix}/AbiSuite/bin/AbiWord

mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
cp $RPM_BUILD_ROOT%{Abi_prefix}/AbiSuite/icons/* $RPM_BUILD_ROOT/usr/share/pixmaps

mkdir -p $RPM_BUILD_ROOT%{prefix}/lib/AbiSuite
mv $RPM_BUILD_ROOT%{Abi_prefix}/AbiSuite/bin $RPM_BUILD_ROOT%{prefix}/lib/AbiSuite
perl -pi -e "s,%{Abi_prefix}/AbiSuite/bin,%{prefix}/lib/AbiSuite/bin,g" $RPM_BUILD_ROOT%{prefix}/bin/AbiWord $RPM_BUILD_ROOT%{prefix}/lib/AbiSuite/bin/AbiWord
[ ! -x $RPM_BUILD_ROOT%{prefix}/lib/AbiSuite/bin/AbiWord_d ] || rm -f $RPM_BUILD_ROOT%{prefix}/lib/AbiSuite/bin/AbiWord_s || :

mkdir -p $RPM_BUILD_ROOT/etc/X11/applnk/Applications
cat >  $RPM_BUILD_ROOT/etc/X11/applnk/Applications/abiword.desktop <<EOF
[Desktop Entry]
Name=AbiWord
Comment=%{summary}
Exec=%{prefix}/bin/AbiWord
Icon=abiword_48.png
Terminal=0
Type=Application
EOF

%post
/usr/sbin/chkfontpath -q -a %{Abi_prefix}/AbiSuite/fonts

%postun
if [ "$1" = "0" ]; then
        /usr/sbin/chkfontpath -q -r %{Abi_prefix}/AbiSuite/fonts
fi

%files
%defattr(-,root,root)
%doc COPYING COPYRIGHT.TXT CREDITS.TXT README.TXT TRADEMARK.TXT VERSION.TXT
%doc docs 
%{prefix}/bin/AbiWord
%{Abi_prefix}/AbiSuite
%{prefix}/lib/AbiSuite
/usr/share/pixmaps/*
/etc/X11/applnk/Applications/abiword.desktop

%changelog
* Mon Jan 15 2001 Than Ngo <than@redhat.com>
- fixed broken code for building

* Fri Dec 29 2000 Matt Wilson <msw@redhat.com>
- 0.7.12
- copy fonts.dir to fonts.scale so mkfontdir doesn't blow it away

* Tue Dec 12 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Rebuild to get rid of 0777 dirs

* Fri Nov 17 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 0.7.11

* Sun Aug 20 2000 Preston Brown <pbrown@redhat.com>
- fix path to chkfontpath, it was wrong.

* Fri Aug 11 2000 Jonathan Blandford <jrb@redhat.com>
- Up Epoch and release

* Mon Aug  7 2000 Jakub Jelinek <jakub@redhat.com>
- Don't ship AbiWord_s if we have AbiWord_d
- Register AbiWord's fontpath with xfs

* Wed Aug  2 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Rebuild with new libpng. This fixes Bug #13707 - gotta love it when they
  change the ABI without increasing the soname!
- fix tooltip (Bug #14711)
- move binaries from /usr/share to /usr/lib

* Wed Jul 12 2000 Jakub Jelinek <jakub@redhat.com>
- Fix build on ia64.

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Tue Jul  4 2000 Jakub Jelinek <jakub@redhat.com>
- Rebuild with new gcc.

* Sat Jun 18 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix build on ia64

* Fri Jun 17 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 0.7.10
- update download location

* Fri Jun  9 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- initial build for main CD
- clean up specfile
- fix build with gcc 2.96 and glibc 2.2
- exclude ia64 for now

* Wed May  3 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 0.7.9

* Wed Feb  2 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 0.7.8
- move the desktop file to /etc/X11/applnk so it can be used in both
  GNOME and KDE
- fix up handling of RPM_OPT_FLAGS

* Thu Jan 20 2000 Tim Powers <timp@redhat.com>
- bzipped source to conserve space.

* Sun Jan  9 2000 Matt Wilson <msw@redhat.com>
- enable GNOME, remove perl hack to do RPM_OPT_FLAGS
- added libpng requirement.  0.7.7 requires 1.0.5 libpng ABI

* Tue Jan  4 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 0.7.7
- handle RPM_OPT_FLAGS

* Mon Nov 15 1999 Tim Powers <timp@redhat.com>
- first build for inclusion into Powertools.
- some things in this spec file are from the abisuite-0.7.5-1mdk package
