jabberd.spec 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 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: 20080716
  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. %if "%{with_sqlite}" == "yes"
  119. --enable-sqlite \
  120. %else
  121. --disable-sqlite \
  122. %endif
  123. %if "%{with_mysql}" == "yes"
  124. --enable-mysql \
  125. %else
  126. --disable-mysql \
  127. %endif
  128. %if "%{with_pgsql}" == "yes"
  129. --enable-pgsql \
  130. %else
  131. --disable-pgsql \
  132. %endif
  133. %if "%{with_pam}" == "yes"
  134. --enable-pam \
  135. %else
  136. --disable-pam \
  137. %endif
  138. --disable-oracle \
  139. --enable-static \
  140. --enable-shared
  141. # build program
  142. %{l_make} %{l_mflags}
  143. %install
  144. # create installation filesystem structure
  145. rm -rf $RPM_BUILD_ROOT
  146. %{l_shtool} mkdir -f -p -m 755 \
  147. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  148. $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd \
  149. $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates \
  150. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd \
  151. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/db \
  152. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/pid \
  153. $RPM_BUILD_ROOT%{l_prefix}/var/jabberd/log
  154. # install components
  155. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  156. # remove unnecessary files
  157. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/*.dist
  158. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/jabberd/templates/*.dist
  159. rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/jabberd/*.a
  160. # install run-command script
  161. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  162. %{SOURCE rc.jabberd} \
  163. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  164. # determine installation files
  165. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  166. %{l_files_std} \
  167. '%config %{l_prefix}/etc/jabberd/*' \
  168. '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd' \
  169. '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jabberd/*'
  170. %files -f files
  171. %clean
  172. rm -rf $RPM_BUILD_ROOT
  173. %post
  174. # after upgrade, restart service
  175. [ $1 -eq 2 ] || exit 0
  176. eval `%{l_rc} jabberd status 2>/dev/null`
  177. [ ".$jabberd_active" = .yes ] && %{l_rc} jabberd restart
  178. exit 0
  179. %preun
  180. # before erase, stop service and remove log files
  181. [ $1 -eq 0 ] || exit 0
  182. %{l_rc} jabberd stop 2>/dev/null
  183. rm -f $RPM_INSTALL_PREFIX/var/jabberd/*.log* >/dev/null 2>&1 || true
  184. exit 0