[SA-exim] SuSE 8.1 RPM specfile

Rob Skedgell rob+sa-exim at nephelococcygia.dyndns.org
Sat May 3 20:27:38 PDT 2003


I have attached an RPM .spec file for Exim 4.14/sa-exim 3.0 which seems to 
be working happily for me so far. Since this is based on the file from the 
SuSE 8.1 distribution, it will 'probably' need a bit of editing to work on 
other Linux versions.

Hopefully more generic RPMs could be made available for download if anypne 
has the time or inclination.

I hope that this is of some use to someone, even if only as an example of 
how not to do specfiles. Any comments/criticism to the address below if 
they do not relate specifically to sa-exim.

-- 
Rob Skedgell <rob at nephelococcygia.dyndns.org>

Everything should be built top-down, except this time.
-------------- next part --------------
#
# spec file for package exim (Version 4.14)
#
# Copyright (c) 2002 SuSE Linux AG, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Updated to 4.14, exim-doc and sa-exim added by Rob Skedgell.
# Don't blame SuSE for any problems with my modifications.
#
# please send bugfixes or comments to rob at nephelococcygia.dyndns.org
#

# neededforbuild  db-devel openssl-devel tcpd xdevel xf86
# usedforbuild    aaa_base aaa_version acl attr bash bind9-utils bison cpio cpp cyrus-sasl db devs diffutils e2fsprogs file filesystem fileutils fillup findutils flex gawk gdbm-devel glibc glibc-devel glibc-locale gpm grep groff gzip kbd less libgcc libstdc++ libxcrypt m4 make man mktemp modutils ncurses ncurses-devel net-tools netcfg pam pam-devel pam-modules patch permissions ps rcs readline sed sendmail sh-utils shadow strace syslogd sysvinit tar texinfo textutils timezone unzip util-linux vim zlib-devel autoconf automake binutils bzip2 cracklib db-devel gcc gdbm gettext libtool openssl-devel perl rpm tcpd xdevel xf86 xshared zlib
%define exim_version 4.14
%define exim_doc_version 4.10
%define sa_exim_version 3.0
Name:         exim
Conflicts:    sendmail sendmail-tls postfix
License:      GPL
Group:        Productivity/Networking/Email/Servers
Autoreqprov:  on
Provides:     smtp_daemon
Provides:     exim_localscan_dlopen
%if %suse_version > 800
Requires:     logrotate
PreReq:       %insserv_prereq %fillup_prereq /usr/sbin/useradd fileutils textutils
%endif
Version:      %{exim_version}
Release:      6
Summary:      The Exim mail transfer agent, a replacement for sendmail
URL:          http://www.exim.org/
Packager:     Rob Skedgell <rob at nephelococcygia.dyndns.org>
BuildRoot:    %{_tmppath}/%{name}-%{exim_version}-build
Source:       ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/exim-%{exim_version}.tar.bz2
# These are from the SuSE 8.1 SRPM ftp://ftp.suse.com/pub/suse/i386/8.1/suse/src/exim-4.10-37.src.rpm
Source1:      sysconfig.exim
Source2:      exim.logrotate
Source11:     exim.rc
Source12:     permissions.exim
# Used for the exim-doc package
Source30:     ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/exim-html-%{exim_doc_version}.tar.bz2
Source31:     ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/exim-pdf-%{exim_doc_version}.tar.bz2
Source32:     ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/exim-postscript-%{exim_doc_version}.tar.bz2
Source33:     ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim4/exim-texinfo-%{exim_doc_version}.tar.bz2
# Essential :-)
Source50:     http://marc.merlins.org/linux/exim/files/sa-exim-%{sa_exim_version}.tar.gz
%package -n eximon
Summary:      Eximon, an graphical frontend to administer Exim's mail queue
Group:        Productivity/Networking/Email/Servers
URL:          http://www.exim.org/
%package -n exim-doc
Summary:      Documentation for Exim in HTML, PDF, postscript and texinfo formats
Version:      %{exim_doc_version}
#Release:      1
Requires:     exim >= %{exim_doc_version}
Group:        Documentation
URL:          http://www.exim.org/
%package -n sa-exim
Summary:      Exim local_scan to use Spamassassin
Version:      %{sa_exim_version}
#Release:      1
Group:        Productivity/Networking/Email/Servers
Requires:     exim_localscan_dlopen
Requires:     spamassassin
URL:          http://marc.merlins.org/linux/exim/sa.html

