%define 	name	xfce
%define 	version	3.8.7
%define		release	2
%define		group	User Interface/Desktops

%define	prefix		%{_prefix}
%define	exec_prefix	%{prefix}
%define	datadir		%{prefix}/share
%define	confdir		%{prefix}/etc/X11
%define	gtkengines	%{prefix}/lib/gtk/themes/engines

# ===========================================================================

Summary:	A Powerful X Environment, with Toolbar and Window Manager
Name:		%{name}
Version: 	%{version}
Release: 	%{release}
URL: 		http://www.xfce.org
Copyright:	GPL
Group: 		%{group}
Source:		http://www.xfce.org/archive/%{name}-%{version}.tar.gz
Patch0:         %{name}-%{version}-aix.patch
BuildRoot: 	%{_tmppath}/%{name}-%{version}-%{release}-buildroot
Requires: 	xscreensaver, gtk+ >= 1.2.6

%description
XFce is a fast, lightweight desktop
environment for Linux and various Unices...


%ifarch ia64
  %define stdlib lib/ia64l32
  %define stdlib64 lib/ia64l64
  %define liblink ../../..
  %define PKG64 %{name}-%{version}-ia64l64
  %define DIRS . %{_builddir}/%{PKG64}/%{name}-%{version}
  %define DEFCCIA cc
  %define DEFCC %{DEFCCIA}
%else
  %define stdlib lib
  %define liblink ../..
  %define DIRS .
  %define DEFCC cc
%endif


%prep
%setup -q
%patch0 -p2 -b .aix


%build
# Use the default compiler for this platform - gcc otherwise
if [[ -z "$CC" ]]
then
    if test "X`type %{DEFCC} 2>/dev/null`" != 'X'; then
       export CC=%{DEFCC}
    else 
       export CC=gcc
    fi
fi
if [[ "$CC" != "gcc" ]]
then
%ifarch ia64
       export CC64="$CC -q64"
%endif
       export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS | sed 's:-fsigned-char::'`
fi
export CFLAGS=$RPM_OPT_FLAGS
export LDFLAGS="-Wl,-brtl"

./configure --prefix=%{prefix} --datadir=%{datadir} --sysconfdir=%{confdir} \
--disable-dt --enable-gtk-engine=%{gtkengines} --disable-xft
make


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT mandir=%{_mandir}
mkdir -p $RPM_BUILD_ROOT%{prefix}/share/icons
mkdir -p $RPM_BUILD_ROOT%{gtkengines}

(
cd $RPM_BUILD_ROOT%{datadir}/xfce
ln -sf ../icons more-icons
)

for i in xsession xinitrc xinitrc.mwm Xclients
do
   chmod 0755 $RPM_BUILD_ROOT%{confdir}/xfce/$i
done

strip -s $RPM_BUILD_ROOT%{prefix}/bin/* || :
strip -s $RPM_BUILD_ROOT%{gtkengines}/* || :
gzip $RPM_BUILD_ROOT%{_mandir}/man1/* || :

(cd $RPM_BUILD_ROOT
 for dir in bin lib share
 do
    mkdir -p usr/$dir
    cd usr/$dir
    ln -sf ../..%{_prefix}/$dir/* .
    cd -
 done
)


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root)
%doc INSTALL ChangeLog AUTHORS COPYING README.UPGRADE-3.*
%{_bindir}/*
%{datadir}/xfce/*
%{datadir}/locale/*
%{_mandir}/man1/*
%{confdir}/xfce/*
%{gtkengines}/libxfce.*
/usr/bin/*
/usr/lib/*
/usr/share/*


%post
if [ "$LC_ALL" = "pt_BR" ]; then
   echo
   echo Nota :
   echo Você agora pode correr o script xfce_setup instalar o xfce como o
   echo ambiente de trabalho padrão ou iniciar o xfce usando o script startxfce
   echo
   echo Importante :
   echo Se você está atualizando uma versão anterior do xfce, por favor
   echo corra o script xfce_upgrade para cada usuário usando o xfce como
   echo ambiente de trabalho, para grantir a compatibilidade com versões
   echo anteriores.
elif [ "$LC_ALL" = "es" ]; then
   echo
   echo Nota :
   echo Ahora usted puede correr el script xfce_setup, instalar xfce como el
   echo ambiente de trabajo estandar o iniciar  xfce usando el script startxfce
   echo
   echo Importante :
   echo Si usted está actualizando una versión anterior de xfce, por favor
   echo corra el script xfce_upgrade para cada usuario usando xfce como
   echo ambiente de trabajo, esto tiene como objetivo para grantizar la
   echo compatibilidad con versiones anteriores.
else
   echo
   echo Note :
   echo You can now run the script xfce_setup to install xfce as the default
   echo desktop environment or start xfce using the script startxfce
   echo
   echo Important :
   echo If you are upgrading from a previous version of xfce, please run
   echo the script xfce_upgrade for each user running xfce as their desktop
   echo environment, to ensure backward compatibility.
   echo
fi


%changelog
* Thu Sep 06 2001 Kevin Monroe <monroek@austin.ibm.com>
- Fixed problem with GNOME menus

* Mon Aug 27 2001 Kevin Monroe <monroek@us.ibm.com>
- Modify prefixes for inclusion in AIX toolkit
- Use IBM VAC compiler; add links into /usr 

* Mon Oct 30 2000 Charles Stevenson <csteven@yellowdoglinux.com>
- A few spec file fixes that work with the new man location

* Sun Oct  1 2000 Fernando M. Roxo da Motta <roxo@conectiva.com>
- Updated to 3.5.2
- Updated brazilian portuguese potfile ( pt_BR.po )
- Updated spanish potfile ( es.po )

* Tue Sep 19 2000 Rodrigo Barbosa <rodrigob@conectiva.com>
- Misc. fixes

* Mon Sep 18 2000 Fernando M. Roxo da Motta <roxo@conectiva.com>
- Added updated brazilian portuguese potfile
- Changed specfile to be according to general RPM macro standards.
* Thu Sep 14 2000 Fernando M. Roxo da Motta <roxo@conectiva.com>
- Added updated brazilian portuguese potfile ( pt_BR.po )
- Using Conectiva macros

* Mon Apr 17 2000 Olivier Fourdan <fourdan@xfce.org>
- Update with FHS compliancy
* Thu Dec 16 1999 Tim Powers <timp@redhat.com>
- updated to 3.2.2
- general cleanups to make it a bit easier to maintain
- configure to build section
- quiet setup
- no more %pre/preun or %post/postun sections, not needed (done in %install instead)
- no more posinstall messages being displayed
- cleaned up %files section
- gzip man pages

* Sat Oct 23 1999 P. Reich -- fixed spec file to build and install 
- correctly in BUILD_ROOT.
- Added preun to remove links in xfce-datadir.
- Moved DATADIR to /usr/share
- Added link to "more-icons" in /usr/share/icons. 
