%define _prefix /opt/freeware
%define _defaultdocdir %{_prefix}/doc
%define no_apm_archs alpha ia64 s390 s390x sparc sparc64 ppc ppc64

%define glib2_version 2.2.3
%define pango_version 1.2.5
%define gtk2_version 2.2.4
%define libgnomeui_version 2.4.0.1
%define gnome_panel_version 2.4.0
%define libgtop2_version 2.0.5
%define gail_version 1.4.0
%define scrollkeeper_version 0.3.12

Summary:        Small applications for the GNOME panel.
Name:     	gnome-applets
Version: 	2.4.0
Release:        1
License:	GPL
Group:          User Interface/Desktops
Source: 	ftp://ftp.gnome.org/pub/GNOME/sources/pre-gnome2/%{name}/%{name}-%{version}.tar.bz2

Patch0:		gnome-applets-2.4.0-aix.patch
Patch1:		gnome-applets-2.4.0-autotools.patch

URL:		http://www.gnome.org/

BuildRoot:	%{_tmppath}/%{name}-%{version}-root

Prereq:         scrollkeeper >= %{scrollkeeper_version}

BuildRequires:  glib2-devel >= %{glib2_version}
BuildRequires:  gtk2-devel >= %{gtk2_version}
BuildRequires:  libgnomeui-devel >= %{libgnomeui_version}
BuildRequires:  gnome-panel >= %{gnome_panel_version}
BuildRequires:  libgtop2-devel >= %{libgtop2_version}
BuildRequires:  pango-devel >= %{pango_version}
BuildRequires:  gail-devel >= %{gail_version}
# BuildRequires:  /usr/bin/automake-1.4

Requires:	gnome-panel >= %{gnome_panel_version}

%description
GNOME (GNU Network Object Model Environment) is a user-friendly set of
applications and desktop tools to be used in conjunction with a window
manager for the X Window System. The gnome-applets package provides
small utilities for the GNOME panel.

%prep
%setup -q

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


%build
PATH=%{_bindir}:$PATH ./configure --prefix=%{_prefix}
PATH=%{_bindir}:$PATH \
	G_CHARSET_ALIAS=%{_libdir}/charset.alias \
	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 XML_CATALOG_FILES=%{_sysconfdir}/xml/docbook
scrollkeeper-update -q > /dev/null

export GCONF_CONFIG_SOURCE=`%{_bindir}/gconftool-2 --get-default-source`
SCHEMAS="mailcheck.schemas stickynotes.schemas mixer.schemas charpick.schemas drivemount.schemas geyes.schemas gkb.schemas gtik.schemas gweather.schemas mini-commander.schemas multiload.schemas"
# modemlights.schemas cdplayer.schemas battstat.schemas: these applets are not installed
for S in $SCHEMAS; do
  %{_bindir}/gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/$S > /dev/null
done

%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

%{_bindir}/*
%{_libexecdir}/*
%{_libdir}/bonobo
%{_sysconfdir}/gconf/schemas/*
%{_sysconfdir}/sound
%{_datadir}/pixmaps
%{_datadir}/gnome-2.0
%{_datadir}/gnome
%{_datadir}/geyes
%{_datadir}/xmodmap
%{_datadir}/gweather
%{_datadir}/gen_util
%{_datadir}/wireless-applet
%{_datadir}/stickynotes
%{_datadir}/omf
%{_datadir}/locale/*/LC_MESSAGES/gnome-applets-2.0.mo

/usr/bin/*
