%define _prefix /opt/freeware
%define _defaultdocdir %{_prefix}/doc
%define pango_version 1.2.5
%define gtk2_version 2.2.4
%define gnome_vfs2_version 2.4.0
%define libgnomeui_version 2.4.0.1
%define libbonobo_version 2.4.0
%define gail_version 1.4.0
%define gtkhtml2_version 2.4.0

Summary: 	A system documentation reader from the Gnome project. 
Name: 		yelp
Version: 	2.4.0
Release: 	1
Source: 	%{name}-%{version}.tar.bz2

Patch0:		yelp-2.4.0-aix.patch
Patch1:		yelp-2.4.0-autotools.patch

License: 	GPL
Group:		Applications/System
BuildRoot: 	%{_tmppath}/%{name}-%{version}-root

Requires: scrollkeeper >= 0.3.12
Requires: gtk2 >= %{gtk2_version}
Requires: gnome-vfs2 >= %{gnome_vfs2_version}
Requires: gtkhtml2 >= %{gtkhtml2_version}
Requires: libgnomeui >= %{libgnomeui_version}
Requires: libbonobo >= %{libbonobo_version}

BuildRequires: pango-devel >= %{pango_version}
BuildRequires: gtk2-devel >= %{gtk2_version}
BuildRequires: gnome-vfs2-devel >= %{gnome_vfs2_version}
BuildRequires: gtkhtml2-devel >= %{gtkhtml2_version}
BuildRequires: libgnomeui-devel >= %{libgnomeui_version}
BuildRequires: libbonobo-devel >= %{libbonobo_version}
BuildRequires: gail-devel >= %{gail_version}

%description
Yelp is the Gnome 2 help/documentation browser. It is designed
to help you browse all the documentation on your system in
one central tool.

%prep
%setup -q

if test x$PATCH = x ; then
  PATCH=patch ;
fi
$PATCH -p2 -s < %{_sourcedir}/yelp-2.4.0-aix.patch
$PATCH -p2 -s < %{_sourcedir}/yelp-2.4.0-autotools.patch


%build
PATH=%{_bindir}:$PATH LDFLAGS="-L%{_libdir}" ./configure --prefix=%{_prefix}
PATH=%{_bindir}:$PATH make

%install
if test "%{buildroot}" != "/"; then
	rm -rf %{buildroot}
fi
mkdir -p %{buildroot}
make DESTDIR=%{buildroot} install-strip

# Make the links
cd %{buildroot}
for dir in bin
do
        mkdir -p usr/$dir
        cd usr/$dir
        ln -sf ../..%{_prefix}/$dir/* .
        cd -
done

%post
test $(uname -v) -eq 4 || /usr/sbin/catman -w  

%files
%defattr(-,root,system)
%doc AUTHORS COPYING NEWS README
%{_bindir}/*
%{_libexecdir}/*
%{_libdir}/bonobo
%{_datadir}/applications/*
%{_datadir}/sgml
%{_datadir}/yelp
%{_datadir}/images
%{_datadir}/locale/*/LC_MESSAGES/yelp.mo

/usr/bin/*
