dovecot/dovecot.spec

Tue, 03 Nov 2009 16:05:28 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 03 Nov 2009 16:05:28 +0100
changeset 236
8b89c85ab535
parent 187
0cbfb8a2de97
child 237
76b4896bea63
permissions
-rw-r--r--

Handle daemon run time activity on package operations.

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

mercurial