michael@144: ## michael@144: ## sasl.spec -- OpenPKG RPM Package Specification michael@144: ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. michael@144: ## michael@144: ## Permission to use, copy, modify, and distribute this software for michael@144: ## any purpose with or without fee is hereby granted, provided that michael@144: ## the above copyright notice and this permission notice appear in all michael@144: ## copies. michael@144: ## michael@144: ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED michael@144: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@144: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@144: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@144: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@144: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@144: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@144: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@144: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@144: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@144: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@144: ## SUCH DAMAGE. michael@144: ## michael@144: michael@144: # package information michael@144: Name: sasl michael@144: Summary: Simple Authentication and Security Layer (SASL) michael@144: URL: http://asg.web.cmu.edu/sasl/ michael@144: Vendor: Cyrus Project, CMU michael@144: Packager: OpenPKG Foundation e.V. michael@144: Distribution: OpenPKG Community michael@144: Class: BASE michael@144: Group: Cryptography michael@144: License: BSD michael@144: Version: 2.1.22 michael@144: Release: 20090207 michael@144: michael@144: # package options michael@144: %option with_fsl yes michael@144: %option with_sasldb yes michael@144: %option with_pam no michael@144: %option with_login no michael@144: %option with_ldap no michael@144: %option with_mysql no michael@144: %option with_pgsql no michael@144: %option with_sqlite no michael@144: %option with_ntlm no michael@144: %option with_otp no michael@144: %option with_srp no michael@144: %option with_kerberos no michael@144: michael@144: # list of sources michael@144: Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-%{version}.tar.gz michael@144: Source1: rc.sasl michael@144: Source2: fsl.sasl michael@144: Source3: saslauthd.conf michael@144: Source4: sasl.pc michael@144: Patch0: sasl.patch michael@144: michael@144: # build information michael@144: Prefix: %{l_prefix} michael@144: BuildRoot: %{l_buildroot} michael@144: BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, make, groff michael@144: PreReq: OpenPKG, openpkg >= 20060823 michael@144: BuildPreReq: db >= 4.1.24, openssl michael@144: PreReq: db >= 4.1.24, openssl michael@144: %if "%{with_fsl}" == "yes" michael@144: BuildPreReq: fsl michael@144: PreReq: fsl michael@144: %endif michael@144: %if "%{with_pam}" == "yes" michael@144: BuildPreReq: PAM michael@144: PreReq: PAM michael@144: %endif michael@144: %if "%{with_ldap}" == "yes" michael@144: BuildPreReq: openldap michael@144: PreReq: openldap michael@144: %endif michael@144: %if "%{with_mysql}" == "yes" michael@144: BuildPreReq: mysql michael@144: PreReq: mysql michael@144: %endif michael@144: %if "%{with_pgsql}" == "yes" michael@144: BuildPreReq: postgresql michael@144: PreReq: postgresql michael@144: %endif michael@144: %if "%{with_sqlite}" == "yes" michael@144: BuildPreReq: sqlite michael@144: PreReq: sqlite michael@144: %endif michael@144: %if "%{with_otp}" == "yes" michael@144: BuildPreReq: opie michael@144: PreReq: opie michael@144: %endif michael@144: %if "%{with_kerberos}" == "yes" michael@144: BuildPreReq: KERBEROS michael@144: PreReq: KERBEROS michael@144: %endif michael@144: AutoReq: no michael@144: AutoReqProv: no michael@144: michael@144: %description michael@144: SASL is the Simple Authentication and Security Layer, a method michael@144: for adding authentication support to connection-based protocols. michael@144: To use SASL, a protocol includes a command for identifying and michael@144: authenticating a user to a server and for optionally negotiating michael@144: protection of subsequent protocol interactions. If its use is michael@144: negotiated, a security layer is inserted between the protocol and michael@144: the connection. michael@144: michael@144: %track michael@144: prog sasl = { michael@144: version = %{version} michael@144: url = ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ michael@144: regex = cyrus-sasl-(\d+\.\d+\.\d+)\.tar\.gz michael@144: } michael@144: michael@144: %prep michael@144: %setup -q -n cyrus-sasl-%{version} michael@144: %patch -p0 michael@144: michael@144: %build michael@144: # ensure the OpenPKG Berkeley-DB is picked up only michael@144: %{l_shtool} subst \ michael@144: -e 's;for dbname in db-.*db$;for dbname in db;' \ michael@144: saslauthd/configure configure michael@144: michael@144: # disable some unwanted configure checks michael@144: %{l_shtool} subst \ michael@144: -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \ michael@144: -e "s;javac;javac-xxx;g" \ michael@144: -e "s;javah;javah-xxx;g" \ michael@144: -e "s;javadoc;javadoc-xxx;g" \ michael@144: configure michael@144: michael@144: # fix OpenLDAP support michael@144: %if "%{with_ldap}" == "yes" michael@144: echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache michael@144: %{l_shtool} subst \ michael@144: -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl -lcrypto \2;" \ michael@144: saslauthd/configure michael@144: %endif michael@144: michael@144: # fix GSS/Kerberos support michael@144: %if "%{with_kerberos}" == "yes" michael@144: %{l_shtool} subst \ michael@144: -e 's;\(-lk5crypto\);\1 -lkrb5support;' \ michael@144: configure michael@144: %endif michael@144: michael@144: # enforce disabled Kerberos 5 support in saslauthd michael@144: echo 'ac_cv_header_krb5_h=no' >config.cache michael@144: michael@144: # configure path to sasl-server config files michael@144: %{l_shtool} subst \ michael@144: -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/sasl.d;g' \ michael@144: lib/server.c michael@144: michael@144: # determine build flags michael@144: cflags="%{l_cflags -O} %{l_cppflags}" michael@144: ldflags="%{l_ldflags} %{l_fsl_ldflags}" michael@144: libs="-ldb %{l_fsl_libs}" michael@144: %if "%{with_ldap}" == "yes" michael@144: cflags="$cflags -DAUTH_LDAP" michael@144: %endif michael@144: %if "%{with_mysql}" == "yes" michael@144: libs="$libs -lz -lm" michael@144: %endif michael@144: %if "%{with_pgsql}" == "yes" michael@144: cflags="$cflags -I%{l_cppflags postgresql}" michael@144: libs="$libs -lssl -lcrypto -lcrypt" michael@144: %endif michael@144: %if "%{with_kerberos}" == "yes" michael@144: cflags="$cflags `krb5-config --cflags gssapi`" michael@144: libs="$libs `krb5-config --libs gssapi`" michael@144: %endif michael@144: case "%{l_platform -t}" in michael@144: *-sunos* ) libs="$libs -lrt" ;; michael@144: esac michael@144: michael@144: # configure package michael@144: CC="%{l_cc}" \ michael@144: CFLAGS="$cflags" \ michael@144: CPPFLAGS="%{l_cppflags}" \ michael@144: LDFLAGS="$ldflags" \ michael@144: LIBS="$libs" \ michael@144: ./configure \ michael@144: --cache-file=./config.cache \ michael@144: --prefix=%{l_prefix} \ michael@144: --sysconfdir=%{l_prefix}/etc/sasl \ michael@144: --with-configdir=%{l_prefix}/etc/sasl/sasl.d \ michael@144: --with-plugindir=%{l_prefix}/lib/sasl \ michael@144: --with-saslauthd=%{l_prefix}/var/sasl/run/saslauthd \ michael@144: --enable-digest \ michael@144: --enable-cram \ michael@144: --enable-anon \ michael@144: %if "%{with_sasldb}" == "yes" michael@144: --enable-auth-sasldb \ michael@144: --with-dbpath=%{l_prefix}/var/sasl/run/sasl.db \ michael@144: --with-dblib=berkeley \ michael@144: --with-bdb-incdir=%{l_prefix}/include \ michael@144: --with-bdb-libdir=%{l_prefix}/lib \ michael@144: %else michael@144: --with-dblib=none \ michael@144: %endif michael@144: --with-openssl=%{l_prefix} \ michael@144: %if "%{with_pam}" == "yes" michael@144: --with-pam \ michael@144: %else michael@144: --without-pam \ michael@144: %endif michael@144: %if "%{with_login}" == "yes" michael@144: --enable-login \ michael@144: %else michael@144: --disable-login \ michael@144: %endif michael@144: %if "%{with_ldap}" == "yes" michael@144: --with-ldap=%{l_prefix} \ michael@144: %else michael@144: --without-ldap \ michael@144: %endif michael@144: %if "%{with_otp}" == "yes" michael@144: --enable-otp \ michael@144: --with-opie=%{l_prefix} \ michael@144: %else michael@144: --disable-otp \ michael@144: --without-opie \ michael@144: %endif michael@144: %if "%{with_srp}" == "yes" michael@144: --enable-srp \ michael@144: %else michael@144: --disable-srp \ michael@144: %endif michael@144: %if "%{with_kerberos}" == "yes" michael@144: --enable-gssapi \ michael@144: --with-gss_impl=`if [ -d %{l_prefix}/include/heimdal ]; then echo "heimdal"; else echo "mit"; fi` \ michael@144: %else michael@144: --disable-gssapi \ michael@144: --without-gss_impl \ michael@144: %endif michael@144: %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" michael@144: --enable-sql \ michael@144: %if "%{with_mysql}" == "yes" michael@144: --with-mysql=%{l_prefix} \ michael@144: %else michael@144: --without-mysql \ michael@144: %endif michael@144: %if "%{with_pgsql}" == "yes" michael@144: --with-pgsql=%{l_prefix} \ michael@144: %else michael@144: --without-pgsql \ michael@144: %endif michael@144: %if "%{with_sqlite}" == "yes" michael@144: --with-sqlite=%{l_prefix} \ michael@144: %else michael@144: --without-sqlite \ michael@144: %endif michael@144: %endif michael@144: %if "%{with_ntlm}" == "yes" michael@144: --enable-ntlm \ michael@144: %else michael@144: --disable-ntlm \ michael@144: %endif michael@144: --enable-shared \ michael@144: --enable-static \ michael@144: --enable-staticdlopen \ michael@144: --enable-sample \ michael@144: --disable-java \ michael@144: --disable-krb4 \ michael@144: --without-des michael@144: michael@144: # post adjustment: trust me, libtool, I know what I am doing michael@144: %{l_shtool} subst \ michael@144: -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \ michael@144: -e 's/\(eval libobjs=.*$whole_archive_flag_spec.*\)$/case $archive_cmds in \\$LD* ) wl= ;; esac; \1/' \ michael@144: libtool michael@144: michael@144: # post adjustment: do not reference static plugins michael@144: %{l_shtool} subst \ michael@144: -e '58s;.*;#define PIC;' \ michael@144: lib/dlopen.c michael@144: michael@144: # post adjustment: do not pull static plugins into static library michael@144: %{l_shtool} subst \ michael@144: -e 's;-ln -s $(SASL_STATIC_SRCS) .;-ln ../sasldb/*.o ../plugins/*.o $(SASL_STATIC_SRCS) .;' \ michael@144: lib/Makefile michael@144: michael@144: # post adjustment: build utils against static library michael@144: %{l_shtool} subst \ michael@144: -e 's;\(\$(CCLD)\);\1 -static;' \ michael@144: -e 's;\(noinst.*=\) *dbconverter.*;\1;' \ michael@144: utils/Makefile \ michael@144: sample/Makefile michael@144: michael@144: # post adjustment: fix OpenLDAP support michael@144: %if "%{with_ldap}" == "yes" michael@144: %{l_shtool} subst \ michael@144: -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \ michael@144: saslauthd/Makefile michael@144: %endif michael@144: michael@144: # build package michael@144: %{l_make} %{l_mflags} michael@144: ( cd saslauthd michael@144: %{l_make} %{l_mflags} testsaslauthd michael@144: ) || exit $? michael@144: ( cd sample michael@144: %{l_make} %{l_mflags} sample-client sample-server michael@144: ) || exit $? michael@144: michael@144: %install michael@144: rm -rf $RPM_BUILD_ROOT michael@144: michael@144: # install package michael@144: %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" michael@144: michael@144: # remove libtool cruft michael@144: rm -f \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a michael@144: michael@144: # post-adjust installation michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/lib/sasl michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/sbin/testsaslauthd \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/sbin/saslauthd-test michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/sbin/pluginviewer \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-pluginviewer michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/pluginviewer.8 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasl-pluginviewer.8 michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd2 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd2.8 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd.8 michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers2 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers michael@144: mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers2.8 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers.8 michael@144: rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dbconverter-2 michael@144: strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true michael@144: michael@144: # install sample client/server programs michael@144: %{l_shtool} install -c -m 755 \ michael@144: sample/sample-client \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-client michael@144: %{l_shtool} install -c -m 755 \ michael@144: sample/sample-server \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-server michael@144: michael@144: # install saslauthd default configuration michael@144: %{l_shtool} mkdir -f -p -m 755 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/etc/sasl michael@144: %{l_shtool} install -c -m 755 \ michael@144: %{SOURCE saslauthd.conf} \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/ michael@144: michael@144: # create necessary additional directories michael@144: %{l_shtool} mkdir -f -p -m 755 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/var/sasl/run/saslauthd \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/sasl.d michael@144: michael@144: # install run-command script michael@144: %if "%{with_pam}" == "yes" michael@144: l_authmech="pam" michael@144: %else michael@144: case "%{l_platform -t}" in michael@144: *-linux* | *-sunos* ) l_authmech="shadow" ;; michael@144: * ) l_authmech="getpwent" ;; michael@144: esac michael@144: %endif michael@144: %{l_shtool} mkdir -f -p -m 755 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@144: %{l_shtool} install -c -m 755 \ michael@144: -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \ michael@144: %{SOURCE rc.sasl} \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@144: michael@144: # install OSSP fsl configuration michael@144: %{l_shtool} mkdir -f -p -m 755 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@144: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@144: %{SOURCE fsl.sasl} \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@144: michael@144: # install pkg-config configuration michael@144: libs="-lsasl2" michael@144: case "%{l_platform -t}" in michael@144: *-linux* ) libs="$libs -ldl" ;; michael@144: esac michael@144: %{l_shtool} mkdir -f -p -m 755 \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig michael@144: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@144: -e "s;@version@;%{version};" \ michael@144: -e "s;@libs@;$libs;" \ michael@144: %{SOURCE sasl.pc} \ michael@144: $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/ michael@144: michael@144: # determine installation files michael@144: %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ michael@144: %{l_files_std} \ michael@144: '%config %{l_prefix}/etc/fsl/fsl.sasl' \ michael@144: '%config %{l_prefix}/etc/sasl/saslauthd.conf' \ michael@144: '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \ michael@144: '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run' \ michael@144: '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run/saslauthd' \ michael@144: '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log' michael@144: michael@144: %files -f files michael@144: michael@144: %clean michael@144: rm -rf $RPM_BUILD_ROOT michael@144: michael@144: %pre michael@144: # before upgrade, save status and stop service michael@144: [ $1 -eq 2 ] || exit 0 michael@144: eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}` michael@144: %{l_rc} sasl stop 2>/dev/null michael@144: exit 0 michael@144: michael@144: %post michael@144: %if "%{with_pam}" == "yes" michael@144: if [ $1 -eq 1 ]; then michael@144: # after install, add PAM configuration entry michael@144: $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl michael@144: fi michael@144: %endif michael@144: if [ $1 -eq 2 ]; then michael@144: # after upgrade, restore status michael@144: eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} michael@144: [ ".$sasl_active" = .yes ] && %{l_rc} sasl start michael@144: fi michael@144: exit 0 michael@144: michael@144: %preun michael@144: # before erase, stop service and remove log files michael@144: [ $1 -eq 0 ] || exit 0 michael@144: %{l_rc} sasl stop 2>/dev/null michael@144: rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true michael@144: %if "%{with_pam}" == "yes" michael@144: # remove PAM configuration entry michael@144: $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl michael@144: %endif michael@144: exit 0 michael@144: