1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dovecot/dovecot.spec Tue Apr 07 19:52:45 2009 +0200 1.3 @@ -0,0 +1,324 @@ 1.4 +## 1.5 +## dovecot.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package version 1.28 +%define V_major 1.1 1.29 +%define V_minor 13 1.30 +%define V_minor_sieve 6 1.31 +%define V_minor_managesieve 1 1.32 +%define V_managesieve 0.10.3 1.33 + 1.34 +# package information 1.35 +Name: dovecot 1.36 +Summary: IMAP4 & POP3 Server 1.37 +URL: http://www.dovecot.org/ 1.38 +Vendor: Timo Sirainen et al. 1.39 +Packager: OpenPKG Foundation e.V. 1.40 +Distribution: OpenPKG Community 1.41 +Class: EVAL 1.42 +Group: Mail 1.43 +License: MIT+LGPL 1.44 +Version: %{V_major}.%{V_minor} 1.45 +Release: 20090319 1.46 + 1.47 +# package options 1.48 +%option with_fsl yes 1.49 +%option with_pam yes 1.50 +%option with_ldap no 1.51 +%option with_mysql no 1.52 +%option with_pgsql no 1.53 +%option with_sqlite no 1.54 +%option with_pop3d no 1.55 +%option with_managesieve no 1.56 +%option with_sieve yes 1.57 + 1.58 +# list of sources 1.59 +Source0: http://www.dovecot.org/releases/%{V_major}/dovecot-%{V_major}.%{V_minor}.tar.gz 1.60 +Source1: http://www.dovecot.org/releases/sieve/dovecot-sieve-%{V_major}.%{V_minor_sieve}.tar.gz 1.61 +Source2: fsl.dovecot 1.62 +Source3: rc.dovecot 1.63 +Patch0: dovecot.patch 1.64 +Patch1: http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}.%{V_minor_managesieve}-managesieve-%{V_managesieve}.diff.gz 1.65 + 1.66 +# build information 1.67 +Prefix: %{l_prefix} 1.68 +BuildRoot: %{l_buildroot} 1.69 +BuildPreReq: OpenPKG, openpkg >= 20060823 1.70 +PreReq: OpenPKG, openpkg >= 20060823, MTA 1.71 +BuildPreReq: libiconv, openssl 1.72 +PreReq: libiconv, openssl 1.73 +%if "%{with_fsl}" == "yes" 1.74 +BuildPreReq: fsl 1.75 +PreReq: fsl 1.76 +%endif 1.77 +%if "%{with_ldap}" == "yes" 1.78 +BuildPreReq: openldap 1.79 +PreReq: openldap 1.80 +%endif 1.81 +%if "%{with_managesieve}" == "yes" 1.82 +BuildPreReq: autoconf, automake, pkgconfig, libtool 1.83 +BuildPreReq: gettext 1.84 +PreReq: gettext 1.85 +%endif 1.86 +%if "%{with_pam}" == "yes" 1.87 +BuildPreReq: PAM 1.88 +PreReq: PAM 1.89 +%endif 1.90 +%if "%{with_mysql}" == "yes" 1.91 +BuildPreReq: mysql, zlib 1.92 +PreReq: mysql, zlib 1.93 +%endif 1.94 +%if "%{with_pgsql}" == "yes" 1.95 +BuildPreReq: postgresql 1.96 +PreReq: postgresql 1.97 +%endif 1.98 +%if "%{with_sqlite}" == "yes" 1.99 +BuildPreReq: sqlite 1.100 +PreReq: sqlite 1.101 +%endif 1.102 +AutoReq: no 1.103 +AutoReqProv: no 1.104 + 1.105 +%description 1.106 + Dovecot is an Open Source IMAP and POP3 server, written with 1.107 + security primarily in mind. Dovecot is an excellent choice for both 1.108 + small and large installations. It's fast, simple to set up, requires 1.109 + no special administration and it uses very little memory. 1.110 + 1.111 +%track 1.112 + prog dovecot = { 1.113 + version = %{V_major}.%{V_minor} 1.114 + url = http://www.dovecot.org/download.html 1.115 + regex = dovecot-(1\.1(\.\d+)+)\.tar\.gz 1.116 + } 1.117 + prog dovecot:sieve = { 1.118 + version = %{V_major}.%{V_minor_sieve} 1.119 + url = http://www.dovecot.org/download.html 1.120 + regex = dovecot-sieve-(%{V_major}(\.\d+)+)\.tar\.gz 1.121 + } 1.122 + prog dovecot:managesieve = { 1.123 + version = %{V_managesieve} 1.124 + url = http://www.rename-it.nl/dovecot/%{V_major}/ 1.125 + regex = dovecot-%{V_major}\.%{V_minor_managesieve}-managesieve-(__VER__)\.diff\.gz 1.126 + } 1.127 + 1.128 +%prep 1.129 + %setup -q 1.130 +%if "%{with_sieve}" == "yes" 1.131 + %setup -q -T -D -a 1 1.132 +%endif 1.133 + %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b 1.134 +%if "%{with_managesieve}" == "yes" 1.135 + sleep 1 1.136 + %{l_gzip} -dc <%{PATCH1} | %{l_patch} -p1 -b 1.137 + sleep 1 1.138 + autoreconf -i --force || true 1.139 +%endif 1.140 + 1.141 +%build 1.142 + cppflags="%{l_cppflags}" 1.143 + ldflags="%{l_ldflags} %{l_fsl_ldflags}" 1.144 + libs="%{l_fsl_libs}" 1.145 + sql_drivers="" 1.146 +%if "%{with_ldap}" == "yes" 1.147 + libs="$libs -llber -lssl -lcrypto" 1.148 +%endif 1.149 +%if "%{with_mysql}" == "yes" 1.150 + cppflags="$cppflags %{l_cppflags mysql}" 1.151 + ldflags="$ldflags %{l_ldflags mysql}" 1.152 + sql_drivers="$sql_drivers,mysql" 1.153 +%endif 1.154 +%if "%{with_pgsql}" == "yes" 1.155 + libs="$libs -lssl -lcrypto -lcrypt" 1.156 + sql_drivers="$sql_drivers,pgsql" 1.157 +%endif 1.158 +%if "%{with_sqlite}" == "yes" 1.159 + sql_drivers="$sql_drivers,sqlite" 1.160 +%endif 1.161 + sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'` 1.162 + 1.163 + CC="%{l_cc}" \ 1.164 + CFLAGS="%{l_cflags -O}" \ 1.165 + CPPFLAGS="$cppflags" \ 1.166 + LDFLAGS="$ldflags" \ 1.167 + LIBS="$libs" \ 1.168 + ./configure \ 1.169 + --prefix=%{l_prefix} \ 1.170 + --sysconfdir=%{l_prefix}/etc/dovecot \ 1.171 + --with-ssldir=%{l_prefix}/etc/dovecot/ssl \ 1.172 + --datadir=%{l_prefix}/share/dovecot \ 1.173 + --docdir=%{l_prefix}/share/dovecot/doc \ 1.174 + --with-rundir=%{l_prefix}/var/dovecot/run \ 1.175 + --with-libiconv-prefix=%{l_prefix} \ 1.176 + --with-ssl=openssl \ 1.177 + --with-deliver \ 1.178 + --with-docs \ 1.179 +%if "%{with_ldap}" == "yes" 1.180 + --with-ldap \ 1.181 +%else 1.182 + --without-ldap \ 1.183 +%endif 1.184 +%if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" 1.185 + --with-sql \ 1.186 + --with-sql-drivers="$sql_drivers" \ 1.187 +%if "%{with_mysql}" == "yes" 1.188 + --with-mysql \ 1.189 +%else 1.190 + --without-mysql \ 1.191 +%endif 1.192 +%if "%{with_pgsql}" == "yes" 1.193 + --with-pgsql \ 1.194 +%else 1.195 + --without-pgsql \ 1.196 +%endif 1.197 +%if "%{with_sqlite}" == "yes" 1.198 + --with-sqlite \ 1.199 +%else 1.200 + --without-sqlite \ 1.201 +%endif 1.202 +%else 1.203 + --without-sql \ 1.204 + --without-sql-drivers \ 1.205 + --without-mysql \ 1.206 + --without-pgsql \ 1.207 + --without-sqlite \ 1.208 +%endif 1.209 +%if "%{with_pam}" == "yes" 1.210 + --with-pam \ 1.211 +%else 1.212 + --without-pam \ 1.213 +%endif 1.214 +%if "%{with_pop3d}" == "yes" 1.215 + --with-pop3d \ 1.216 +%else 1.217 + --without-pop3d \ 1.218 +%endif 1.219 + --without-gc \ 1.220 + --without-gssapi \ 1.221 + --without-lucene \ 1.222 + --without-vpopmail \ 1.223 + --enable-shared \ 1.224 + --disable-static 1.225 + %{l_make} %{l_mflags -O} 1.226 + 1.227 +%if "%{with_sieve}" == "yes" 1.228 + # build optional Dovecot LDA sieve plugin 1.229 + ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve} 1.230 + CC="%{l_cc}" \ 1.231 + CFLAGS="%{l_cflags -O}" \ 1.232 + CPPFLAGS="%{l_cppflags}" \ 1.233 + LDFLAGS="%{l_ldflags}" \ 1.234 + ./configure \ 1.235 + --prefix=%{l_prefix} \ 1.236 + --with-dovecot=.. 1.237 + %{l_make} %{l_mflags -O} 1.238 + ) || exit $? 1.239 +%endif 1.240 + 1.241 +%install 1.242 + rm -rf $RPM_BUILD_ROOT 1.243 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 1.244 + 1.245 +%if "%{with_sieve}" == "yes" 1.246 + # install optional Dovecot LDA sieve plugin 1.247 + ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve} 1.248 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 1.249 + ) || exit $? 1.250 +%endif 1.251 + 1.252 + # adjust file names of configuration files 1.253 + ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot 1.254 + for i in dovecot dovecot-ldap dovecot-sql; do 1.255 + mv ${i}{-example,}.conf 1.256 + done 1.257 + ) || exit $? 1.258 + 1.259 + # create additional dirctories 1.260 + %{l_shtool} mkdir -f -p -m 755 \ 1.261 + $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \ 1.262 + $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \ 1.263 + $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login 1.264 + 1.265 + # install run-command script 1.266 + %{l_shtool} mkdir -f -p -m 755 \ 1.267 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.268 +%if "%{with_pop3d}" == "yes" 1.269 + cmd='/<\/\{0,1\}with_pop3d>/d' 1.270 +%else 1.271 + cmd='/<with_pop3d>/,/<\/with_pop3d>/d' 1.272 +%endif 1.273 + %{l_shtool} install -c -m 755 %{l_value -s -a} \ 1.274 + -e "$cmd" \ 1.275 + %{SOURCE rc.dovecot} \ 1.276 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.277 + 1.278 + # install OSSP fsl configuration 1.279 + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.280 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.281 + %{SOURCE fsl.dovecot} \ 1.282 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.283 + 1.284 + # strip installation 1.285 + rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la \ 1.286 + >/dev/null 2>&1 || true 1.287 + strip \ 1.288 + $RPM_BUILD_ROOT%{l_prefix}/sbin/* \ 1.289 + $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \ 1.290 + >/dev/null 2>&1 || true 1.291 + 1.292 + # generate file list 1.293 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \ 1.294 + '%not %dir %{l_prefix}/etc/fsl' \ 1.295 + '%config %{l_prefix}/etc/fsl/fsl.dovecot' \ 1.296 + '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \ 1.297 + '%config %attr(0640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \ 1.298 + '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \ 1.299 + '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot' \ 1.300 + '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \ 1.301 + '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run' \ 1.302 + '%dir %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run/login' \ 1.303 + '%doc %{l_prefix}/share/dovecot/doc' \ 1.304 + '%doc %{l_prefix}/share/dovecot/doc/wiki' 1.305 + 1.306 +%files -f files 1.307 + 1.308 +%clean 1.309 + rm -rf $RPM_BUILD_ROOT 1.310 + 1.311 +%post 1.312 + # after upgrade, restart service 1.313 + [ $1 -eq 2 ] || exit 0 1.314 + eval `%{l_rc} dovecot status 2>/dev/null` 1.315 + [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart 1.316 + exit 0 1.317 + 1.318 +%preun 1.319 + # before erase, stop service and remove log files 1.320 + [ $1 -eq 0 ] || exit 0 1.321 + %{l_rc} dovecot stop 2>/dev/null 1.322 + rm -f $RPM_INSTALL_PREFIX/var/dovecot/* >/dev/null 2>&1 || true 1.323 + rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/* >/dev/null 2>&1 || true 1.324 + rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/* >/dev/null 2>&1 || true 1.325 + rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true 1.326 + exit 0 1.327 +