DISTVERSION=	${CLAWSVERSION}
PORTREVISION?=	0
CATEGORIES?=	mail
MASTER_SITES=	http://www.claws-mail.org/download.php?file=releases/

MAINTAINER=	portmaster@BSDforge.com

LICENSE=	GPLv3

USES+=		gmake iconv libtool pkgconfig tar:xz
.if !defined(NO_GTK)
USES+=		gnome
USE_GNOME+=	gtk30
.endif
GNU_CONFIGURE=	yes
CONFIGURE_ARGS+=	${ICONV_CONFIGURE_ARG} --disable-dbus --disable-static

.include "../claws-mail/Makefile.ver"
.include "../claws-mail/Makefile.claws.plugins"

.for p in ${CLAWS_PLUGINS}
.  if empty(CLAWS_PLUGINS_BUILD:M${p})
CONFIGURE_ARGS+=	--disable-${p}-plugin
.  endif
.endfor

.if defined(CLAWS_PLUGINS_BUILD)
DISTNAME=	claws-mail-${DISTVERSION}
PKGNAMEPREFIX=	claws-mail-

BUILD_DEPENDS+=	claws-mail>=${DISTVERSION}:mail/claws-mail
RUN_DEPENDS+=	claws-mail>=${DISTVERSION}:mail/claws-mail

DISTINFO_FILE=	${.CURDIR}/../claws-mail/distinfo

.  for p in ${CLAWS_PLUGINS_BUILD}
PLIST_FILES+=	lib/claws-mail/plugins/${p:S|spam_|spam|}.so
.  endfor

do-build:
.  for p in ${CLAWS_PLUGINS_BUILD}
	(cd ${WRKSRC}/src/plugins/${p} && ${DO_MAKE_BUILD})
.  endfor

do-install:
	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/claws-mail/plugins
.  for p in ${CLAWS_PLUGINS_BUILD}
	(cd ${WRKSRC}/src/plugins/${p} && \
		${INSTALL_LIB} .libs/${p:S|spam_|spam|}.so \
		${STAGEDIR}${PREFIX}/lib/claws-mail/plugins)
.  endfor

.endif
