dovecot/dovecot.spec

Tue, 21 Apr 2009 14:23:37 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 21 Apr 2009 14:23:37 +0200
changeset 187
0cbfb8a2de97
parent 168
7a1d64c9a105
child 204
5aa32536e189
permissions
-rw-r--r--

Specify additional log paths, correct user names, adapt permissions.

     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             13
    27 %define       V_minor_sieve       6
    28 %define       V_minor_managesieve 1
    29 %define       V_managesieve       0.10.3
    31 #   package information
    32 Name:         dovecot
    33 Summary:      IMAP4 & POP3 Server
    34 URL:          http://www.dovecot.org/
    35 Vendor:       Timo Sirainen et al.
    36 Packager:     OpenPKG Foundation e.V.
    37 Distribution: OpenPKG Community
    38 Class:        EVAL
    39 Group:        Mail
    40 License:      MIT+LGPL
    41 Version:      %{V_major}.%{V_minor}
    42 Release:      20090418
    44 #   package options
    45 %option       with_fsl          yes
    46 %option       with_pam          yes
    47 %option       with_ldap         no
    48 %option       with_mysql        no
    49 %option       with_pgsql        no
    50 %option       with_sqlite       no
    51 %option       with_pop3d        no
    52 %option       with_managesieve  no
    53 %option       with_sieve        yes
    55 #   list of sources
    56 Source0:      http://www.dovecot.org/releases/%{V_major}/dovecot-%{V_major}.%{V_minor}.tar.gz
    57 Source1:      http://www.dovecot.org/releases/sieve/dovecot-sieve-%{V_major}.%{V_minor_sieve}.tar.gz
    58 Source2:      fsl.dovecot
    59 Source3:      rc.dovecot
    60 Patch0:       dovecot.patch
    61 Patch1:       http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}.%{V_minor_managesieve}-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}\.%{V_minor_managesieve}-managesieve-(__VER__)\.diff\.gz
   123     }
   125 %prep
   126     %setup -q
   127 %if "%{with_sieve}" == "yes"
   128     %setup -q -T -D -a 1
   129 %endif
   130     %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b
   131 %if "%{with_managesieve}" == "yes"
   132     sleep 1
   133     %{l_gzip} -dc <%{PATCH1} | %{l_patch} -p1 -b
   134     sleep 1
   135     autoreconf -i --force || true
   136 %endif
   138 %build
   139     cppflags="%{l_cppflags}"
   140     ldflags="%{l_ldflags} %{l_fsl_ldflags}"
   141     libs="%{l_fsl_libs}"
   142     sql_drivers=""
   143 %if "%{with_ldap}" == "yes"
   144     libs="$libs -llber -lssl -lcrypto"
   145 %endif
   146 %if "%{with_mysql}" == "yes"
   147     cppflags="$cppflags %{l_cppflags mysql}"
   148     ldflags="$ldflags %{l_ldflags mysql}"
   149     sql_drivers="$sql_drivers,mysql"
   150 %endif
   151 %if "%{with_pgsql}" == "yes"
   152     libs="$libs -lssl -lcrypto -lcrypt"
   153     sql_drivers="$sql_drivers,pgsql"
   154 %endif
   155 %if "%{with_sqlite}" == "yes"
   156     sql_drivers="$sql_drivers,sqlite"
   157 %endif
   158     sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'`
   160     CC="%{l_cc}" \
   161     CFLAGS="%{l_cflags -O}" \
   162     CPPFLAGS="$cppflags" \
   163     LDFLAGS="$ldflags" \
   164     LIBS="$libs" \
   165     GREP="grep" \
   166     ./configure \
   167         --prefix=%{l_prefix} \
   168         --sysconfdir=%{l_prefix}/etc/dovecot \
   169         --with-ssldir=%{l_prefix}/etc/dovecot/ssl \
   170         --datadir=%{l_prefix}/share/dovecot \
   171         --docdir=%{l_prefix}/share/dovecot/doc \
   172         --with-rundir=%{l_prefix}/var/dovecot/run \
   173         --with-statedir=%{l_prefix}/var/dovecot/dat \
   174         --with-libiconv-prefix=%{l_prefix} \
   175         --with-ssl=openssl \
   176         --with-deliver \
   177         --with-docs \
   178 %if "%{with_ldap}" == "yes"
   179         --with-ldap \
   180 %else
   181         --without-ldap \
   182 %endif
   183 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
   184         --with-sql \
   185         --with-sql-drivers="$sql_drivers" \
   186 %if "%{with_mysql}" == "yes"
   187         --with-mysql \
   188 %else
   189         --without-mysql \
   190 %endif
   191 %if "%{with_pgsql}" == "yes"
   192         --with-pgsql \
   193 %else
   194         --without-pgsql \
   195 %endif
   196 %if "%{with_sqlite}" == "yes"
   197         --with-sqlite \
   198 %else
   199         --without-sqlite \
   200 %endif
   201 %else
   202         --without-sql \
   203         --without-sql-drivers \
   204         --without-mysql \
   205         --without-pgsql \
   206         --without-sqlite \
   207 %endif
   208 %if "%{with_pam}" == "yes"
   209         --with-pam \
   210 %else
   211         --without-pam \
   212 %endif
   213 %if "%{with_pop3d}" == "yes"
   214         --with-pop3d \
   215 %else
   216         --without-pop3d \
   217 %endif
   218         --without-gc \
   219         --without-gssapi \
   220         --without-lucene \
   221         --without-vpopmail
   222     %{l_make} %{l_mflags -O}
   224 %if "%{with_sieve}" == "yes"
   225     #   build optional Dovecot LDA sieve plugin
   226     ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
   227       CC="%{l_cc}" \
   228       CFLAGS="%{l_cflags -O}" \
   229       CPPFLAGS="%{l_cppflags}" \
   230       LDFLAGS="%{l_ldflags}" \
   231       GREP="grep" \
   232       ./configure \
   233           --prefix=%{l_prefix} \
   234           --with-dovecot=..
   235       %{l_make} %{l_mflags -O}
   236     ) || exit $?
   237 %endif
   239 %install
   240     rm -rf $RPM_BUILD_ROOT
   241     %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   243 %if "%{with_sieve}" == "yes"
   244     #   install optional Dovecot LDA sieve plugin
   245     ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
   246       %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   247     ) || exit $?
   248 %endif
   250     #   adjust file names of configuration files
   251     ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot
   252       for i in dovecot dovecot-db dovecot-ldap dovecot-sql; do
   253           mv ${i}{-example,}.conf
   254       done
   255     ) || exit $?
   257     #   create additional dirctories
   258     %{l_shtool} mkdir -f -p -m 755 \
   259         $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \
   260         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/dat \
   261         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \
   262         $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login
   264     #   install runcommand script
   265     %{l_shtool} mkdir -f -p -m 755 \
   266         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   267 %if "%{with_pop3d}" == "yes"
   268     cmd='/<\/\{0,1\}with_pop3d>/d'
   269 %else
   270     cmd='/<with_pop3d>/,/<\/with_pop3d>/d'
   271 %endif
   272     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   273         -e "$cmd" \
   274         %{SOURCE rc.dovecot} \
   275         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   277     #   install OSSP fsl configuration
   278     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   279     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   280         %{SOURCE fsl.dovecot} \
   281         $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   283     #   strip installation
   284     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la \
   285         >/dev/null 2>&1 || true
   286     rmdir $RPM_BUILD_ROOT%{l_prefix}/include/dovecot \
   287         $RPM_BUILD_ROOT%{l_prefix}/include \
   288         >/dev/null 2>&1 || true
   289     strip \
   290         $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
   291         $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \
   292         >/dev/null 2>&1 || true
   294     #   generate file list
   295     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
   296         '%not %dir %{l_prefix}/etc/fsl' \
   297         '%config %{l_prefix}/etc/fsl/fsl.dovecot' \
   298         '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \
   299         '%config %attr(0640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \
   300         '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \
   301         '%dir %attr(0755,%{l_musr},%{l_mgrp}) %{l_prefix}/var/dovecot' \
   302         '%dir %attr(0770,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/dat' \
   303         '%dir %attr(0770,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \
   304         '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/run' \
   305         '%dir %attr(0750,%{l_musr},%{l_ngrp}) %{l_prefix}/var/dovecot/run/login' \
   306         '%doc %{l_prefix}/share/dovecot/doc' \
   307         '%doc %{l_prefix}/share/dovecot/doc/wiki'
   309 %files -f files
   311 %clean
   312     rm -rf $RPM_BUILD_ROOT
   314 %post
   315     #   after upgrade, restart service
   316     [ $1 -eq 2 ] || exit 0
   317     eval `%{l_rc} dovecot status 2>/dev/null`
   318     [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart
   319     exit 0
   321 %preun
   322     #   before erase, stop service and remove log files
   323     [ $1 -eq 0 ] || exit 0
   324     %{l_rc} dovecot stop 2>/dev/null
   325     rm -f $RPM_INSTALL_PREFIX/var/dovecot/*           >/dev/null 2>&1 || true
   326     rm -f $RPM_INSTALL_PREFIX/var/dovecot/dat/*       >/dev/null 2>&1 || true
   327     rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/*       >/dev/null 2>&1 || true
   328     rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/*       >/dev/null 2>&1 || true
   329     rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true
   330     exit 0

mercurial