sasl.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. ##
  2. ## sasl.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2005 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2005 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2005 Cable & Wireless <http://www.cw.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
  32. Class: BASE
  33. Group: Cryptography
  34. License: BSD
  35. Version: 2.1.20
  36. Release: 20050321
  37. # package options
  38. %option with_fsl yes
  39. %option with_pam no
  40. %option with_login no
  41. %option with_ldap no
  42. %option with_mysql no
  43. %option with_pgsql no
  44. %option with_sqlite no
  45. %option with_ntlm no
  46. %option with_sasldb no
  47. # list of sources
  48. Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-%{version}.tar.gz
  49. Source1: rc.sasl
  50. Source2: fsl.sasl
  51. Source3: saslauthd.conf
  52. Patch0: sasl.patch
  53. # build information
  54. Prefix: %{l_prefix}
  55. BuildRoot: %{l_buildroot}
  56. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc, make, groff
  57. PreReq: OpenPKG, openpkg >= 20040130
  58. BuildPreReq: db >= 4.1.24, openssl
  59. PreReq: db >= 4.1.24, openssl
  60. %if "%{with_fsl}" == "yes"
  61. BuildPreReq: fsl >= 1.2.0
  62. PreReq: fsl >= 1.2.0
  63. %endif
  64. %if "%{with_pam}" == "yes"
  65. BuildPreReq: PAM
  66. PreReq: PAM
  67. %endif
  68. %if "%{with_ldap}" == "yes"
  69. BuildPreReq: openldap
  70. PreReq: openldap
  71. %endif
  72. %if "%{with_mysql}" == "yes"
  73. BuildPreReq: mysql
  74. PreReq: mysql
  75. %endif
  76. %if "%{with_pgsql}" == "yes"
  77. BuildPreReq: postgresql
  78. PreReq: postgresql
  79. %endif
  80. %if "%{with_sqlite}" == "yes"
  81. BuildPreReq: sqlite
  82. PreReq: sqlite
  83. %endif
  84. AutoReq: no
  85. AutoReqProv: no
  86. %description
  87. SASL is the Simple Authentication and Security Layer, a method
  88. for adding authentication support to connection-based protocols.
  89. To use SASL, a protocol includes a command for identifying and
  90. authenticating a user to a server and for optionally negotiating
  91. protection of subsequent protocol interactions. If its use is
  92. negotiated, a security layer is inserted between the protocol and
  93. the connection.
  94. %track
  95. prog sasl = {
  96. version = %{version}
  97. url = ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
  98. regex = cyrus-sasl-(\d+\.\d+\.\d+)\.tar\.gz
  99. }
  100. %prep
  101. %setup -q -n cyrus-sasl-%{version}
  102. %patch -p0
  103. %build
  104. # disable some unwanted configure checks
  105. %{l_shtool} subst \
  106. -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \
  107. -e "s;javac;javac-xxx;g" \
  108. -e "s;javah;javah-xxx;g" \
  109. -e "s;javadoc;javadoc-xxx;g" \
  110. configure
  111. # fix OpenLDAP support
  112. %if "%{with_ldap}" == "yes"
  113. echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache
  114. %{l_shtool} subst \
  115. -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl \2;" \
  116. saslauthd/configure
  117. %endif
  118. # enforce disabled Kerberos 5 support in saslauthd
  119. echo 'ac_cv_header_krb5_h=no' >config.cache
  120. # configure path to sasl-server config files
  121. %{l_shtool} subst \
  122. -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/apps;g' \
  123. lib/server.c
  124. # determine build flags
  125. cflags="%{l_cflags -O} %{l_cppflags}"
  126. ldflags="%{l_ldflags} %{l_fsl_ldflags}"
  127. libs="-ldb %{l_fsl_libs}"
  128. %if "%{with_ldap}" == "yes"
  129. cflags="$cflags -DAUTH_LDAP"
  130. %endif
  131. %if "%{with_mysql}" == "yes"
  132. libs="$libs -lz -lm"
  133. %endif
  134. case "%{l_platform -t}" in
  135. *-sunos* ) libs="$libs -lrt" ;;
  136. esac
  137. # configure package
  138. CC="%{l_cc}" \
  139. CFLAGS="$cflags" \
  140. CPPFLAGS="%{l_cppflags}" \
  141. LDFLAGS="$ldflags" \
  142. LIBS="$libs" \
  143. ./configure \
  144. --cache-file=./config.cache \
  145. --prefix=%{l_prefix} \
  146. --sysconfdir="%{l_prefix}/etc/sasl" \
  147. --with-plugindir=%{l_prefix}/lib/sasl \
  148. --with-saslauthd=%{l_prefix}/var/sasl/saslauthd \
  149. --with-dbpath=%{l_prefix}/var/sasl/sasldb \
  150. --with-dblib=berkeley \
  151. --with-bdb-incdir=%{l_prefix}/include \
  152. --with-bdb-libdir=%{l_prefix}/lib \
  153. --with-openssl=%{l_prefix} \
  154. %if "%{with_pam}" == "yes"
  155. --with-pam \
  156. %else
  157. --without-pam \
  158. %endif
  159. %if "%{with_login}" == "yes"
  160. --enable-login \
  161. %else
  162. --disable-login \
  163. %endif
  164. %if "%{with_ldap}" == "yes"
  165. --with-ldap=%{l_prefix} \
  166. %else
  167. --without-ldap \
  168. %endif
  169. %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_pgsql}" == "yes"
  170. --enable-sql \
  171. %if "%{with_mysql}" == "yes"
  172. --with-mysql=%{l_prefix} \
  173. %else
  174. --without-mysql \
  175. %endif
  176. %if "%{with_pgsql}" == "yes"
  177. --with-pgsql=%{l_prefix} \
  178. %else
  179. --without-pgsql \
  180. %endif
  181. %if "%{with_sqlite}" == "yes"
  182. --with-sqlite=%{l_prefix} \
  183. %else
  184. --without-sqlite \
  185. %endif
  186. %endif
  187. %if "%{with_ntlm}" == "yes"
  188. --enable-ntlm \
  189. %else
  190. --disable-ntlm \
  191. %endif
  192. %if "%{with_sasldb}" == "yes"
  193. --enable-auth-sasldb \
  194. %endif
  195. --enable-shared \
  196. --enable-static \
  197. --enable-staticdlopen \
  198. --disable-java \
  199. --disable-sample \
  200. --disable-krb4 \
  201. --disable-gssapi \
  202. --disable-otp \
  203. --without-des \
  204. --without-opie
  205. # post adjustment: trust me, libtool, I know what I am doing
  206. %{l_shtool} subst \
  207. -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \
  208. libtool
  209. # post adjustment: do not reference static plugins
  210. %{l_shtool} subst \
  211. -e '58s;.*;#define PIC;' \
  212. lib/dlopen.c
  213. # post adjustment: do not pull static plugins into static library
  214. %{l_shtool} subst \
  215. -e '/^SASL_STATIC_OBJS/s;\.\./plugins/[^ ]* *;;g' \
  216. lib/Makefile
  217. # post adjustment: build utils against static library
  218. %{l_shtool} subst \
  219. -e 's;\(\$(CCLD)\);\1 -static;' \
  220. -e 's;\(noinst.*=\) *dbconverter.*;\1;' \
  221. utils/Makefile
  222. # post adjustment: fix OpenLDAP support
  223. %if "%{with_ldap}" == "yes"
  224. %{l_shtool} subst \
  225. -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \
  226. saslauthd/Makefile
  227. %endif
  228. # build package
  229. %{l_make} %{l_mflags}
  230. cd saslauthd
  231. %{l_make} %{l_mflags} testsaslauthd
  232. %install
  233. rm -rf $RPM_BUILD_ROOT
  234. # install package
  235. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  236. # remove libtool cruft
  237. rm -f \
  238. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \
  239. $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \
  240. $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \
  241. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.la \
  242. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a
  243. # post-adjust installation
  244. mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \
  245. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl
  246. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  247. # install saslauthd test program
  248. %{l_shtool} mkdir -f -p -m 755 \
  249. $RPM_BUILD_ROOT%{l_prefix}/sbin
  250. %{l_shtool} install -c -m 755 \
  251. saslauthd/testsaslauthd \
  252. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  253. # install saslauthd default configuration
  254. %{l_shtool} mkdir -f -p -m 755 \
  255. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl
  256. %{l_shtool} install -c -m 755 \
  257. %{SOURCE saslauthd.conf} \
  258. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/
  259. # install missing manual pages
  260. %{l_shtool} mkdir -f -p -m 755 \
  261. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  262. %{l_shtool} install -c -m 644 \
  263. utils/saslpasswd2.8 \
  264. utils/sasldblistusers2.8 \
  265. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  266. # create necessary additional directories
  267. %{l_shtool} mkdir -f -p -m 755 \
  268. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \
  269. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/saslauthd \
  270. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/apps
  271. # install run-command script
  272. %if "%{with_pam}" == "yes"
  273. l_authmech="pam"
  274. %else
  275. case "%{l_platform -t}" in
  276. *-linux* | *-sunos* ) l_authmech="shadow" ;;
  277. * ) l_authmech="getpwent" ;;
  278. esac
  279. %endif
  280. %{l_shtool} mkdir -f -p -m 755 \
  281. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  282. %{l_shtool} install -c -m 755 \
  283. -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \
  284. %{SOURCE rc.sasl} \
  285. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  286. # install OSSP fsl configuration
  287. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  288. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  289. %{SOURCE fsl.sasl} \
  290. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  291. # determine installation files
  292. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  293. %{l_files_std} \
  294. '%not %dir %{l_prefix}/etc/fsl' \
  295. '%config %{l_prefix}/etc/fsl/fsl.sasl' \
  296. '%config %{l_prefix}/etc/sasl/saslauthd.conf' \
  297. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \
  298. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/saslauthd' \
  299. '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log'
  300. %files -f files
  301. %clean
  302. rm -rf $RPM_BUILD_ROOT
  303. %pre
  304. # before upgrade, save status and stop service
  305. [ $1 -eq 2 ] || exit 0
  306. eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}`
  307. %{l_rc} sasl stop 2>/dev/null
  308. exit 0
  309. %post
  310. %if "%{with_pam}" == "yes"
  311. if [ $1 -eq 1 ]; then
  312. # after install, add PAM configuration entry
  313. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl
  314. fi
  315. %endif
  316. if [ $1 -eq 2 ]; then
  317. # after upgrade, restore status
  318. eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
  319. [ ".$sasl_active" = .yes ] && %{l_rc} sasl start
  320. fi
  321. exit 0
  322. %preun
  323. # before erase, stop service and remove log files
  324. [ $1 -eq 0 ] || exit 0
  325. %{l_rc} sasl stop 2>/dev/null
  326. rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true
  327. %if "%{with_pam}" == "yes"
  328. # remove PAM configuration entry
  329. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl
  330. %endif
  331. exit 0