123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- ##
- ## sendmail.spec -- OpenPKG RPM Specification
- ## Copyright (c) 2000-2001 Cable & Wireless Deutschland GmbH
- ## Copyright (c) 2000-2001 Ralf S. Engelschall <rse@engelschall.com>
- ##
- ## 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.
- ##
- %define V_sendmail 8.11.6
- %define V_wide 8.11.6+3.4W
- %define V_smtpfeed 1.16
- %define V_lmtp2nntp 1.0.0
- # package information
- Name: sendmail
- Summary: Mail Transfer Agent
- URL: http://www.sendmail.org/
- Vendor: Eric Allman
- Packager: The OpenPKG Project
- Distribution: OpenPKG [EXP]
- Group: Mail
- License: BSD
- Version: %{V_sendmail}
- Release: %{l_branch}.0
- # list of sources
- Source0: ftp://ftp.sendmail.org/pub/sendmail/sendmail.%{V_sendmail}.tar.gz
- Source1: ftp://ftp.kyoto.wide.ad.jp/pub/mail/smtpfeed/smtpfeed-%{V_smtpfeed}.tar.gz
- Source2: ftp://ftp.ossp.org/pkg/lmtp2nntp/lmtp2nntp-%{V_lmtp2nntp}.tar.gz
- Source3: etc.sendmail.tar
- Source4: ftp://ftp.openpkg.org/DST/sendmail/fakesyslog.tar.gz
- Source5: cf.tar
- Source6: rc.sendmail
- Patch0: ftp://ftp.kyoto.wide.ad.jp/pub/mail/sendmail/sendmail%{V_wide}.patch.gz
- Patch1: sendmail.%{V_sendmail}.patch.autonomous
- # build information
- Prefix: %{l_prefix}
- BuildRoot: %{l_buildroot}
- BuildPreReq: openpkg >= 0.9-24, m4, make, db, openssl, sfio, patch
- PreReq: openpkg >= 0.9-24, m4, make, perl, procmail
- AutoReq: no
- AutoReqProv: no
- Provides: MTA
- %description
- Sendmail is the most-popular Mail Transfer Agent (MTA).
- Local specifics in this OpenPKG version:
- o Sendmail uses two process pools (incoming and outgoing)
- o Sendmail logs directly to the filesystem and not via syslog(3)
- o Sendmail delivers local mail via Procmail to ~<user>/.mail/inbox
- o Sendmail by default uses SMTPfeed for outgoing mass-delivery
- o Sendmail by default supports STARTTLS
- %prep
- # unpack standard tarballs
- %setup0 -q -c
- %setup1 -q -T -D -a 1
- %setup2 -q -T -D -a 2
- %setup3 -q -T -D -a 3
- %setup4 -q -T -D -a 4
- # apply Sendmail patch manually
- ( cd sendmail-%{V_sendmail}/sendmail
- %{l_gzip} -dc %{SOURCE sendmail%{V_wide}.patch.gz} |\
- sed -e 's;LOG_INFO;LOG_DEBUG;' | %{l_patch} -p1
- %{l_patch} -p1 <%{SOURCE sendmail.%{V_sendmail}.patch.autonomous}
- )
- # add own M4 stuff to Sendmail configuration set
- ( cd sendmail-%{V_sendmail}
- %{l_tar} xf %{SOURCE cf.tar}
- )
- %build
- PATH="%{l_prefix}/bin:$PATH"; export PATH
- # build faked syslog(3) library
- fakesyslogdir="`pwd`/fakesyslog"
- ( cd fakesyslog
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- ./configure \
- --with-logfile=%{l_prefix}/var/sendmail/sendmail.log
- %{l_make} %{l_mflags}
- )
- # build Sendmail
- ( cd sendmail-%{V_sendmail}
- # indicate with a plus sign that we use a patched version
- chmod u+w sendmail/version.c
- %{l_rpmtool} subst \
- 's;\(Version\[\][^"]*\)"[^"]*";\1"%{V_sendmail}+";' \
- -- sendmail/version.c
- # configure Sendmail
- ( echo "define(\`confMAPDEF', \`-DMAP_REGEX')dnl"
- echo "define(\`confSBINOWN', \`%{l_fsusr}')dnl"
- echo "define(\`confSBINGRP', \`%{l_fsgrp}')dnl"
- echo "define(\`confUBINOWN', \`%{l_fsusr}')dnl"
- echo "define(\`confUBINGRP', \`%{l_fsgrp}')dnl"
- echo "define(\`confMANOWN', \`%{l_fsusr}')dnl"
- echo "define(\`confMANGRP', \`%{l_fsgrp}')dnl"
- echo "define(\`confEBINDIR', \`%{l_prefix}/libexec/sendmail')dnl"
- echo "define(\`confHFDIR', \`%{l_prefix}/etc/sendmail')dnl"
- echo "define(\`confHFFILE', \`sendmail.help')dnl"
- echo "define(\`confINCLUDEDIR', \`%{l_prefix}/include/sendmail')dnl"
- echo "define(\`confINSTALL_RAWMAN', \`1')dnl"
- echo "define(\`confLIBDIR', \`%{l_prefix}/lib/sendmail')dnl"
- echo "define(\`confMANROOT', \`%{l_prefix}/man/cat')dnl"
- echo "define(\`confMANROOTMAN', \`%{l_prefix}/man/man')dnl"
- echo "define(\`confMBINDIR', \`%{l_prefix}/sbin')dnl"
- echo "define(\`confSBINDIR', \`%{l_prefix}/sbin')dnl"
- echo "define(\`confSHAREDLIBDIR', \`%{l_prefix}/lib')dnl"
- echo "define(\`confSTDIR', \`%{l_prefix}/var/sendmail')dnl"
- echo "define(\`confSTFILE', \`sendmail.stat')dnl"
- echo "define(\`confUBINDIR', \`%{l_prefix}/bin')dnl"
- echo "define(\`confLNOPTS', \`-f')dnl"
- echo "APPENDDEF(\`confENVDEF', \`-DPATCH_AUTONOMOUS')dnl"
- echo "APPENDDEF(\`confENVDEF', \`-D_PATH_SENDMAILCF=\\\"%{l_prefix}/etc/sendmail/sendmail.cf\\\"')dnl"
- echo "APPENDDEF(\`confENVDEF', \`-D_PATH_SENDMAILPID=\\\"%{l_prefix}/var/sendmail/sendmail.pid\\\"')dnl"
- echo "APPENDDEF(\`confENVDEF', \`-DSFIO')dnl"
- echo "APPENDDEF(\`confINCDIRS', \`-I%{l_prefix}/include')dnl"
- echo "APPENDDEF(\`confLIBDIRS', \`-L%{l_prefix}/lib')dnl"
- echo "APPENDDEF(\`confLIBS', \`-ldb')dnl"
- echo "define(\`confSTDIO_TYPE', \`portable')dnl"
- echo "APPENDDEF(\`confINCDIRS', \`-I%{l_prefix}/include/sfio')dnl"
- echo "APPENDDEF(\`confLIBS', \`-lsfio')dnl"
- echo "APPENDDEF(\`conf_sendmail_ENVDEF', \`-DSTARTTLS')dnl"
- echo "APPENDDEF(\`conf_sendmail_LIBS', \`-lssl -lcrypto')dnl"
- echo "APPENDDEF(\`confLIBDIRS', \`-L$fakesyslogdir')dnl"
- echo "APPENDDEF(\`confLIBS', \`-lfakesyslog')dnl"
- ) >devtools/Site/site.config.m4
- # build Sendmail package
- %{l_make} %{l_mflags}
- )
- # build the LMTP mailer SMTPFeed
- ( cd smtpfeed-%{V_smtpfeed}
- %{l_rpmtool} subst \
- 's;smtpfeed 1.[0-9]*;smtpfeed %{V_smtpfeed};' \
- -- version.c
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- LDFLAGS="-L$fakesyslogdir" \
- LIBS="-lfakesyslog" \
- ./configure \
- --prefix=%{l_prefix}
- %{l_make} %{l_mflags -O}
- )
- # build the LMTP mailer LMTP2NNTP
- ( cd lmtp2nntp-%{V_lmtp2nntp}
- CC="%{l_cc}" \
- CFLAGS="%{l_cflags -O}" \
- ./configure \
- --prefix=%{l_prefix}
- %{l_make} %{l_mflags}
- )
- %install
- rm -rf $RPM_BUILD_ROOT
- PATH="%{l_prefix}/bin:$PATH"; export PATH
- # manually create filesystem hierarchy, because Sendmail's
- # install target doesn't properly create it itself.
- %{l_shtool} mkdir -f -p -m 755 \
- $RPM_BUILD_ROOT%{l_prefix} \
- $RPM_BUILD_ROOT%{l_prefix}/etc/sendmail \
- $RPM_BUILD_ROOT%{l_prefix}/bin \
- $RPM_BUILD_ROOT%{l_prefix}/sbin \
- $RPM_BUILD_ROOT%{l_prefix}/lib \
- $RPM_BUILD_ROOT%{l_prefix}/libexec/sendmail \
- $RPM_BUILD_ROOT%{l_prefix}/man \
- $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
- $RPM_BUILD_ROOT%{l_prefix}/man/man5 \
- $RPM_BUILD_ROOT%{l_prefix}/man/man8 \
- $RPM_BUILD_ROOT%{l_prefix}/man/cat1 \
- $RPM_BUILD_ROOT%{l_prefix}/man/cat5 \
- $RPM_BUILD_ROOT%{l_prefix}/man/cat8
- # install Sendmail
- ( cd sendmail-%{V_sendmail}
- myusr=`(id -un) 2>/dev/null ||\
- (whoami) 2>/dev/null ||\
- (who am i | cut "-d " -f1) 2>/dev/null ||\
- echo $LOGNAME`
- mygrp=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
- grep "^${myusr}:" | awk -F: '{ print $4; }' | head -1`
- mygrp=`(cat /etc/group; ypcat group) 2>/dev/null |\
- grep ":${mygrp}:" | awk -F: '{ print $1; }' | head -1`
- %{l_rpmtool} subst \
- "s;^\\(SBINOWN.*=\\).*;\\1 $myusr;" \
- "s;^\\(SBINGRP.*=\\).*;\\1 $mygrp;" \
- "s;^\\(UBINOWN.*=\\).*;\\1 $myusr;" \
- "s;^\\(UBINGRP.*=\\).*;\\1 $mygrp;" \
- "s;^\\(MANOWN.*=\\).*;\\1 $myusr;" \
- "s;^\\(MANGRP.*=\\).*;\\1 $mygrp;" \
- 's;ln -s *;$(LN) $(LNOPTS) $(DESTDIR);' \
- -- Makefile */Makefile */*/Makefile
- %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
- # remember the Sendmail M4 stuff for re-configuration
- (%{l_tar} cf $RPM_BUILD_ROOT%{l_prefix}/etc/sendmail/cf.tar cf)
- compress $RPM_BUILD_ROOT%{l_prefix}/etc/sendmail/cf.tar
- %{l_shtool} install -c -m 644 cf/README \
- $RPM_BUILD_ROOT%{l_prefix}/etc/sendmail/cf.README
- %{l_shtool} install -c -m 755 contrib/re-mqueue.pl \
- $RPM_BUILD_ROOT%{l_prefix}/sbin/re-mqueue
- %{l_shtool} install -c -m 755 -e 's;^#!.*;#!%{l_prefix}/bin/perl;' \
- contrib/qtool.pl $RPM_BUILD_ROOT%{l_prefix}/sbin/qtool
- %{l_shtool} install -c -m 755 -e 's;^#!.*;#!%{l_prefix}/bin/perl;' \
- contrib/qtool.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/qtool.8
- )
- # install SMTPFeed
- ( cd smtpfeed-%{V_smtpfeed}
- %{l_shtool} install -c -s -m 755 \
- smtpfeed $RPM_BUILD_ROOT%{l_prefix}/libexec/sendmail/
- %{l_shtool} install -c -m 644 \
- smtpfeed.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
- )
- # install LMTP2NNTP
- ( cd lmtp2nntp-%{V_lmtp2nntp}
- %{l_shtool} install -c -s -m 755 \
- lmtp2nntp $RPM_BUILD_ROOT%{l_prefix}/libexec/sendmail/
- %{l_shtool} install -c -m 644 \
- lmtp2nntp.1 %$RPM_BUILD_ROOT%{l_prefix}/man/man8/lmtp2nntp.8
- )
- # install a reasonable default configuration
- ( cd etc.sendmail
- l_hostname=`%{l_shtool} echo -e %h`
- l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
- l_ostype=bsd4.4
- case "%{l_target}" in
- *-freebsd4*) l_ostype=freebsd4 ;;
- *-freebsd*) l_ostype=bsd4.4 ;;
- *-solaris2.8) l_ostype=solaris8 ;;
- *-solaris*) l_ostype=solaris2 ;;
- *-linux*) l_ostype=linux ;;
- esac
- %{l_shtool} install -c -m 644 \
- -e "s;@l_prefix@;%{l_prefix};g" \
- -e "s;@l_fsusr@;%{l_fsusr};g" \
- -e "s;@l_fsgrp@;%{l_fsgrp};g" \
- -e "s;@l_hostname@;${l_hostname};g" \
- -e "s;@l_domainname@;${l_domainname};g" \
- -e "s;@l_ostype@;${l_ostype};g" \
- * $RPM_BUILD_ROOT%{l_prefix}/etc/sendmail/
- )
- # install the run-command script
- %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
- %{l_shtool} install -c -m 755 \
- -e 's;@l_prefix@;%{l_prefix};g' \
- -e 's;@l_fsusr@;%{l_fsusr};g' \
- -e 's;@l_fsgrp@;%{l_fsgrp};g' \
- %{SOURCE rc.sendmail} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
- # create important files which have to be present from the beginning
- %{l_shtool} mkdir -f -p -m 700 $RPM_BUILD_ROOT%{l_prefix}/var/sendmail/mqueue
- touch $RPM_BUILD_ROOT%{l_prefix}/var/sendmail/sendmail.in.pid
- touch $RPM_BUILD_ROOT%{l_prefix}/var/sendmail/sendmail.out.pid
- touch $RPM_BUILD_ROOT%{l_prefix}/var/sendmail/sendmail.log
- # adjust installation tree
- rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/cat*
- chmod -R u+w $RPM_BUILD_ROOT%{l_prefix}/
- strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2> /dev/null || true
- strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2> /dev/null || true
- # determine file list
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
- %{l_files_std} \
- '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/sbin/sendmail' \
- '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/bin/hoststat' \
- '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/bin/mailq' \
- '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/bin/newaliases' \
- '%attr(4755,root,%{l_fsgrp}) %{l_prefix}/bin/purgestat' \
- '%config %{l_prefix}/etc/sendmail/*' \
- '%config %attr(644,root,%{l_fsgrp}) %{l_prefix}/etc/sendmail/ca.crt' \
- '%config %attr(644,root,%{l_fsgrp}) %{l_prefix}/etc/sendmail/sendmail.crt' \
- '%config %attr(600,root,%{l_fsgrp}) %{l_prefix}/etc/sendmail/sendmail.key' \
- '%attr(700,root,%{l_fsgrp}) %{l_prefix}/var/sendmail/mqueue' \
- '%attr(644,root,%{l_fsgrp}) %{l_prefix}/var/sendmail/sendmail.log' \
- '%attr(644,root,%{l_fsgrp}) %{l_prefix}/var/sendmail/sendmail.*.pid'
- %files -f files
- %clean
- rm -rf $RPM_BUILD_ROOT
- %post
- if [ $1 -eq 1 ]; then
- (cd $RPM_INSTALL_PREFIX/etc/sendmail; %{l_make} all >/dev/null 2>&1 || true)
- elif [ $1 -gt 1 ]; then
- (cd $RPM_INSTALL_PREFIX/etc/sendmail; %{l_make} clean all >/dev/null 2>&1 || true)
- $RPM_INSTALL_PREFIX/etc/rc sendmail reload >/dev/null 2>&1 || true
- fi
- %preun
- if [ $1 -eq 0 ]; then
- $RPM_INSTALL_PREFIX/etc/rc sendmail stop >/dev/null 2>&1 || true
- (cd $RPM_INSTALL_PREFIX/etc/sendmail/; %{l_make} clean >/dev/null 2>&1 || true)
- fi
|