michael@148: ## michael@148: ## dovecot.spec -- OpenPKG RPM Package Specification michael@148: ## Copyright (c) 2000-2008 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@148: %define V_major 1.1 michael@148: %define V_minor 13 michael@148: %define V_minor_sieve 6 michael@148: %define V_minor_managesieve 1 michael@148: %define V_managesieve 0.10.3 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@187: Release: 20090418 michael@148: michael@148: # package options michael@148: %option with_fsl yes michael@148: %option with_pam 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: %option with_pop3d no michael@148: %option with_managesieve no michael@148: %option with_sieve yes 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@148: Source1: http://www.dovecot.org/releases/sieve/dovecot-sieve-%{V_major}.%{V_minor_sieve}.tar.gz michael@148: Source2: fsl.dovecot michael@148: Source3: rc.dovecot michael@148: Patch0: dovecot.patch michael@148: Patch1: http://www.rename-it.nl/dovecot/%{V_major}/dovecot-%{V_major}.%{V_minor_managesieve}-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@148: PreReq: OpenPKG, openpkg >= 20060823, MTA 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: autoconf, automake, pkgconfig, libtool 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@148: regex = dovecot-(1\.1(\.\d+)+)\.tar\.gz michael@148: } michael@148: prog dovecot:sieve = { michael@148: version = %{V_major}.%{V_minor_sieve} michael@148: url = http://www.dovecot.org/download.html michael@148: regex = dovecot-sieve-(%{V_major}(\.\d+)+)\.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@148: regex = dovecot-%{V_major}\.%{V_minor_managesieve}-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@148: %{l_sed} <%{PATCH0} %{l_value -s -a} | %{l_patch} -p0 -b michael@148: %if "%{with_managesieve}" == "yes" michael@148: sleep 1 michael@148: %{l_gzip} -dc <%{PATCH1} | %{l_patch} -p1 -b michael@148: sleep 1 michael@148: autoreconf -i --force || true michael@148: %endif michael@148: michael@148: %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@149: GREP="grep" \ michael@148: ./configure \ michael@148: --prefix=%{l_prefix} \ 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@150: --with-statedir=%{l_prefix}/var/dovecot/dat \ michael@148: --with-libiconv-prefix=%{l_prefix} \ michael@148: --with-ssl=openssl \ michael@148: --with-deliver \ 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: %if "%{with_pop3d}" == "yes" michael@148: --with-pop3d \ michael@148: %else michael@148: --without-pop3d \ michael@148: %endif michael@148: --without-gc \ michael@148: --without-gssapi \ michael@148: --without-lucene \ michael@187: --without-vpopmail michael@148: %{l_make} %{l_mflags -O} michael@148: michael@148: %if "%{with_sieve}" == "yes" michael@148: # build optional Dovecot LDA sieve plugin michael@148: ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve} michael@148: CC="%{l_cc}" \ michael@148: CFLAGS="%{l_cflags -O}" \ michael@148: CPPFLAGS="%{l_cppflags}" \ michael@148: LDFLAGS="%{l_ldflags}" \ michael@149: GREP="grep" \ michael@148: ./configure \ michael@148: --prefix=%{l_prefix} \ michael@148: --with-dovecot=.. michael@148: %{l_make} %{l_mflags -O} michael@148: ) || exit $? michael@148: %endif michael@148: michael@148: %install michael@148: rm -rf $RPM_BUILD_ROOT michael@161: %{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@148: ( cd dovecot-sieve-%{V_major}.%{V_minor_sieve} michael@161: %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT michael@148: ) || exit $? michael@148: %endif michael@148: michael@148: # adjust file names of configuration files michael@148: ( cd $RPM_BUILD_ROOT%{l_prefix}/etc/dovecot michael@150: for i in dovecot dovecot-db dovecot-ldap dovecot-sql; do michael@148: mv ${i}{-example,}.conf michael@148: done michael@148: ) || exit $? michael@148: 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@150: $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@150: # install runcommand script michael@148: %{l_shtool} mkdir -f -p -m 755 \ michael@148: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d michael@148: %if "%{with_pop3d}" == "yes" michael@148: cmd='/<\/\{0,1\}with_pop3d>/d' michael@148: %else michael@148: cmd='//,/<\/with_pop3d>/d' michael@148: %endif michael@148: %{l_shtool} install -c -m 755 %{l_value -s -a} \ michael@148: -e "$cmd" \ michael@148: %{SOURCE rc.dovecot} \ michael@148: $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ michael@148: michael@148: # install OSSP fsl configuration michael@148: %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl michael@148: %{l_shtool} install -c -m 644 %{l_value -s -a} \ michael@148: %{SOURCE fsl.dovecot} \ michael@148: $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ michael@148: michael@148: # strip installation michael@148: rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/dovecot/{,*}/*.la \ michael@148: >/dev/null 2>&1 || true michael@150: rmdir $RPM_BUILD_ROOT%{l_prefix}/include/dovecot \ michael@150: $RPM_BUILD_ROOT%{l_prefix}/include \ michael@150: >/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@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@148: '%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@187: '%dir %attr(0755,%{l_musr},%{l_mgrp}) %{l_prefix}/var/dovecot' \ michael@187: '%dir %attr(0770,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/dat' \ michael@187: '%dir %attr(0770,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/log' \ michael@187: '%dir %attr(0750,%{l_musr},%{l_rgrp}) %{l_prefix}/var/dovecot/run' \ michael@187: '%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@150: 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: