# $OpenBSD$

COMMENT=		"InterNetNews - a complete Usenet system"

DISTNAME=		inn-2.4.3
CATEGORIES=		news

HOMEPAGE=		http://www.isc.org/sw/inn/

MAINTAINER=		Marc Balmer <mbalmer@openbsd.org>

# GPL
PERMIT_PACKAGE_CDROM=	Yes
PERMIT_PACKAGE_FTP=	Yes
PERMIT_DISTFILES_CDROM=	Yes
PERMIT_DISTFILES_FTP=	Yes

WANTLIB=		c

MASTER_SITES=		ftp://ftp.isc.org/isc/inn/

CONFIGURE_STYLE=	gnu
CONFIGURE_ARGS+=	--with-etc-dir=${SYSCONFDIR}/news \
			--with-doc-dir=${LOCALBASE}/share/doc/inn \
			--with-control-dir=${LOCALBASE}/news/control \
			--with-db-dir=/var/news/db \
			--with-filter-dir=${LOCALBASE}/news/filter \
			--includedir=${LOCALBASE}/include/inn \
			--with-lib-dir=${LOCALBASE}/lib \
			--with-log-dir=/var/log \
			--with-run-dir=/var/run \
			--with-spool-dir=/var/spool/news \
			--with-tmp-dir=/var/news/tmp \
			--with-news-user=_inn \
			--with-news-group=_inn


FLAVORS=	no_bdb no_perl no_python no_ssl sasl kerberos no_gpg
FLAVOR?=

CONFIGURE_ENV=	

.if empty(FLAVOR:L:Mno_bdb)
BUILD_DEPENDS+=         ::databases/db/v4
CONFIGURE_ARGS+=	--with-berkeleydb
LIB_DEPENDS+=           lib/db4/db.=4:db-4.*:databases/db/v4
CONFIGURE_ENV+=		BERKELEY_DB_DIR=yes BERKELEY_DB_LDFLAGS=-L${LOCALBASE}/lib/db4
.endif

.if empty(FLAVOR:L:Mno_perl)
CONFIGURE_ARGS+=--with-perl
.endif

.if empty(FLAVOR:L:Mno_python)
CONFIGURE_ARGS+=--with-python
BUILD_DEPENDS+=         ::lang/python
.endif

.if empty(FLAVOR:L:Mno_ssl)
CONFIGURE_ARGS+=--with-openssl
.endif

.if !empty(FLAVOR:L:Msasl)
CONFIGURE_ARGS+=--with-sasl
BUILD_DEPENDS+=         ::security/cyrus-sasl2
.endif

.if !empty(FLAVOR:L:Mkerberos)
CONFIGURE_ARGS+=--with-kerberos
.endif

.if empty(FLAVOR:L:Mno_gpg)
# Using gpg for control messages is *STRONGLY* recommended, so
# pull it in if it is not already there.
BUILD_DEPENDS+=         ::security/gnupg
.endif



post-install:
	${INSTALL_DATA_DIR} ${PREFIX}/share/examples
	mv ${WRKINST}${SYSCONFDIR}/news ${PREFIX}/share/examples/inn
	mv ${WRKINST}/var/news ${PREFIX}/share/examples/inn

.include <bsd.port.mk>
