freebsd-ports/mail/smx/Makefile
Dirk Meyer d20a9d8a85 - improve setup
Submitted by:	Volodymyr Kostyrko
2005-12-03 17:35:27 +00:00

185 lines
5.7 KiB
Makefile

# New ports collection makefile for: sms
# Date created: 04 Nov 2005
# Whom: dirk.meyer@dinoex.sub.org
#
# $FreeBSD$
#
PORTNAME= smx
PORTVERSION= 0.0.0.0
CATEGORIES= mail ipv6
MASTER_SITES= ftp://ftp.sendmail.org/pub/sendmail/ \
${MASTER_SITE_RINGSERVER:S,%SUBDIR%,net/mail/sendmail/&,}
PKGNAMESUFFIX?= ${TLS_SUFFIX}${SASL_SUFFIX}${LDAP_SUFFIX}${BERKELEYDB_SUFFIX}${PMILTER_SUFFIX}${PKGNAMESUFFIX2}
DISTNAME= ${PORTNAME2}-${PORTVERSION}
MAINTAINER= dinoex@FreeBSD.org
COMMENT= Secure and efficient mail gateway
NOT_FOR_ARCHS= ia64
PORTNAME2= smX
WRKSRC= ${WRKDIR}/${PORTNAME2}-${PORTVERSION}
USE_REINPLACE= yes
GNU_CONFIGURE= yes
CONFIGURE_TARGET=
CONFIGURE_ARGS+= --disable-dependency-tracking
MAKE_ENV+= SMXCONFDIR="${SMXCONFDIR}"
MAN5= sendmailx.conf.5
MAN8= createmap.8 mailq.8 mcp.8 milter-spamd.8 qmgr.8 \
qmgrctl.8 runas.8 sendmailx.8 smar.8 smtpc.8 smtps.8
MLINKS= sendmailx.conf.5 smx.conf.5 \
sendmailx.8 sendmailX.8
PORTDOCS= README.dvi README.html README.pdf README.ps README.txt \
img1.png img2.png img3.png img4.png img5.png img6.png \
nx_grp_g.png overview1.eps overview1.gif overview1.pdf \
prev_g.png up_g.png pmilter.api.tex
PLIST_SUB+= SPOOL=${DESTDIR}/var/spool
PLIST_SUB+= NOLOGIN=${NOLOGIN_CMD}
EXTRA_SBIN= libcheck/noroot libconf/tree libmta/statit \
libmta/t-hostname checks/t-getgroup
# Options to define Features:
# SMX_WITHOUT_TLS=yes
# SMX_WITHOUT_SASL=yes
# SMX_WITH_PMILTER=yes
# SMX_WITH_INTERNAL_BERKELEYD=yes
# SMX_WITH_BERKELEYDB_VER=41
# SMX_WITH_BERKELEYDB_VER=42
# SMX_WITH_BERKELEYDB_VER=43
# default config:
SMXCONFDIR?= ${PREFIX}/etc/smx
.if defined(SMX_WITH_INTERNAL_BERKELEYD)
BERKELEYDB_SUFFIX= -intbdb
PLIST_SUB+= WITH_BDBINT=""
.else
.if !defined(SMX_WITH_BERKELEYDB_VER)
SMX_WITH_BERKELEYDB_VER=43
.endif
.if ${SMX_WITH_BERKELEYDB_VER} == "41"
BERKELEYDB_PORT?= databases/db41
BERKELEYDB_LIB?= db41
BERKELEYDB_LIBDIR?= ${LOCALBASE}/lib
BERKELEYDB_INCLUDE?= ${LOCALBASE}/include/db41
.elif ${SMX_WITH_BERKELEYDB_VER} == "42"
BERKELEYDB_PORT?= databases/db42
BERKELEYDB_LIB?= db-4.2
BERKELEYDB_LIBDIR?= ${LOCALBASE}/lib/db42
BERKELEYDB_INCLUDE?= ${LOCALBASE}/include/db42
.elif ${SMX_WITH_BERKELEYDB_VER} == "43"
BERKELEYDB_PORT?= databases/db43
BERKELEYDB_LIB?= db-4.3
BERKELEYDB_LIBDIR?= ${LOCALBASE}/lib/db43
BERKELEYDB_INCLUDE?= ${LOCALBASE}/include/db43
.endif
LIB_DEPENDS+= ${BERKELEYDB_LIB}:${PORTSDIR}/${BERKELEYDB_PORT}
CONFIGURE_ARGS+= --disable-included-bdb
CONFIGURE_ARGS+= --with-bdb-incdir=${BERKELEYDB_INCLUDE}
CONFIGURE_ARGS+= --with-bdb-libdir=${BERKELEYDB_LIBDIR}
PLIST_SUB+= WITH_BDBINT="@comment "
.endif
.if defined(SMX_WITHOUT_SASL)
SASL_SUFFIX?= -nosasl
CONFIGURE_ARGS+= --disable-SASL
.else
LIB_DEPENDS+= sasl2.2:${PORTSDIR}/security/cyrus-sasl2
.if !defined(SMX_WITHOUT_SASLAUTHD)
RUN_DEPENDS+= ${LOCALBASE}/sbin/saslauthd:${PORTSDIR}/security/cyrus-sasl2-saslauthd
.endif
CONFIGURE_ARGS+= --enable-SASL
CONFIGURE_ARGS+= --with-sasl-incdir=${LOCALBASE}/include
CONFIGURE_ARGS+= --with-sasl-libdir=${LOCALBASE}/lib
.endif
.if defined(SMX_WITHOUT_TLS) || defined(WITHOUT_TLS)
TLS_SUFFIX?= -notls
CONFIGURE_ARGS+= --disable-TLS
.else
CONFIGURE_ARGS+= --enable-TLS
.endif
.if defined(SMX_WITH_PMILTER) || defined(WITH_PMILTER)
PMILTER_SUFFIX?= -pmilter
CONFIGURE_ARGS+= --enable-pmilter
USE_OPENSSL= yes
.else
CONFIGURE_ARGS+= --disable-pmilter
.endif
.if defined(BATCH)
EXTRA_PATCHES+= ${FILESDIR}/batch.patch
.endif
post-configure:
@${CP} ${WRKSRC}/misc/sm.check.sh ${WRKSRC}/misc/sm.setup.sh \
${WRKDIR}/
@${REINPLACE_CMD} -e 's|/etc/smx|${SMXCONFDIR}|g' \
-e 's|$${SD}/misc|${PREFIX}/bin|' \
-e 's|$${SD}/libcheck|${PREFIX}/sbin|' \
-e 's|$${SD}/libmta|${PREFIX}/sbin|' \
-e 's|$${SD}/checks|${PREFIX}/sbin|' \
${WRKDIR}/sm.check.sh
@${REINPLACE_CMD} -e 's|/etc/smx|${SMXCONFDIR}|g' \
-e 's|[.]/misc|${PREFIX}/bin|' \
-e 's|$${S}/libconf|${PREFIX}/sbin|' \
-e 's|[.]/libmta|${PREFIX}/sbin|' \
-e 's|[.]/checks|${PREFIX}/sbin|' \
-e 's|=mcp.sh|=${PREFIX}/etc/rc.d/smx-mcp.sh|' \
${WRKDIR}/sm.setup.sh
test:
(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} check)
pre-install:
if ! pw groupshow smxm; then pw groupadd smxs -g 260; fi
if ! pw groupshow smxq; then pw groupadd smxq -g 261; fi
if ! pw groupshow smxc; then pw groupadd smxc -g 262; fi
if ! pw groupshow smxm; then pw groupadd smxm -g 263; fi
if ! pw groupshow smx; then pw groupadd smx -g 264; fi
if ! pw usershow smxs; then pw useradd smxs -g smxs -u 260 \
-h - -d ${NONEXISTENT} -s ${NOLOGIN_CMD} -c "Sendmail X SMTPS"; fi
if ! pw usershow smxq; then pw useradd smxq -g smxq -u 261 \
-h - -d ${NONEXISTENT} -s ${NOLOGIN_CMD} -c "Sendmail X QMGR"; fi
if ! pw usershow smxc; then pw useradd smxc -g smxc -u 262 \
-h - -d ${NONEXISTENT} -s ${NOLOGIN_CMD} -c "Sendmail X SMTPC"; fi
if ! pw usershow smxm; then pw useradd smxm -g smxm -u 263 \
-h - -d ${NONEXISTENT} -s ${NOLOGIN_CMD} -c "Sendmail X misc"; fi
if ! pw usershow smx; then pw useradd smx -g smx -u 264 \
-h - -d ${NONEXISTENT} -s ${NOLOGIN_CMD} -c "Sendmail X other"; fi
pw groupmod smxc -m smxs
pw groupmod smxm -m smxs,smxq
.if !defined(BATCH)
cd ${WRKSRC} && ${SH} ./misc/sm.setup.sh
.endif
post-install:
${INSTALL_SCRIPT} ${WRKDIR}/sm.check.sh ${PREFIX}/sbin/
${INSTALL_SCRIPT} ${WRKDIR}/sm.setup.sh ${PREFIX}/sbin/
.for i in ${EXTRA_SBIN}
${INSTALL_PROGRAM} ${WRKSRC}/${i} ${PREFIX}/sbin/
.endfor
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
@cd ${WRKSRC}/doc && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}/
.endif
.include <bsd.port.pre.mk>
.if !defined(UID)
UID!= ${ID} -u
.endif
.if ${UID} != 0
post-build: test
.endif
.if ${OSVERSION} < 500000
NOLOGIN_CMD?= /sbin/nologin
.else
NOLOGIN_CMD?= /usr/sbin/nologin
.endif
.include <bsd.port.post.mk>