sasl.spec 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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.14
  35. Release: 20030708
  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, gcc
  52. PreReq: OpenPKG, openpkg >= 20030415
  53. BuildPreReq: db >= 4.1.24, openssl
  54. PreReq: db >= 4.1.24, openssl
  55. %if "%{with_fsl}" == "yes"
  56. BuildPreReq: fsl
  57. PreReq: fsl
  58. %endif
  59. %if "%{with_pam}" == "yes"
  60. BuildPreReq: PAM
  61. PreReq: PAM
  62. %endif
  63. %if "%{with_ldap}" == "yes"
  64. BuildPreReq: openldap
  65. PreReq: openldap
  66. %endif
  67. %if "%{with_mysql}" == "yes"
  68. BuildPreReq: mysql
  69. PreReq: mysql
  70. %endif
  71. AutoReq: no
  72. AutoReqProv: no
  73. %description
  74. SASL is the Simple Authentication and Security Layer, a method
  75. for adding authentication support to connection-based protocols.
  76. To use SASL, a protocol includes a command for identifying and
  77. authenticating a user to a server and for optionally negotiating
  78. protection of subsequent protocol interactions. If its use is
  79. negotiated, a security layer is inserted between the protocol and
  80. the connection.
  81. %prep
  82. %setup -q -n cyrus-sasl-%{version}
  83. %patch -p0
  84. %build
  85. # disable some unwanted configure checks
  86. %{l_shtool} subst \
  87. -e 's;^ *for dbname in ;for dbname in db ;' \
  88. -e "s;javac;javac-xxx;g" \
  89. -e "s;javah;javah-xxx;g" \
  90. -e "s;javadoc;javadoc-xxx;g" \
  91. configure
  92. # fix OpenLDAP support
  93. %if "%{with_ldap}" == "yes"
  94. echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache
  95. %{l_shtool} subst \
  96. -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl \2;" \
  97. saslauthd/configure
  98. %endif
  99. # enforce disabled Kerberos 5 support in saslauthd
  100. echo 'ac_cv_header_krb5_h=no' >config.cache
  101. # configure path to sasl-server config files
  102. %{l_shtool} subst \
  103. -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/apps;g' \
  104. lib/server.c
  105. # determine build flags
  106. cflags="%{l_cflags -O} %{l_cppflags}"
  107. ldflags="%{l_ldflags} %{l_fsl_ldflags}"
  108. libs="-ldb %{l_fsl_libs}"
  109. %if "%{with_ldap}" == "yes"
  110. cflags="$cflags -DAUTH_LDAP"
  111. %endif
  112. %if "%{with_mysql}" == "yes"
  113. libs="$libs -lz -lm"
  114. %endif
  115. # configure package
  116. CC="%{l_cc}" \
  117. CFLAGS="$cflags" \
  118. CPPFLAGS="%{l_cppflags}" \
  119. LDFLAGS="$ldflags" \
  120. LIBS="$libs" \
  121. ./configure \
  122. --cache-file=./config.cache \
  123. --prefix=%{l_prefix} \
  124. --sysconfdir="%{l_prefix}/etc/sasl" \
  125. --with-plugindir=%{l_prefix}/lib/sasl \
  126. --with-saslauthd=%{l_prefix}/var/sasl/saslauthd \
  127. --with-dbpath=%{l_prefix}/var/sasl/sasldb \
  128. --with-dblib=berkeley \
  129. --with-bdb-incdir=%{l_prefix}/include \
  130. --with-bdb-libdir=%{l_prefix}/lib \
  131. --with-openssl=%{l_prefix} \
  132. %if "%{with_pam}" == "yes"
  133. --with-pam \
  134. %else
  135. --without-pam \
  136. %endif
  137. %if "%{with_login}" == "yes"
  138. --enable-login \
  139. %else
  140. --disable-login \
  141. %endif
  142. %if "%{with_ldap}" == "yes"
  143. --with-ldap=%{l_prefix} \
  144. %else
  145. --without-ldap \
  146. %endif
  147. %if "%{with_mysql}" == "yes"
  148. --with-mysql=%{l_prefix} \
  149. %else
  150. --without-mysql \
  151. %endif
  152. --enable-shared \
  153. --enable-static \
  154. --enable-staticdlopen \
  155. --disable-java \
  156. --disable-sample \
  157. --disable-krb4 \
  158. --disable-gssapi \
  159. --disable-otp \
  160. --without-des \
  161. --without-opie
  162. # post adjustment: trust me, libtool, I know what I am doing
  163. %{l_shtool} subst \
  164. -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \
  165. libtool
  166. # post adjustment: do not reference static plugins
  167. %{l_shtool} subst \
  168. -e '58s;.*;#define PIC;' \
  169. lib/dlopen.c
  170. # post adjustment: do not pull static plugins into static library
  171. %{l_shtool} subst \
  172. -e '/^SASL_STATIC_OBJS/s;\.\./plugins/[^ ]* *;;g' \
  173. lib/Makefile
  174. # post adjustment: build utils against static library
  175. %{l_shtool} subst \
  176. -e 's;\(\$(CCLD)\);\1 -static;' \
  177. utils/Makefile
  178. # build package
  179. %{l_make} %{l_mflags}
  180. cd saslauthd
  181. %{l_make} %{l_mflags} testsaslauthd
  182. %install
  183. rm -rf $RPM_BUILD_ROOT
  184. # install package
  185. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  186. # remove libtool cruft
  187. rm -f \
  188. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \
  189. $RPM_BUILD_ROOT%{l_prefix}/lib/*.so \
  190. $RPM_BUILD_ROOT%{l_prefix}/lib/*.so.* \
  191. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.la \
  192. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a
  193. # post-adjust installation
  194. mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \
  195. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl
  196. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  197. # install saslauthd test program
  198. %{l_shtool} mkdir -f -p -m 755 \
  199. $RPM_BUILD_ROOT%{l_prefix}/sbin
  200. %{l_shtool} install -c -m 755 \
  201. saslauthd/testsaslauthd \
  202. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  203. # install saslauthd default configuration
  204. %{l_shtool} mkdir -f -p -m 755 \
  205. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl
  206. %{l_shtool} install -c -m 755 \
  207. %{SOURCE saslauthd.conf} \
  208. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/
  209. # install missing manual pages
  210. %{l_shtool} mkdir -f -p -m 755 \
  211. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  212. %{l_shtool} install -c -m 644 \
  213. utils/saslpasswd2.8 \
  214. utils/sasldblistusers2.8 \
  215. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  216. # create necessary additional directories
  217. %{l_shtool} mkdir -f -p -m 755 \
  218. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \
  219. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/saslauthd \
  220. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/apps
  221. # install run-command script
  222. %if "%{with_pam}" == "yes"
  223. l_authmech="pam"
  224. %else
  225. case "%{l_target}" in
  226. *-linux* | *-solaris* ) l_authmech="shadow" ;;
  227. * ) l_authmech="getpwent" ;;
  228. esac
  229. %endif
  230. %{l_shtool} mkdir -f -p -m 755 \
  231. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  232. %{l_shtool} install -c -m 755 \
  233. -e "s;@l_authmech@;${l_authmech};g" \
  234. -e 's;@l_prefix@;%{l_prefix};g' \
  235. -e 's;@l_susr@;%{l_susr};g' \
  236. -e 's;@l_rusr@;%{l_rusr};g' \
  237. -e 's;@l_rgrp@;%{l_rgrp};g' \
  238. %{SOURCE rc.sasl} \
  239. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  240. # install OSSP fsl configuration
  241. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  242. %{l_shtool} install -c -m 644 \
  243. -e 's;@l_prefix@;%{l_prefix};g' \
  244. %{SOURCE fsl.sasl} \
  245. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  246. # determine installation files
  247. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  248. %{l_files_std} \
  249. '%not %dir %{l_prefix}/etc/fsl' \
  250. '%config %{l_prefix}/etc/fsl/fsl.sasl' \
  251. '%config %{l_prefix}/etc/sasl/saslauthd.conf' \
  252. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \
  253. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/saslauthd' \
  254. '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log'
  255. %files -f files
  256. %clean
  257. rm -rf $RPM_BUILD_ROOT