sasl.spec 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. ##
  2. ## sasl.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 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: 20041025
  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
  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;^ *for dbname in ;for dbname in db ;' \
  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. # configure package
  135. CC="%{l_cc}" \
  136. CFLAGS="$cflags" \
  137. CPPFLAGS="%{l_cppflags}" \
  138. LDFLAGS="$ldflags" \
  139. LIBS="$libs" \
  140. ./configure \
  141. --cache-file=./config.cache \
  142. --prefix=%{l_prefix} \
  143. --sysconfdir="%{l_prefix}/etc/sasl" \
  144. --with-plugindir=%{l_prefix}/lib/sasl \
  145. --with-saslauthd=%{l_prefix}/var/sasl/saslauthd \
  146. --with-dbpath=%{l_prefix}/var/sasl/sasldb \
  147. --with-dblib=berkeley \
  148. --with-bdb-incdir=%{l_prefix}/include \
  149. --with-bdb-libdir=%{l_prefix}/lib \
  150. --with-openssl=%{l_prefix} \
  151. %if "%{with_pam}" == "yes"
  152. --with-pam \
  153. %else
  154. --without-pam \
  155. %endif
  156. %if "%{with_login}" == "yes"
  157. --enable-login \
  158. %else
  159. --disable-login \
  160. %endif
  161. %if "%{with_ldap}" == "yes"
  162. --with-ldap=%{l_prefix} \
  163. %else
  164. --without-ldap \
  165. %endif
  166. %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_pgsql}" == "yes"
  167. --enable-sql \
  168. %if "%{with_mysql}" == "yes"
  169. --with-mysql=%{l_prefix} \
  170. %else
  171. --without-mysql \
  172. %endif
  173. %if "%{with_pgsql}" == "yes"
  174. --with-pgsql=%{l_prefix} \
  175. %else
  176. --without-pgsql \
  177. %endif
  178. %if "%{with_sqlite}" == "yes"
  179. --with-sqlite=%{l_prefix} \
  180. %else
  181. --without-sqlite \
  182. %endif
  183. %endif
  184. %if "%{with_ntlm}" == "yes"
  185. --enable-ntlm \
  186. %else
  187. --disable-ntlm \
  188. %endif
  189. %if "%{with_sasldb}" == "yes"
  190. --enable-auth-sasldb \
  191. %endif
  192. --enable-shared \
  193. --enable-static \
  194. --enable-staticdlopen \
  195. --disable-java \
  196. --disable-sample \
  197. --disable-krb4 \
  198. --disable-gssapi \
  199. --disable-otp \
  200. --without-des \
  201. --without-opie
  202. # post adjustment: trust me, libtool, I know what I am doing
  203. %{l_shtool} subst \
  204. -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \
  205. libtool
  206. # post adjustment: do not reference static plugins
  207. %{l_shtool} subst \
  208. -e '58s;.*;#define PIC;' \
  209. lib/dlopen.c
  210. # post adjustment: do not pull static plugins into static library
  211. %{l_shtool} subst \
  212. -e '/^SASL_STATIC_OBJS/s;\.\./plugins/[^ ]* *;;g' \
  213. lib/Makefile
  214. # post adjustment: build utils against static library
  215. %{l_shtool} subst \
  216. -e 's;\(\$(CCLD)\);\1 -static;' \
  217. utils/Makefile
  218. # post adjustment: fix OpenLDAP support
  219. %if "%{with_ldap}" == "yes"
  220. %{l_shtool} subst \
  221. -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \
  222. saslauthd/Makefile
  223. %endif
  224. # build package
  225. %{l_make} %{l_mflags}
  226. cd saslauthd
  227. %{l_make} %{l_mflags} testsaslauthd
  228. %install
  229. rm -rf $RPM_BUILD_ROOT
  230. # install package
  231. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  232. # remove libtool cruft
  233. rm -f \
  234. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \
  235. $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \
  236. $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \
  237. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.la \
  238. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a
  239. # post-adjust installation
  240. mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \
  241. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl
  242. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  243. # install saslauthd test program
  244. %{l_shtool} mkdir -f -p -m 755 \
  245. $RPM_BUILD_ROOT%{l_prefix}/sbin
  246. %{l_shtool} install -c -m 755 \
  247. saslauthd/testsaslauthd \
  248. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  249. # install saslauthd default configuration
  250. %{l_shtool} mkdir -f -p -m 755 \
  251. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl
  252. %{l_shtool} install -c -m 755 \
  253. %{SOURCE saslauthd.conf} \
  254. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/
  255. # install missing manual pages
  256. %{l_shtool} mkdir -f -p -m 755 \
  257. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  258. %{l_shtool} install -c -m 644 \
  259. utils/saslpasswd2.8 \
  260. utils/sasldblistusers2.8 \
  261. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  262. # create necessary additional directories
  263. %{l_shtool} mkdir -f -p -m 755 \
  264. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \
  265. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/saslauthd \
  266. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/apps
  267. # install run-command script
  268. %if "%{with_pam}" == "yes"
  269. l_authmech="pam"
  270. %else
  271. case "%{l_platform -t}" in
  272. *-linux* | *-sunos* ) l_authmech="shadow" ;;
  273. * ) l_authmech="getpwent" ;;
  274. esac
  275. %endif
  276. %{l_shtool} mkdir -f -p -m 755 \
  277. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  278. %{l_shtool} install -c -m 755 \
  279. -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \
  280. %{SOURCE rc.sasl} \
  281. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  282. # install OSSP fsl configuration
  283. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  284. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  285. %{SOURCE fsl.sasl} \
  286. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  287. # determine installation files
  288. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  289. %{l_files_std} \
  290. '%not %dir %{l_prefix}/etc/fsl' \
  291. '%config %{l_prefix}/etc/fsl/fsl.sasl' \
  292. '%config %{l_prefix}/etc/sasl/saslauthd.conf' \
  293. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \
  294. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/saslauthd' \
  295. '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log'
  296. %files -f files
  297. %clean
  298. rm -rf $RPM_BUILD_ROOT
  299. %pre
  300. # before upgrade, save status and stop service
  301. [ $1 -eq 2 ] || exit 0
  302. eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}`
  303. %{l_rc} sasl stop 2>/dev/null
  304. exit 0
  305. %post
  306. %if "%{with_pam}" == "yes"
  307. if [ $1 -eq 1 ]; then
  308. # after install, add PAM configuration entry
  309. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl
  310. fi
  311. %endif
  312. if [ $1 -eq 2 ]; then
  313. # after upgrade, restore status
  314. eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
  315. [ ".$sasl_active" = .yes ] && %{l_rc} sasl start
  316. fi
  317. exit 0
  318. %preun
  319. # before erase, stop service and remove log files
  320. [ $1 -eq 0 ] || exit 0
  321. %{l_rc} sasl stop 2>/dev/null
  322. rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true
  323. %if "%{with_pam}" == "yes"
  324. # remove PAM configuration entry
  325. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl
  326. %endif
  327. exit 0