jabberd.spec 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. ##
  2. ## jabberd.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_major 2.2
  25. %define V_minor 3
  26. # package information
  27. Name: jabberd
  28. Summary: Jabber Instant Messaging Daemon
  29. URL: http://jabberd2.xiaoka.com/
  30. Vendor: Jabber Software Foundation
  31. Packager: OpenPKG Foundation e.V.
  32. Distribution: OpenPKG Community
  33. Class: PLUS
  34. Group: InstantMessaging
  35. License: JOSL/GPL
  36. Version: %{V_major}.%{V_minor}
  37. Release: 20080810
  38. # package options
  39. %option with_sqlite no
  40. %option with_mysql no
  41. %option with_pgsql no
  42. %option with_pam no
  43. # list of sources
  44. Source0: http://ftp.xiaoka.com/jabberd2/releases/jabberd-%{version}.tar.gz
  45. Source1: rc.jabberd
  46. Patch0: jabberd.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20060823, make
  51. PreReq: OpenPKG, openpkg >= 20060823, perl
  52. BuildPreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns
  53. PreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl, udns
  54. %if "%{with_sqlite}" == "yes"
  55. BuildPreReq: sqlite
  56. PreReq: sqlite
  57. %endif
  58. %if "%{with_mysql}" == "yes"
  59. BuildPreReq: mysql
  60. PreReq: mysql
  61. %endif
  62. %if "%{with_pgsql}" == "yes"
  63. BuildPreReq: postgresql
  64. PreReq: postgresql
  65. %endif
  66. %if "%{with_pam}" == "yes"
  67. BuildPreReq: PAM
  68. PreReq: PAM
  69. %endif
  70. AutoReq: no
  71. AutoReqProv: no
  72. %description
  73. JabberD is the original server implementation for the Jabber instant
  74. messaging platform. JabberD 2 is the next generation of the JabberD
  75. server. It has been rewritten from the ground up to be scalable,
  76. architecturally sound, and to support the latest protocol extensions
  77. coming out of the JSF.
  78. %track
  79. prog jabberd = {
  80. version = %{version}
  81. url = http://ftp.xiaoka.com/jabberd2/releases/
  82. regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.gz
  83. }
  84. %prep
  85. %setup -q -n jabberd-%{version}
  86. %{l_sed} <%{PATCH0} -e 's;@l_prefix@;%{l_prefix};g' | %{l_patch} -p0 -b
  87. %{l_shtool} subst \
  88. -e 's;exec perl;exec %{l_prefix}/bin/perl;' \
  89. tools/jabberd.in
  90. %build
  91. # configure program
  92. export CC="%{l_cc}"
  93. export CFLAGS="%{l_cflags -O}"
  94. export CPPFLAGS="%{l_cppflags libidn}"
  95. export LDFLAGS="%{l_ldflags}"
  96. export LIBS=""
  97. case "%{l_platform -t}" in
  98. *-linux* ) LIBS="$LIBS -ldl" ;;
  99. *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
  100. esac
  101. export JHOME=%{l_prefix}/var/jabberd
  102. %if "%{with_mysql}" == "yes"
  103. CPPFLAGS="$CPPFLAGS %{l_cppflags mysql}"
  104. LDFLAGS="$LDFLAGS %{l_ldflags mysql}"
  105. LIBS="$LIBS -lz -lm"
  106. %endif
  107. %if "%{with_pgsql}" == "yes"
  108. CPPFLAGS="$CPPFLAGS %{l_cppflags postgresql}"
  109. %endif
  110. ./configure \
  111. --prefix=%{l_prefix} \
  112. --sysconfdir=%{l_prefix}/etc/jabberd \
  113. --mandir=%{l_prefix}/man \
  114. --enable-db \
  115. --enable-fs \
  116. --enable-pipe \
  117. --enable-ssl \
  118. --with-sasl=gsasl \
  119. %if "%{with_sqlite}" == "yes"
  120. --enable-sqlite \
  121. %else
  122. --disable-sqlite \
  123. %endif
  124. %if "%{with_mysql}" == "yes"
  125. --enable-mysql \
  126. %else
  127. --disable-mysql \
  128. %endif
  129. %if "%{with_pgsql}" == "yes"
  130. --enable-pgsql \
  131. %else
  132. --disable-pgsql \
  133. %endif
  134. %if "%{with_pam}" == "yes"
  135. --enable-pam \
  136. %else
  137. --disable-pam \
  138. %endif
  139. --disable-oracle \
  140. --enable-static \
  141. --enable-shared
  142. # build program
  143. %{l_make} %{l_mflags}
  144. %install
  145. # create installation filesystem structure
  146. rm -rf $RPM_BUILD_ROOT
  147. %{l_shtool} mkdir -f -p -m 755 \
  148. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  149. $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \
  150. $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \
  151. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \
  152. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \
  153. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \
  154. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log
  155. # install components
  156. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  157. # remove unnecessary files
  158. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist
  159. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist
  160. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a
  161. # install run-command script
  162. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  163. %{SOURCE rc.jabberd} \
  164. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  165. # determine installation files
  166. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  167. %{l_files_std} \
  168. '%config %{l_prefix}/etc/jabberd/*' \
  169. '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \
  170. '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*'
  171. %files -f files
  172. %clean
  173. rm -rf $RPM_BUILD_ROOT
  174. %post
  175. # after upgrade, restart service
  176. [ $1 -eq 2 ] || exit 0
  177. eval `%{l_rc} jabberd status 2>/dev/null`
  178. [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart
  179. exit 0
  180. %preun
  181. # before erase, stop service and remove log files
  182. [ $1 -eq 0 ] || exit 0
  183. %{l_rc} jabberd stop 2>/dev/null
  184. rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true
  185. exit 0