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