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.

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

mercurial