%define name jabber
%define version 1.4.2
%define release 1

Summary: Jabber is an instant messaging System.
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.gz
Source1: %{name}-README.IBM
Patch0: jabber-%{version}-aix.patch
Copyright: Jabber Public License
Group: System/Servers
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
Buildrequires: pth >= 1.4.0, pth-devel >= 1.4.0, make >= 3.79.1
Requires: pth >= 1.4.0

%description
Jabber is an instant messaging System, similar to ICQ or AIM, yet far different. 
It is open source, absolutely free, simple, fast, extensible, modularized,
cross platform, and created with the future in mind. Jabber has been designed
from the ground up to serve the needs of the end user, satisfy business demands,
and maintain compatibility with other messaging systems.

%define stdlib lib
%define liblink ../..
%define DEFCC gcc

%prep 
%setup -q 
%patch0 -p1
cp $RPM_SOURCE_DIR/jabber-README.IBM ./README.IBM

%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::'`
       export CFLAGS="$RPM_OPT_FLAGS -qcpluscmt"
else #gcc
       export CFLAGS="$RPM_OPT_FLAGS"
fi

CC=$CC CFLAGS="$CFLAGS" JHOME=%{_prefix}/jabber ./configure --prefix=%{_prefix}
make 
/usr/bin/strip jabberd/jabberd

%install
rm -rf $RPM_BUILD_ROOT
# Jabber does not have a proper "make install".
# It just echo's a message saying to run jabber directly
# from where it was built.  But that isn't what we want
# to do.  So, we will have this SPEC file copy the files
# to the desired install location, which was specified
# in the build phase by the JHOME value (we patched it to
# accept it on the command line; see the configure above).

mkdir -p  $RPM_BUILD_ROOT/%{_prefix}/jabber/jabberd
mkdir $RPM_BUILD_ROOT/%{_prefix}/jabber/jsm
mkdir $RPM_BUILD_ROOT/%{_prefix}/jabber/pthsock
mkdir $RPM_BUILD_ROOT/%{_prefix}/jabber/xdb_file
mkdir $RPM_BUILD_ROOT/%{_prefix}/jabber/dnsrv
mkdir $RPM_BUILD_ROOT/%{_prefix}/jabber/dialback
mkdir $RPM_BUILD_ROOT/%{_prefix}/jabber/spool
cp -p jabberd/jabberd $RPM_BUILD_ROOT/%{_prefix}/jabber/jabberd
cp -p jsm/jsm.so jsm/README $RPM_BUILD_ROOT/%{_prefix}/jabber/jsm
cp -p pthsock/pthsock_client.so $RPM_BUILD_ROOT/%{_prefix}/jabber/pthsock
cp -p pthsock/README.pthsock_client $RPM_BUILD_ROOT/%{_prefix}/jabber/pthsock
cp -p xdb_file/xdb_file.so $RPM_BUILD_ROOT/%{_prefix}/jabber/xdb_file
cp -p dnsrv/dnsrv.so $RPM_BUILD_ROOT/%{_prefix}/jabber/dnsrv
cp -p dialback/dialback.so $RPM_BUILD_ROOT/%{_prefix}/jabber/dialback
cp -p jabber.xml $RPM_BUILD_ROOT/%{_prefix}/jabber
cp -p README* UPGRADE $RPM_BUILD_ROOT/%{_prefix}/jabber

# No links created to /usr/lib or /usr/bin; jabber must be run out
# of path where specified by build.

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc %{_prefix}/jabber/README
%doc %{_prefix}/jabber/README.IBM
%doc %{_prefix}/jabber/UPGRADE
%config %{_prefix}/jabber/jabber.xml
%{_prefix}/jabber/jabberd
%{_prefix}/jabber/jsm
%{_prefix}/jabber/pthsock
%{_prefix}/jabber/xdb_file
%{_prefix}/jabber/dnsrv
%{_prefix}/jabber/dialback
%dir %{_prefix}/jabber/spool


%ifos linux
%post
sed s/HOST/$(hostname)/ %{_docdir}/%{name}-%{version}/jserver.xml.template > /etc/jserver.xml
%endif

%changelog
* Tue Apr 30 2002 David Clissold <cliss@austin.ibm.com>
- Update to version 1.4.2; maybe this one works better.

* Sun Apr 1  2001 David Clissold <cliss@austin.ibm.com>
- Add a README.IBM to point out the common server bug.

* Mon Feb 26 2001 David Clissold <aixtoolbox-l@austin.ibm.com>
- Updated (along with the patch) so this will build with
  the AIX xlc compiler

* Tue Feb 13 2001 David Clissold <aixtoolbox-l@austin.ibm.com>
- Updated for Jabber 1.4

* Wed Jan 24 2001 David Clissold <aixtoolbox-l@austin.ibm.com>
- Added patch for JHOME.
- Set up install and files sections

* Tue Jan  9 2001 Marc Stephenson <aixtoolbox-l@austin.ibm.com>
- Add build requires

* Tue Oct  3 2000 Vincent Saugey <vince@mandrakesoft.com> 1.0.1-3mdk
- Add build requires

* Fri Sep  8 2000 Vincent Saugey <vince@mandrakesoft.com> 1.0.1-2mdk
- Correct init script
- change default config file

* Thu Sep  7 2000 Vincent Saugey <vince@mandrakesoft.com> 1.0.1-1mdk
- Up to 1.0.1

* Thu Aug 31 2000 Vincent Saugey <vince@mandrakesoft.com> 1.0-1mdk
- Fisrt mdk release

# end of file
