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