Fri, 15 Oct 2010 18:46:25 +0200
Update copyright, file server URL, modify doc and link logic.
Now documentation is installed by default to the correct path,
and QtCreator links against Qt shared libraries instead of Qt
static libraries. This unfortunate change supports Nokia's
unfortunate decision to poorly support static linking in Qt.
1 ##
2 ## sasl.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2008 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://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: 20090206
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.andrew.cmu.edu/pub/cyrus-mail/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 Prefix: %{l_prefix}
61 BuildRoot: %{l_buildroot}
62 BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, make, groff
63 PreReq: OpenPKG, openpkg >= 20060823
64 BuildPreReq: db >= 4.1.24, openssl
65 PreReq: db >= 4.1.24, openssl
66 %if "%{with_fsl}" == "yes"
67 BuildPreReq: fsl
68 PreReq: fsl
69 %endif
70 %if "%{with_pam}" == "yes"
71 BuildPreReq: PAM
72 PreReq: PAM
73 %endif
74 %if "%{with_ldap}" == "yes"
75 BuildPreReq: openldap
76 PreReq: openldap
77 %endif
78 %if "%{with_mysql}" == "yes"
79 BuildPreReq: mysql
80 PreReq: mysql
81 %endif
82 %if "%{with_pgsql}" == "yes"
83 BuildPreReq: postgresql
84 PreReq: postgresql
85 %endif
86 %if "%{with_sqlite}" == "yes"
87 BuildPreReq: sqlite
88 PreReq: sqlite
89 %endif
90 %if "%{with_otp}" == "yes"
91 BuildPreReq: opie
92 PreReq: opie
93 %endif
94 %if "%{with_kerberos}" == "yes"
95 BuildPreReq: KERBEROS
96 PreReq: KERBEROS
97 %endif
98 AutoReq: no
99 AutoReqProv: no
101 %description
102 SASL is the Simple Authentication and Security Layer, a method
103 for adding authentication support to connection-based protocols.
104 To use SASL, a protocol includes a command for identifying and
105 authenticating a user to a server and for optionally negotiating
106 protection of subsequent protocol interactions. If its use is
107 negotiated, a security layer is inserted between the protocol and
108 the connection.
110 %track
111 prog sasl = {
112 version = %{version}
113 url = ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
114 regex = cyrus-sasl-(\d+\.\d+\.\d+)\.tar\.gz
115 }
117 %prep
118 %setup -q -n cyrus-sasl-%{version}
119 %patch -p0
120 %{l_shtool} subst \
121 -e 's;u_int;uint;g' \
122 sasldb/db_berkeley.c
124 %build
125 # ensure the OpenPKG Berkeley-DB is picked up only
126 %{l_shtool} subst \
127 -e 's;for dbname in db-.*db$;for dbname in db;' \
128 saslauthd/configure configure
130 # disable some unwanted configure checks
131 %{l_shtool} subst \
132 -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \
133 -e "s;javac;javac-xxx;g" \
134 -e "s;javah;javah-xxx;g" \
135 -e "s;javadoc;javadoc-xxx;g" \
136 configure
138 # fix OpenLDAP support
139 %if "%{with_ldap}" == "yes"
140 echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache
141 %{l_shtool} subst \
142 -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl -lcrypto \2;" \
143 saslauthd/configure
144 %endif
146 # fix GSS/Kerberos support
147 %if "%{with_kerberos}" == "yes"
148 %{l_shtool} subst \
149 -e 's;\(-lk5crypto\);\1 -lkrb5support;' \
150 configure
151 %endif
153 # enforce disabled Kerberos 5 support in saslauthd
154 echo 'ac_cv_header_krb5_h=no' >config.cache
156 # configure path to sasl-server config files
157 %{l_shtool} subst \
158 -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/sasl.d;g' \
159 lib/server.c
161 # determine build flags
162 cflags="%{l_cflags -O} %{l_cppflags}"
163 ldflags="%{l_ldflags} %{l_fsl_ldflags}"
164 libs="-ldb %{l_fsl_libs}"
165 %if "%{with_ldap}" == "yes"
166 cflags="$cflags -DAUTH_LDAP"
167 %endif
168 %if "%{with_mysql}" == "yes"
169 libs="$libs -lz -lm"
170 %endif
171 %if "%{with_pgsql}" == "yes"
172 cflags="$cflags -I%{l_cppflags postgresql}"
173 libs="$libs -lssl -lcrypto -lcrypt"
174 %endif
175 %if "%{with_kerberos}" == "yes"
176 cflags="$cflags `krb5-config --cflags gssapi`"
177 libs="$libs `krb5-config --libs gssapi`"
178 %endif
179 case "%{l_platform -t}" in
180 *-sunos* ) libs="$libs -lrt" ;;
181 esac
183 # configure package
184 CC="%{l_cc}" \
185 CFLAGS="$cflags" \
186 CPPFLAGS="%{l_cppflags}" \
187 LDFLAGS="$ldflags" \
188 LIBS="$libs" \
189 ./configure \
190 --cache-file=./config.cache \
191 --prefix=%{l_prefix} \
192 --sysconfdir=%{l_prefix}/etc/sasl \
193 --with-configdir=%{l_prefix}/etc/sasl/sasl.d \
194 --with-plugindir=%{l_prefix}/lib/sasl \
195 --with-saslauthd=%{l_prefix}/var/sasl/run/saslauthd \
196 --enable-digest \
197 --enable-cram \
198 --enable-anon \
199 %if "%{with_sasldb}" == "yes"
200 --enable-auth-sasldb \
201 --with-dbpath=%{l_prefix}/var/sasl/run/sasl.db \
202 --with-dblib=berkeley \
203 --with-bdb-incdir=%{l_prefix}/include \
204 --with-bdb-libdir=%{l_prefix}/lib \
205 %else
206 --with-dblib=none \
207 %endif
208 --with-openssl=%{l_prefix} \
209 %if "%{with_pam}" == "yes"
210 --with-pam \
211 %else
212 --without-pam \
213 %endif
214 %if "%{with_login}" == "yes"
215 --enable-login \
216 %else
217 --disable-login \
218 %endif
219 %if "%{with_ldap}" == "yes"
220 --with-ldap=%{l_prefix} \
221 %else
222 --without-ldap \
223 %endif
224 %if "%{with_otp}" == "yes"
225 --enable-otp \
226 --with-opie=%{l_prefix} \
227 %else
228 --disable-otp \
229 --without-opie \
230 %endif
231 %if "%{with_srp}" == "yes"
232 --enable-srp \
233 %else
234 --disable-srp \
235 %endif
236 %if "%{with_kerberos}" == "yes"
237 --enable-gssapi \
238 --with-gss_impl=`if [ -d %{l_prefix}/include/heimdal ]; then echo "heimdal"; else echo "mit"; fi` \
239 %else
240 --disable-gssapi \
241 --without-gss_impl \
242 %endif
243 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
244 --enable-sql \
245 %if "%{with_mysql}" == "yes"
246 --with-mysql=%{l_prefix} \
247 %else
248 --without-mysql \
249 %endif
250 %if "%{with_pgsql}" == "yes"
251 --with-pgsql=%{l_prefix} \
252 %else
253 --without-pgsql \
254 %endif
255 %if "%{with_sqlite}" == "yes"
256 --with-sqlite=%{l_prefix} \
257 %else
258 --without-sqlite \
259 %endif
260 %endif
261 %if "%{with_ntlm}" == "yes"
262 --enable-ntlm \
263 %else
264 --disable-ntlm \
265 %endif
266 --enable-shared \
267 --enable-static \
268 --enable-staticdlopen \
269 --enable-sample \
270 --disable-java \
271 --disable-krb4 \
272 --without-des
274 # post adjustment: trust me, libtool, I know what I am doing
275 %{l_shtool} subst \
276 -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \
277 -e 's/\(eval libobjs=.*$whole_archive_flag_spec.*\)$/case $archive_cmds in \\$LD* ) wl= ;; esac; \1/' \
278 libtool
280 # post adjustment: do not reference static plugins
281 %{l_shtool} subst \
282 -e '58s;.*;#define PIC;' \
283 lib/dlopen.c
285 # post adjustment: do not pull static plugins into static library
286 %{l_shtool} subst \
287 -e 's;-ln -s $(SASL_STATIC_SRCS) .;-ln ../sasldb/*.o ../plugins/*.o $(SASL_STATIC_SRCS) .;' \
288 lib/Makefile
290 # post adjustment: build utils against static library
291 %{l_shtool} subst \
292 -e 's;\(\$(CCLD)\);\1 -static;' \
293 -e 's;\(noinst.*=\) *dbconverter.*;\1;' \
294 utils/Makefile \
295 sample/Makefile
297 # post adjustment: fix OpenLDAP support
298 %if "%{with_ldap}" == "yes"
299 %{l_shtool} subst \
300 -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \
301 saslauthd/Makefile
302 %endif
304 # build package
305 %{l_make} %{l_mflags}
306 ( cd saslauthd
307 %{l_make} %{l_mflags} testsaslauthd
308 ) || exit $?
309 ( cd sample
310 %{l_make} %{l_mflags} sample-client sample-server
311 ) || exit $?
313 %install
314 rm -rf $RPM_BUILD_ROOT
316 # install package
317 %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
319 # remove libtool cruft
320 rm -f \
321 $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \
322 $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \
323 $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \
324 $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a
326 # post-adjust installation
327 mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \
328 $RPM_BUILD_ROOT%{l_prefix}/lib/sasl
329 mv $RPM_BUILD_ROOT%{l_prefix}/sbin/testsaslauthd \
330 $RPM_BUILD_ROOT%{l_prefix}/sbin/saslauthd-test
331 mv $RPM_BUILD_ROOT%{l_prefix}/sbin/pluginviewer \
332 $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-pluginviewer
333 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/pluginviewer.8 \
334 $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasl-pluginviewer.8
335 mv $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd2 \
336 $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd
337 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd2.8 \
338 $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd.8
339 mv $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers2 \
340 $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers
341 mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers2.8 \
342 $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers.8
343 rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dbconverter-2
344 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
346 # install sample client/server programs
347 %{l_shtool} install -c -m 755 \
348 sample/sample-client \
349 $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-client
350 %{l_shtool} install -c -m 755 \
351 sample/sample-server \
352 $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-server
354 # install saslauthd default configuration
355 %{l_shtool} mkdir -f -p -m 755 \
356 $RPM_BUILD_ROOT%{l_prefix}/etc/sasl
357 %{l_shtool} install -c -m 755 \
358 %{SOURCE saslauthd.conf} \
359 $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/
361 # create necessary additional directories
362 %{l_shtool} mkdir -f -p -m 755 \
363 $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \
364 $RPM_BUILD_ROOT%{l_prefix}/var/sasl/run/saslauthd \
365 $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/sasl.d
367 # install run-command script
368 %if "%{with_pam}" == "yes"
369 l_authmech="pam"
370 %else
371 case "%{l_platform -t}" in
372 *-linux* | *-sunos* ) l_authmech="shadow" ;;
373 * ) l_authmech="getpwent" ;;
374 esac
375 %endif
376 %{l_shtool} mkdir -f -p -m 755 \
377 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
378 %{l_shtool} install -c -m 755 \
379 -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \
380 %{SOURCE rc.sasl} \
381 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
383 # install OSSP fsl configuration
384 %{l_shtool} mkdir -f -p -m 755 \
385 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
386 %{l_shtool} install -c -m 644 %{l_value -s -a} \
387 %{SOURCE fsl.sasl} \
388 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
390 # install pkg-config configuration
391 libs="-lsasl2"
392 case "%{l_platform -t}" in
393 *-linux* ) libs="$libs -ldl" ;;
394 esac
395 %{l_shtool} mkdir -f -p -m 755 \
396 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
397 %{l_shtool} install -c -m 644 %{l_value -s -a} \
398 -e "s;@version@;%{version};" \
399 -e "s;@libs@;$libs;" \
400 %{SOURCE sasl.pc} \
401 $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
403 # determine installation files
404 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
405 %{l_files_std} \
406 '%config %{l_prefix}/etc/fsl/fsl.sasl' \
407 '%config %{l_prefix}/etc/sasl/saslauthd.conf' \
408 '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \
409 '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run' \
410 '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run/saslauthd' \
411 '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log'
413 %files -f files
415 %clean
416 rm -rf $RPM_BUILD_ROOT
418 %pre
419 # before upgrade, save status and stop service
420 [ $1 -eq 2 ] || exit 0
421 eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}`
422 %{l_rc} sasl stop 2>/dev/null
423 exit 0
425 %post
426 %if "%{with_pam}" == "yes"
427 if [ $1 -eq 1 ]; then
428 # after install, add PAM configuration entry
429 $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl
430 fi
431 %endif
432 if [ $1 -eq 2 ]; then
433 # after upgrade, restore status
434 eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
435 [ ".$sasl_active" = .yes ] && %{l_rc} sasl start
436 fi
437 exit 0
439 %preun
440 # before erase, stop service and remove log files
441 [ $1 -eq 0 ] || exit 0
442 %{l_rc} sasl stop 2>/dev/null
443 rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true
444 %if "%{with_pam}" == "yes"
445 # remove PAM configuration entry
446 $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl
447 %endif
448 exit 0