sasl.spec 8.6 KB

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