michael@148: ## michael@148: ## dovecot.spec -- OpenPKG RPM Package Specification michael@608: ## Copyright (c) 2000-2012 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@148: # package version michael@609: %define V_major 2.1 michael@609: %define V_minor 9 michael@609: %define V_pigeonhole 0.3.1 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@609: Release: 20120800 michael@148: michael@148: # package options michael@148: %option with_fsl yes michael@237: %option with_sieve yes michael@608: %option with_pam no 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@608: Source1: http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}-pigeonhole-%{V_pigeonhole}.tar.gz michael@608: Source2: fsl.dovecot michael@608: Source3: rc.dovecot michael@608: Source4: dovecot.conf michael@148: Patch0: dovecot.patch michael@148: michael@148: # build information michael@636: BuildPreReq: OpenPKG, openpkg >= 20100101, pkgconfig, make michael@609: PreReq: OpenPKG, openpkg >= 20100101, MTA, x509 michael@608: BuildPreReq: libiconv, openssl, zlib, bzip2 michael@608: PreReq: libiconv, openssl, zlib, bzip2 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@608: %if "%{with_sieve}" == "yes" michael@608: BuildPreReq: gettext, autoconf, automake, libtool 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: 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@608: regex = dovecot-(\d+\.\d+(?:\.\d+))\.tar\.gz michael@148: } michael@148: prog dovecot:sieve = { michael@608: version = %{V_pigeonhole} michael@237: url = http://www.rename-it.nl/dovecot/%{V_major}/ michael@608: regex = dovecot-%{V_major}-pigeonhole-(__VER__)\.tar\.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@148: %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b michael@204: michael@204: %build michael@608: # build Dovecot michael@608: %{l_shtool} subst \ michael@608: -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \ michael@608: src/config/all-settings.c \ michael@608: src/lib-lda/lda-settings.c michael@148: cppflags="%{l_cppflags}" michael@148: ldflags="%{l_ldflags} %{l_fsl_ldflags}" michael@609: libs="%{l_fsl_libs} `%{l_prefix}/bin/pkg-config --libs-only-l openssl`" michael@148: sql_drivers="" michael@148: %if "%{with_ldap}" == "yes" michael@609: ldflags="$ldflags `%{l_prefix}/bin/pkg-config --libs-only-L openldap`" michael@609: libs="$libs `%{l_prefix}/bin/pkg-config --libs-only-l openldap`" 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: %endif michael@148: %if "%{with_pgsql}" == "yes" michael@609: libs="$libs `%{l_prefix}/bin/pg_config --libs" michael@148: %endif michael@148: sql_drivers=`echo "$sql_drivers" | sed 's;^,;;'` 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@608: --sysconfdir=%{l_prefix}/etc \ 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@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: %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-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@608: --enable-shared \ 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@608: ( cd dovecot-*-pigeonhole-* michael@608: ./autogen.sh 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@608: --with-dovecot=`pwd`/.. \ michael@608: --with-managesieve michael@204: %{l_make} %{l_mflags -O} michael@204: ) || exit $? michael@204: %endif michael@204: michael@148: %install michael@608: # install Dovecot michael@608: %{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@608: ( cd dovecot-*-pigeonhole-* michael@608: %{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@148: $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/log \ michael@148: $RPM_BUILD_ROOT%{l_prefix}/var/dovecot/run/login michael@148: michael@608: # install run-command 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@608: rm -rf $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/dovecot michael@608: rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/README michael@608: rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot/dovecot*example.conf michael@608: rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/dovecot michael@608: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.a >/dev/null 2>&1 || true michael@608: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la >/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@608: %{l_shtool} install -c -m 644 %{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@608: '%config %attr(0644,%{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@608: '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot' \ michael@608: '%dir %attr(0770,%{l_susr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \ michael@608: '%dir %attr(0755,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run' \ michael@608: '%dir %attr(0750,%{l_susr},%{l_mgrp}) %{l_prefix}/var/dovecot/run/login' michael@148: michael@148: %files -f files michael@148: michael@148: %clean 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@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: