michael@224: ## michael@224: ## jabberd.spec -- OpenPKG RPM Package Specification michael@224: ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. michael@224: ## michael@224: ## Permission to use, copy, modify, and distribute this software for michael@224: ## any purpose with or without fee is hereby granted, provided that michael@224: ## the above copyright notice and this permission notice appear in all michael@224: ## copies. michael@224: ## michael@224: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@224: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@224: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@224: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@224: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@224: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@224: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@224: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@224: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@224: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@224: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@224: ## SUCH DAMAGE. michael@224: ## michael@224: michael@224: # package version michael@224: %define V_major 2.2 michael@363: %define V_minor 14 michael@225: %define V_mucon 0.8 michael@224: michael@224: # package information michael@224: Name: jabberd michael@224: Summary: Jabber Instant Messaging Daemon michael@224: URL: http://jabberd2.xiaoka.com/ michael@224: Vendor: Jabber Software Foundation michael@224: Packager: OpenPKG Foundation e.V. michael@224: Distribution: OpenPKG Community michael@224: Class: PLUS michael@224: Group: InstantMessaging michael@224: License: JOSL/GPL michael@224: Version: %{V_major}.%{V_minor} michael@363: Release: 20110914 michael@224: michael@224: # package options michael@225: %option with_mucon yes michael@225: %option with_sqlite yes michael@224: %option with_mysql no michael@224: %option with_pgsql no michael@224: %option with_pam no michael@224: michael@224: # list of sources michael@224: Source0: http://codex.xiaoka.com/pub/jabberd2/releases/jabberd-%{version}.tar.gz michael@225: Source1: http://download.gna.org/mu-conference/mu-conference_%{V_mucon}.tar.gz michael@225: Source2: rc.jabberd michael@224: Patch0: jabberd.patch michael@224: michael@224: # build information michael@224: Prefix: %{l_prefix} michael@224: BuildRoot: %{l_buildroot} michael@224: BuildPreReq: OpenPKG, openpkg >= 20060823, make michael@224: PreReq: OpenPKG, openpkg >= 20060823, perl michael@224: BuildPreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns michael@224: PreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns michael@225: %if "%{with_mucon}" == "yes" michael@225: BuildPreReq: glib2 michael@225: PreReq: glib2 michael@225: %endif michael@224: %if "%{with_sqlite}" == "yes" michael@224: BuildPreReq: sqlite michael@224: PreReq: sqlite michael@224: %endif michael@224: %if "%{with_mysql}" == "yes" michael@224: BuildPreReq: mysql michael@224: PreReq: mysql michael@224: %endif michael@224: %if "%{with_pgsql}" == "yes" michael@224: BuildPreReq: postgresql michael@224: PreReq: postgresql michael@224: %endif michael@224: %if "%{with_pam}" == "yes" michael@224: BuildPreReq: PAM michael@224: PreReq: PAM michael@224: %endif michael@224: AutoReq: no michael@224: AutoReqProv: no michael@224: michael@224: %description michael@224: JabberD is the original server implementation for the Jabber instant michael@224: messaging platform. JabberD 2 is the next generation of the JabberD michael@224: server. It has been rewritten from the ground up to be scalable, michael@224: architecturally sound, and to support the latest protocol extensions michael@224: coming out of the JSF. michael@224: michael@224: %track michael@224: prog jabberd = { michael@224: version = %{version} michael@224: url = http://codex.xiaoka.com/pub/jabberd2/releases/ michael@224: regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.gz michael@224: } michael@225: prog jabberd:mucon = { michael@225: version = %{V_mucon} michael@225: url = http://download.gna.org/mu-conference/ michael@225: regex = mu-conference_(__VER__)\.tar\.gz michael@225: } michael@224: michael@224: %prep michael@224: %setup -q -n jabberd-%{version} michael@225: %setup -q -D -T -a 1 michael@224: %{l_sed} <%{PATCH0} -e 's;@l_prefix@;%{l_prefix};g' | %{l_patch} -p0 -b michael@224: %{l_shtool} subst \ michael@224: -e 's;exec perl;exec %{l_prefix}/bin/perl;' \ michael@224: tools/jabberd.in michael@225: %if "%{with_mucon}" == "yes" michael@225: %{l_shtool} subst \ michael@225: -e 's;^\(CFLAGS\ *:=.*pkg-config --cflags glib-2.0\);\1 libidn;' \ michael@225: -e 's;^\(LIBS\ *:=.*\);\1 $(LOCLIBS);' \ michael@225: mu-conference_%{V_mucon}/src/Makefile michael@225: %{l_shtool} subst \ michael@225: -e 's;mu-conference.log;muc.log;g' \ michael@225: mu-conference_%{V_mucon}/src/jcomp/jcr_log.c michael@225: %{l_shtool} subst \ michael@225: -e 's;[0-9][0-9]*;5347;' \ michael@225: -e 's;.*;%{l_prefix}/var/jabberd/spool/rooms;' \ michael@225: -e 's;\./syslogs;%{l_prefix}/var/jabberd/log;' \ michael@225: -e 's;\./logs/;%{l_prefix}/var/jabberd/spool/logs;' \ michael@225: -e 's;.*;%{l_prefix}/var/jabberd/pid/muc.pid;' \ michael@225: -e 's;.*;http://name.host.tld/;' \ michael@225: -e 's;.*;%{l_prefix}/share/jabberd/style.css;' \ michael@225: mu-conference_%{V_mucon}/muc-default.xml michael@225: echo \ michael@225: 'muc @sysconfdir@/muc.xml' \ michael@225: >>etc/jabberd.cfg.dist.in michael@225: %endif michael@224: michael@224: %build michael@224: # configure program michael@224: export CC="%{l_cc}" michael@224: export CFLAGS="%{l_cflags -O}" michael@224: export CPPFLAGS="%{l_cppflags libidn}" michael@224: export LDFLAGS="%{l_ldflags}" michael@224: export LIBS="" michael@224: case "%{l_platform -t}" in michael@224: *-linux* ) LIBS="$LIBS -ldl" ;; michael@224: *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;; michael@224: esac michael@224: export JHOME=%{l_prefix}/var/jabberd michael@224: %if "%{with_mysql}" == "yes" michael@224: CPPFLAGS="$CPPFLAGS %{l_cppflags mysql}" michael@224: LDFLAGS="$LDFLAGS %{l_ldflags mysql}" michael@224: LIBS="$LIBS -lz -lm" michael@224: %endif michael@224: %if "%{with_pgsql}" == "yes" michael@224: CPPFLAGS="$CPPFLAGS %{l_cppflags postgresql}" michael@224: %endif michael@224: ./configure \ michael@224: --prefix=%{l_prefix} \ michael@224: --sysconfdir=%{l_prefix}/etc/jabberd \ michael@224: --mandir=%{l_prefix}/man \ michael@224: --enable-db \ michael@224: --enable-fs \ michael@224: --enable-pipe \ michael@224: --enable-ssl \ michael@225: --enable-debug \ michael@224: --with-sasl=gsasl \ michael@224: %if "%{with_sqlite}" == "yes" michael@224: --enable-sqlite \ michael@224: %else michael@224: --disable-sqlite \ michael@224: %endif michael@224: %if "%{with_mysql}" == "yes" michael@224: --enable-mysql \ michael@224: %else michael@224: --disable-mysql \ michael@224: %endif michael@224: %if "%{with_pgsql}" == "yes" michael@224: --enable-pgsql \ michael@224: %else michael@224: --disable-pgsql \ michael@224: %endif michael@224: %if "%{with_pam}" == "yes" michael@224: --enable-pam \ michael@224: %else michael@224: --disable-pam \ michael@224: %endif michael@224: --disable-oracle \ michael@224: --enable-static \ michael@224: --enable-shared michael@224: michael@224: # build program michael@225: %{l_make} %{l_mflags -O} michael@225: michael@225: %if "%{with_mucon}" == "yes" michael@225: loclibs='' michael@225: case "%{l_platform -t}" in michael@225: *-sunos* ) michael@225: loclibs='-lsocket -lnsl' michael@225: ;; michael@225: esac michael@225: ( cd mu-conference_%{V_mucon} michael@225: %{l_make} %{l_mflags -O} LOCLIBS=$loclibs michael@225: ) || exit $? michael@225: %endif michael@224: michael@224: %install michael@224: # create installation filesystem structure michael@224: rm -rf $RPM_BUILD_ROOT michael@224: %{l_shtool} mkdir -f -p -m 755 \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log michael@224: michael@225: # install required components michael@224: %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT michael@224: michael@225: # install optional components michael@225: %if "%{with_mucon}" == "yes" michael@225: %{l_shtool} mkdir -f -p -m 755 \ michael@225: $RPM_BUILD_ROOT%{l_prefix}/share/jabberd \ michael@225: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/logs \ michael@225: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/rooms michael@225: %{l_shtool} install -c -m 644 \ michael@225: mu-conference_%{V_mucon}/muc-default.xml \ michael@225: $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/muc.xml michael@225: %{l_shtool} install -c \ michael@225: mu-conference_%{V_mucon}/src/mu-conference \ michael@225: $RPM_BUILD_ROOT%{l_prefix}/bin/ michael@225: %{l_shtool} install -c \ michael@225: mu-conference_%{V_mucon}/style.css \ michael@225: $RPM_BUILD_ROOT%{l_prefix}/share/jabberd michael@225: %endif michael@225: michael@225: # strip installation michael@225: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true michael@225: michael@224: # remove unnecessary files michael@224: rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist michael@224: rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist michael@224: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a michael@224: michael@224: # install run-command script michael@224: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@225: %if "%{with_mucon}" == "yes" michael@225: -e 's;\(jabberd_daemons\s*=.*\)\s\s*\(\w\w*\);\1 mucon\2;' \ michael@225: %endif michael@224: %{SOURCE rc.jabberd} \ michael@224: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@224: michael@224: # determine installation files michael@224: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@224: %{l_files_std} \ michael@224: '%config %{l_prefix}/etc/jabberd/*' \ michael@224: '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \ michael@224: '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*' michael@224: michael@224: %files -f files michael@224: michael@224: %clean michael@224: rm -rf $RPM_BUILD_ROOT michael@224: michael@224: %post michael@224: # after upgrade, restart service michael@224: [ $1 -eq 2 ] || exit 0 michael@224: eval `%{l_rc} jabberd status 2>/dev/null` michael@224: [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart michael@224: exit 0 michael@224: michael@224: %preun michael@224: # before erase, stop service and remove log files michael@224: [ $1 -eq 0 ] || exit 0 michael@224: %{l_rc} jabberd stop 2>/dev/null michael@224: rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true michael@224: exit 0 michael@224: