sasl/sasl.spec

Fri, 05 Oct 2012 22:38:08 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 05 Oct 2012 22:38:08 +0200
changeset 725
405367b5a7ff
parent 724
b318ab5c5f26
child 727
914043724d20
permissions
-rw-r--r--

Correct use of nonstandard fixed bit datatypes u_int[0-9][0-9]*.

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

mercurial