I made some modifications to the spec file to make it easier to build packages without some of the optional components. I also expanded the BuildPreReq list so that unless you ask to exclude the optional components, you have all of the requirements to build the full suite.
The diff is attached. If anyone wants to test it out, I'll put the spec for 0.42.2 at:
http://phantom.dragonsdawn.net/~gordon/courier-patches/
--- courier.spec.in.orig Sun Jul 20 20:20:57 2003
+++ courier.spec.in Sun Aug 3 23:06:44 2003
@@ -6,6 +6,20 @@
# Need to version-upgrade RH builds due to different directory locations.
#
+# --- Build behavior defines --------------------------------------------------
+
+%{?_without_fax: %define with_fax 0}
+%{!?_without_fax: %define with_fax 1}
+%{?_without_mysql: %define with_mysql 0}
+%{!?_without_mysql: %define with_mysql 1}
+%{?_without_pgsql: %define with_pgsql 0}
+%{!?_without_pgsql: %define with_pgsql 1}
+%{?_without_ldap: %define with_ldap 0}
+%{!?_without_ldap: %define with_ldap 1}
+
+%define _missing_doc_files_terminate_build 1
+%define _unpackaged_files_terminate_build 1
+
%define alternatives %(test -x /usr/sbin/alternatives && echo 1 || echo 0)
%define is_not_mandrake %(test ! -e /etc/mandrake-release && echo 1 || echo 0)
@@ -17,35 +31,7 @@
%define __libtoolize /bin/true
-%define configure CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; FFLAGS="${FFLAGS:-%optflags}" ;
export FFLAGS ; ./configure --host=%{_host} --build=%{_build}
--target=%{_target_platform} --program-prefix=%{?_program_prefix} --prefix=%{_prefix}
--exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir}
--sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir}
--libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir}
--sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir}
-
-%define _missing_doc_files_terminate_build 1
-%define _unpackaged_files_terminate_build 1
-
-Summary: Courier @VERSION@ mail server
-Name: courier
-Version: @VERSION@
-Release: 1%{courier_release}
-License: GPL
-Group: Applications/Mail
-Source: http://download.sourceforge.net/courier/[EMAIL PROTECTED]@.tar.bz2
-Packager: %{PACKAGER}
-BuildRoot: %{_tmppath}/courier-install
-Provides: smtpdaemon config(courier) = %{version}-%{release}
-AutoProv: no
-Requires(post): /sbin/chkconfig
-Requires(preun): /sbin/chkconfig
-Requires: fileutils
-%if %alternatives
-Obsoletes: courier-sendmail-wrapper
-Requires(postun): /sbin/chkconfig
-Provides: /usr/sbin/sendmail /usr/bin/mailq /usr/bin/rmail /usr/bin/newaliases
-%endif
-
-BuildPreReq: rpm >= 4.0.2 fileutils binutils sed perl make openssl gdbm-devel
openssl-devel pam-devel gnupg >= 1.0.5 expect fam-devel postgresql-devel mysql-devel
openldap-devel openldap-servers
-%if %is_not_mandrake
-BuildPreReq: openssl-perl
-%endif
+%define configure CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; FFLAGS="${FFLAGS:-%optflags}" ;
export FFLAGS ; ./configure --host=%{_host} --build=%{_build}
--target=%{_target_platform} --program-prefix=%{?_program_prefix} --prefix=%{_prefix}
--exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir}
--sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir}
--libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir}
--sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir}
%{?_without_mysql:--without-authmysql} %{?_without_pgsql:--without-authpgsql}
%{?_without_ldap:--without-authldap}
#
# RH custom locations.
@@ -73,9 +59,68 @@
%define _documentrootdir %{apachedir}/html
%define _imageurl /webmail
+# -----------------------------------------------------------------------------
+
+Summary: Courier @VERSION@ mail server
+Name: courier
+Version: @VERSION@
+Release: 1%{courier_release}
+
+Group: Applications/Mail
+License: GPL
+URL: http://www.courier-mta.org
+Packager: %{PACKAGER}
+Source: http://download.sourceforge.net/courier/[EMAIL PROTECTED]@.tar.bz2
+BuildRoot: %{_tmppath}/courier-install
+Provides: smtpdaemon
+Provides: config(courier) = %{version}-%{release}
+AutoProv: no
+Requires(post): /sbin/chkconfig
+Requires(preun): /sbin/chkconfig
+Requires: fileutils
%if %alternatives
+Obsoletes: courier-sendmail-wrapper
+Requires(postun): /sbin/chkconfig
+Provides: /usr/sbin/sendmail /usr/bin/mailq /usr/bin/rmail /usr/bin/newaliases
+%endif
-%else
+BuildPreReq: rpm >= 4.0.2
+BuildPreReq: fileutils
+BuildPreReq: binutils
+BuildPreReq: sed
+BuildPreReq: gawk
+BuildPreReq: perl
+BuildPreReq: make
+BuildPreReq: gnupg >= 1.0.5
+BuildPreReq: expect
+BuildPreReq: gdbm-devel
+BuildPreReq: pam-devel
+BuildPreReq: fam-devel
+BuildPreReq: openssl
+BuildPreReq: openssl-devel
+%if %is_not_mandrake
+BuildPreReq: openssl-perl
+%endif
+%if %with_fax
+BuildPreReq: groff
+BuildPreReq: ghostscript
+BuildPreReq: xpdf
+BuildPreReq: mgetty-sendfax
+BuildPreReq: netpbm-progs
+%endif
+%if %with_mysql
+BuildPreReq: mysql-devel
+%endif
+%if %with_pgsql
+BuildPreReq: postgresql-devel
+%endif
+%if %with_ldap
+BuildPreReq: openldap-devel
+BuildPreReq: openldap-servers
+%endif
+
+
+%if ! %alternatives
%package sendmail-wrapper
Summary: Courier @VERSION@ soft links for sendmail
Group: Applications/Mail
@@ -117,10 +162,12 @@
Group: Applications/Mail
Requires: courier = @VERSION@
+%if %with_fax
%package fax
Summary: Courier @VERSION@ fax support
Group: Application/Mail
-Requires: courier = @VERSION@ groff ghostscript netpbm-progs /etc/mgetty+sendfax
+Requires: courier = @VERSION@ groff ghostscript netpbm-progs mgetty-sendfax xpdf
+%endif
%package maildrop-wrapper
Summary: Courier @VERSION@ soft links for maildrop
@@ -132,22 +179,27 @@
Group: Applications/Mail
Requires: courier = @VERSION@ fileutils
+%if %with_ldap
%package ldap
Summary: Courier @VERSION@ mail server LDAP authentication module
Group: Applications/Mail
Requires: courier = @VERSION@
+%endif
+%if %with_mysql
%package mysql
Summary: Courier @VERSION@ mail server MySQL authentication module
Group: Applications/Mail
Requires: courier = @VERSION@
+%endif
+%if %with_pgsql
%package pgsql
Summary: Courier @VERSION@ mail server PostgreSQL authentication module
Group: Applications/Mail
Requires: courier = @VERSION@
+%endif
-Summary: Courier
%description
The Courier mail transfer agent (MTA) is an integrated mail/groupware
server based on open commodity protocols, such as ESMTP, IMAP, POP3, LDAP,
@@ -168,9 +220,10 @@
in %{_sysconfdir}/webadmin/password (which is initialized to a random string
by default), you will be able to configure Courier using any web browser.
-%if %alternatives
+Available rpmbuild rebuild options:
+--without : fax mysql pgsql ldap
-%else
+%if ! %alternatives
%description sendmail-wrapper
This package contains two soft links from /usr/sbin/sendmail and
/usr/lib/sendmail to %{_bindir}/sendmail. This allows application
@@ -213,10 +266,12 @@
and all external logins must use SSL. See the installation notes
for information on enabling external non-SSL access.
+%if %with_fax
%description fax
This package adds support for faxing E-mail messages. You need to install
this package if you want the ability to send fax messages simply by
Sending an E-mail to [EMAIL PROTECTED]
+%endif
%description maildrop
This package adds mail filtering abilities to Courier. Mail filtering
@@ -251,6 +306,7 @@
Install this package if you need to provide authenticated ESMTP relaying.
+%if %with_ldap
%description ldap
This is an add-on package to the Courier mail server, that adds the
ability to authenticate and manage mail accounts using an LDAP-based
@@ -258,7 +314,9 @@
Install this package if you want to be able to manage and authenticate
mail accounts using an LDAP directory.
+%endif
+%if %with_mysql
%description mysql
This is an add-on package to the Courier mail server, that adds the
ability to authenticate and manage mail accounts using a MySQL
@@ -266,7 +324,9 @@
Install this package if you want to be able to manage and authenticate
mail accounts using a MySQL database.
+%endif
+%if %with_pgsql
%description pgsql
This is an add-on package to the Courier mail server, that adds the
ability to authenticate and manage mail accounts using a PostgreSQL
@@ -274,6 +334,9 @@
Install this package if you want to be able to manage and authenticate
mail accounts using a PostgreSQL database.
+%endif
+
+# -----------------------------------------------------------------------------
%prep
@@ -300,6 +363,8 @@
EOF
+# -----------------------------------------------------------------------------
+
%build
LANG=C
export LANG
@@ -632,6 +697,8 @@
done
EOF
+# -----------------------------------------------------------------------------
+
%post
if test -f %{_sysconfdir}/userdb || test -d %{_sysconfdir}/userdb
@@ -685,6 +752,7 @@
/sbin/chkconfig --del courier
fi
+%if %with_ldap
%preun ldap
if test -x %{_sbindir}/courierldapaliasd
then
@@ -694,18 +762,23 @@
then
%{_libexecdir}/authlib/authdaemond.ldap stop >/dev/null 2>&1 || /bin/true
fi
+%endif
+%if %with_mysql
%preun mysql
if test -x %{_libexecdir}/authlib/authdaemond.mysql
then
%{_libexecdir}/authlib/authdaemond.mysql stop >/dev/null 2>&1 || /bin/true
fi
+%endif
+%if %with_pgsql
%preun pgsql
if test -x %{_libexecdir}/authlib/authdaemond.pgsql
then
%{_libexecdir}/authlib/authdaemond.pgsql stop >/dev/null 2>&1 || /bin/true
fi
+%endif
%post imapd
%{_datadir}/sysconftool `%{__cat} %{_datadir}/configlist.imap` >/dev/null
@@ -787,6 +860,8 @@
test -f /etc/pam.d/webmail || test ! -f /etc/pam.d/webmail.rpmnew || mv -f
/etc/pam.d/webmail.rpmnew /etc/pam.d/webmail
test -f /etc/pam.d/calendar || test ! -f /etc/pam.d/calendar.rpmnew || mv -f
/etc/pam.d/calendar.rpmnew /etc/pam.d/calendar
+# -----------------------------------------------------------------------------
+
%files -f filelist
%if %alternatives
%attr(-, root, root) /usr/bin/sendmail
@@ -801,9 +876,7 @@
%attr(-, root, root) /etc/skel/Maildir
-%if %alternatives
-
-%else
+%if ! %alternatives
%files sendmail-wrapper -f filelist.sendmail-wrapper
%endif
@@ -836,14 +909,24 @@
%files smtpauth -f filelist.auth
+%if %with_ldap
%files ldap -f filelist.ldap
+%endif
+%if %with_mysql
%files mysql -f filelist.mysql
+%endif
+%if %with_pgsql
%files pgsql -f filelist.pgsql
+%endif
+%if %with_fax
%files fax -f filelist.fax
%attr(-, root, root) /etc/mgetty+sendfax/new_fax
+%endif
+
+# -----------------------------------------------------------------------------
%clean
%{__rm} -rf $RPM_BUILD_ROOT