%description
Exim is a mail transport agent (MTA) developed at the University of
Cambridge for use on Unix systems connected to the Internet. It is
freely available under the terms of the GNU General Public Licence. In
style it is similar to Smail 3, but its facilities are more extensive,
and in particular it has options for verifying incoming sender and
recipient addresses, for refusing mail from specified hosts, networks,
or senders, and for controlling mail relaying.

Authors:
--------
    Philip Hazel <ph10 at cus.cam.ac.uk>


%description -n eximon
This allows administrators to view the exim agent's mail queue and logs,
and perform a variety of actions on queued messages, such as freezing,
bouncing and thawing messages, and even editing body and header of
mails.

Authors:
--------
    Philip Hazel <ph10 at cus.cam.ac.uk>

%description -n exim-doc
Documentation for Exim in HTML, PDF, postscript and texinfo formats

Authors:
--------
    Philip Hazel <ph10 at cus.cam.ac.uk>

%description -n sa-exim
Exim local_scan to use Spamassassin.

Insert the following line into your exim.conf
    local_scan_path = /usr/lib/exim4/local_scan/sa-exim.so
 
Authors:
--------
    Marc MERLIN <marc at merlins.org>

%prep
%setup 
cat <<-EOF > Local/Makefile
	# see src/EDITME for comments.
	BIN_DIRECTORY=/usr/sbin
	CONFIGURE_FILE=/etc/exim/exim.conf
	EXIM_USER=mail
	EXIM_GROUP=mail
	SPOOL_DIRECTORY=/var/spool/exim
	
	ROUTER_ACCEPT=yes
	ROUTER_DNSLOOKUP=yes
	ROUTER_IPLITERAL=yes
	ROUTER_MANUALROUTE=yes
	ROUTER_QUERYPROGRAM=yes
	ROUTER_REDIRECT=yes
	# ROUTER_IPLOOKUP=yes
	TRANSPORT_APPENDFILE=yes
	TRANSPORT_AUTOREPLY=yes
	TRANSPORT_PIPE=yes
	TRANSPORT_SMTP=yes
	TRANSPORT_LMTP=yes
	SUPPORT_MAILDIR=yes
	# SUPPORT_MAILSTORE=yes
	# SUPPORT_MBX=yes
	LOOKUP_DBM=yes
	LOOKUP_LSEARCH=yes
	# LOOKUP_CDB=yes
	LOOKUP_DNSDB=yes
	LOOKUP_DSEARCH=yes
	# LOOKUP_MYSQL=yes
	# LOOKUP_NIS=yes
	# LOOKUP_NISPLUS=yes
	# LOOKUP_ORACLE=yes
	# LOOKUP_PGSQL=yes
	# LOOKUP_WHOSON=yes
	
	LOOKUP_LDAP=yes
	# LDAP_LIB_TYPE=OPENLDAP1
	LDAP_LIB_TYPE=OPENLDAP2
	# LDAP_LIB_TYPE=NETSCAPE
	# LDAP_LIB_TYPE=SOLARIS
	
	LOOKUP_INCLUDE= #-I /usr/local/mysql/include -I /usr/local/pgsql/include
	LOOKUP_LIBS=-lldap -llber #-lmysqlclient -lpq
	
	EXIM_MONITOR=eximon.bin
	
	AUTH_CRAM_MD5=yes
	AUTH_PLAINTEXT=yes
	# AUTH_SPA=yes
	SUPPORT_TLS=yes
	TLS_LIBS=-lssl -lcrypto
	
	INFO_DIRECTORY=%{_infodir}
	LOG_FILE_PATH="syslog:/var/log/exim/%%s.log"
	EXICYCLOG_MAX=10
	COMPRESS_COMMAND=/bin/gzip
	COMPRESS_SUFFIX=gz
	ZCAT_COMMAND=/usr/bin/zcat
	SUPPORT_PAM=yes
	# You probably need to add -lpam to EXTRALIBS
	# RADIUS_CONFIG_FILE=/etc/radiusclient/radiusclient.conf
	# CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
	USE_TCP_WRAPPERS=yes
	
	NO_SYMLINK=yes
	CHOWN_COMMAND=/bin/chown
	CHGRP_COMMAND=/bin/chgrp
	MV_COMMAND=/bin/mv
	RM_COMMAND=/bin/rm
	PERL_COMMAND=/usr/bin/perl
	# APPENDFILE_MODE=0600
	# APPENDFILE_DIRECTORY_MODE=0700
	# APPENDFILE_LOCKFILE_MODE=0600
	# CONFIGURE_FILE_USE_NODE=yes
	# CONFIGURE_FILE_USE_EUID=yes
	# DELIVER_BUFFER_SIZE=8192
	# EXIMDB_DIRECTORY_MODE=0750
	# EXIMDB_MODE=0640
	# EXIMDB_LOCKFILE_MODE=0640
	# HEADER_MAXSIZE="(1024*1024)"
	# INPUT_DIRECTORY_MODE=0750
	# LOG_DIRECTORY_MODE=0750
	# LOG_MODE=0640
	# LOOKUP_TESTDB=yes
	MAKE_SHELL=/bin/bash
	# MAX_NAMED_LIST=16
	# MAXINTERFACES=250
	# MSGLOG_DIRECTORY_MODE=0750
    EXIM_PERL = perl.o
	# PERL_CC=
	# PERL_CCOPTS=
	# PERL_LIBS=
	PID_FILE_PATH=/var/run/exim%%s.pid
	# SPOOL_DIRECTORY_MODE=0750
	# SPOOL_MODE=0640
	SUPPORT_MOVE_FROZEN_MESSAGES=yes
	HAVE_IPV6=YES
    
    # Note that localscan_dlopen.patch modifies src/EDITME, so
    # for the SuSE 8.1 exim.spec these are also needed here.
    DLOPEN_LOCAL_SCAN=yes
    LFLAGS=-rdynamic
	
	CFLAGS=$RPM_OPT_FLAGS
	EXTRALIBS=-ldl -lpam -lwrap -L/usr/X11R6/%{_lib}
