Fri, 17 Apr 2009 23:41:36 +0200
Remove automake(1) variables, as only autoconf is used in build conf.
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 ##
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
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: 20090408
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
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
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
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.
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 }
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
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;^,;;'`
160 CC="%{l_cc}" \
161 CFLAGS="%{l_cflags -O}" \
162 CPPFLAGS="$cppflags" \
163 LDFLAGS="$ldflags" \
164 LIBS="$libs" \
165 GREP="grep" \
166 ./configure \
167 --prefix=%{l_prefix} \
168 --sysconfdir=%{l_prefix}/etc/dovecot \
169 --with-ssldir=%{l_prefix}/etc/dovecot/ssl \
170 --datadir=%{l_prefix}/share/dovecot \
171 --docdir=%{l_prefix}/share/dovecot/doc \
172 --with-rundir=%{l_prefix}/var/dovecot/run \
173 --with-statedir=%{l_prefix}/var/dovecot/dat \
174 --with-libiconv-prefix=%{l_prefix} \
175 --with-ssl=openssl \
176 --with-deliver \
177 --with-docs \
178 %if "%{with_ldap}" == "yes"
179 --with-ldap \
180 %else
181 --without-ldap \
182 %endif
183 %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes"
184 --with-sql \
185 --with-sql-drivers="$sql_drivers" \
186 %if "%{with_mysql}" == "yes"
187 --with-mysql \
188 %else
189 --without-mysql \
190 %endif
191 %if "%{with_pgsql}" == "yes"
192 --with-pgsql \
193 %else
194 --without-pgsql \
195 %endif
196 %if "%{with_sqlite}" == "yes"
197 --with-sqlite \
198 %else
199 --without-sqlite \
200 %endif
201 %else
202 --without-sql \
203 --without-sql-drivers \
204 --without-mysql \
205 --without-pgsql \
206 --without-sqlite \
207 %endif
208 %if "%{with_pam}" == "yes"
209 --with-pam \
210 %else
211 --without-pam \
212 %endif
213 %if "%{with_pop3d}" == "yes"
214 --with-pop3d \
215 %else
216 --without-pop3d \
217 %endif
218 --without-gc \
219 --without-gssapi \
220 --without-lucene \
221 --without-vpopmail \
222 --enable-shared \
223 --disable-static
224 %{l_make} %{l_mflags -O}
226 %if "%{with_sieve}" == "yes"
227 # build optional Dovecot LDA sieve plugin
228 ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
229 CC="%{l_cc}" \
230 CFLAGS="%{l_cflags -O}" \
231 CPPFLAGS="%{l_cppflags}" \
232 LDFLAGS="%{l_ldflags}" \
233 GREP="grep" \
234 ./configure \
235 --prefix=%{l_prefix} \
236 --with-dovecot=..
237 %{l_make} %{l_mflags -O}
238 ) || exit $?
239 %endif
241 %install
242 rm -rf $RPM_BUILD_ROOT
243 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
245 %if "%{with_sieve}" == "yes"
246 # install optional Dovecot LDA sieve plugin
247 ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve}
248 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
249 ) || exit $?
250 %endif
252 # adjust file names of configuration files
253 ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot
254 for i in dovecot dovecot-db dovecot-ldap dovecot-sql; do
255 mv ${i}{-example,}.conf
256 done
257 ) || exit $?
259 # create additional dirctories
260 %{l_shtool} mkdir -f -p -m 755 \
261 $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \
262 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/dat \
263 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \
264 $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login
266 # install runcommand script
267 %{l_shtool} mkdir -f -p -m 755 \
268 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
269 %if "%{with_pop3d}" == "yes"
270 cmd='/<\/\{0,1\}with_pop3d>/d'
271 %else
272 cmd='/<with_pop3d>/,/<\/with_pop3d>/d'
273 %endif
274 %{l_shtool} install -c -m 755 %{l_value -s -a} \
275 -e "$cmd" \
276 %{SOURCE rc.dovecot} \
277 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
279 # install OSSP fsl configuration
280 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
281 %{l_shtool} install -c -m 644 %{l_value -s -a} \
282 %{SOURCE fsl.dovecot} \
283 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
285 # strip installation
286 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la \
287 >/dev/null 2>&1 || true
288 rmdir $RPM_BUILD_ROOT%{l_prefix}/include/dovecot \
289 $RPM_BUILD_ROOT%{l_prefix}/include \
290 >/dev/null 2>&1 || true
291 strip \
292 $RPM_BUILD_ROOT%{l_prefix}/sbin/* \
293 $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \
294 >/dev/null 2>&1 || true
296 # generate file list
297 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \
298 '%not %dir %{l_prefix}/etc/fsl' \
299 '%config %{l_prefix}/etc/fsl/fsl.dovecot' \
300 '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \
301 '%config %attr(0640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \
302 '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \
303 '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot' \
304 '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/dat' \
305 '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \
306 '%dir %attr(0755,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/run' \
307 '%dir %attr(0750,%{l_susr},%{l_ngrp}) %{l_prefix}/var/dovecot/run/login' \
308 '%doc %{l_prefix}/share/dovecot/doc' \
309 '%doc %{l_prefix}/share/dovecot/doc/wiki'
311 %files -f files
313 %clean
314 rm -rf $RPM_BUILD_ROOT
316 %post
317 # after upgrade, restart service
318 [ $1 -eq 2 ] || exit 0
319 eval `%{l_rc} dovecot status 2>/dev/null`
320 [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart
321 exit 0
323 %preun
324 # before erase, stop service and remove log files
325 [ $1 -eq 0 ] || exit 0
326 %{l_rc} dovecot stop 2>/dev/null
327 rm -f $RPM_INSTALL_PREFIX/var/dovecot/* >/dev/null 2>&1 || true
328 rm -f $RPM_INSTALL_PREFIX/var/dovecot/dat/* >/dev/null 2>&1 || true
329 rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/* >/dev/null 2>&1 || true
330 rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/* >/dev/null 2>&1 || true
331 rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true
332 exit 0