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