jabberd.spec 6.3 KB

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