jabberd.spec 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 11
  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: 20070727
  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, config, sed
  52. PreReq: OpenPKG, openpkg >= 20060823, perl
  53. BuildPreReq: pth, openssl, libidn, libiconv
  54. PreReq: pth, openssl, libidn, libiconv
  55. BuildPreReq: db
  56. PreReq: db
  57. %if "%{with_sqlite}" == "yes"
  58. BuildPreReq: sqlite
  59. PreReq: sqlite
  60. %endif
  61. %if "%{with_mysql}" == "yes"
  62. BuildPreReq: mysql
  63. PreReq: mysql
  64. %endif
  65. %if "%{with_pgsql}" == "yes"
  66. BuildPreReq: postgresql
  67. PreReq: postgresql
  68. %endif
  69. %if "%{with_pam}" == "yes"
  70. BuildPreReq: PAM
  71. PreReq: PAM
  72. %endif
  73. AutoReq: no
  74. AutoReqProv: no
  75. %description
  76. JabberD is the original server implementation for the Jabber instant
  77. messaging platform. JabberD 2 is the next generation of the JabberD
  78. server. It has been rewritten from the ground up to be scalable,
  79. architecturally sound, and to support the latest protocol extensions
  80. coming out of the JSF.
  81. %track
  82. prog jabberd = {
  83. version = %{version}
  84. url = http://ftp.xiaoka.com/jabberd2/releases/
  85. regex = jabberd-(\d+\.\d+(\.\d+)*)\.tar\.gz
  86. }
  87. %prep
  88. %setup -q -n jabberd-%{version}
  89. %patch -p0
  90. %{l_prefix}/bin/config install
  91. %{l_shtool} subst \
  92. -e 's;exec perl;exec %{l_prefix}/bin/perl;' \
  93. tools/jabberd.in
  94. %build
  95. # configure program
  96. export CC="%{l_cc}"
  97. export CFLAGS="%{l_cflags -O}"
  98. export CPPFLAGS="%{l_cppflags pth libidn}"
  99. export LDFLAGS="%{l_ldflags pth}"
  100. export LIBS=""
  101. case "%{l_platform -t}" in
  102. *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
  103. esac
  104. export JHOME=%{l_prefix}/var/jabberd
  105. %if "%{with_mysql}" == "yes"
  106. CPPFLAGS="$CPPFLAGS %{l_cppflags mysql}"
  107. LDFLAGS="$LDFLAGS %{l_ldflags mysql}"
  108. %endif
  109. %if "%{with_pgsql}" == "yes"
  110. CPPFLAGS="$CPPFLAGS %{l_cppflags postgresql}"
  111. %endif
  112. ./configure \
  113. --prefix=%{l_prefix} \
  114. --sysconfdir=%{l_prefix}/etc/jabberd \
  115. --enable-ssl \
  116. --enable-idn \
  117. --enable-fs \
  118. --enable-db \
  119. --enable-pipe \
  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. --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