diff -r 13509f36148e -r f6edc24e328f dovecot/dovecot.spec --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dovecot/dovecot.spec Tue Apr 07 19:52:45 2009 +0200 @@ -0,0 +1,324 @@ +## +## dovecot.spec -- OpenPKG RPM Package Specification +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package version +%define V_major 1.1 +%define V_minor 13 +%define V_minor_sieve 6 +%define V_minor_managesieve 1 +%define V_managesieve 0.10.3 + +# package information +Name: dovecot +Summary: IMAP4 & POP3 Server +URL: http://www.dovecot.org/ +Vendor: Timo Sirainen et al. +Packager: OpenPKG Foundation e.V. +Distribution: OpenPKG Community +Class: EVAL +Group: Mail +License: MIT+LGPL +Version: %{V_major}.%{V_minor} +Release: 20090319 + +# package options +%option with_fsl yes +%option with_pam yes +%option with_ldap no +%option with_mysql no +%option with_pgsql no +%option with_sqlite no +%option with_pop3d no +%option with_managesieve no +%option with_sieve yes + +# list of sources +Source0: http://www.dovecot.org/releases/%{V_major}/dovecot-%{V_major}.%{V_minor}.tar.gz +Source1: http://www.dovecot.org/releases/sieve/dovecot-sieve-%{V_major}.%{V_minor_sieve}.tar.gz +Source2: fsl.dovecot +Source3: rc.dovecot +Patch0: dovecot.patch +Patch1: http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}.%{V_minor_managesieve}-managesieve-%{V_managesieve}.diff.gz + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20060823 +PreReq: OpenPKG, openpkg >= 20060823, MTA +BuildPreReq: libiconv, openssl +PreReq: libiconv, openssl +%if "%{with_fsl}" == "yes" +BuildPreReq: fsl +PreReq: fsl +%endif +%if "%{with_ldap}" == "yes" +BuildPreReq: openldap +PreReq: openldap +%endif +%if "%{with_managesieve}" == "yes" +BuildPreReq: autoconf, automake, pkgconfig, libtool +BuildPreReq: gettext +PreReq: gettext +%endif +%if "%{with_pam}" == "yes" +BuildPreReq: PAM +PreReq: PAM +%endif +%if "%{with_mysql}" == "yes" +BuildPreReq: mysql, zlib +PreReq: mysql, zlib +%endif +%if "%{with_pgsql}" == "yes" +BuildPreReq: postgresql +PreReq: postgresql +%endif +%if "%{with_sqlite}" == "yes" +BuildPreReq: sqlite +PreReq: sqlite +%endif +AutoReq: no +AutoReqProv: no + +%description + Dovecot is an Open Source IMAP and POP3 server, written with + security primarily in mind. Dovecot is an excellent choice for both + small and large installations. It's fast, simple to set up, requires + no special administration and it uses very little memory. + +%track + prog dovecot = { + version = %{V_major}.%{V_minor} + url = http://www.dovecot.org/download.html + regex = dovecot-(1\.1(\.\d+)+)\.tar\.gz + } + prog dovecot:sieve = { + version = %{V_major}.%{V_minor_sieve} + url = http://www.dovecot.org/download.html + regex = dovecot-sieve-(%{V_major}(\.\d+)+)\.tar\.gz + } + prog dovecot:managesieve = { + version = %{V_managesieve} + url = http://www.rename-it.nl/dovecot/%{V_major}/ + regex = dovecot-%{V_major}\.%{V_minor_managesieve}-managesieve-(__VER__)\.diff\.gz + } + +%prep + %setup -q +%if "%{with_sieve}" == "yes" + %setup -q -T -D -a 1 +%endif + %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b +%if "%{with_managesieve}" == "yes" + sleep 1 + %{l_gzip} -dc <%{PATCH1} | %{l_patch} -p1 -b + sleep 1 + autoreconf -i --force || true +%endif + +%build + cppflags="%{l_cppflags}" + ldflags="%{l_ldflags} %{l_fsl_ldflags}" + libs="%{l_fsl_libs}" + sql_drivers="" +%if "%{with_ldap}" == "yes" + libs="$libs -llber -lssl -lcrypto" +%endif +%if "%{with_mysql}" == "yes" + cppflags="$cppflags %{l_cppflags mysql}" + ldflags="$ldflags %{l_ldflags mysql}" + sql_drivers="$sql_drivers,mysql" +%endif +%if "%{with_pgsql}" == "yes" + libs="$libs -lssl -lcrypto -lcrypt" + sql_drivers="$sql_drivers,pgsql" +%endif +%if "%{with_sqlite}" == "yes" + sql_drivers="$sql_drivers,sqlite" +%endif + sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'` + + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="$cppflags" \ + LDFLAGS="$ldflags" \ + LIBS="$libs" \ + ./configure \ + --prefix=%{l_prefix} \ + --sysconfdir=%{l_prefix}/etc/dovecot \ + --with-ssldir=%{l_prefix}/etc/dovecot/ssl \ + --datadir=%{l_prefix}/share/dovecot \ + --docdir=%{l_prefix}/share/dovecot/doc \ + --with-rundir=%{l_prefix}/var/dovecot/run \ + --with-libiconv-prefix=%{l_prefix} \ + --with-ssl=openssl \ + --with-deliver \ + --with-docs \ +%if "%{with_ldap}" == "yes" + --with-ldap \ +%else + --without-ldap \ +%endif +%if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" + --with-sql \ + --with-sql-drivers="$sql_drivers" \ +%if "%{with_mysql}" == "yes" + --with-mysql \ +%else + --without-mysql \ +%endif +%if "%{with_pgsql}" == "yes" + --with-pgsql \ +%else + --without-pgsql \ +%endif +%if "%{with_sqlite}" == "yes" + --with-sqlite \ +%else + --without-sqlite \ +%endif +%else + --without-sql \ + --without-sql-drivers \ + --without-mysql \ + --without-pgsql \ + --without-sqlite \ +%endif +%if "%{with_pam}" == "yes" + --with-pam \ +%else + --without-pam \ +%endif +%if "%{with_pop3d}" == "yes" + --with-pop3d \ +%else + --without-pop3d \ +%endif + --without-gc \ + --without-gssapi \ + --without-lucene \ + --without-vpopmail \ + --enable-shared \ + --disable-static + %{l_make} %{l_mflags -O} + +%if "%{with_sieve}" == "yes" + # build optional Dovecot LDA sieve plugin + ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve} + CC="%{l_cc}" \ + CFLAGS="%{l_cflags -O}" \ + CPPFLAGS="%{l_cppflags}" \ + LDFLAGS="%{l_ldflags}" \ + ./configure \ + --prefix=%{l_prefix} \ + --with-dovecot=.. + %{l_make} %{l_mflags -O} + ) || exit $? +%endif + +%install + rm -rf $RPM_BUILD_ROOT + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" + +%if "%{with_sieve}" == "yes" + # install optional Dovecot LDA sieve plugin + ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve} + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" + ) || exit $? +%endif + + # adjust file names of configuration files + ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot + for i in dovecot dovecot-ldap dovecot-sql; do + mv ${i}{-example,}.conf + done + ) || exit $? + + # create additional dirctories + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/ssl \ + $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \ + $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login + + # install run-command script + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d +%if "%{with_pop3d}" == "yes" + cmd='/<\/\{0,1\}with_pop3d>/d' +%else + cmd='//,/<\/with_pop3d>/d' +%endif + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + -e "$cmd" \ + %{SOURCE rc.dovecot} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ + + # install OSSP fsl configuration + %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl + %{l_shtool} install -c -m 644 %{l_value -s -a} \ + %{SOURCE fsl.dovecot} \ + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ + + # strip installation + rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la \ + >/dev/null 2>&1 || true + strip \ + $RPM_BUILD_ROOT%{l_prefix}/sbin/* \ + $RPM_BUILD_ROOT%{l_prefix}/libexec/dovecot/* \ + >/dev/null 2>&1 || true + + # generate file list + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} \ + '%not %dir %{l_prefix}/etc/fsl' \ + '%config %{l_prefix}/etc/fsl/fsl.dovecot' \ + '%config %attr(0600,%{l_musr},%{l_mgrp}) %{l_prefix}/etc/dovecot/*' \ + '%config %attr(0640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/dovecot/dovecot.conf' \ + '%dir %attr(0700,%{l_susr},%{l_mgrp}) %{l_prefix}/etc/dovecot/ssl' \ + '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot' \ + '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \ + '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run' \ + '%dir %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run/login' \ + '%doc %{l_prefix}/share/dovecot/doc' \ + '%doc %{l_prefix}/share/dovecot/doc/wiki' + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + # after upgrade, restart service + [ $1 -eq 2 ] || exit 0 + eval `%{l_rc} dovecot status 2>/dev/null` + [ ".$dovecot_active" = .yes ] && %{l_rc} dovecot restart + exit 0 + +%preun + # before erase, stop service and remove log files + [ $1 -eq 0 ] || exit 0 + %{l_rc} dovecot stop 2>/dev/null + rm -f $RPM_INSTALL_PREFIX/var/dovecot/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/dovecot/log/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/* >/dev/null 2>&1 || true + rm -f $RPM_INSTALL_PREFIX/var/dovecot/run/login/* >/dev/null 2>&1 || true + exit 0 +