sasl.spec 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. ##
  2. ## sasl.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: sasl
  27. Summary: Simple Authentication and Security Layer (SASL)
  28. URL: http://asg.web.cmu.edu/sasl/
  29. Vendor: Cyrus Project, CMU
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [PLUS]
  32. Group: Cryptography
  33. License: BSD
  34. Version: 2.1.13
  35. Release: 20030624
  36. # package options
  37. %option with_fsl yes
  38. %option with_pam no
  39. %option with_login no
  40. %option with_ldap no
  41. %option with_mysql no
  42. # list of sources
  43. Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-%{version}.tar.gz
  44. Source1: rc.sasl
  45. Source2: fsl.sasl
  46. Source3: saslauthd.conf
  47. Patch0: sasl.patch
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20030415, db >= 4.1.24, gcc, openssl
  52. PreReq: OpenPKG, openpkg >= 20030415, db >= 4.1.24
  53. %if "%{with_fsl}" == "yes"
  54. BuildPreReq: fsl
  55. PreReq: fsl
  56. %endif
  57. %if "%{with_pam}" == "yes"
  58. BuildPreReq: PAM
  59. PreReq: PAM
  60. %endif
  61. %if "%{with_ldap}" == "yes"
  62. BuildPreReq: openldap
  63. %endif
  64. %if "%{with_mysql}" == "yes"
  65. BuildPreReq: MYSQL
  66. %endif
  67. AutoReq: no
  68. AutoReqProv: no
  69. %description
  70. SASL is the Simple Authentication and Security Layer, a method
  71. for adding authentication support to connection-based protocols.
  72. To use SASL, a protocol includes a command for identifying and
  73. authenticating a user to a server and for optionally negotiating
  74. protection of subsequent protocol interactions. If its use is
  75. negotiated, a security layer is inserted between the protocol and
  76. the connection.
  77. %prep
  78. %setup -q -n cyrus-sasl-%{version}
  79. %patch -p0
  80. %build
  81. # disable some unwanted configure checks
  82. %{l_shtool} subst \
  83. -e 's;^ *for dbname in ;for dbname in db ;' \
  84. -e "s;javac;javac-xxx;g" \
  85. -e "s;javah;javah-xxx;g" \
  86. -e "s;javadoc;javadoc-xxx;g" \
  87. configure
  88. # fix OpenLDAP support
  89. %if "%{with_ldap}" == "yes"
  90. echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache
  91. %{l_shtool} subst \
  92. -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl \2;" \
  93. saslauthd/configure
  94. %endif
  95. # configure path to sasl-server config files
  96. %{l_shtool} subst \
  97. -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/apps;g' \
  98. lib/server.c
  99. # determine build flags
  100. cflags="%{l_cflags -O} %{l_cppflags}"
  101. ldflags="%{l_ldflags} %{l_fsl_ldflags}"
  102. libs="-ldb %{l_fsl_libs}"
  103. %if "%{with_ldap}" == "yes"
  104. cflags="$cflags -DAUTH_LDAP"
  105. %endif
  106. %if "%{with_mysql}" == "yes"
  107. libs="$libs -lz -lm"
  108. %endif
  109. # configure package
  110. CC="%{l_cc}" \
  111. CFLAGS="$cflags" \
  112. CPPFLAGS="%{l_cppflags}" \
  113. LDFLAGS="$ldflags" \
  114. LIBS="$libs" \
  115. ./configure \
  116. --prefix=%{l_prefix} \
  117. --sysconfdir="%{l_prefix}/etc/sasl" \
  118. --with-plugindir=%{l_prefix}/lib/sasl \
  119. --with-saslauthd=%{l_prefix}/var/sasl/saslauthd \
  120. --with-dbpath=%{l_prefix}/var/sasl/sasldb \
  121. --with-dblib=berkeley \
  122. --with-bdb-incdir=%{l_prefix}/include \
  123. --with-bdb-libdir=%{l_prefix}/lib \
  124. %if "%{with_pam}" == "yes"
  125. --with-pam \
  126. %else
  127. --without-pam \
  128. %endif
  129. %if "%{with_login}" == "yes"
  130. --enable-login \
  131. %else
  132. --disable-login \
  133. %endif
  134. %if "%{with_ldap}" == "yes"
  135. --with-ldap=%{l_prefix} \
  136. --with-openssl=%{l_prefix} \
  137. %else
  138. --without-ldap \
  139. --without-openssl \
  140. %endif
  141. %if "%{with_mysql}" == "yes"
  142. --with-mysql=%{l_prefix} \
  143. %else
  144. --without-mysql \
  145. %endif
  146. --enable-shared \
  147. --enable-static \
  148. --enable-staticdlopen \
  149. --disable-java \
  150. --disable-sample \
  151. --disable-krb4 \
  152. --disable-gssapi \
  153. --disable-otp \
  154. --without-des \
  155. --without-opie
  156. # post adjustment: trust me, libtool, I know what I am doing
  157. %{l_shtool} subst \
  158. -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \
  159. libtool
  160. # post adjustment: do not reference static plugins
  161. %{l_shtool} subst \
  162. -e '58s;.*;#define PIC;' \
  163. lib/dlopen.c
  164. # post adjustment: do not pull static plugins into static library
  165. %{l_shtool} subst \
  166. -e '/^SASL_STATIC_OBJS/s;\.\./plugins/[^ ]* *;;g' \
  167. lib/Makefile
  168. # post adjustment: build utils against static library
  169. %{l_shtool} subst \
  170. -e 's;\(\$(CCLD)\);\1 -static;' \
  171. utils/Makefile
  172. # build package
  173. %{l_make} %{l_mflags}
  174. cd saslauthd
  175. %{l_make} %{l_mflags} testsaslauthd
  176. %install
  177. rm -rf $RPM_BUILD_ROOT
  178. # install package
  179. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  180. # remove libtool cruft
  181. rm -f \
  182. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \
  183. $RPM_BUILD_ROOT%{l_prefix}/lib/*.so \
  184. $RPM_BUILD_ROOT%{l_prefix}/lib/*.so.* \
  185. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.la \
  186. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a
  187. # post-adjust installation
  188. mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \
  189. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl
  190. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  191. # install saslauthd test program
  192. %{l_shtool} mkdir -f -p -m 755 \
  193. $RPM_BUILD_ROOT%{l_prefix}/sbin
  194. %{l_shtool} install -c -m 755 \
  195. saslauthd/testsaslauthd \
  196. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  197. # install saslauthd default configuration
  198. %{l_shtool} mkdir -f -p -m 755 \
  199. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl
  200. %{l_shtool} install -c -m 755 \
  201. %{SOURCE saslauthd.conf} \
  202. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/
  203. # install missing manual pages
  204. %{l_shtool} mkdir -f -p -m 755 \
  205. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  206. %{l_shtool} install -c -m 644 \
  207. utils/saslpasswd2.8 \
  208. utils/sasldblistusers2.8 \
  209. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  210. # create necessary additional directories
  211. %{l_shtool} mkdir -f -p -m 755 \
  212. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \
  213. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/saslauthd \
  214. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/apps
  215. # install run-command script
  216. %if "%{with_pam}" == "yes"
  217. l_authmech="pam"
  218. %else
  219. case "%{l_target}" in
  220. *-linux* | *-solaris* ) l_authmech="shadow" ;;
  221. * ) l_authmech="getpwent" ;;
  222. esac
  223. %endif
  224. %{l_shtool} mkdir -f -p -m 755 \
  225. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  226. %{l_shtool} install -c -m 755 \
  227. -e "s;@l_authmech@;${l_authmech};g" \
  228. -e 's;@l_prefix@;%{l_prefix};g' \
  229. -e 's;@l_susr@;%{l_susr};g' \
  230. -e 's;@l_rusr@;%{l_rusr};g' \
  231. -e 's;@l_rgrp@;%{l_rgrp};g' \
  232. %{SOURCE rc.sasl} \
  233. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  234. # OSSP fake syslog library
  235. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  236. %{l_shtool} install -c -m 644 \
  237. -e 's;@l_prefix@;%{l_prefix};g' \
  238. %{SOURCE fsl.%{name}} \
  239. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  240. # determine installation files
  241. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  242. %{l_files_std} \
  243. '%not %dir %{l_prefix}/etc/fsl' \
  244. '%config %{l_prefix}/etc/fsl/fsl.%{name}' \
  245. '%config %{l_prefix}/etc/sasl/saslauthd.conf' \
  246. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \
  247. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/saslauthd' \
  248. '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log'
  249. %files -f files
  250. %clean
  251. rm -rf $RPM_BUILD_ROOT