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