# HG changeset patch # User Michael Schloh von Bennewitz # Date 1257012000 -3600 # Node ID 29b273d638358a0f8c72e166af21ebb8460fbf85 # Parent d1b7fc7f844a4c2031dd47bba7ae1cbfc454e1de Import package vendor original specs for necessary manipulations. diff -r d1b7fc7f844a -r 29b273d63835 jabberd/jabberd.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jabberd/jabberd.patch Sat Oct 31 19:00:00 2009 +0100 @@ -0,0 +1,183 @@ +Index: etc/c2s.xml.dist.in +--- etc/c2s.xml.dist.in.orig 2009-06-30 11:38:16 +0200 ++++ etc/c2s.xml.dist.in 2009-06-30 20:45:22 +0200 +@@ -50,18 +50,16 @@ + + + +- ++ + +- jabberd/c2s ++ + + +- local3 ++ + + +- + + + +@@ -137,7 +135,7 @@ + --> + + +- 0.0.0.0 ++ 127.0.0.1 + + +@@ -331,7 +329,7 @@ + @pkglibdir@ + + +- sqlite ++ db + + + +Index: etc/router.xml.dist.in +--- etc/router.xml.dist.in.orig 2009-06-30 11:38:16 +0200 ++++ etc/router.xml.dist.in 2009-06-30 20:45:06 +0200 +@@ -8,24 +8,22 @@ + @localstatedir@/jabberd/pid/router.pid + + +- ++ + +- jabberd/router ++ + + +- local3 ++ + + +- + + + + + +- 0.0.0.0 ++ 127.0.0.1 + + + 5347 +Index: etc/s2s.xml.dist.in +--- etc/s2s.xml.dist.in.orig 2009-06-30 11:38:16 +0200 ++++ etc/s2s.xml.dist.in 2009-06-30 20:45:06 +0200 +@@ -60,25 +60,23 @@ + + + +- ++ + +- jabberd/s2s ++ + + +- local3 ++ + + +- + + + + + +- 0.0.0.0 ++ 127.0.0.1 + 5269 + + +- ++ + +- jabberd/sm ++ + + +- local3 ++ + + + +- sqlite ++ db + + +Index: sm/mod_iq_time.c +--- sm/mod_iq_time.c.orig 2009-06-30 11:38:15 +0200 ++++ sm/mod_iq_time.c 2009-06-30 20:45:06 +0200 +@@ -39,6 +39,7 @@ + static mod_ret_t _iq_time_pkt_sm(mod_instance_t mi, pkt_t pkt) + { + time_t t; ++ time_t tzone; + struct tm *tm; + char buf[64]; + char *c; +@@ -78,7 +79,8 @@ + datetime_out(t, dt_DATETIME, buf, 64); + nad_insert_elem(pkt->nad, 2, NAD_ENS(pkt->nad, 1), "utc", buf); + #ifdef HAVE_TZSET +- snprintf(buf, 64, "%+03d:%02d", -((int)timezone)/(60*60), -((int)timezone)%(60*60)); ++ tzone = (time_t)((long)mktime(gmtime(&t)) - (long)t); ++ snprintf(buf, 64, "%+03d:%02d", (int) -tzone/(60*60), (int) -tzone%(60*60)); + #else + snprintf(buf, 64, "%+03d:%02d", (int) tm->tm_gmtoff/(60*60), (int) tm->tm_gmtoff%(60*60)); + #endif +Index: sm/mod_roster.c +--- sm/mod_roster.c.orig 2009-06-30 11:38:15 +0200 ++++ sm/mod_roster.c 2009-06-30 20:45:06 +0200 +@@ -635,6 +635,9 @@ + if(user->sessions == NULL) + return mod_PASS; + ++ /* We have to free old packet - Lemming's memory leak fix */ ++ pkt_free(pkt); ++ + /* build a new packet to push out to everyone */ + pkt = pkt_create(user->sm, "iq", "set", NULL, NULL); + pkt_id_new(pkt); +Index: util/util.h +--- util/util.h.orig 2009-06-30 11:38:16 +0200 ++++ util/util.h 2009-06-30 20:45:06 +0200 +@@ -30,6 +30,8 @@ + #include + #include + #include ++#include ++#include + + #include + diff -r d1b7fc7f844a -r 29b273d63835 jabberd/jabberd.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jabberd/jabberd.spec Sat Oct 31 19:00:00 2009 +0100 @@ -0,0 +1,205 @@ +## +## jabberd.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2009 OpenPKG Foundation e.V. +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package version +%define V_major 2.2 +%define V_minor 9 + +# package information +Name: jabberd +Summary: Jabber Instant Messaging Daemon +URL: http://jabberd2.xiaoka.com/ +Vendor: Jabber Software Foundation +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: PLUS +Group: InstantMessaging +License: JOSL/GPL +Version: %{V_major}.%{V_minor} +Release: 20090707 + +# package options +%option with_sqlite no +%option with_mysql no +%option with_pgsql no +%option with_pam no + +# list of sources +Source0: http://codex.xiaoka.com/pub/jabberd2/releases/jabberd-%{version}.tar.gz +Source1: rc.jabberd +Patch0: jabberd.patch + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823, make +PreReq: OpenPKG, openpkg >= 20060823, perl +BuildPreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns +PreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns +%if "%{with_sqlite}" == "yes" +BuildPreReq: sqlite +PreReq: sqlite +%endif +%if "%{with_mysql}" == "yes" +BuildPreReq: mysql +PreReq: mysql +%endif +%if "%{with_pgsql}" == "yes" +BuildPreReq: postgresql +PreReq: postgresql +%endif +%if "%{with_pam}" == "yes" +BuildPreReq: PAM +PreReq: PAM +%endif +AutoReq: no +AutoReqProv: no + +%description + JabberD is the original server implementation for the Jabber instant + messaging platform. 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. + +%track + prog jabberd = { + version = %{version} + url = http://codex.xiaoka.com/pub/jabberd2/releases/ + regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.gz + } + +%prep + %setup -q -n jabberd-%{version} + %{l_sed} <%{PATCH0} -e 's;@l_prefix@;%{l_prefix};g' | %{l_patch} -p0 -b + %{l_shtool} subst \ + -e 's;exec perl;exec %{l_prefix}/bin/perl;' \ + tools/jabberd.in + +%build + # configure program + export CC="%{l_cc}" + export CFLAGS="%{l_cflags -O}" + export CPPFLAGS="%{l_cppflags libidn}" + export LDFLAGS="%{l_ldflags}" + export LIBS="" + case "%{l_platform -t}" in + *-linux* ) LIBS="$LIBS -ldl" ;; + *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;; + esac + export JHOME=%{l_prefix}/var/jabberd +%if "%{with_mysql}" == "yes" + CPPFLAGS="$CPPFLAGS %{l_cppflags mysql}" + LDFLAGS="$LDFLAGS %{l_ldflags mysql}" + LIBS="$LIBS -lz -lm" +%endif +%if "%{with_pgsql}" == "yes" + CPPFLAGS="$CPPFLAGS %{l_cppflags postgresql}" +%endif + ./configure \ + --prefix=%{l_prefix} \ + --sysconfdir=%{l_prefix}/etc/jabberd \ + --mandir=%{l_prefix}/man \ + --enable-db \ + --enable-fs \ + --enable-pipe \ + --enable-ssl \ + --with-sasl=gsasl \ +%if "%{with_sqlite}" == "yes" + --enable-sqlite \ +%else + --disable-sqlite \ +%endif +%if "%{with_mysql}" == "yes" + --enable-mysql \ +%else + --disable-mysql \ +%endif +%if "%{with_pgsql}" == "yes" + --enable-pgsql \ +%else + --disable-pgsql \ +%endif +%if "%{with_pam}" == "yes" + --enable-pam \ +%else + --disable-pam \ +%endif + --disable-oracle \ + --enable-static \ + --enable-shared + + # build program + %{l_make} %{l_mflags} + +%install + # create installation filesystem structure + rm -rf $RPM_BUILD_ROOT + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ + $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \ + $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \ + $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \ + $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \ + $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \ + $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log + + # install components + %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT + + # remove unnecessary files + rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist + rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist + rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a + + # install run-command script + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE rc.jabberd} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # determine installation files + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ + %{l_files_std} \ + '%config %{l_prefix}/etc/jabberd/*' \ + '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \ + '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} jabberd status 2>/dev/null` + [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} jabberd stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true + exit 0 + diff -r d1b7fc7f844a -r 29b273d63835 jabberd/rc.jabberd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jabberd/rc.jabberd Sat Oct 31 19:00:00 2009 +0100 @@ -0,0 +1,71 @@ +#!@l_prefix@/bin/openpkg rc +## +## rc.jabberd -- Run-Commands +## + +%config + jabberd_enable="$openpkg_rc_def" + jabberd_hostname=`hostname` + jabberd_daemons="c2s resolver router s2s sm" + jabberd_cfgfile="@l_prefix@/etc/jabberd/jabberd.cfg" + jabberd_log_prolog="true" + jabberd_log_epilog="true" + jabberd_log_numfiles="10" + jabberd_log_minsize="1M" + jabberd_log_complevel="9" + +%common + jabberd_signal () { + local retcode=0 + local daemons= + for daemons in $jabberd_daemons; do + [ -f @l_prefix@/var/jabberd/pid/${daemons}.pid ] \ + && kill -$1 `cat @l_prefix@/var/jabberd/pid/${daemons}.pid` + retcode=$(($retcode+$?)) + done + return $retcode + } + +%status -u @l_nusr@ -o + jabberd_usable="unknown" + jabberd_active="no" + rcService jabberd enable yes && \ + jabberd_signal 0 && jabberd_active="yes" + echo "jabberd_enable=\"$jabberd_enable\"" + echo "jabberd_usable=\"$jabberd_usable\"" + echo "jabberd_active=\"$jabberd_active\"" + +%start -u @l_nusr@ + rcService jabberd enable yes || exit 0 + rcService jabberd active yes && exit 0 + @l_prefix@/bin/jabberd -b -c $jabberd_cfgfile + +%stop -u @l_nusr@ + rcService jabberd enable yes || exit 0 + rcService jabberd active no && exit 0 + jabberd_signal TERM + sleep 2 + for daemons in $jabberd_daemons; do + rm -f @l_prefix@/var/jabberd/pid/${daemons}.pid + done + +%restart -u @l_nusr@ + rcService jabberd enable yes || exit 0 + rcService jabberd active no && exit 0 + rc jabberd stop + sleep 2 + rc jabberd start + +%daily -u @l_susr@ + rcService jabberd enable yes || exit 0 + logfiles= + for daemons in $jabberd_daemons; do + logfiles="$logfiles @l_prefix@/var/jabberd/log/$daemons.log" + done + shtool rotate -f \ + -n ${jabberd_log_numfiles} -s ${jabberd_log_minsize} -d \ + -z ${jabberd_log_complevel} -m 644 -o @l_susr@ -g @l_mgrp@ \ + -P "${jabberd_log_prolog}" \ + -E "${jabberd_log_epilog}; rc jabberd restart" \ + $logfiles +