EOF
touch Local/eximon.conf

# Unpack and move the documentation
# TODO: this _should_ be another package
tar xjvf %{SOURCE30}
tar xjvf %{SOURCE31}
tar xjvf %{SOURCE32}
tar xjvf %{SOURCE33}
mv -f ./exim-{html,pdf,postscript,texinfo}-%{exim_doc_version}/doc/* ./doc
rm -rf ./exim-{html,pdf,postscript,texinfo}-%{exim_doc_version}

# Unpack the sa-exim sources
tar xzvf %{SOURCE50}
# Apply the localscan_dlopen patch
patch -p1 <./sa-exim-%{sa_exim_version}/localscan_dlopen.patch

%build
%if %suse_version <= 800
	/usr/sbin/useradd -o -g mail -u 8 -s /bin/false -c "Mailer daemon" -d /var/spool/clientmqueue mail 2> /dev/null || :
%endif
# Build Exim4
make 

# Build sa-exim
cd ./sa-exim-%{sa_exim_version}
make SACONF=/etc/exim/spamassassin.conf EXIM_SRC=../src
cd ..

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
mkdir -p $RPM_BUILD_ROOT/usr/{bin,sbin}
mkdir -p $RPM_BUILD_ROOT/var/log/exim
mkdir -p $RPM_BUILD_ROOT/var/spool/mail/
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
mkdir -p $RPM_BUILD_ROOT%{_mandir}/{man5,man8}
mkdir -p $RPM_BUILD_ROOT/usr/X11R6/bin
make 	inst_dest=$RPM_BUILD_ROOT/usr/sbin \
	inst_conf=$RPM_BUILD_ROOT/etc/exim/exim.conf \
	inst_info=$RPM_BUILD_ROOT/%{_infodir} 	install
mv $RPM_BUILD_ROOT/usr/sbin/exim-%{exim_version}* $RPM_BUILD_ROOT/usr/sbin/exim
install -m 755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/exim
ln -sv /usr/sbin/exim $RPM_BUILD_ROOT/usr/bin/mailq
ln -sv /usr/sbin/exim $RPM_BUILD_ROOT/usr/bin/runq
ln -sv /usr/sbin/exim $RPM_BUILD_ROOT/usr/bin/newaliases
ln -sv /usr/sbin/exim $RPM_BUILD_ROOT/usr/sbin/sendmail
ln -sv ../../etc/init.d/exim $RPM_BUILD_ROOT/usr/sbin/rcexim
mv $RPM_BUILD_ROOT/usr/sbin/eximon* $RPM_BUILD_ROOT/usr/X11R6/bin/
cp -p %{S:1} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.exim
install -m 644 %{S:2} $RPM_BUILD_ROOT/etc/logrotate.d/exim
mv doc/exim.8 $RPM_BUILD_ROOT/%{_mandir}/man8/
gzip -9 doc/*.txt
for i in main panic reject; do 
	touch $RPM_BUILD_ROOT/var/log/exim/${i}.log
done
install -o root -g root -m 0755 -d $RPM_BUILD_ROOT/etc/permissions.d
install -o root -g root -m 0644 $RPM_SOURCE_DIR/permissions.exim $RPM_BUILD_ROOT/etc/permissions.d/exim

# Install sa-exim
install -o root -g root -m 0755 -d $RPM_BUILD_ROOT/usr/lib/exim4
install -o root -g root -m 0755 -d $RPM_BUILD_ROOT/usr/lib/exim4/local_scan
install -o root -g root -m 0755 ./sa-exim-%{sa_exim_version}/accept.so \
    $RPM_BUILD_ROOT/usr/lib/exim4/local_scan/accept.so
install -o root -g root -m 0755 ./sa-exim-%{sa_exim_version}/sa-exim-%{sa_exim_version}.so \
    $RPM_BUILD_ROOT/usr/lib/exim4/local_scan/sa-exim-%{sa_exim_version}.so
ln -sv /usr/lib/exim4/local_scan/sa-exim-%{sa_exim_version}.so \
    $RPM_BUILD_ROOT/usr/lib/exim4/local_scan/sa-exim.so
install -o root -g root -m 0644 ./sa-exim-%{sa_exim_version}/spamassassin.conf \
    $RPM_BUILD_ROOT/etc/exim/spamassassin.conf
install -o root -g root -m 0644 ./sa-exim-%{sa_exim_version}/spamassassin_short.conf \
    $RPM_BUILD_ROOT/etc/exim/spamassassin_short.conf

%pre
%if %suse_version <= 800
	/usr/sbin/useradd -o -g mail -u 8 -s /bin/false -c "Mailer daemon" -d /var/spool/clientmqueue mail 2> /dev/null || :
%endif

%post
if ! test -s etc/exim/exim.conf; then 
	if test -s etc/exim.conf; then
		mv etc/exim.conf etc/exim/
		echo moving exim.conf to /etc/exim/ 
	else
		cp -p usr/share/doc/packages/exim/configure.default etc/exim/exim.conf 
		echo copying default config file to /etc/exim/exim.conf
	fi
fi
%if %suse_version < 800
	echo "Updating /etc/rc.config..."
	bin/cat > var/adm/fillup-templates/rc.config.exim <<-EOF 
		#
		# Start the exim mail transfer agent? (yes|no)
		#
		START_EXIM=yes
	EOF
	bin/fillup -q etc/rc.config var/adm/fillup-templates/rc.config.exim
	bin/rm var/adm/fillup-templates/rc.config.exim
	bin/fillup -q etc/rc.config var/adm/fillup-templates/sysconfig.exim
	sbin/insserv etc/init.d/exim
%else
	%{fillup_and_insserv exim}
%endif
exit 0

%postun
sbin/insserv etc/init.d/

%files
%defattr(-,root,root)
%doc doc/README
%doc doc/ChangeLog
%doc doc/Exim*.upgrade
%doc doc/*.txt.gz
%doc doc/NewStuff
%doc src/configure.default
%doc build-Linux-*/convert4r{3,4}
%doc %{_mandir}/man8/*
/usr/sbin/exicyclog
/usr/sbin/exigrep
/usr/sbin/exim
/usr/sbin/exim_*
/usr/sbin/eximstats
/usr/sbin/exinext
/usr/sbin/exiqsumm
/usr/sbin/exiwhat
%dir /usr/lib/exim4
%dir /usr/lib/exim4/local_scan
%dir /etc/exim
%config /etc/init.d/exim
%config(noreplace) /etc/logrotate.d/exim
%config(noreplace) /etc/permissions.d/exim
/usr/sbin/rcexim
/usr/bin/mailq
/usr/bin/runq
/usr/bin/newaliases
/usr/sbin/sendmail
/var/adm/fillup-templates/sysconfig.exim
%dir /var/log/exim

%files -n eximon
%defattr(-,root,root)
/usr/X11R6/bin/eximon
/usr/X11R6/bin/eximon.bin

%files -n exim-doc
%defattr(-,root,root)
%doc doc/html/
%doc doc/*.pdf
%doc doc/*.ps
%doc doc/*.texinfo

%files -n sa-exim
%defattr(-,root,root)
%doc sa-exim-%{sa_exim_version}/README
%doc sa-exim-%{sa_exim_version}/INSTALL
%doc sa-exim-%{sa_exim_version}/TODO
%doc sa-exim-%{sa_exim_version}/LICENSE
%doc sa-exim-%{sa_exim_version}/ACKNOWLEDGEMENTS
%doc sa-exim-%{sa_exim_version}/CHANGELOG
/usr/lib/exim4/local_scan/accept.so
/usr/lib/exim4/local_scan/sa-exim-%{sa_exim_version}.so
/usr/lib/exim4/local_scan/sa-exim.so
%config(noreplace) /etc/exim/spamassassin.conf
%config(noreplace) /etc/exim/spamassassin_short.conf

%changelog -n exim
* Sat May 03 2003 - Rob Skedgell <rob at nephelococcygia.dyndns.org> -6
- add 'DLOPEN_LOCAL_SCAN=yes' to text cat'ed >Local/Makefile (d'oh)
* Thu May 01 2003 - Rob Skedgell <rob at nephelococcygia.dyndns.org> -5
- new package: sa-exim version 3.0 (puts .so's in /usr/lib/exim4/local_scan)
- apply localfilter_dlopen patch from sa-exim 3.0 to main package
- new package: exim-doc version 4.10 (HTML, PDF, postscript, texinfo)
* Sat Mar 22 2003 - Rob Skedgell <rob at nephelococcygia.demon.co.uk> -4
- replace src/local_scan.c with sa-exim.c from sa-exim-2.2
* Sun Mar 16 2003 - Rob Skedgell <rob at nephelococcygia.demon.co.uk> -2
- include embedded perl support
- add DNSDB lookup
- add syslog to LOG_FILE_PATH
* Fri Mar 14 2003 - Rob Skedgell <rob at nephelococcygia.demon.co.uk> 4.14-0
- update to version 4.14
* Sat Mar 08 2003 - Rob Skedgell <rob at nephelococcygia.dyndns.org> 4.12-0
- update to version 4.12
- disable MySQL and postgresql lookups
* Tue Aug 13 2002 - poeml at suse.de
- remove stupid arch-dependant path from filelist
* Tue Aug 13 2002 - poeml at suse.de
- mv exim.conf to /etc/exim/
- add scripts for conversion of 3.xx config files
- add symbolic link "runq" (same as exim -q)
- use %%defattr
* Mon Aug 12 2002 - poeml at suse.de
- improve logrotate configuration
- fix PreReq
- install exim.8 manpage and gzip the remaining documentation
- Moved log file creation from %%post to rcexim
* Tue Aug 06 2002 - draht at suse.de
- added /etc/permissions.d/exim for setuid /usr/sbin/exim
* Fri Aug 02 2002 - poeml at suse.de
- package created (4.10)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exim.spec.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.merlins.org/archives/sa-exim/attachments/20030503/3d6fe527/exim.spec-0001.bin


More information about the SA-Exim mailing list