Building Sendmail from ports

David Robillard david.robillard at gmail.com
Wed Nov 22 06:39:27 PST 2006


[ ---8<--- Text has been removed! ---8<---]

> But, where will the port install my *.mc and *.cf files? This I can't
> seem to figure out. I would like to know before I hit 'make install' in
> the port dir. I would think it will install them into
> /usr/local/share/sendmail/cf, would that be correct?

Hi DAve,

When you use the mail/sendmail port, it does install files in
/usr/local/share/sendmail. Think of it as the base system's sendmail
files in /usr/share/sendmail.

Now, the .mc and .cf files are still kept in /etc/mail and not in
/usr/local/etc/mail as one could think by using a port.

Note that you will find two scripts in /usr/local/etc/rc.d when you
install the sendmail port. They are `sendmail.sh.sample' and
`sm-client.sh.sample'. But you don't need to use them. The base
system's /etc/rc.d/sendmail script handles both the base system's
sendmail and the port's sendmail.

The key for a pain free mail/sendmail ports usage is to do what you
said. That is to edit make.conf(5) and to use special make(1) targets
from the mail/sendmail's Makefile.

Briefly, here's the way I do things when I update mail/sendmail (YMMV of course)

sudo vi /etc/make.conf

##
# mail/sendmail port configuration.
##

# Do not build and install the base distribution of sendmail.
#
NO_SENDMAIL= TRUE

# Specify where the configuration directory is located.
#
SENDMAIL_CF_DIR=/usr/local/share/sendmail/cf

.if ${.CURDIR:M*/mail/sendmail}
SENDMAIL_WITHOUT_IPV6=yes \
SENDMAIL_WITHOUT_NIS=yes \
SENDMAIL_WITH_TLS=yes \
SENDMAIL_WITH_SMTPS=yes \
SENDMAIL_WITH_LDAP=yes \
SENDMAIL_WITH_BERKELEYDB_VER=42 \
SENDMAIL_WITH_SOCKETMAP=yes \
SENDMAIL_WITH_PICKY_HELO_CHECK=yes \
SENDMAIL_WITH_SHARED_MILTER=yes
.endif

sudo porteasy -uv mail/sendmail
sudo porteasy -uv security/openssl
sudo porteasy -uv security/gnutls

cd /usr/ports/mail/sendmail

sudo make
# -OR if you don't want to edit make.conf(5), you can run something like this:
sudo make -DSENDMAIL_WITHOUT_IPV6 -DSENDMAIL_WITHOUT_NIS
-DSENDMAIL_WITH_TLS -DSENDMAIL_WITH_SMTPS \
-DSENDMAIL_WITH_BERKELEYDB_VER=42 -DSENDMAIL_WITH_SOCKETMAP
-DSENDMAIL_WITH_PICKY_HELO_CHECK -DSENDMAIL_WITH_SHARED_MILTER

sudo make tls-install
sudo make install
sudo make mailer.conf
sudo make clean

Now, you might not need the exact same features of Sendmail as I do,
of course. But the `make mailer.conf' is quite important. That's going
to edit /etc/mail/mailer.conf which instructs the OS to use
/usr/local/sbin/sendmail instead of the base system's sendmail. You
don't have to change your PATH either.

Why? Because if take a look at /usr/sbin/sendmail, it's not a binary,
it's a symbolic link to `/usr/sbin/mailwrapper'. Just read the
mailwrapper(8) man page and you'll understand how things work.

> I want to make certain that when I build new sendmail.in.cf and
> sendmail.out.cf the correct files are used by m4. Currently I run the
> following when making changes to my *.mc files
>
> /usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/
> /usr/share/sendmail/cf/m4/cf.m4 sendmail.in.mc > sendmail.in.cf

Take a look at the /etc/mail/Makefile and you'll see that it can
determine your _CF_DIR_. But it takes a wrong decision. It uses either
/usr/share/sendmail/cf or /usr/src/contrib/sendmail/cf.

To work around this, you can edit /etc/mail/Makefile or use the
following at the top of your sendmail.mc files:

dnl include.
dnl Use the following m4 macro file.
dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl

That's it. If you need any help, don't hesitate to contact me.

Have fun :)

David
-- 
David Robillard
UNIX systems administrator & Oracle DBA
CISSP, RHCE & Sun Certified Security Administrator
Montreal: +1 514 966 0122


More information about the freebsd-questions mailing list