# -*-sh-*-
#ident	"@(#)smail:RELEASE-3_2_0_115:EDITME-netbsdpkg,v 1.21 2003/03/27 23:02:35 woods Exp"
#
# netbsdpkg -- a netbsd install under "$PREFIX" with lots of options
#
# This should also work for FreeBSD and OpenBSD, or by hand with
# $PREFIX set in the environment (which is what the pkgsrc do-build
# target does).  Note though that you'll probably want the
# "mailwrapper" program too since this package explictly does *not*
# replace sendmail directly but installs in $PREFIX/libexec/smail.
#
if [ -z "$PREFIX" ] ; then
        echo "You have not set PREFIX in the environment!!!"
        exit 2
fi
#
CC=${CC:-cc}
# 
# these are all OK on NetBSD-1.3.2 thorugh 1.6
# (with only minor cast-qual warnings from old gcc (2.7.2* and older?))
# 
CWARNS="-Wall -Wshadow -Wswitch -Wreturn-type -Wpointer-arith -Wconversion -Wimplicit -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wcast-qual -Wno-format-extra-args"
# Smail does not care about 'const' in enough places, yet....
#CWARNS="$CWARNS -Wwrite-strings
#
if ${CC} -o /dev/null -c -Wnetbsd-format-audit ${ROOT}/compat/dummy.c > /dev/null 2>&1 ; then
	# format-audit is also only on newer systems (egcs-1.x?),
	# only in the stock NetBSD compiler,
	# and only on some architectures (eg. not sparc64).
	CWARNS="$CWARNS -Wnetbsd-format-audit"
fi
# 
# Note that -pipe _may_ slow down small-memory systems
# 
CFLAGS="-g -O2 -pipe $CWARNS"
LDFLAGS="-g -O2 -pipe -static"
#
# don't waste time searching the sysem default directories twice for
# package libident and libwhoson.
#
# XXX this still needs tweaks to handle pkgsrc buildlink
#
if [ "$PREFIX" != /usr ]; then
	CPPFLAGS="-I${PREFIX}/include"
	LDFLAGS="${LDFLAGS} -Wl,-R${PREFIX}/lib -L${PREFIX}/lib"
fi
OS_TYPE=bsd4.4-lite
MISC_DEFINES="SMAIL_LOG_STYLE=2"
MISC_DEFINES="$MISC_DEFINES:NO_FORWARDTO_FILE"
MISC_DEFINES="$MISC_DEFINES:USE_TARGET_DOMAIN"
MISC_DEFINES="$MISC_DEFINES:USE_LSEARCH_REGEXCMP"
MISC_DEFINES="$MISC_DEFINES:LOG_SMTP_NON_COMPLIANCE"
MISC_DEFINES="$MISC_DEFINES:LOG_SMTP_ILLEGAL_OPERAND_WARNING"
#
HAVE=EHLO
#
HAVE=$HAVE:RFC1413
LIBS="-lident"
#
HAVE=$HAVE:LIBWHOSON
LIBS="$LIBS -lwhoson"
# 
# It would be nice to be able to force this to /etc/smail if
# PREFIX=/usr, but that cannot yet be done with NetBSD's pkg tools.
# (PLIST entries always have the value of $PREFIX added to them)
#
LIB_DIR=$PREFIX/etc/smail
# 
UTIL_BIN_DIR=$PREFIX/libexec/smail
# 
# force everything into $PREFIX/libexec/smail
# note that the pkgsrc Makefile will fix a couple things up for us...
#
SMAIL_BIN_DIR=$UTIL_BIN_DIR
# 
# Override the conf/os/bsd4.4 replacement of sendmail in /usr
# Note that the following two settings depend on having mailwrapper to
# replace sendmail.
#
NEWALIASES="$UTIL_BIN_DIR/newaliases"
OTHER_SMAIL_NAMES="$UTIL_BIN_DIR/sendmail"
# 
# set SMAIL_NAME empty to use $SMAIL_BIN_DIR/smail
#
SMAIL_NAME=''
# 
# Note that the pkg_* tools will not know about these /var places, but
# that's OK because they get created at run-time....
#
SPOOL_DIRS=/var/spool/smail
TMP_DIR=/var/spool/smail/tmp
LOG_DIR=/var/log/smail
UNSHAR_MAP_DIR=/var/spool/uumaps
NEWS_SPOOL_DIR=/var/spool/news
UUWHO_FILE=/var/spool/smail/uuwho
# 
# WARNING: some older versions of pkgsrc will need 'cd $PREFIX; ln -s . share'
# 
MAN1=$PREFIX/share/man/man1
MAN1_EXT=1
MAN5=$PREFIX/share/man/man5
MAN5_EXT=5
MAN8=$PREFIX/share/man/man8
MAN8_EXT=8
# 
# The pkg_* tools won't know about /etc/aliases either, but we're
# simply stealing it from sendmail anyway so there's no need to
# include it in the binary package.
# 
if [ -f /etc/mail/aliases ] ; then
	ALIASES_FILE=/etc/mail/aliases
else
	ALIASES_FILE=/etc/aliases
fi
# 
# ... note we are eliminating the use of db for alias files
#
ALIASES_TYPE=lsearch
# 
REWRITE_FILE=rewrite
REWRITE_TYPE=lsearch
#
# this assumes you use the HDB UUCP style config, which is
# the only one that will work with UUCP_SYSTEM_FILE anyway...
# (and if this file does not exist "uuname" is used instead)
#
UUCP_SYSTEM_FILE=/etc/uucp/Systems
