dovecot/dovecot.spec

Thu, 05 Nov 2009 18:06:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 05 Nov 2009 18:06:08 +0100
changeset 239
d2e66a0e1aa8
parent 237
76b4896bea63
child 243
a306070c4f81
permissions
-rw-r--r--

Specify required statedir, correct permissions, improve config.

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

mercurial