jabberd.spec 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. *-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. --enable-db \
  114. --enable-fs \
  115. --enable-gsasl \
  116. --enable-idn \
  117. --enable-pipe \
  118. --enable-ssl \
  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-cyrus \
  140. --disable-oracle \
  141. --enable-static \
  142. --enable-shared
  143. # build program
  144. %{l_make} %{l_mflags}
  145. %install
  146. # create installation filesystem structure
  147. rm -rf $RPM_BUILD_ROOT
  148. %{l_shtool} mkdir -f -p -m 755 \
  149. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  150. $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \
  151. $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \
  152. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \
  153. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \
  154. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \
  155. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log
  156. # install components
  157. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  158. # remove unnecessary files
  159. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist
  160. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist
  161. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a
  162. # install run-command script
  163. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  164. %{SOURCE rc.jabberd} \
  165. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  166. # determine installation files
  167. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  168. %{l_files_std} \
  169. '%config %{l_prefix}/etc/jabberd/*' \
  170. '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \
  171. '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*'
  172. %files -f files
  173. %clean
  174. rm -rf $RPM_BUILD_ROOT
  175. %post
  176. # after upgrade, restart service
  177. [ $1 -eq 2 ] || exit 0
  178. eval `%{l_rc} jabberd status 2>/dev/null`
  179. [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart
  180. exit 0
  181. %preun
  182. # before erase, stop service and remove log files
  183. [ $1 -eq 0 ] || exit 0
  184. %{l_rc} jabberd stop 2>/dev/null
  185. rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true
  186. exit 0