sasl.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. ##
  2. ## sasl.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package information
  25. Name: sasl
  26. Summary: Simple Authentication and Security Layer (SASL)
  27. URL: http://asg.web.cmu.edu/sasl/
  28. Vendor: Cyrus Project, CMU
  29. Packager: OpenPKG Foundation e.V.
  30. Distribution: OpenPKG Community
  31. Class: BASE
  32. Group: Cryptography
  33. License: BSD
  34. Version: 2.1.22
  35. Release: 20061217
  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. %option with_pgsql no
  43. %option with_sqlite no
  44. %option with_ntlm no
  45. %option with_otp no
  46. %option with_gss no
  47. %option with_sasldb no
  48. # list of sources
  49. Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-%{version}.tar.gz
  50. Source1: rc.sasl
  51. Source2: fsl.sasl
  52. Source3: saslauthd.conf
  53. Patch0: sasl.patch
  54. # build information
  55. Prefix: %{l_prefix}
  56. BuildRoot: %{l_buildroot}
  57. BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, make, groff
  58. PreReq: OpenPKG, openpkg >= 20060823
  59. BuildPreReq: db >= 4.1.24, openssl
  60. PreReq: db >= 4.1.24, openssl
  61. %if "%{with_fsl}" == "yes"
  62. BuildPreReq: fsl >= 1.2.0
  63. PreReq: fsl >= 1.2.0
  64. %endif
  65. %if "%{with_pam}" == "yes"
  66. BuildPreReq: PAM
  67. PreReq: PAM
  68. %endif
  69. %if "%{with_ldap}" == "yes"
  70. BuildPreReq: openldap
  71. PreReq: openldap
  72. %endif
  73. %if "%{with_mysql}" == "yes"
  74. BuildPreReq: mysql
  75. PreReq: mysql
  76. %endif
  77. %if "%{with_pgsql}" == "yes"
  78. BuildPreReq: postgresql
  79. PreReq: postgresql
  80. %endif
  81. %if "%{with_sqlite}" == "yes"
  82. BuildPreReq: sqlite, sqlite::with_v2 = yes
  83. PreReq: sqlite, sqlite::with_v2 = yes
  84. %endif
  85. %if "%{with_otp}" == "yes"
  86. BuildPreReq: opie
  87. PreReq: opie
  88. %endif
  89. %if "%{with_gss}" == "yes"
  90. BuildPreReq: kerberos
  91. PreReq: kerberos
  92. %endif
  93. AutoReq: no
  94. AutoReqProv: no
  95. %description
  96. SASL is the Simple Authentication and Security Layer, a method
  97. for adding authentication support to connection-based protocols.
  98. To use SASL, a protocol includes a command for identifying and
  99. authenticating a user to a server and for optionally negotiating
  100. protection of subsequent protocol interactions. If its use is
  101. negotiated, a security layer is inserted between the protocol and
  102. the connection.
  103. %track
  104. prog sasl = {
  105. version = %{version}
  106. url = ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
  107. regex = cyrus-sasl-(\d+\.\d+\.\d+)\.tar\.gz
  108. }
  109. %prep
  110. %setup -q -n cyrus-sasl-%{version}
  111. %patch -p0
  112. %build
  113. # disable some unwanted configure checks
  114. %{l_shtool} subst \
  115. -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \
  116. -e "s;javac;javac-xxx;g" \
  117. -e "s;javah;javah-xxx;g" \
  118. -e "s;javadoc;javadoc-xxx;g" \
  119. configure
  120. # fix OpenLDAP support
  121. %if "%{with_ldap}" == "yes"
  122. echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache
  123. %{l_shtool} subst \
  124. -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl -lcrypto \2;" \
  125. saslauthd/configure
  126. %endif
  127. # fix GSS/Kerberos support
  128. %if "%{with_gss}" == "yes"
  129. %{l_shtool} subst \
  130. -e 's;\(-lk5crypto\);\1 -lkrb5support;' \
  131. configure
  132. %endif
  133. # enforce disabled Kerberos 5 support in saslauthd
  134. echo 'ac_cv_header_krb5_h=no' >config.cache
  135. # configure path to sasl-server config files
  136. %{l_shtool} subst \
  137. -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/apps;g' \
  138. lib/server.c
  139. # determine build flags
  140. cflags="%{l_cflags -O} %{l_cppflags}"
  141. ldflags="%{l_ldflags} %{l_fsl_ldflags}"
  142. libs="-ldb %{l_fsl_libs}"
  143. %if "%{with_ldap}" == "yes"
  144. cflags="$cflags -DAUTH_LDAP"
  145. %endif
  146. %if "%{with_mysql}" == "yes"
  147. libs="$libs -lz -lm"
  148. %endif
  149. %if "%{with_gss}" == "yes"
  150. ldflags="$ldflags %{l_ldflags kerberos}"
  151. %endif
  152. case "%{l_platform -t}" in
  153. *-sunos* ) libs="$libs -lrt" ;;
  154. esac
  155. # configure package
  156. CC="%{l_cc}" \
  157. CFLAGS="$cflags" \
  158. CPPFLAGS="%{l_cppflags}" \
  159. LDFLAGS="$ldflags" \
  160. LIBS="$libs" \
  161. ./configure \
  162. --cache-file=./config.cache \
  163. --prefix=%{l_prefix} \
  164. --sysconfdir="%{l_prefix}/etc/sasl" \
  165. --with-plugindir=%{l_prefix}/lib/sasl \
  166. --with-saslauthd=%{l_prefix}/var/sasl/saslauthd \
  167. --with-dbpath=%{l_prefix}/var/sasl/sasldb \
  168. --with-dblib=berkeley \
  169. --with-bdb-incdir=%{l_prefix}/include \
  170. --with-bdb-libdir=%{l_prefix}/lib \
  171. --with-openssl=%{l_prefix} \
  172. %if "%{with_pam}" == "yes"
  173. --with-pam \
  174. %else
  175. --without-pam \
  176. %endif
  177. %if "%{with_login}" == "yes"
  178. --enable-login \
  179. %else
  180. --disable-login \
  181. %endif
  182. %if "%{with_ldap}" == "yes"
  183. --with-ldap=%{l_prefix} \
  184. %else
  185. --without-ldap \
  186. %endif
  187. %if "%{with_otp}" == "yes"
  188. --enable-otp \
  189. --with-opie=%{l_prefix} \
  190. %else
  191. --disable-otp \
  192. --without-opie \
  193. %endif
  194. %if "%{with_gss}" == "yes"
  195. --enable-gssapi \
  196. --with-gss_impl=mit \
  197. %else
  198. --disable-gssapi \
  199. --without-gss_impl \
  200. %endif
  201. %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
  202. --enable-sql \
  203. %if "%{with_mysql}" == "yes"
  204. --with-mysql=%{l_prefix} \
  205. %else
  206. --without-mysql \
  207. %endif
  208. %if "%{with_pgsql}" == "yes"
  209. --with-pgsql=%{l_prefix} \
  210. %else
  211. --without-pgsql \
  212. %endif
  213. %if "%{with_sqlite}" == "yes"
  214. --with-sqlite=%{l_prefix} \
  215. %else
  216. --without-sqlite \
  217. %endif
  218. %endif
  219. %if "%{with_ntlm}" == "yes"
  220. --enable-ntlm \
  221. %else
  222. --disable-ntlm \
  223. %endif
  224. %if "%{with_sasldb}" == "yes"
  225. --enable-auth-sasldb \
  226. %endif
  227. --enable-shared \
  228. --enable-static \
  229. --enable-staticdlopen \
  230. --disable-java \
  231. --disable-sample \
  232. --disable-krb4 \
  233. --without-des
  234. # post adjustment: trust me, libtool, I know what I am doing
  235. %{l_shtool} subst \
  236. -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \
  237. -e 's/\(eval libobjs=.*$whole_archive_flag_spec.*\)$/case $archive_cmds in \\$LD* ) wl= ;; esac; \1/' \
  238. libtool
  239. # post adjustment: do not reference static plugins
  240. %{l_shtool} subst \
  241. -e '58s;.*;#define PIC;' \
  242. lib/dlopen.c
  243. # post adjustment: do not pull static plugins into static library
  244. %{l_shtool} subst \
  245. -e 's;-ln -s $(SASL_STATIC_SRCS) .;-ln ../sasldb/*.o ../plugins/*.o $(SASL_STATIC_SRCS) .;' \
  246. lib/Makefile
  247. # post adjustment: build utils against static library
  248. %{l_shtool} subst \
  249. -e 's;\(\$(CCLD)\);\1 -static;' \
  250. -e 's;\(noinst.*=\) *dbconverter.*;\1;' \
  251. utils/Makefile \
  252. sample/Makefile
  253. # post adjustment: fix OpenLDAP support
  254. %if "%{with_ldap}" == "yes"
  255. %{l_shtool} subst \
  256. -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \
  257. saslauthd/Makefile
  258. %endif
  259. # build package
  260. %{l_make} %{l_mflags}
  261. cd saslauthd
  262. %{l_make} %{l_mflags} testsaslauthd
  263. %install
  264. rm -rf $RPM_BUILD_ROOT
  265. # install package
  266. %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
  267. # remove libtool cruft
  268. rm -f \
  269. $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \
  270. $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \
  271. $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \
  272. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.la \
  273. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a
  274. # post-adjust installation
  275. mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \
  276. $RPM_BUILD_ROOT%{l_prefix}/lib/sasl
  277. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  278. # install saslauthd test program
  279. %{l_shtool} mkdir -f -p -m 755 \
  280. $RPM_BUILD_ROOT%{l_prefix}/sbin
  281. %{l_shtool} install -c -m 755 \
  282. saslauthd/testsaslauthd \
  283. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  284. # install saslauthd default configuration
  285. %{l_shtool} mkdir -f -p -m 755 \
  286. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl
  287. %{l_shtool} install -c -m 755 \
  288. %{SOURCE saslauthd.conf} \
  289. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/
  290. # install missing manual pages
  291. %{l_shtool} mkdir -f -p -m 755 \
  292. $RPM_BUILD_ROOT%{l_prefix}/man/man8
  293. %{l_shtool} install -c -m 644 \
  294. utils/saslpasswd2.8 \
  295. utils/sasldblistusers2.8 \
  296. $RPM_BUILD_ROOT%{l_prefix}/man/man8/
  297. # create necessary additional directories
  298. %{l_shtool} mkdir -f -p -m 755 \
  299. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \
  300. $RPM_BUILD_ROOT%{l_prefix}/var/sasl/saslauthd \
  301. $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/apps
  302. # install run-command script
  303. %if "%{with_pam}" == "yes"
  304. l_authmech="pam"
  305. %else
  306. case "%{l_platform -t}" in
  307. *-linux* | *-sunos* ) l_authmech="shadow" ;;
  308. * ) l_authmech="getpwent" ;;
  309. esac
  310. %endif
  311. %{l_shtool} mkdir -f -p -m 755 \
  312. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  313. %{l_shtool} install -c -m 755 \
  314. -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \
  315. %{SOURCE rc.sasl} \
  316. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  317. # install OSSP fsl configuration
  318. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  319. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  320. %{SOURCE fsl.sasl} \
  321. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  322. # determine installation files
  323. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  324. %{l_files_std} \
  325. '%not %dir %{l_prefix}/etc/fsl' \
  326. '%config %{l_prefix}/etc/fsl/fsl.sasl' \
  327. '%config %{l_prefix}/etc/sasl/saslauthd.conf' \
  328. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \
  329. '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/saslauthd' \
  330. '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log'
  331. %files -f files
  332. %clean
  333. rm -rf $RPM_BUILD_ROOT
  334. %pre
  335. # before upgrade, save status and stop service
  336. [ $1 -eq 2 ] || exit 0
  337. eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}`
  338. %{l_rc} sasl stop 2>/dev/null
  339. exit 0
  340. %post
  341. %if "%{with_pam}" == "yes"
  342. if [ $1 -eq 1 ]; then
  343. # after install, add PAM configuration entry
  344. $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl
  345. fi
  346. %endif
  347. if [ $1 -eq 2 ]; then
  348. # after upgrade, restore status
  349. eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
  350. [ ".$sasl_active" = .yes ] && %{l_rc} sasl start
  351. fi
  352. exit 0
  353. %preun
  354. # before erase, stop service and remove log files
  355. [ $1 -eq 0 ] || exit 0
  356. %{l_rc} sasl stop 2>/dev/null
  357. rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true
  358. %if "%{with_pam}" == "yes"
  359. # remove PAM configuration entry
  360. $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl
  361. %endif
  362. exit 0