%define version __ABI_BUILD_VERSION__
%define release	__ABI_RELEASE_NUMBER__

#
# spec file for AbiSuite 
#
Summary: AbiSuite Office Applications
Name: abisuite
Version: %{version}
Release: %{release}
Copyright: GPL
Group: Applications/Editors
Source: abisuite-%{version}.tar
URL: http://www.abisource.com/
Vendor: AbiSource, Inc.
Packager: Dom Lachowicz <dominicl@seas.upenn.edu>
AutoReqProv: yes

Requires: gtk+ >= 1.2.7
Requires: glib >= 1.2.7

# TODO: requirements in for *Gnome Only*
#Requires: gnome-libs >= 1.0.57
#Requires: gnome-print >= 0.25
#Requires: gal >= 0.0.1

# TODO: requirements for pspell only
#Requires: pspell >= 0.11.2

%description
AbiSuite is a collection of cross-platform, Open Source office
productivity aplications developed by AbiSource, Inc. 
(http://www.abisource.com)

%prep
%setup

%build
UNIX_CAN_BUILD_STATIC=0 ABI_BUILD_VERSION=%{version} make -C abi-%{version} compile canonical

%install
umask 002
UNIX_CAN_BUILD_STATIC=0 ABI_BUILD_VERSION=%{version} make -C abi-%{version} install_redhat

# I can't think of a way to do this in a non-overlapping fashion
# as part of the %files section with %defattr() blocks, so I do
# it here.

# /usr/share/abisuite ; all dirs 0755
find /usr/share/abisuite -type d -exec chown root.root {} \;
find /usr/share/abisuite -type d -exec chmod 0755 {} \;

# /usr/share/abisuite ; all files 0644
find /usr/share/abisuite -type f -exec chown root.root {} \;
find /usr/share/abisuite -type f -exec chmod 0644 {} \;

# symlinks in /usr/bin 0777 by default ; own by root.root
chown root.root /usr/bin/AbiWord
chown root.root /usr/bin/abiword

# exception to find above, bins 0755
chown root.root /usr/share/abisuite/bin/AbiWord*
chmod 0755      /usr/share/abisuite/bin/AbiWord*

# docs 0755 for dir
chown root.root /usr/doc/abisuite
chmod 0755 /usr/doc/abisuite

# docs 0644 for files
chown root.root /usr/doc/abisuite/*
chmod 0644 /usr/doc/abisuite/*

# menu file 0644
chown root.root /usr/lib/menu/abisuite
chmod 644 /usr/lib/menu/abisuite

# icon file 0644
chown root.root /usr/share/pixmaps/abiword*
chmod 0644 /usr/share/pixmaps/abiword*

# desktop file 0644
chown root.root /usr/share/gnome/apps/Applications/abiword.desktop
chmod 0644 /usr/share/gnome/apps/Applications/abiword.desktop

%files
/usr/bin/AbiWord
/usr/bin/abiword
%docdir /usr/doc/abisuite
/usr/lib/menu/abisuite
/usr/share/pixmaps/abiword_48.png
/usr/share/gnome/apps/Applications/abiword.desktop
/usr/share/abisuite

%clean
rm -rf /usr/share/abisuite
rm -rf /usr/doc/abisuite
rm -f /usr/bin/AbiWord
rm -f /usr/bin/abiword
rm -f /usr/lib/menu/abisuite
rm -f /usr/share/pixmaps/abiword_48.png
rm -f /usr/share/gnome/apps/Applications/abiword.desktop
rm -rf $RPM_BUILD_DIR/abisuite-%{version}
# are there better ways to get these paths?
rm -f $RPM_SOURCE_DIR/abisuite-%{version}.tar
rm -f $RPM_SOURCE_DIR/../SRPMS/abisuite-%{version}-%{release}.src.rpm
rm -f $RPM_SOURCE_DIR/../SPECS/abisuite-%{version}.spec