sasl/sasl.spec

Mon, 06 Apr 2009 20:29:28 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 06 Apr 2009 20:29:28 +0200
changeset 144
f53f65b7bfb9
child 145
d06cf9bcdea5
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

     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:      20090207
    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
   121 %build
   122     #   ensure the OpenPKG Berkeley-DB is picked up only
   123     %{l_shtool} subst \
   124         -e 's;for dbname in db-.*db$;for dbname in db;' \
   125         saslauthd/configure configure
   127     #   disable some unwanted configure checks
   128     %{l_shtool} subst \
   129         -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \
   130         -e "s;javac;javac-xxx;g" \
   131         -e "s;javah;javah-xxx;g" \
   132         -e "s;javadoc;javadoc-xxx;g" \
   133         configure
   135     #   fix OpenLDAP support
   136 %if "%{with_ldap}" == "yes"
   137     echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache
   138     %{l_shtool} subst \
   139         -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl -lcrypto \2;" \
   140         saslauthd/configure
   141 %endif
   143     #   fix GSS/Kerberos support
   144 %if "%{with_kerberos}" == "yes"
   145     %{l_shtool} subst \
   146         -e 's;\(-lk5crypto\);\1 -lkrb5support;' \
   147         configure
   148 %endif
   150     #   enforce disabled Kerberos 5 support in saslauthd
   151     echo 'ac_cv_header_krb5_h=no' >config.cache
   153     #   configure path to sasl-server config files
   154     %{l_shtool} subst \
   155         -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/sasl.d;g' \
   156         lib/server.c
   158     #   determine build flags
   159     cflags="%{l_cflags -O} %{l_cppflags}"
   160     ldflags="%{l_ldflags} %{l_fsl_ldflags}"
   161     libs="-ldb %{l_fsl_libs}"
   162 %if "%{with_ldap}" == "yes"
   163     cflags="$cflags -DAUTH_LDAP"
   164 %endif
   165 %if "%{with_mysql}" == "yes"
   166     libs="$libs -lz -lm"
   167 %endif
   168 %if "%{with_pgsql}" == "yes"
   169     cflags="$cflags -I%{l_cppflags postgresql}"
   170     libs="$libs -lssl -lcrypto -lcrypt"
   171 %endif
   172 %if "%{with_kerberos}" == "yes"
   173     cflags="$cflags `krb5-config --cflags gssapi`"
   174     libs="$libs `krb5-config --libs gssapi`"
   175 %endif
   176     case "%{l_platform -t}" in
   177         *-sunos* ) libs="$libs -lrt" ;;
   178     esac
   180     #   configure package
   181     CC="%{l_cc}" \
   182     CFLAGS="$cflags" \
   183     CPPFLAGS="%{l_cppflags}" \
   184     LDFLAGS="$ldflags" \
   185     LIBS="$libs" \
   186     ./configure \
   187         --cache-file=./config.cache \
   188         --prefix=%{l_prefix} \
   189         --sysconfdir=%{l_prefix}/etc/sasl \
   190         --with-configdir=%{l_prefix}/etc/sasl/sasl.d \
   191         --with-plugindir=%{l_prefix}/lib/sasl \
   192         --with-saslauthd=%{l_prefix}/var/sasl/run/saslauthd \
   193         --enable-digest \
   194         --enable-cram \
   195         --enable-anon \
   196 %if "%{with_sasldb}" == "yes"
   197         --enable-auth-sasldb \
   198         --with-dbpath=%{l_prefix}/var/sasl/run/sasl.db \
   199         --with-dblib=berkeley \
   200         --with-bdb-incdir=%{l_prefix}/include \
   201         --with-bdb-libdir=%{l_prefix}/lib \
   202 %else
   203         --with-dblib=none \
   204 %endif
   205         --with-openssl=%{l_prefix} \
   206 %if "%{with_pam}" == "yes"
   207         --with-pam \
   208 %else
   209         --without-pam \
   210 %endif
   211 %if "%{with_login}" == "yes"
   212         --enable-login \
   213 %else
   214         --disable-login \
   215 %endif
   216 %if "%{with_ldap}" == "yes"
   217         --with-ldap=%{l_prefix} \
   218 %else
   219         --without-ldap \
   220 %endif
   221 %if "%{with_otp}" == "yes"
   222         --enable-otp \
   223         --with-opie=%{l_prefix} \
   224 %else
   225         --disable-otp \
   226         --without-opie \
   227 %endif
   228 %if "%{with_srp}" == "yes"
   229         --enable-srp \
   230 %else
   231         --disable-srp \
   232 %endif
   233 %if "%{with_kerberos}" == "yes"
   234         --enable-gssapi \
   235         --with-gss_impl=`if [ -d %{l_prefix}/include/heimdal ]; then echo "heimdal"; else echo "mit"; fi` \
   236 %else
   237         --disable-gssapi \
   238         --without-gss_impl \
   239 %endif
   240 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
   241         --enable-sql \
   242 %if "%{with_mysql}" == "yes"
   243         --with-mysql=%{l_prefix} \
   244 %else
   245         --without-mysql \
   246 %endif
   247 %if "%{with_pgsql}" == "yes"
   248         --with-pgsql=%{l_prefix} \
   249 %else
   250         --without-pgsql \
   251 %endif
   252 %if "%{with_sqlite}" == "yes"
   253         --with-sqlite=%{l_prefix} \
   254 %else
   255         --without-sqlite \
   256 %endif
   257 %endif
   258 %if "%{with_ntlm}" == "yes"
   259         --enable-ntlm \
   260 %else
   261         --disable-ntlm \
   262 %endif
   263         --enable-shared \
   264         --enable-static \
   265         --enable-staticdlopen \
   266         --enable-sample \
   267         --disable-java \
   268         --disable-krb4 \
   269         --without-des
   271     #   post adjustment: trust me, libtool, I know what I am doing
   272     %{l_shtool} subst \
   273         -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \
   274         -e 's/\(eval libobjs=.*$whole_archive_flag_spec.*\)$/case $archive_cmds in \\$LD* ) wl= ;; esac; \1/' \
   275         libtool
   277     #   post adjustment: do not reference static plugins
   278     %{l_shtool} subst \
   279         -e '58s;.*;#define PIC;' \
   280         lib/dlopen.c
   282     #   post adjustment: do not pull static plugins into static library
   283     %{l_shtool} subst \
   284         -e 's;-ln -s $(SASL_STATIC_SRCS) .;-ln ../sasldb/*.o ../plugins/*.o $(SASL_STATIC_SRCS) .;' \
   285         lib/Makefile
   287     #   post adjustment: build utils against static library
   288     %{l_shtool} subst \
   289         -e 's;\(\$(CCLD)\);\1 -static;' \
   290         -e 's;\(noinst.*=\) *dbconverter.*;\1;' \
   291         utils/Makefile \
   292         sample/Makefile
   294     #   post adjustment: fix OpenLDAP support
   295 %if "%{with_ldap}" == "yes"
   296     %{l_shtool} subst \
   297         -e "s;^\(saslauthd_LDADD[ 	]*=[ 	]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \
   298         saslauthd/Makefile
   299 %endif
   301     #   build package
   302     %{l_make} %{l_mflags}
   303     ( cd saslauthd
   304       %{l_make} %{l_mflags} testsaslauthd
   305     ) || exit $?
   306     ( cd sample
   307       %{l_make} %{l_mflags} sample-client sample-server
   308     ) || exit $?
   310 %install
   311     rm -rf $RPM_BUILD_ROOT
   313     #   install package
   314     %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
   316     #   remove libtool cruft
   317     rm -f \
   318         $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \
   319         $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \
   320         $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \
   321         $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a
   323     #   post-adjust installation
   324     mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \
   325        $RPM_BUILD_ROOT%{l_prefix}/lib/sasl
   326     mv $RPM_BUILD_ROOT%{l_prefix}/sbin/testsaslauthd \
   327        $RPM_BUILD_ROOT%{l_prefix}/sbin/saslauthd-test
   328     mv $RPM_BUILD_ROOT%{l_prefix}/sbin/pluginviewer \
   329        $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-pluginviewer
   330     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/pluginviewer.8 \
   331        $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasl-pluginviewer.8
   332     mv $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd2 \
   333        $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd
   334     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd2.8 \
   335        $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd.8
   336     mv $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers2 \
   337        $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers
   338     mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers2.8 \
   339        $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers.8
   340     rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dbconverter-2
   341     strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   343     #   install sample client/server programs
   344     %{l_shtool} install -c -m 755 \
   345         sample/sample-client \
   346         $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-client
   347     %{l_shtool} install -c -m 755 \
   348         sample/sample-server \
   349         $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-server
   351     #   install saslauthd default configuration
   352     %{l_shtool} mkdir -f -p -m 755 \
   353         $RPM_BUILD_ROOT%{l_prefix}/etc/sasl
   354     %{l_shtool} install -c -m 755 \
   355         %{SOURCE saslauthd.conf} \
   356         $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/
   358     #   create necessary additional directories
   359     %{l_shtool} mkdir -f -p -m 755 \
   360         $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \
   361         $RPM_BUILD_ROOT%{l_prefix}/var/sasl/run/saslauthd \
   362         $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/sasl.d
   364     #   install run-command script
   365 %if "%{with_pam}" == "yes"
   366     l_authmech="pam"
   367 %else
   368     case "%{l_platform -t}" in
   369         *-linux* | *-sunos* ) l_authmech="shadow"   ;;
   370         *                   ) l_authmech="getpwent" ;;
   371     esac
   372 %endif
   373     %{l_shtool} mkdir -f -p -m 755 \
   374         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   375     %{l_shtool} install -c -m 755 \
   376         -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \
   377         %{SOURCE rc.sasl} \
   378         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   380     #   install OSSP fsl configuration
   381     %{l_shtool} mkdir -f -p -m 755 \
   382         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   383     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   384         %{SOURCE fsl.sasl} \
   385         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   387     #   install pkg-config configuration
   388     libs="-lsasl2"
   389     case "%{l_platform -t}" in
   390         *-linux* ) libs="$libs -ldl" ;;
   391     esac
   392     %{l_shtool} mkdir -f -p -m 755 \
   393         $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig
   394     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   395         -e "s;@version@;%{version};" \
   396         -e "s;@libs@;$libs;" \
   397         %{SOURCE sasl.pc} \
   398         $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/
   400     #   determine installation files
   401     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   402         %{l_files_std} \
   403         '%config %{l_prefix}/etc/fsl/fsl.sasl' \
   404         '%config %{l_prefix}/etc/sasl/saslauthd.conf' \
   405         '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \
   406         '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run' \
   407         '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run/saslauthd' \
   408         '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log'
   410 %files -f files
   412 %clean
   413     rm -rf $RPM_BUILD_ROOT
   415 %pre
   416     #   before upgrade, save status and stop service
   417     [ $1 -eq 2 ] || exit 0
   418     eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}`
   419     %{l_rc} sasl stop 2>/dev/null
   420     exit 0
   422 %post
   423 %if "%{with_pam}" == "yes"
   424     if [ $1 -eq 1 ]; then
   425         #   after install, add PAM configuration entry
   426         $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl
   427     fi
   428 %endif
   429     if [ $1 -eq 2 ]; then
   430         #   after upgrade, restore status
   431         eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}
   432         [ ".$sasl_active" = .yes ] && %{l_rc} sasl start
   433     fi
   434     exit 0
   436 %preun
   437     #   before erase, stop service and remove log files
   438     [ $1 -eq 0 ] || exit 0
   439     %{l_rc} sasl stop 2>/dev/null
   440     rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true
   441 %if "%{with_pam}" == "yes"
   442     #   remove PAM configuration entry
   443     $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl
   444 %endif
   445     exit 0

mercurial