jabberd.spec 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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.1
  25. %define V_minor 24.1
  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: 20080427
  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
  53. PreReq: db, expat, libiconv, libidn, gpg-error, gcrypt, libgsasl, openssl
  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-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