##
## qpopper.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2005 OpenPKG Foundation e.V.
## Copyright (c) 2000-2005 Ralf S. Engelschall
##
## 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 information
Name: qpopper
Summary: POP3 Daemon
URL: http://www.eudora.com/qpopper/
Vendor: Qualcom
Packager: OpenPKG
Distribution: OpenPKG
Class: BASE
Group: Mail
License: GPL
Version: 4.0.8
Release: 20050927
# package options
%option with_fsl yes
%option with_pam no
# list of sources
Source0: ftp://ftp.qualcomm.com/eudora/servers/unix/popper/qpopper%{version}.tar.gz
Source1: rc.qpopper
Source2: fsl.qpopper
Patch0: qpopper.patch
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, MTA, openssl, gdbm
PreReq: OpenPKG, openpkg >= 20040130, MTA, openssl, gdbm
%if "%{with_fsl}" == "yes"
BuildPreReq: fsl >= 1.2.0
PreReq: fsl >= 1.2.0
%endif
%if "%{with_pam}" == "yes"
BuildPreReq: PAM
PreReq: PAM
%endif
AutoReq: no
AutoReqProv: no
Provides: POP
Conflicts: teapop
%description
Qualcom Popper is a full-featured POP3 daemon.
%track
prog qpopper = {
version = %{version}
url = ftp://ftp.qualcomm.com/eudora/servers/unix/popper/
regex = qpopper(__VER__)\.tar\.gz
}
%prep
%setup -q -n qpopper%{version}
%patch -p0
%build
# build qpopper
CC="%{l_cc}" \
CFLAGS="%{l_cflags}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
LIBS="%{l_fsl_libs}" \
%if "%{with_pam}" == "yes"
CFLAGS="$CFLAGS -I`%{l_rc} --query pam_incdir`" \
CPPFLAGS="$CPPFLAGS -I`%{l_rc} --query pam_incdir`" \
LDFLAGS="$LDFLAGS -L`%{l_rc} --query pam_libdir`" \
%endif
OS_DEFS="-DPIDFILE=\\\"%{l_prefix}/var/qpopper/qpopper.pid\\\"" \
./configure \
--prefix=%{l_prefix} \
--sbindir=%{l_prefix}/sbin \
--enable-apop=%{l_prefix}/etc/qpopper/qpopper.auth \
--enable-popuid=%{l_rusr} \
--disable-bulldb \
--enable-servermode \
--enable-standalone \
--enable-log-login \
%if "%{with_pam}" == "yes"
--with-pam=qpopper \
%else
--without-pam \
%endif
%if "%{with_fsl}" == "yes"
--with-log-facility=LOG_USER \
%else
--with-log-facility=LOG_MAIL \
%endif
--with-openssl=%{l_prefix} \
--disable-nls
%{l_shtool} subst \
-e 's;\(MAIL_COMMAND[^"]*"\)[^"]*;\1%{l_prefix}/sbin/sendmail;' \
config.h
%{l_make} %{l_mflags}
%install
rm -rf $RPM_BUILD_ROOT
# create installation area
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/sbin \
$RPM_BUILD_ROOT%{l_prefix}/man/man8 \
$RPM_BUILD_ROOT%{l_prefix}/var/qpopper \
$RPM_BUILD_ROOT%{l_prefix}/etc/qpopper
%{l_shtool} mkdir -f -p -m 775 \
$RPM_BUILD_ROOT%{l_prefix}/var/qpopper/cache \
$RPM_BUILD_ROOT%{l_prefix}/var/qpopper/spool
# install qpopper
%{l_shtool} install -c -m 644 \
-e 's;^# \(set home-dir-mail[^=]*=\).*;\1 ".mail/inbox";' \
-e 's;^# \(set mail-command[^=]*=\).*;\1 "%{l_prefix}/sbin/sendmail";' \
-e 's;^# \(set cache-dir[^=]*=\).*;\1 "%{l_prefix}/var/qpopper/cache";' \
-e 's;^# \(set spool-dir[^=]*=\).*;\1 "%{l_prefix}/var/qpopper/spool";' \
-e 's;^# \(set auth-file[^=]*=\).*;\1 "%{l_prefix}/etc/qpopper/users.allow";' \
-e 's;^# \(set nonauth-file[^=]*=\).*;\1 "%{l_prefix}/etc/qpopper/users.deny";' \
-e 's;^# \(set clear-text-password[^=]*=\).*;\1 local;' \
samples/qpopper.config $RPM_BUILD_ROOT%{l_prefix}/etc/qpopper/
%{l_shtool} install -c -s -m 755 \
popper/popper $RPM_BUILD_ROOT%{l_prefix}/sbin/qpopper
%{l_shtool} install -c -m 644 \
man/popper.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qpopper.8
%{l_shtool} install -c -s -m 755 \
popper/popauth $RPM_BUILD_ROOT%{l_prefix}/sbin/popauth
%{l_shtool} install -c -m 644 \
man/popauth.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/popauth.8
# add more stuff
%{l_shtool} install -c -m 644 \
/dev/null $RPM_BUILD_ROOT%{l_prefix}/etc/qpopper/users.allow
%{l_shtool} install -c -m 644 \
/dev/null $RPM_BUILD_ROOT%{l_prefix}/etc/qpopper/users.deny
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.qpopper} $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.qpopper} \
$RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%not %dir %{l_prefix}/etc/fsl' \
'%attr(4755,%{l_rusr},%{l_mgrp}) %{l_prefix}/sbin/popauth' \
'%config %{l_prefix}/etc/fsl/fsl.qpopper' \
'%config %{l_prefix}/etc/qpopper/*'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT
%post
%if "%{with_pam}" == "yes"
# add PAM configuration entry
if [ $1 -eq 1 ]; then
$RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=qpopper
fi
%endif
# after upgrade, restart service
[ $1 -eq 2 ] || exit 0
eval `%{l_rc} qpopper status 2>/dev/null`
[ ".$qpopper_active" = .yes ] && %{l_rc} qpopper restart
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
%{l_rc} qpopper stop 2>/dev/null
rm -f $RPM_INSTALL_PREFIX/var/qpopper/qpopper.log* >/dev/null 2>&1 || true
%if "%{with_pam}" == "yes"
# remove PAM configuration entry
$RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=qpopper
%endif
exit 0