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