Summary: OpenSource server implementation of the Jabber protocols
Name: jabberd
Version: 2.1.15
Release: 1.n0i.1%{?dist}
Group: System Environment/Daemons
License: GPLv2+
URL: http://jabberd2.xiaoka.com/
Source0: http://ftp.xiaoka.com/jabberd2/releases/%{name}-%{version}.tar.bz2
Source1: jabberd
Source2: jabberd.sysconfig
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: openssl-devel >= 0.9.6b
BuildRequires: libidn-devel >= 0.3.0
BuildRequires: libgsasl-devel >= 0.2.14
BuildRequires: expat-devel
# %{name} is a leaky beast ;-)
BuildRequires: gc-devel
%{!?_without_mysql:BuildRequires: mysql-devel}
%{!?_without_pgsql:BuildRequires: postgresql-devel}
%{!?_without_sqlite:BuildRequires: sqlite-devel >= 3.0}
%{!?_without_db:BuildRequires: db4-devel >= 4.1.24}
%{!?_without_ldap:BuildRequires: openldap-devel >= 2.1.0}
%{!?_without_pam:BuildRequires: pam-devel}
%{?_with_oracle:BuildRequires: oracle-instantclient-devel}
Requires: %{name}-libs = %{version}
Requires(pre): /usr/sbin/useradd
Requires(pre): /usr/sbin/groupadd
Requires(post): openssl
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(preun): /sbin/chkconfig
#Requires(preun): /usr/sbin/userdel
Requires(postun): /sbin/service
%description
The jabberd project aims to provide an open-source server implementation of the
Jabber protocols for instant messaging and XML routing. The goal of this
project is to provide a scalable, reliable, efficient and extensible server
that provides a complete set of features and is up to date with the latest
protocol revisions.
jabberd 2 is the next generation of the jabberd server. It has been rewritten
from the ground up to be scalable, architecturally sound, and to support the
latest protocol extensions coming out of the JSF.
%package libs
Group: System Environment/Libraries
Summary: Jabberd libraries
%description libs
Jabberd libraries.
%if 0%{!?_without_mysql:1}
%package libs-mysql
Group: System Environment/Libraries
Summary: Jabberd MySQL libraries
Requires: %{name}-libs = %{version}
%description libs-mysql
MySQL support libraries for Jabberd.
%endif
%if 0%{!?_without_pgsql:1}
%package libs-pgsql
Group: System Environment/Libraries
Summary: Jabberd PostgreSQL libraries
Requires: %{name}-libs = %{version}
%description libs-pgsql
PostgreSQL support libraries for Jabberd.
%endif
%if 0%{!?_without_sqlite:1}
%package libs-sqlite
Group: System Environment/Libraries
Summary: Jabberd SQLite libraries
Requires: %{name}-libs = %{version}
%description libs-sqlite
SQLite support libraries for Jabberd.
%endif
%if 0%{!?_without_db:1}
%package libs-db
Group: System Environment/Libraries
Summary: Jabberd Berkeley DB libraries
Requires: %{name}-libs = %{version}
%description libs-db
Berkeley DB support libraries for Jabberd.
%endif
%if 0%{!?_without_ldap:1}
%package libs-ldap
Group: System Environment/Libraries
Summary: Jabberd OpenLDAP libraries
Requires: %{name}-libs = %{version}
%description libs-ldap
OpenLDAP support libraries for Jabberd.
%endif
%if 0%{?_with_oracle:1}
%package libs-oracle
Group: System Environment/Libraries
Summary: Jabberd Oracle libraries
Requires: %{name}-libs = %{version}
%description libs-oracle
Oracle support libraries for Jabberd.
%endif
%prep
%setup -q -n %{name}-%{version}
%{__perl} -pi -e 's{(\S+->open)}{($1)}' storage/{storage,authreg}_db.c
%build
EXTRA_LIB=""
EXTRA_INC=""
%if 0%{?_with_oracle:1}
EXTRA_LIB="${EXTRA_LIB}:%(rpm -ql oracle-instantclient-devel |%{__sed} -n 's/[^\/]\+\.so$//; t q; T; :q p;q')"
EXTRA_INC="${EXTRA_INC}:%(rpm -ql oracle-instantclient-devel |%{__sed} -n 's/[^\/]\+\.h$//; t q; T; :q p;q')"
%endif
%if 0%{!?_without_mysql:1}
EXTRA_LIB="${EXTRA_LIB}:%{_libdir}/mysql"
EXTRA_INC="${EXTRA_INC}:%{_includedir}/mysql"
%endif
# GC plug (see http://jabberd2.xiaoka.com/wiki/Hints)
export LIBS='-lgc'
%configure \
%{!?_without_mysql: --enable-mysql} \
%{!?_without_pgsql: --enable-pgsql} \
%{!?_without_sqlite: --enable-sqlite} \
%{!?_without_db: --enable-db} \
%{!?_without_ldap: --enable-ldap} \
%{!?_without_pam: --enable-pam} \
%{!?_without_pipe: --enable-pipe} \
%{!?_without_anon: --enable-anon} \
%{?_with_oracle: --enable-oracle} \
%{?_with_fs: --enable-fs} \
--sysconfdir=%{_sysconfdir}/%{name} \
--localstatedir=%{_var}/lib \
--with-extra-library-path="${EXTRA_LIB}" \
--with-extra-include-path="${EXTRA_INC}" \
%{__make} %{?_smp_mflags}
%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__make} install DESTDIR=$RPM_BUILD_ROOT
%{__mkdir_p} $RPM_BUILD_ROOT/%{_var}/lib/jabberd/{log,pid,db}
%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
%{__install} -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/%{name}
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
%{__install} -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
%{__sed} -i -e "s,__BINDIR__,%{_bindir},g" \
-e "s,__ETCDIR__,%{_sysconfdir}/%{name},g" \
-e "s,__PIDDIR__,%{_var}/lib/%{name}/pid,g" \
-e "s,__SYSCONF__,%{_sysconfdir}/sysconfig,g" \
$RPM_BUILD_ROOT%{_initrddir}/%{name} \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
### PAM support
%if 0%{!?_without_pam:1}
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d
%{__cat} >> $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/%{name} << END
#%PAM-1.0
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
END
# default driver for storage
# the default pam backend needs auto creation of accounts
%{__sed} -i -e ':a;N;$!ba' \
-e 's,mysql,db,g' \
-e 's,,,g' \
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}/sm.xml
# default authentication backend
# enable SSL certificate
# clients must do STARTTLS
%{__sed} -i -e ':a;N;$!ba' \
-e 's,mysql,pam,g' \
-e 's,,%{_sysconfdir}/%{name}/server.pem,g' \
-e 's,,,g' \
$RPM_BUILD_ROOT%{_sysconfdir}/%{name}/c2s.xml
%endif
### /PAM support
# ghost file
touch $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/server.pem
# we have our own start script
%{__rm} $RPM_BUILD_ROOT%{_bindir}/jabberd
# we have our own start script
%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/jabberd.cfg*
# prepare "tools" files to be added as %%doc
%{__chmod} 644 tools/*
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
# creating jabber user/group
getent group jabber >/dev/null \
|| /usr/sbin/groupadd -r jabber
getent passwd jabber >/dev/null \
|| /usr/sbin/useradd -r -g jabber -d %{_var}/lib/%{name} \
-s /sbin/nologin -c "Jabber Server" jabber
exit 0
%post
if [ "$1" -eq "1" ]; then
# register %{name} service
/sbin/chkconfig --add %{name}
# replace default passwords (yet another ugly hack)
NEWPASS=$( dd if=/dev/urandom bs=20 count=1 2>/dev/null \
| sha1sum | cut -d' ' -f1 )
cd %{_sysconfdir}/%{name}
%{__sed} -i -f- router-users.xml router.xml <secret,$NEWPASS,g
END
%{__sed} -i -f- *.xml <secret,$NEWPASS,g
END
fi
# create SSL certificate
cd %{_sysconfdir}/%{name}
if [ ! -e server.pem ]; then
%{___build_shell} %{_sysconfdir}/pki/tls/certs/make-dummy-cert server.pem
%{__chown} root:jabber server.pem
%{__chmod} 640 server.pem
fi
%preun
if [ "$1" -eq "0" ]; then
/sbin/service %{name} stop &> /dev/null
/sbin/chkconfig --del %{name}
# jabber user is not deleted to avoid unowned files
#/usr/sbin/userdel jabber
# should %{_var}/lib/jabberd be deleted???
#%{__rm} -rf %{_var}/lib/%{name}
fi
%postun
[ "$1" -eq "1" ] && /sbin/service %{name} condrestart &> /dev/null
%files
%defattr(-,root,root)
%doc AUTHORS BUGS ChangeLog COPYING NEWS README PROTOCOL TODO UPGRADE
%doc tools/migrate.pl tools/pipe-auth.pl
%attr(750, jabber, jabber) %dir %{_sysconfdir}/%{name}
%attr(750, jabber, jabber) %dir %{_sysconfdir}/%{name}/templates
%attr(640, jabber, jabber) %config(noreplace) %{_sysconfdir}/%{name}/*xml
%attr(640, jabber, jabber) %config(noreplace) %{_sysconfdir}/%{name}/templates/*xml
%exclude %{_sysconfdir}/%{name}/*xml.dist
%exclude %{_sysconfdir}/%{name}/templates/*xml.dist
%if 0%{!?_without_pam:1}
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
%endif
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%ghost %{_sysconfdir}/%{name}/server.pem
%{_initrddir}/%{name}
%attr(-, jabber, jabber) %{_var}/lib/%{name}
%{_bindir}/*
%{_mandir}/man*/*
%files libs
%defattr(-,root,root)
%{_libdir}/%{name}
%exclude %{_libdir}/%{name}/*.la
%{!?_without_db:%exclude %{_libdir}/%{name}/*_db.so}
%{!?_without_ldap:%exclude %{_libdir}/%{name}/*_ldap.so}
%{!?_without_mysql:%exclude %{_libdir}/%{name}/*_mysql.so}
%{!?_without_pgsql:%exclude %{_libdir}/%{name}/*_pgsql.so}
%{!?_without_sqlite:%exclude %{_libdir}/%{name}/*_sqlite.so}
%{?_with_oracle:%exclude %{_libdir}/%{name}/*_oracle.so}
%if 0%{!?_without_mysql:1}
%files libs-mysql
%defattr(-,root,root)
%doc tools/db-*.mysql
%{_libdir}/%{name}/*_mysql.so
%endif
%if 0%{!?_without_pgsql:1}
%files libs-pgsql
%defattr(-,root,root)
%doc tools/db-*.pgsql tools/db-jd14-2-jd2.sql
%{_libdir}/%{name}/*_pgsql.so
%endif
%if 0%{!?_without_sqlite:1}
%files libs-sqlite
%defattr(-,root,root)
%doc tools/db-*.sqlite
%{_libdir}/%{name}/*_sqlite.so
%endif
%if 0%{!?_without_db:1}
%files libs-db
%defattr(-,root,root)
%{_libdir}/%{name}/*_db.so
%endif
%if 0%{!?_without_ldap:1}
%files libs-ldap
%defattr(-,root,root)
%{_libdir}/%{name}/*_ldap.so
%endif
%if 0%{?_with_oracle:1}
%files libs-oracle
%defattr(-,root,root)
%doc tools/db-*.oracle
%{_libdir}/%{name}/*_oracle.so
%endif
%changelog
* Thu Sep 13 2007 Marius FERARU - 2.1.15-1.n0i.1
- version 2.1.15
- dropped glibc-open patch (included an inline-fix)
- versioned BRs
- more BR: libgsasl-devel and expat-devel
- dropped the confusing %%sysconfdir macro
- added more build options (sqlite, oracle, pipe, anon, fs)
- scripts tweaks (dropped dependency on awk, added plain/full BR)
- %%files & %%install cleanup
- dropped %%_datadir/%%name, used %%doc for those files
- plugged Boehm-Demers-Weiser garbage collector as jabberd is a leaky beast
- split into more packages
- proper "--without pam" installation
- FIXME: "--with oracle" is still buggy (until we convince Oracle folks
to provide *proper* "instant client" RPMs, as using our internal version
won't work - cannot distribute them)
* Mon Aug 27 2007 Adrian Reber - 2.0-0.s11.14
- applied patch to fix bz #175219
- removed config flag for startup script
- updated License
- added patch for new glibc open macro
* Thu Jun 12 2007 Thorsten Leemhuis - 2.0-0.s11.13
- rebuilt on behalf of Adrian
* Thu Dec 07 2006 Adrian Reber - 2.0-0.s11.12
- rebuilt
* Tue Sep 12 2006 Adrian Reber - 2.0-0.s11.11
- rebuilt
* Mon Aug 07 2006 Adrian Reber - 2.0-0.s11.10
- changed pam file to use include
- added return value for status() function (bz #200996)
* Mon Apr 03 2006 Adrian Reber - 2.0-0.s11.9
- updated to 2.0-0.s11
* Wed Feb 15 2006 Adrian Reber - 2.0-0.s10.9
- rebuilt
* Sun Nov 27 2005 Adrian Reber - 2.0-0.s10.8
- %%{_sysconfdir}/jabberd/server.pem was listed twice
- added /sbin/service dependency to %%post, %%postun and %%preun
- jabber user is not deleted to avoid unowned files
* Mon Oct 17 2005 Adrian Reber - 2.0-0.s10.7
- updated to 2.0-0.s10
* Mon Aug 01 2005 Adrian Reber - 2.0-0.s9.6
- updated to 2.0-0.s9.6
* Thu May 12 2005 Adrian Reber - 2.0-0.s8.5
- updated to 2.0-0.s8.5
- using new location of make-dummy-cert
* Wed Mar 09 2005 Adrian Reber - 2.0-0.s6.5
- removed Epoch: 0
- more Requires(...)
- typo
- changed db location to %%{_var}/lib/jabberd
- removed noreplace for start script
- make backends optional during build
- use -p with the install command
- combined some of the sed magic
- added a jabberd file in sysconfig to control if all daemons
should be started
- don't suid c2s and add config option in sysconfig/jabberd
to start c2s as root if required to authenticate against pam/shadow
* Tue Mar 08 2005 Adrian Reber - 2.0-0.s6.4
- made password more random (/dev/random)
- replace password in the config without making it visible in ps
- enable ldap, mysql, postgresql backends
- remove dependency on perl during build
- make pam default authentication backend in c2s.xml
- make files in etc (640, jabber, jabber)
- enabled SSL certificate in c2s.xml
- enabled auto creation of accounts in sm.xml (necessary for usage with PAM)
- enabled require-startls
* Mon Mar 07 2005 Adrian Reber - 2.0-0.s6.3
- changed startscript again
* Mon Mar 07 2005 Adrian Reber - 2.0-0.s6.2
- changed startscript to support condrestart
* Mon Mar 07 2005 Adrian Reber - 2.0-0.s6.1
- updated to 2.0s6
* Wed Nov 24 2004 Adrian Reber - 0:2.0-0.fdr.16.s4
- updated to 2.0s4
- added jabberd-c2s-buffers.patch
(http://jabberstudio.org/projects/jabberd2/bugs/view.php?id=4528)
- replace mysql with db in sm.xml
* Mon Jul 19 2004 Adrian Reber - 0:2.0-0.fdr.15.s3
- add ||: at the end of the useradd line
* Mon Jul 19 2004 Adrian Reber - 0:2.0-0.fdr.14.s3
- create jabber user in %%pre instead of in %%post
- remove -r from userdel
* Mon Jul 19 2004 Adrian Reber - 0:2.0-0.fdr.13.s3
- s/jabberd2/%%{name}/
- replace another default password
* Fri Jul 16 2004 Adrian Reber - 0:2.0-0.fdr.12.s3
- %%{_var}/jabberd is now owned be the package
- %%ghost-ing server.pem
- disable rm-ing %%{_var}/jabberd on uninstall
* Fri Jul 16 2004 Adrian Reber - 0:2.0-0.fdr.11.s3
- using %%{_datadir}/ssl/certs/make-dummy-cert to
create the certificate
- added -r to useradd
- added openssl to post-requires
- added libidn-devel and pam-devel as BuildRequires
* Mon Jul 12 2004 Adrian Reber - 0:2.0-0.fdr.10.s3
- complete rewrite for fedora (I mean it)
* Tue May 18 2004 Tim Niemueller
- Initial spec file