michael@224: ##
michael@224: ## jabberd.spec -- OpenPKG RPM Package Specification
michael@540: ## Copyright (c) 2000-2011 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@541: %define V_minor 17
michael@768: %define V_mucon 0.8.81
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@768: Release: 20130000
michael@224:
michael@224: # package options
michael@693: %option with_sqlite yes
michael@224: %option with_mysql no
michael@224: %option with_pgsql no
michael@224: %option with_pam no
michael@541: %option with_mucon yes
michael@224:
michael@224: # list of sources
michael@541: Source0: http://www.github.com/downloads/Jabberd2/jabberd2/jabberd-%{version}.tar.xz
michael@768: Source1: http://download.gna.org/mu-conference/mu-conference-%{V_mucon}.tar.gz
michael@540: Source1: rc.jabberd
michael@224: Patch0: jabberd.patch
michael@224:
michael@224: # build information
michael@540: BuildPreReq: OpenPKG, openpkg >= 20100101, make
michael@540: PreReq: OpenPKG, openpkg >= 20100101, 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@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@541: %if "%{with_mucon}" == "yes"
michael@541: BuildPreReq: glib, pkgconfig
michael@541: PreReq: glib
michael@541: %endif
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@768: coming out of the XSF.
michael@224:
michael@224: %track
michael@224: prog jabberd = {
michael@224: version = %{version}
michael@541: url = http://www.github.com/downloads/Jabberd2/jabberd2/
michael@541: regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.xz
michael@541: }
michael@541: prog jabberd:mucon = {
michael@541: version = %{V_mucon}
michael@541: url = http://download.gna.org/mu-conference/
michael@768: regex = mu-conference-(__VER__)\.tar\.gz
michael@224: }
michael@224:
michael@224: %prep
michael@224: %setup -q -n jabberd-%{version}
michael@541: %setup -q -D -T -a 1
michael@693: %{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@541: %{l_shtool} subst \
michael@541: -e 's;\$(initdir);;g' \
michael@541: etc/Makefile.in
michael@541: %if "%{with_mucon}" == "yes"
michael@541: %{l_shtool} subst \
michael@541: -e 's;^\(CFLAGS\ *:=.*pkg-config --cflags glib-2.0\);\1 libidn;' \
michael@541: -e 's;^\(LIBS\ *:=.*\);\1 $(LOCLIBS);' \
michael@768: mu-conference-%{V_mucon}/src/Makefile
michael@541: %{l_shtool} subst \
michael@541: -e 's;mu-conference.log;muc.log;g' \
michael@768: mu-conference-%{V_mucon}/src/jcomp/jcr_log.c
michael@541: %{l_shtool} subst \
michael@541: -e 's;[0-9][0-9]*;5347;' \
michael@541: -e 's;.*;%{l_prefix}/var/jabberd/spool/rooms;' \
michael@541: -e 's;\./syslogs;%{l_prefix}/var/jabberd/log;' \
michael@541: -e 's;\./logs/;%{l_prefix}/var/jabberd/spool/logs;' \
michael@541: -e 's;.*;%{l_prefix}/var/jabberd/pid/muc.pid;' \
michael@541: -e 's;.*;http://name.host.tld/;' \
michael@541: -e 's;.*;%{l_prefix}/share/jabberd/style.css;' \
michael@768: mu-conference-%{V_mucon}/muc-default.xml
michael@541: echo \
michael@541: 'muc @sysconfdir@/muc.xml' \
michael@541: >>etc/jabberd.cfg.dist.in
michael@541: %endif
michael@224:
michael@224: %build
michael@224: # configure program
michael@540: ( echo "ac_cv_func_kqueue=no"
michael@540: ) >config.cache
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@540: --cache-file=./config.cache \
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@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@541: %{l_make} %{l_mflags -O}
michael@541:
michael@768: #http://www.suramya.com/linux/tutorials/JabberSetup/
michael@541: %if "%{with_mucon}" == "yes"
michael@541: loclibs=''
michael@541: case "%{l_platform -t}" in
michael@541: *-sunos* )
michael@541: loclibs='-lsocket -lnsl'
michael@541: ;;
michael@541: esac
michael@768: ( cd mu-conference-%{V_mucon}
michael@541: %{l_make} %{l_mflags -O} LOCLIBS=$loclibs
michael@541: ) || exit $?
michael@541: %endif
michael@224:
michael@224: %install
michael@224: # create installation filesystem structure
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@540: # install components
michael@224: %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@224:
michael@541: # install optional components
michael@541: %if "%{with_mucon}" == "yes"
michael@541: %{l_shtool} mkdir -f -p -m 755 \
michael@541: $RPM_BUILD_ROOT%{l_prefix}/share/jabberd \
michael@541: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/logs \
michael@541: $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/rooms
michael@541: %{l_shtool} install -c -m 644 \
michael@768: mu-conference-%{V_mucon}/muc-default.xml \
michael@541: $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/muc.xml
michael@541: %{l_shtool} install -c \
michael@768: mu-conference-%{V_mucon}/src/mu-conference \
michael@541: $RPM_BUILD_ROOT%{l_prefix}/bin/
michael@541: %{l_shtool} install -c \
michael@768: mu-conference-%{V_mucon}/style.css \
michael@541: $RPM_BUILD_ROOT%{l_prefix}/share/jabberd
michael@541: %endif
michael@541:
michael@541: # strip installation
michael@541: strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@541:
michael@224: # remove unnecessary files
michael@224: rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist
michael@782: rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/jabberd-*.conf
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@541: # install runcommand script
michael@224: %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@541: %if "%{with_mucon}" == "yes"
michael@541: -e 's;\(jabberd_daemons\s*=.*\)\s\s*\(\w\w*\);\1 mucon\2;' \
michael@541: %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@704: '%config %attr(0640,%{l_mgrp},%{l_ngrp}) %{l_prefix}/etc/jabberd/*' \
michael@224: '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \
michael@704: '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*' \
michael@704: '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*/*'
michael@224:
michael@224: %files -f files
michael@224:
michael@224: %clean
michael@224:
michael@224: %post
michael@782: if [ $1 -eq 1 ]; then
michael@782: # print information describing initial population of database
michael@782: ( echo "Jabberd stores data in SQL and requires an existing"
michael@782: echo "local or remote installation of PostgreSQL, MySQL, or"
michael@782: echo "SQLite. Please refer to online documentation to carry"
michael@782: echo "out the SQL configuration, something like:"
michael@782: echo ""
michael@782: %if "%{with_sqlite}" == "yes"
michael@782: echo "$RPM_INSTALL_PREFIX/bin/sqlite $RPM_INSTALL_PREFIX/var/jabberd/db/sqlite.db < $RPM_INSTALL_PREFIX/share/jabberd/db-setup.sqlite"
michael@782: %endif
michael@782: %if "%{with_pgsql}" == "yes"
michael@782: echo "template1=> \i $RPM_INSTALL_PREFIX/share/jabberd/db-setup.pgsql"
michael@782: %endif
michael@782: %if "%{with_mysql}" == "yes"
michael@782: echo "mysql> \. $RPM_INSTALL_PREFIX/share/jabberd/db-setup.mysql"
michael@782: %endif
michael@782: ) | %{l_rpmtool} msg -b -t notice
michael@782: fi
michael@782: [ $1 -eq 2 ] || exit 0
michael@782: # print information describing initial population of database
michael@782: ( echo "The jabberd installation is being upgraded. It may be"
michael@782: echo "necessary to upgrade the database structures as well."
michael@782: echo "To carry this out please refer to online documentation"
michael@782: echo "regarding the SQL configuration, something like:"
michael@782: echo ""
michael@782: %if "%{with_sqlite}" == "yes"
michael@782: echo "$RPM_INSTALL_PREFIX/bin/sqlite $RPM_INSTALL_PREFIX/var/jabberd/db/sqlite.db < $RPM_INSTALL_PREFIX/share/jabberd/db-update.sqlite"
michael@782: %endif
michael@782: %if "%{with_pgsql}" == "yes"
michael@782: echo "template1=> \i $RPM_INSTALL_PREFIX/share/jabberd/db-update.pgsql"
michael@782: %endif
michael@782: %if "%{with_mysql}" == "yes"
michael@782: echo "mysql> \. $RPM_INSTALL_PREFIX/share/jabberd/db-update.mysql"
michael@782: %endif
michael@782: ) | %{l_rpmtool} msg -b -t notice
michael@224: # after upgrade, restart service
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: