Thu, 24 Mar 2011 20:08:25 +0100
Import new package spec for introduction into repository.
michael@224 | 1 | ## |
michael@224 | 2 | ## jabberd.spec -- OpenPKG RPM Package Specification |
michael@224 | 3 | ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@224 | 4 | ## |
michael@224 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@224 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@224 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@224 | 8 | ## copies. |
michael@224 | 9 | ## |
michael@224 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@224 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@224 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@224 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@224 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@224 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@224 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@224 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@224 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@224 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@224 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@224 | 21 | ## SUCH DAMAGE. |
michael@224 | 22 | ## |
michael@224 | 23 | |
michael@224 | 24 | # package version |
michael@224 | 25 | %define V_major 2.2 |
michael@303 | 26 | %define V_minor 11 |
michael@225 | 27 | %define V_mucon 0.8 |
michael@224 | 28 | |
michael@224 | 29 | # package information |
michael@224 | 30 | Name: jabberd |
michael@224 | 31 | Summary: Jabber Instant Messaging Daemon |
michael@224 | 32 | URL: http://jabberd2.xiaoka.com/ |
michael@224 | 33 | Vendor: Jabber Software Foundation |
michael@224 | 34 | Packager: OpenPKG Foundation e.V. |
michael@224 | 35 | Distribution: OpenPKG Community |
michael@224 | 36 | Class: PLUS |
michael@224 | 37 | Group: InstantMessaging |
michael@224 | 38 | License: JOSL/GPL |
michael@224 | 39 | Version: %{V_major}.%{V_minor} |
michael@225 | 40 | Release: 20091028 |
michael@224 | 41 | |
michael@224 | 42 | # package options |
michael@225 | 43 | %option with_mucon yes |
michael@225 | 44 | %option with_sqlite yes |
michael@224 | 45 | %option with_mysql no |
michael@224 | 46 | %option with_pgsql no |
michael@224 | 47 | %option with_pam no |
michael@224 | 48 | |
michael@224 | 49 | # list of sources |
michael@224 | 50 | Source0: http://codex.xiaoka.com/pub/jabberd2/releases/jabberd-%{version}.tar.gz |
michael@225 | 51 | Source1: http://download.gna.org/mu-conference/mu-conference_%{V_mucon}.tar.gz |
michael@225 | 52 | Source2: rc.jabberd |
michael@224 | 53 | Patch0: jabberd.patch |
michael@224 | 54 | |
michael@224 | 55 | # build information |
michael@224 | 56 | Prefix: %{l_prefix} |
michael@224 | 57 | BuildRoot: %{l_buildroot} |
michael@224 | 58 | BuildPreReq: OpenPKG, openpkg >= 20060823, make |
michael@224 | 59 | PreReq: OpenPKG, openpkg >= 20060823, perl |
michael@224 | 60 | BuildPreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns |
michael@224 | 61 | PreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns |
michael@225 | 62 | %if "%{with_mucon}" == "yes" |
michael@225 | 63 | BuildPreReq: glib2 |
michael@225 | 64 | PreReq: glib2 |
michael@225 | 65 | %endif |
michael@224 | 66 | %if "%{with_sqlite}" == "yes" |
michael@224 | 67 | BuildPreReq: sqlite |
michael@224 | 68 | PreReq: sqlite |
michael@224 | 69 | %endif |
michael@224 | 70 | %if "%{with_mysql}" == "yes" |
michael@224 | 71 | BuildPreReq: mysql |
michael@224 | 72 | PreReq: mysql |
michael@224 | 73 | %endif |
michael@224 | 74 | %if "%{with_pgsql}" == "yes" |
michael@224 | 75 | BuildPreReq: postgresql |
michael@224 | 76 | PreReq: postgresql |
michael@224 | 77 | %endif |
michael@224 | 78 | %if "%{with_pam}" == "yes" |
michael@224 | 79 | BuildPreReq: PAM |
michael@224 | 80 | PreReq: PAM |
michael@224 | 81 | %endif |
michael@224 | 82 | AutoReq: no |
michael@224 | 83 | AutoReqProv: no |
michael@224 | 84 | |
michael@224 | 85 | %description |
michael@224 | 86 | JabberD is the original server implementation for the Jabber instant |
michael@224 | 87 | messaging platform. JabberD 2 is the next generation of the JabberD |
michael@224 | 88 | server. It has been rewritten from the ground up to be scalable, |
michael@224 | 89 | architecturally sound, and to support the latest protocol extensions |
michael@224 | 90 | coming out of the JSF. |
michael@224 | 91 | |
michael@224 | 92 | %track |
michael@224 | 93 | prog jabberd = { |
michael@224 | 94 | version = %{version} |
michael@224 | 95 | url = http://codex.xiaoka.com/pub/jabberd2/releases/ |
michael@224 | 96 | regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.gz |
michael@224 | 97 | } |
michael@225 | 98 | prog jabberd:mucon = { |
michael@225 | 99 | version = %{V_mucon} |
michael@225 | 100 | url = http://download.gna.org/mu-conference/ |
michael@225 | 101 | regex = mu-conference_(__VER__)\.tar\.gz |
michael@225 | 102 | } |
michael@224 | 103 | |
michael@224 | 104 | %prep |
michael@224 | 105 | %setup -q -n jabberd-%{version} |
michael@225 | 106 | %setup -q -D -T -a 1 |
michael@224 | 107 | %{l_sed} <%{PATCH0} -e 's;@l_prefix@;%{l_prefix};g' | %{l_patch} -p0 -b |
michael@224 | 108 | %{l_shtool} subst \ |
michael@224 | 109 | -e 's;exec perl;exec %{l_prefix}/bin/perl;' \ |
michael@224 | 110 | tools/jabberd.in |
michael@225 | 111 | %if "%{with_mucon}" == "yes" |
michael@225 | 112 | %{l_shtool} subst \ |
michael@225 | 113 | -e 's;^\(CFLAGS\ *:=.*pkg-config --cflags glib-2.0\);\1 libidn;' \ |
michael@225 | 114 | -e 's;^\(LIBS\ *:=.*\);\1 $(LOCLIBS);' \ |
michael@225 | 115 | mu-conference_%{V_mucon}/src/Makefile |
michael@225 | 116 | %{l_shtool} subst \ |
michael@225 | 117 | -e 's;mu-conference.log;muc.log;g' \ |
michael@225 | 118 | mu-conference_%{V_mucon}/src/jcomp/jcr_log.c |
michael@225 | 119 | %{l_shtool} subst \ |
michael@225 | 120 | -e 's;<port>[0-9][0-9]*</port>;<port>5347</port>;' \ |
michael@225 | 121 | -e 's;<spool>.*</spool>;<spool>%{l_prefix}/var/jabberd/spool/rooms</spool>;' \ |
michael@225 | 122 | -e 's;<logdir>\./syslogs</logdir>;<logdir>%{l_prefix}/var/jabberd/log</logdir>;' \ |
michael@225 | 123 | -e 's;<logdir>\./logs/</logdir>;<logdir>%{l_prefix}/var/jabberd/spool/logs</logdir>;' \ |
michael@225 | 124 | -e 's;<pidfile>.*</pidfile>;<pidfile>%{l_prefix}/var/jabberd/pid/muc.pid</pidfile>;' \ |
michael@225 | 125 | -e 's;<URL>.*</URL>;<URL>http://name.host.tld/</URL>;' \ |
michael@225 | 126 | -e 's;<stylesheet>.*</stylesheet>;<stylesheet>%{l_prefix}/share/jabberd/style.css</stylesheet>;' \ |
michael@225 | 127 | mu-conference_%{V_mucon}/muc-default.xml |
michael@225 | 128 | echo \ |
michael@225 | 129 | 'muc @sysconfdir@/muc.xml' \ |
michael@225 | 130 | >>etc/jabberd.cfg.dist.in |
michael@225 | 131 | %endif |
michael@224 | 132 | |
michael@224 | 133 | %build |
michael@224 | 134 | # configure program |
michael@224 | 135 | export CC="%{l_cc}" |
michael@224 | 136 | export CFLAGS="%{l_cflags -O}" |
michael@224 | 137 | export CPPFLAGS="%{l_cppflags libidn}" |
michael@224 | 138 | export LDFLAGS="%{l_ldflags}" |
michael@224 | 139 | export LIBS="" |
michael@224 | 140 | case "%{l_platform -t}" in |
michael@224 | 141 | *-linux* ) LIBS="$LIBS -ldl" ;; |
michael@224 | 142 | *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;; |
michael@224 | 143 | esac |
michael@224 | 144 | export JHOME=%{l_prefix}/var/jabberd |
michael@224 | 145 | %if "%{with_mysql}" == "yes" |
michael@224 | 146 | CPPFLAGS="$CPPFLAGS %{l_cppflags mysql}" |
michael@224 | 147 | LDFLAGS="$LDFLAGS %{l_ldflags mysql}" |
michael@224 | 148 | LIBS="$LIBS -lz -lm" |
michael@224 | 149 | %endif |
michael@224 | 150 | %if "%{with_pgsql}" == "yes" |
michael@224 | 151 | CPPFLAGS="$CPPFLAGS %{l_cppflags postgresql}" |
michael@224 | 152 | %endif |
michael@224 | 153 | ./configure \ |
michael@224 | 154 | --prefix=%{l_prefix} \ |
michael@224 | 155 | --sysconfdir=%{l_prefix}/etc/jabberd \ |
michael@224 | 156 | --mandir=%{l_prefix}/man \ |
michael@224 | 157 | --enable-db \ |
michael@224 | 158 | --enable-fs \ |
michael@224 | 159 | --enable-pipe \ |
michael@224 | 160 | --enable-ssl \ |
michael@225 | 161 | --enable-debug \ |
michael@224 | 162 | --with-sasl=gsasl \ |
michael@224 | 163 | %if "%{with_sqlite}" == "yes" |
michael@224 | 164 | --enable-sqlite \ |
michael@224 | 165 | %else |
michael@224 | 166 | --disable-sqlite \ |
michael@224 | 167 | %endif |
michael@224 | 168 | %if "%{with_mysql}" == "yes" |
michael@224 | 169 | --enable-mysql \ |
michael@224 | 170 | %else |
michael@224 | 171 | --disable-mysql \ |
michael@224 | 172 | %endif |
michael@224 | 173 | %if "%{with_pgsql}" == "yes" |
michael@224 | 174 | --enable-pgsql \ |
michael@224 | 175 | %else |
michael@224 | 176 | --disable-pgsql \ |
michael@224 | 177 | %endif |
michael@224 | 178 | %if "%{with_pam}" == "yes" |
michael@224 | 179 | --enable-pam \ |
michael@224 | 180 | %else |
michael@224 | 181 | --disable-pam \ |
michael@224 | 182 | %endif |
michael@224 | 183 | --disable-oracle \ |
michael@224 | 184 | --enable-static \ |
michael@224 | 185 | --enable-shared |
michael@224 | 186 | |
michael@224 | 187 | # build program |
michael@225 | 188 | %{l_make} %{l_mflags -O} |
michael@225 | 189 | |
michael@225 | 190 | %if "%{with_mucon}" == "yes" |
michael@225 | 191 | loclibs='' |
michael@225 | 192 | case "%{l_platform -t}" in |
michael@225 | 193 | *-sunos* ) |
michael@225 | 194 | loclibs='-lsocket -lnsl' |
michael@225 | 195 | ;; |
michael@225 | 196 | esac |
michael@225 | 197 | ( cd mu-conference_%{V_mucon} |
michael@225 | 198 | %{l_make} %{l_mflags -O} LOCLIBS=$loclibs |
michael@225 | 199 | ) || exit $? |
michael@225 | 200 | %endif |
michael@224 | 201 | |
michael@224 | 202 | %install |
michael@224 | 203 | # create installation filesystem structure |
michael@224 | 204 | rm -rf $RPM_BUILD_ROOT |
michael@224 | 205 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@224 | 206 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \ |
michael@224 | 207 | $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \ |
michael@224 | 208 | $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \ |
michael@224 | 209 | $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \ |
michael@224 | 210 | $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \ |
michael@224 | 211 | $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \ |
michael@224 | 212 | $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log |
michael@224 | 213 | |
michael@225 | 214 | # install required components |
michael@224 | 215 | %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT |
michael@224 | 216 | |
michael@225 | 217 | # install optional components |
michael@225 | 218 | %if "%{with_mucon}" == "yes" |
michael@225 | 219 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@225 | 220 | $RPM_BUILD_ROOT%{l_prefix}/share/jabberd \ |
michael@225 | 221 | $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/logs \ |
michael@225 | 222 | $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/spool/rooms |
michael@225 | 223 | %{l_shtool} install -c -m 644 \ |
michael@225 | 224 | mu-conference_%{V_mucon}/muc-default.xml \ |
michael@225 | 225 | $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/muc.xml |
michael@225 | 226 | %{l_shtool} install -c \ |
michael@225 | 227 | mu-conference_%{V_mucon}/src/mu-conference \ |
michael@225 | 228 | $RPM_BUILD_ROOT%{l_prefix}/bin/ |
michael@225 | 229 | %{l_shtool} install -c \ |
michael@225 | 230 | mu-conference_%{V_mucon}/style.css \ |
michael@225 | 231 | $RPM_BUILD_ROOT%{l_prefix}/share/jabberd |
michael@225 | 232 | %endif |
michael@225 | 233 | |
michael@225 | 234 | # strip installation |
michael@225 | 235 | strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
michael@225 | 236 | |
michael@224 | 237 | # remove unnecessary files |
michael@224 | 238 | rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist |
michael@224 | 239 | rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist |
michael@224 | 240 | rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a |
michael@224 | 241 | |
michael@224 | 242 | # install run-command script |
michael@224 | 243 | %{l_shtool} install -c -m 755 %{l_value -s -a} \ |
michael@225 | 244 | %if "%{with_mucon}" == "yes" |
michael@225 | 245 | -e 's;\(jabberd_daemons\s*=.*\)\s\s*\(\w\w*\);\1 mucon\2;' \ |
michael@225 | 246 | %endif |
michael@224 | 247 | %{SOURCE rc.jabberd} \ |
michael@224 | 248 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@224 | 249 | |
michael@224 | 250 | # determine installation files |
michael@224 | 251 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@224 | 252 | %{l_files_std} \ |
michael@224 | 253 | '%config %{l_prefix}/etc/jabberd/*' \ |
michael@224 | 254 | '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \ |
michael@224 | 255 | '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*' |
michael@224 | 256 | |
michael@224 | 257 | %files -f files |
michael@224 | 258 | |
michael@224 | 259 | %clean |
michael@224 | 260 | rm -rf $RPM_BUILD_ROOT |
michael@224 | 261 | |
michael@224 | 262 | %post |
michael@224 | 263 | # after upgrade, restart service |
michael@224 | 264 | [ $1 -eq 2 ] || exit 0 |
michael@224 | 265 | eval `%{l_rc} jabberd status 2>/dev/null` |
michael@224 | 266 | [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart |
michael@224 | 267 | exit 0 |
michael@224 | 268 | |
michael@224 | 269 | %preun |
michael@224 | 270 | # before erase, stop service and remove log files |
michael@224 | 271 | [ $1 -eq 0 ] || exit 0 |
michael@224 | 272 | %{l_rc} jabberd stop 2>/dev/null |
michael@224 | 273 | rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true |
michael@224 | 274 | exit 0 |
michael@224 | 275 |