%define _prefix /opt/freeware
%define _defaultdocdir %{_prefix}/doc

%define glib2_version 2.2.1
%define pango_version 1.2.1
%define gtk2_version 2.2.1
%define libgnomeui_version 2.2.0.1
%define gail_version 1.2.0
%define gnome_panel_version 2.2.1
%define scrollkeeper_version 0.3.11

Summary: 	GNOME utility programs.
Name: 		gnome-utils
Version: 	2.2.1
Release: 	1
License: 	GPL
Group: 		Applications/System
Source: 	ftp://ftp.gnome.org/pub/GNOME/pre-gnome2/sources/gnome-utils/gnome-utils-%{version}.tar.bz2

Patch0:		gnome-utils-2.2.1-aix.patch
Patch1:		gnome-utils-2.2.1-autotools.patch

BuildRoot: 	%{_tmppath}/%{name}-%{version}-root
PreReq:         scrollkeeper >= %{scrollkeeper_version}
URL: 		http://www.gnome.org

BuildRequires:  glib2-devel >= %{glib2_version}
BuildRequires:  pango-devel >= %{pango_version}
BuildRequires:  gtk2-devel >= %{gtk2_version}
BuildRequires:  libgnomeui-devel >= %{libgnomeui_version}
BuildRequires:  gail-devel >= %{gail_version}
BuildRequires:  gnome-panel >= %{gnome_panel_version}

%description
GNOME (GNU Network Object Model Environment) is a user-friendly set of
GUI applications and desktop tools to be used in conjunction with a
window manager for the X Window System. The gnome-utils package
includes a set of small "desk accessory" utility applications for GNOME
such as a calculator.

%prep
%setup -q

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


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

%install
if test "%{buildroot}" != "/"; then
        rm -rf %{buildroot}
fi
mkdir -p %{buildroot}
PATH=%{_bindir}:$PATH \
	XML_CATALOG_FILES=%{_sysconfdir}/xml/docbook \
	GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 \
	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

%clean

%post
export PATH=%{_bindir}:$PATH
export GCONF_CONFIG_SOURCE=`%{_bindir}/gconftool-2 --get-default-source`
SCHEMAS="gdict.schemas"
for S in $SCHEMAS; do
  %{_bindir}/gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/$S > /dev/null
done
export XML_CATALOG_FILES=%{_sysconfdir}/xml/docbook
scrollkeeper-update -q > /dev/null

%postun
export PATH=%{_bindir}:$PATH
export XML_CATALOG_FILES=%{_sysconfdir}/xml/docbook
scrollkeeper-update -q > /dev/null


%files 
%defattr(-, root, system)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_datadir}/applications
%{_datadir}/gnome-2.0
%{_datadir}/gnome
%{_datadir}/omf
%{_datadir}/pixmaps 
%{_libdir}/locale/*/LC_MESSAGES/gnome-utils-2.0.mo
%{_bindir}/*
%{_libexecdir}/*
%{_libdir}/bonobo
%{_sysconfdir}/gconf
%{_mandir}/man*/*
# %{_datadir}/gnome-utils #for the moment, pb with gfloppy  @faur1d 
# %{_datadir}/mime-info  #for the moment, pb with gfloppy  @faur1d

/usr/bin/*
