dovecot/dovecot.spec

Wed, 27 May 2009 19:56:08 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 27 May 2009 19:56:08 +0200
changeset 204
5aa32536e189
parent 187
0cbfb8a2de97
child 237
76b4896bea63
permissions
-rw-r--r--

Update version, adjust and improve patch, correct managesieve patch
logic, and introduce managesieve build logic.

     1 ##
     2 ##  dovecot.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 version
    25 %define       V_major             1.1
    26 %define       V_minor             15
    27 %define       V_minor_sieve       6
    28 %define       V_managesieve       0.10.6
    30 #   package information
    31 Name:         dovecot
    32 Summary:      IMAP4 & POP3 Server
    33 URL:          http://www.dovecot.org/
    34 Vendor:       Timo Sirainen et al.
    35 Packager:     OpenPKG Foundation e.V.
    36 Distribution: OpenPKG Community
    37 Class:        EVAL
    38 Group:        Mail
    39 License:      MIT+LGPL
    40 Version:      %{V_major}.%{V_minor}
    41 Release:      20090521
    43 #   package options
    44 %option       with_fsl          yes
    45 %option       with_pam          yes
    46 %option       with_ldap         no
    47 %option       with_mysql        no
    48 %option       with_pgsql        no
    49 %option       with_sqlite       no
    50 %option       with_pop3d        no
    51 %option       with_managesieve  no
    52 %option       with_sieve        yes
    54 #   list of sources
    55 Source0:      http://www.dovecot.org/releases/%{V_major}/dovecot-%{V_major}.%{V_minor}.tar.gz
    56 Source1:      http://www.dovecot.org/releases/sieve/dovecot-sieve-%{V_major}.%{V_minor_sieve}.tar.gz
    57 Source2:      http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}-managesieve-%{V_managesieve}.tar.gz
    58 Source3:      fsl.dovecot
    59 Source4:      rc.dovecot
    60 Patch0:       dovecot.patch
    61 Patch1:       http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}.%{V_minor}-managesieve-%{V_managesieve}.diff.gz
    63 #   build information
    64 Prefix:       %{l_prefix}
    65 BuildRoot:    %{l_buildroot}
    66 BuildPreReq:  OpenPKG, openpkg >= 20060823
    67 PreReq:       OpenPKG, openpkg >= 20060823, MTA
    68 BuildPreReq:  libiconv, openssl
    69 PreReq:       libiconv, openssl
    70 %if "%{with_fsl}" == "yes"
    71 BuildPreReq:  fsl
    72 PreReq:       fsl
    73 %endif
    74 %if "%{with_ldap}" == "yes"
    75 BuildPreReq:  openldap
    76 PreReq:       openldap
    77 %endif
    78 %if "%{with_managesieve}" == "yes"
    79 BuildPreReq:  autoconf, automake, pkgconfig, libtool
    80 BuildPreReq:  gettext
    81 PreReq:       gettext
    82 %endif
    83 %if "%{with_pam}" == "yes"
    84 BuildPreReq:  PAM
    85 PreReq:       PAM
    86 %endif
    87 %if "%{with_mysql}" == "yes"
    88 BuildPreReq:  mysql, zlib
    89 PreReq:       mysql, zlib
    90 %endif
    91 %if "%{with_pgsql}" == "yes"
    92 BuildPreReq:  postgresql
    93 PreReq:       postgresql
    94 %endif
    95 %if "%{with_sqlite}" == "yes"
    96 BuildPreReq:  sqlite
    97 PreReq:       sqlite
    98 %endif
    99 AutoReq:      no
   100 AutoReqProv:  no
   102 %description
   103     Dovecot is an Open Source IMAP and POP3 server, written with
   104     security primarily in mind. Dovecot is an excellent choice for both
   105     small and large installations. It's fast, simple to set up, requires
   106     no special administration and it uses very little memory.
   108 %track
   109     prog dovecot = {
   110         version   = %{V_major}.%{V_minor}
   111         url       = http://www.dovecot.org/download.html
   112         regex     = dovecot-(1\.1(\.\d+)+)\.tar\.gz
   113     }
   114     prog dovecot:sieve = {
   115         version   = %{V_major}.%{V_minor_sieve}
   116         url       = http://www.dovecot.org/download.html
   117         regex     = dovecot-sieve-(%{V_major}(\.\d+)+)\.tar\.gz
   118     }
   119     prog dovecot:managesieve = {
   120         version   = %{V_managesieve}
   121         url       = http://www.rename-it.nl/dovecot/%{V_major}/
   122         regex     = dovecot-%{V_major}-managesieve-(__VER__)\.tar\.gz
   123     }
   125 %prep
   126     %setup -q
   127 %if "%{with_sieve}" == "yes"
   128     %setup -q -T -D -a 1
   129 %endif
   130 %if "%{with_managesieve}" == "yes"
   131     %setup -q -T -D -a 2
   132     %{l_gzip} -dc <%{PATCH1} | %{l_patch} -p1 -b
   133     %{l_shtool} subst \
   134         -e 's;/usr/\(libexec/dovecot/managesieve\);%{l_prefix}/\1;g' \
   135         dovecot-example.conf
   136 %endif
   137     %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b
   139 %build
   140 %if "%{with_managesieve}" == "yes"
   141     autoreconf -i --force || true
   142 %endif
   143     cppflags="%{l_cppflags}"
   144     ldflags="%{l_ldflags} %{l_fsl_ldflags}"
   145     libs="%{l_fsl_libs}"
   146     sql_drivers=""
   147 %if "%{with_ldap}" == "yes"
   148     libs="$libs -llber -lssl -lcrypto"
   149 %endif
   150 %if "%{with_mysql}" == "yes"
   151     cppflags="$cppflags %{l_cppflags mysql}"
   152     ldflags="$ldflags %{l_ldflags mysql}"
   153     sql_drivers="$sql_drivers,mysql"
   154 %endif
   155 %if "%{with_pgsql}" == "yes"
   156     libs="$libs -lssl -lcrypto -lcrypt"
   157     sql_drivers="$sql_drivers,pgsql"
   158 %endif
   159 %if "%{with_sqlite}" == "yes"
   160     sql_drivers="$sql_drivers,sqlite"
   161 %endif
   162     sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'`
   164     CC="%{l_cc}" \
   165     CFLAGS="%{l_cflags -O}" \
   166     CPPFLAGS="$cppflags" \
   167     LDFLAGS="$ldflags" \
   168     LIBS="$libs" \
   169     GREP="grep" \
   170     ./configure \
   171         --prefix=%{l_prefix} \
   172         --sysconfdir=%{l_prefix}/etc/dovecot \
   173         --with-ssldir=%{l_prefix}/etc/dovecot/ssl \
   174         --datadir=%{l_prefix}/share/dovecot \
   175         --docdir=%{l_prefix}/share/dovecot/doc \
   176         --with-rundir=%{l_prefix}/var/dovecot/run \
   177         --with-statedir=%{l_prefix}/var/dovecot/dat \
   178         --with-libiconv-prefix=%{l_prefix} \
   179         --with-ssl=openssl \
   180         --with-deliver \
   181         --with-docs \
   182 %if "%{with_ldap}" == "yes"
   183         --with-ldap \
   184 %else
   185         --without-ldap \
   186 %endif
   187 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
   188         --with-sql \
   189         --with-sql-drivers="$sql_drivers" \
   190 %if "%{with_mysql}" == "yes"
   191         --with-mysql \
   192 %else
   193         --without-mysql \
   194 %endif
   195 %if "%{with_pgsql}" == "yes"
   196         --with-pgsql \
   197 %else
   198         --without-pgsql \
   199 %endif
   200 %if "%{with_sqlite}" == "yes"
   201         --with-sqlite \
   202 %else
   203         --without-sqlite \
   204 %endif
   205 %else
   206         --without-sql \
   207         --without-sql-drivers \
   208         --without-mysql \
   209         --without-pgsql \
   210         --without-sqlite \
   211 %endif
   212 %if "%{with_pam}" == "yes"
   213         --with-pam \
   214 %else
   215         --without-pam \
   216 %endif
   217 %if "%{with_pop3d}" == "yes"
   218         --with-pop3d \
   219 %else
   220         --without-pop3d \
   221 %endif
   222         --without-gc \
   223         --without-gssapi \
   224         --without-lucene \
   225         --without-vpopmail
   226     %{l_make} %{l_mflags -O}
   228 %if "%{with_sieve}" == "yes"
   229     #   build optional Dovecot LDA sieve plugin
   230     ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
   231       CC="%{l_cc}" \
   232       CFLAGS="%{l_cflags -O}" \
   233       CPPFLAGS="%{l_cppflags}" \
   234       LDFLAGS="%{l_ldflags}" \
   235       GREP="grep" \
   236       ./configure \
   237           --prefix=%{l_prefix} \
   238           --with-dovecot=..
   239       %{l_make} %{l_mflags -O}
   240     ) || exit $?
   241 %endif
   243 %if "%{with_managesieve}" == "yes"
   244     #   build optional Dovecot managesieve package
   245     ( cd dovecot-%{V_major}-managesieve-%{V_managesieve}
   246       CC="%{l_cc}" \
   247       CFLAGS="%{l_cflags -O}" \
   248       CPPFLAGS="%{l_cppflags}" \
   249       LDFLAGS="%{l_ldflags}" \
   250       GREP="grep" \
   251       ./configure \
   252           --prefix=%{l_prefix} \
   253           --with-dovecot=.. \
   254           --with-dovecot-sieve=../dovecot-sieve-%{V_major}.%{V_minor_sieve}
   255       %{l_make} %{l_mflags -O}
   256     ) || exit $?
   257 %endif
   259 %install
   260     rm -rf $RPM_BUILD_ROOT
   261     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   263 %if "%{with_sieve}" == "yes"
   264     #   install optional Dovecot LDA sieve plugin
   265     ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
   266       %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   267     ) || exit $?
   268 %endif
   270 %if "%{with_managesieve}" == "yes"
   271     #   install optional Dovecot managesieve package
   272     ( cd dovecot-%{V_major}-managesieve-%{V_managesieve}
   273       %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   274     ) || exit $?
   275 %endif
   277     #   adjust file names of configuration files
   278     ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot
   279       for i in dovecot dovecot-db dovecot-ldap dovecot-sql; do
   280           mv ${i}{-example,}.conf
   281       done
   282     ) || exit $?
   284     #   create additional dirctories
   285     %{l_shtool} mkdir -f -p -m 755 \
   286         $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \
   287         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/dat \
   288         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \
   289         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login
   291     #   install runcommand script
   292     %{l_shtool} mkdir -f -p -m 755 \
   293         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   294 %if "%{with_pop3d}" == "yes"
   295     cmd='/<\/\{0,1\}with_pop3d>/d'
   296 %else
   297     cmd='/<with_pop3d>/,/<\/with_pop3d>/d'
   298 %endif
   299     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   300         -e "$cmd" \
   301         %{SOURCE rc.dovecot} \
   302         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   304     #   install OSSP fsl configuration
   305     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   306     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   307         %{SOURCE fsl.dovecot} \
   308         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   310     #   strip installation
   311     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la \
   312         >/dev/null 2>&1 || true
   313     rmdir $RPM_BUILD_ROOT%{l_prefix}/include/dovecot \
   314         $RPM_BUILD_ROOT%{l_prefix}/include \
   315         >/dev/null 2>&1 || true
   316     strip \
   317         $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
   318         $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \
   319         >/dev/null 2>&1 || true
   321     #   generate file list
   322     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
   323         '%not %dir %{l_prefix}/etc/fsl' \
   324         '%config %{l_prefix}/etc/fsl/fsl.dovecot' \
   325         '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \
   326         '%config %attr(0640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \
   327         '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \
   328         '%dir %attr(0755,%{l_musr},%{l_mgrp}) %{l_prefix}/var/dovecot' \
   329         '%dir %attr(0770,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/dat' \
   330         '%dir %attr(0770,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \
   331         '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/run' \
   332         '%dir %attr(0750,%{l_musr},%{l_ngrp}) %{l_prefix}/var/dovecot/run/login' \
   333         '%doc %{l_prefix}/share/dovecot/doc' \
   334         '%doc %{l_prefix}/share/dovecot/doc/wiki'
   336 %files -f files
   338 %clean
   339     rm -rf $RPM_BUILD_ROOT
   341 %post
   342     #   after upgrade, restart service
   343     [ $1 -eq 2 ] || exit 0
   344     eval `%{l_rc} dovecot status 2>/dev/null`
   345     [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart
   346     exit 0
   348 %preun
   349     #   before erase, stop service and remove log files
   350     [ $1 -eq 0 ] || exit 0
   351     %{l_rc} dovecot stop 2>/dev/null
   352     rm -f $RPM_INSTALL_PREFIX/var/dovecot/*           >/dev/null 2>&1 || true
   353     rm -f $RPM_INSTALL_PREFIX/var/dovecot/dat/*       >/dev/null 2>&1 || true
   354     rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/*       >/dev/null 2>&1 || true
   355     rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/*       >/dev/null 2>&1 || true
   356     rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true
   357     exit 0

mercurial