dovecot/dovecot.spec

Wed, 08 Feb 2012 20:16:25 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:16:25 +0200
changeset 608
09548e292fb1
parent 243
a306070c4f81
child 609
747afbba9aa8
permissions
-rw-r--r--

Update to new major vendor version from 1 to 2, adjusting buildconf accordingly.

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@608 25 %define V_major 2.0
michael@608 26 %define V_minor 18
michael@608 27 %define V_pigeonhole 0.2.6
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@608 40 Release: 20120208
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@148 60 Prefix: %{l_prefix}
michael@148 61 BuildRoot: %{l_buildroot}
michael@148 62 BuildPreReq: OpenPKG, openpkg >= 20060823
michael@237 63 PreReq: OpenPKG, openpkg >= 20060823, MTA, x509
michael@608 64 BuildPreReq: libiconv, openssl, zlib, bzip2
michael@608 65 PreReq: libiconv, openssl, zlib, bzip2
michael@148 66 %if "%{with_fsl}" == "yes"
michael@148 67 BuildPreReq: fsl
michael@148 68 PreReq: fsl
michael@148 69 %endif
michael@148 70 %if "%{with_ldap}" == "yes"
michael@148 71 BuildPreReq: openldap
michael@148 72 PreReq: openldap
michael@148 73 %endif
michael@608 74 %if "%{with_sieve}" == "yes"
michael@608 75 BuildPreReq: gettext, autoconf, automake, libtool
michael@148 76 PreReq: gettext
michael@148 77 %endif
michael@148 78 %if "%{with_pam}" == "yes"
michael@148 79 BuildPreReq: PAM
michael@148 80 PreReq: PAM
michael@148 81 %endif
michael@148 82 %if "%{with_mysql}" == "yes"
michael@148 83 BuildPreReq: mysql, zlib
michael@148 84 PreReq: mysql, zlib
michael@148 85 %endif
michael@148 86 %if "%{with_pgsql}" == "yes"
michael@148 87 BuildPreReq: postgresql
michael@148 88 PreReq: postgresql
michael@148 89 %endif
michael@148 90 %if "%{with_sqlite}" == "yes"
michael@148 91 BuildPreReq: sqlite
michael@148 92 PreReq: sqlite
michael@148 93 %endif
michael@148 94 AutoReq: no
michael@148 95 AutoReqProv: no
michael@148 96
michael@148 97 %description
michael@148 98 Dovecot is an Open Source IMAP and POP3 server, written with
michael@148 99 security primarily in mind. Dovecot is an excellent choice for both
michael@148 100 small and large installations. It's fast, simple to set up, requires
michael@148 101 no special administration and it uses very little memory.
michael@148 102
michael@148 103 %track
michael@148 104 prog dovecot = {
michael@148 105 version = %{V_major}.%{V_minor}
michael@148 106 url = http://www.dovecot.org/download.html
michael@608 107 regex = dovecot-(\d+\.\d+(?:\.\d+))\.tar\.gz
michael@148 108 }
michael@148 109 prog dovecot:sieve = {
michael@608 110 version = %{V_pigeonhole}
michael@237 111 url = http://www.rename-it.nl/dovecot/%{V_major}/
michael@608 112 regex = dovecot-%{V_major}-pigeonhole-(__VER__)\.tar\.gz
michael@148 113 }
michael@148 114
michael@148 115 %prep
michael@148 116 %setup -q
michael@148 117 %if "%{with_sieve}" == "yes"
michael@148 118 %setup -q -T -D -a 1
michael@148 119 %endif
michael@148 120 %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b
michael@204 121
michael@204 122 %build
michael@608 123 # build Dovecot
michael@608 124 %{l_shtool} subst \
michael@608 125 -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
michael@608 126 src/config/all-settings.c \
michael@608 127 src/lib-lda/lda-settings.c
michael@148 128 cppflags="%{l_cppflags}"
michael@148 129 ldflags="%{l_ldflags} %{l_fsl_ldflags}"
michael@148 130 libs="%{l_fsl_libs}"
michael@148 131 sql_drivers=""
michael@148 132 %if "%{with_ldap}" == "yes"
michael@148 133 libs="$libs -llber -lssl -lcrypto"
michael@148 134 %endif
michael@148 135 %if "%{with_mysql}" == "yes"
michael@148 136 cppflags="$cppflags %{l_cppflags mysql}"
michael@148 137 ldflags="$ldflags %{l_ldflags mysql}"
michael@148 138 %endif
michael@148 139 %if "%{with_pgsql}" == "yes"
michael@148 140 libs="$libs -lssl -lcrypto -lcrypt"
michael@148 141 %endif
michael@148 142 sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'`
michael@148 143 CC="%{l_cc}" \
michael@148 144 CFLAGS="%{l_cflags -O}" \
michael@148 145 CPPFLAGS="$cppflags" \
michael@148 146 LDFLAGS="$ldflags" \
michael@148 147 LIBS="$libs" \
michael@148 148 ./configure \
michael@148 149 --prefix=%{l_prefix} \
michael@237 150 --mandir=%{l_prefix}/man \
michael@608 151 --sysconfdir=%{l_prefix}/etc \
michael@148 152 --with-ssldir=%{l_prefix}/etc/dovecot/ssl \
michael@148 153 --datadir=%{l_prefix}/share/dovecot \
michael@148 154 --docdir=%{l_prefix}/share/dovecot/doc \
michael@148 155 --with-rundir=%{l_prefix}/var/dovecot/run \
michael@148 156 --with-libiconv-prefix=%{l_prefix} \
michael@148 157 --with-ssl=openssl \
michael@148 158 --with-docs \
michael@148 159 %if "%{with_ldap}" == "yes"
michael@148 160 --with-ldap \
michael@148 161 %else
michael@148 162 --without-ldap \
michael@148 163 %endif
michael@148 164 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
michael@148 165 --with-sql \
michael@148 166 %if "%{with_mysql}" == "yes"
michael@148 167 --with-mysql \
michael@148 168 %else
michael@148 169 --without-mysql \
michael@148 170 %endif
michael@148 171 %if "%{with_pgsql}" == "yes"
michael@148 172 --with-pgsql \
michael@148 173 %else
michael@148 174 --without-pgsql \
michael@148 175 %endif
michael@148 176 %if "%{with_sqlite}" == "yes"
michael@148 177 --with-sqlite \
michael@148 178 %else
michael@148 179 --without-sqlite \
michael@148 180 %endif
michael@148 181 %else
michael@148 182 --without-sql \
michael@148 183 --without-mysql \
michael@148 184 --without-pgsql \
michael@148 185 --without-sqlite \
michael@148 186 %endif
michael@148 187 %if "%{with_pam}" == "yes"
michael@148 188 --with-pam \
michael@148 189 %else
michael@148 190 --without-pam \
michael@148 191 %endif
michael@148 192 --without-gc \
michael@148 193 --without-gssapi \
michael@148 194 --without-lucene \
michael@237 195 --without-vpopmail \
michael@608 196 --enable-shared \
michael@237 197 --disable-static
michael@148 198 %{l_make} %{l_mflags -O}
michael@148 199
michael@148 200 %if "%{with_sieve}" == "yes"
michael@148 201 # build optional Dovecot LDA sieve plugin
michael@608 202 ( cd dovecot-*-pigeonhole-*
michael@608 203 ./autogen.sh
michael@148 204 CC="%{l_cc}" \
michael@148 205 CFLAGS="%{l_cflags -O}" \
michael@148 206 CPPFLAGS="%{l_cppflags}" \
michael@148 207 LDFLAGS="%{l_ldflags}" \
michael@148 208 ./configure \
michael@148 209 --prefix=%{l_prefix} \
michael@237 210 --mandir=%{l_prefix}/man \
michael@608 211 --with-dovecot=`pwd`/.. \
michael@608 212 --with-managesieve
michael@204 213 %{l_make} %{l_mflags -O}
michael@204 214 ) || exit $?
michael@204 215 %endif
michael@204 216
michael@148 217 %install
michael@608 218 # clean build cruft
michael@148 219 rm -rf $RPM_BUILD_ROOT
michael@608 220
michael@608 221 # install Dovecot
michael@608 222 %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
michael@148 223
michael@148 224 %if "%{with_sieve}" == "yes"
michael@148 225 # install optional Dovecot LDA sieve plugin
michael@608 226 ( cd dovecot-*-pigeonhole-*
michael@608 227 %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
michael@204 228 ) || exit $?
michael@204 229 %endif
michael@204 230
michael@148 231 # create additional dirctories
michael@148 232 %{l_shtool} mkdir -f -p -m 755 \
michael@148 233 $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \
michael@148 234 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \
michael@148 235 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login
michael@148 236
michael@608 237 # install run-command script
michael@148 238 %{l_shtool} mkdir -f -p -m 755 \
michael@148 239 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
michael@148 240 %{l_shtool} install -c -m 755 %{l_value -s -a} \
michael@148 241 %{SOURCE rc.dovecot} \
michael@148 242 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
michael@148 243
michael@148 244 # strip installation
michael@608 245 rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/dovecot
michael@608 246 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/README
michael@608 247 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/dovecot*example.conf
michael@608 248 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/dovecot
michael@608 249 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.a >/dev/null 2>&1 || true
michael@608 250 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la >/dev/null 2>&1 || true
michael@148 251 strip \
michael@148 252 $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
michael@148 253 $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \
michael@148 254 >/dev/null 2>&1 || true
michael@148 255
michael@237 256 # install default server configuration
michael@237 257 %{l_shtool} mkdir -f -p -m 755 \
michael@237 258 $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot
michael@608 259 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@237 260 %{SOURCE dovecot.conf} \
michael@237 261 $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/
michael@237 262
michael@237 263 # install OSSP fsl configuration
michael@237 264 %{l_shtool} mkdir -f -p -m 755 \
michael@237 265 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
michael@237 266 %{l_shtool} install -c -m 644 %{l_value -s -a} \
michael@237 267 %{SOURCE fsl.dovecot} \
michael@237 268 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
michael@237 269
michael@148 270 # generate file list
michael@148 271 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
michael@148 272 '%not %dir %{l_prefix}/etc/fsl' \
michael@148 273 '%config %{l_prefix}/etc/fsl/fsl.dovecot' \
michael@148 274 '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \
michael@608 275 '%config %attr(0644,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \
michael@148 276 '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \
michael@608 277 '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot' \
michael@608 278 '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \
michael@608 279 '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run' \
michael@608 280 '%dir %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run/login'
michael@148 281
michael@148 282 %files -f files
michael@148 283
michael@148 284 %clean
michael@148 285 rm -rf $RPM_BUILD_ROOT
michael@148 286
michael@148 287 %post
michael@148 288 # after upgrade, restart service
michael@148 289 [ $1 -eq 2 ] || exit 0
michael@148 290 eval `%{l_rc} dovecot status 2>/dev/null`
michael@148 291 [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart
michael@148 292 exit 0
michael@148 293
michael@148 294 %preun
michael@148 295 # before erase, stop service and remove log files
michael@148 296 [ $1 -eq 0 ] || exit 0
michael@148 297 %{l_rc} dovecot stop 2>/dev/null
michael@148 298 rm -f $RPM_INSTALL_PREFIX/var/dovecot/* >/dev/null 2>&1 || true
michael@148 299 rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/* >/dev/null 2>&1 || true
michael@148 300 rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/* >/dev/null 2>&1 || true
michael@148 301 rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true
michael@148 302 exit 0
michael@148 303

mercurial