dovecot/dovecot.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 609
747afbba9aa8
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 ##
     2 ##  dovecot.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2012 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 version
    25 %define       V_major       2.1
    26 %define       V_minor       9
    27 %define       V_pigeonhole  0.3.1
    29 #   package information
    30 Name:         dovecot
    31 Summary:      IMAP4 & POP3 Server
    32 URL:          http://www.dovecot.org/
    33 Vendor:       Timo Sirainen et al.
    34 Packager:     OpenPKG Foundation e.V.
    35 Distribution: OpenPKG Community
    36 Class:        EVAL
    37 Group:        Mail
    38 License:      MIT+LGPL
    39 Version:      %{V_major}.%{V_minor}
    40 Release:      20120800
    42 #   package options
    43 %option       with_fsl          yes
    44 %option       with_sieve        yes
    45 %option       with_pam          no
    46 %option       with_ldap         no
    47 %option       with_mysql        no
    48 %option       with_pgsql        no
    49 %option       with_sqlite       no
    51 #   list of sources
    52 Source0:      http://www.dovecot.org/releases/%{V_major}/dovecot-%{V_major}.%{V_minor}.tar.gz
    53 Source1:      http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}-pigeonhole-%{V_pigeonhole}.tar.gz
    54 Source2:      fsl.dovecot
    55 Source3:      rc.dovecot
    56 Source4:      dovecot.conf
    57 Patch0:       dovecot.patch
    59 #   build information
    60 BuildPreReq:  OpenPKG, openpkg >= 20100101, pkgconfig, make
    61 PreReq:       OpenPKG, openpkg >= 20100101, MTA, x509
    62 BuildPreReq:  libiconv, openssl, zlib, bzip2
    63 PreReq:       libiconv, openssl, zlib, bzip2
    64 %if "%{with_fsl}" == "yes"
    65 BuildPreReq:  fsl
    66 PreReq:       fsl
    67 %endif
    68 %if "%{with_ldap}" == "yes"
    69 BuildPreReq:  openldap
    70 PreReq:       openldap
    71 %endif
    72 %if "%{with_sieve}" == "yes"
    73 BuildPreReq:  gettext, autoconf, automake, libtool
    74 PreReq:       gettext
    75 %endif
    76 %if "%{with_pam}" == "yes"
    77 BuildPreReq:  PAM
    78 PreReq:       PAM
    79 %endif
    80 %if "%{with_mysql}" == "yes"
    81 BuildPreReq:  mysql, zlib
    82 PreReq:       mysql, zlib
    83 %endif
    84 %if "%{with_pgsql}" == "yes"
    85 BuildPreReq:  postgresql
    86 PreReq:       postgresql
    87 %endif
    88 %if "%{with_sqlite}" == "yes"
    89 BuildPreReq:  sqlite
    90 PreReq:       sqlite
    91 %endif
    93 %description
    94     Dovecot is an Open Source IMAP and POP3 server, written with
    95     security primarily in mind. Dovecot is an excellent choice for both
    96     small and large installations. It's fast, simple to set up, requires
    97     no special administration and it uses very little memory.
    99 %track
   100     prog dovecot = {
   101         version   = %{V_major}.%{V_minor}
   102         url       = http://www.dovecot.org/download.html
   103         regex     = dovecot-(\d+\.\d+(?:\.\d+))\.tar\.gz
   104     }
   105     prog dovecot:sieve = {
   106         version   = %{V_pigeonhole}
   107         url       = http://www.rename-it.nl/dovecot/%{V_major}/
   108         regex     = dovecot-%{V_major}-pigeonhole-(__VER__)\.tar\.gz
   109     }
   111 %prep
   112     %setup -q
   113 %if "%{with_sieve}" == "yes"
   114     %setup -q -T -D -a 1
   115 %endif
   116     %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b
   118 %build
   119     #   build Dovecot
   120     %{l_shtool} subst \
   121         -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
   122         src/config/all-settings.c \
   123         src/lib-lda/lda-settings.c
   124     cppflags="%{l_cppflags}"
   125     ldflags="%{l_ldflags} %{l_fsl_ldflags}"
   126     libs="%{l_fsl_libs} `%{l_prefix}/bin/pkg-config --libs-only-l openssl`"
   127     sql_drivers=""
   128 %if "%{with_ldap}" == "yes"
   129     ldflags="$ldflags `%{l_prefix}/bin/pkg-config --libs-only-L openldap`"
   130     libs="$libs `%{l_prefix}/bin/pkg-config --libs-only-l openldap`"
   131 %endif
   132 %if "%{with_mysql}" == "yes"
   133     cppflags="$cppflags %{l_cppflags mysql}"
   134     ldflags="$ldflags %{l_ldflags mysql}"
   135 %endif
   136 %if "%{with_pgsql}" == "yes"
   137     libs="$libs `%{l_prefix}/bin/pg_config --libs"
   138 %endif
   139     sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'`
   140     CC="%{l_cc}" \
   141     CFLAGS="%{l_cflags -O}" \
   142     CPPFLAGS="$cppflags" \
   143     LDFLAGS="$ldflags" \
   144     LIBS="$libs" \
   145     ./configure \
   146         --prefix=%{l_prefix} \
   147         --mandir=%{l_prefix}/man \
   148         --sysconfdir=%{l_prefix}/etc \
   149         --with-ssldir=%{l_prefix}/etc/dovecot/ssl \
   150         --datadir=%{l_prefix}/share/dovecot \
   151         --docdir=%{l_prefix}/share/dovecot/doc \
   152         --with-rundir=%{l_prefix}/var/dovecot/run \
   153         --with-libiconv-prefix=%{l_prefix} \
   154         --with-ssl=openssl \
   155         --with-docs \
   156 %if "%{with_ldap}" == "yes"
   157         --with-ldap \
   158 %else
   159         --without-ldap \
   160 %endif
   161 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
   162         --with-sql \
   163 %if "%{with_mysql}" == "yes"
   164         --with-mysql \
   165 %else
   166         --without-mysql \
   167 %endif
   168 %if "%{with_pgsql}" == "yes"
   169         --with-pgsql \
   170 %else
   171         --without-pgsql \
   172 %endif
   173 %if "%{with_sqlite}" == "yes"
   174         --with-sqlite \
   175 %else
   176         --without-sqlite \
   177 %endif
   178 %else
   179         --without-sql \
   180         --without-mysql \
   181         --without-pgsql \
   182         --without-sqlite \
   183 %endif
   184 %if "%{with_pam}" == "yes"
   185         --with-pam \
   186 %else
   187         --without-pam \
   188 %endif
   189         --without-gc \
   190         --without-gssapi \
   191         --without-lucene \
   192         --without-vpopmail \
   193         --enable-shared \
   194         --disable-static
   195     %{l_make} %{l_mflags -O}
   197 %if "%{with_sieve}" == "yes"
   198     #   build optional Dovecot LDA sieve plugin
   199     ( cd dovecot-*-pigeonhole-*
   200       ./autogen.sh
   201       CC="%{l_cc}" \
   202       CFLAGS="%{l_cflags -O}" \
   203       CPPFLAGS="%{l_cppflags}" \
   204       LDFLAGS="%{l_ldflags}" \
   205       ./configure \
   206           --prefix=%{l_prefix} \
   207           --mandir=%{l_prefix}/man \
   208           --with-dovecot=`pwd`/.. \
   209           --with-managesieve
   210       %{l_make} %{l_mflags -O}
   211     ) || exit $?
   212 %endif
   214 %install
   215     #   install Dovecot
   216     %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
   218 %if "%{with_sieve}" == "yes"
   219     #   install optional Dovecot LDA sieve plugin
   220     ( cd dovecot-*-pigeonhole-*
   221       %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
   222     ) || exit $?
   223 %endif
   225     #   create additional dirctories
   226     %{l_shtool} mkdir -f -p -m 755 \
   227         $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \
   228         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \
   229         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login
   231     #   install run-command script
   232     %{l_shtool} mkdir -f -p -m 755 \
   233         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   234     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   235         %{SOURCE rc.dovecot} \
   236         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   238     #   strip installation
   239     rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/dovecot
   240     rm -f  $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/README
   241     rm -f  $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/dovecot*example.conf
   242     rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/dovecot
   243     rm -f  $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.a  >/dev/null 2>&1 || true
   244     rm -f  $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la >/dev/null 2>&1 || true
   245     strip \
   246         $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
   247         $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \
   248         >/dev/null 2>&1 || true
   250     #   install default server configuration
   251     %{l_shtool} mkdir -f -p -m 755 \
   252         $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot
   253     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   254         %{SOURCE dovecot.conf} \
   255         $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/
   257     #   install OSSP fsl configuration
   258     %{l_shtool} mkdir -f -p -m 755 \
   259         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   260     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   261         %{SOURCE fsl.dovecot} \
   262         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   264     #   generate file list
   265     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
   266         '%not %dir %{l_prefix}/etc/fsl' \
   267         '%config %{l_prefix}/etc/fsl/fsl.dovecot' \
   268         '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \
   269         '%config %attr(0644,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \
   270         '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \
   271         '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot' \
   272         '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \
   273         '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run' \
   274         '%dir %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run/login'
   276 %files -f files
   278 %clean
   280 %post
   281     #   after upgrade, restart service
   282     [ $1 -eq 2 ] || exit 0
   283     eval `%{l_rc} dovecot status 2>/dev/null`
   284     [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart
   285     exit 0
   287 %preun
   288     #   before erase, stop service and remove log files
   289     [ $1 -eq 0 ] || exit 0
   290     %{l_rc} dovecot stop 2>/dev/null
   291     rm -f $RPM_INSTALL_PREFIX/var/dovecot/*           >/dev/null 2>&1 || true
   292     rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/*       >/dev/null 2>&1 || true
   293     rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/*       >/dev/null 2>&1 || true
   294     rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true
   295     exit 0

mercurial