# $OpenBSD: Makefile.template,v 1.54 2008/01/13 16:43:57 espie Exp $

COMMENT-main=		mail indexer (and not much of an email program)
COMMENT-emacs=		Emacs bindings for notmuch

V=			0.28.3
DISTNAME=		notmuch-${V}
PKGNAME-main=		notmuch-${V}
PKGNAME-emacs=		notmuch-emacs-${V}

SHARED_LIBS +=		notmuch 0.0 # 5.2

CATEGORIES=		mail databases

HOMEPAGE=		https://notmuchmail.org/
MASTER_SITES=		https://notmuchmail.org/releases/

# GPLv3+
PERMIT_PACKAGE_CDROM=	Yes

MULTI_PACKAGES=	-main -emacs

WANTLIB-main += ${COMPILER_LIBCXX} c gio-2.0 glib-2.0 gmime-2.6 gobject-2.0
WANTLIB-main += intl m talloc xapian z

BUILD_DEPENDS=	devel/doxygen \
		editors/emacs \
		textproc/py-sphinx

LIB_DEPENDS=	databases/xapian-core \
		devel/libtalloc \
		mail/gmime

RUN_DEPENDS-main=	devel/desktop-file-utils

RUN_DEPENDS-emacs=	devel/desktop-file-utils \
			editors/emacs \
			mail/notmuch

USE_GMAKE=		Yes
MAKE_FLAGS=		V=1
NO_TEST=		Yes
CONFIGURE_STYLE=	simple
CONFIGURE_ARGS=		--mandir=${PREFIX}/man \
			--infodir=${PREFIX}/info \
			--sysconfdir=${SYSCONFDIR} \
			--bashcompletiondir=${PREFIX}/share/notmuch/bash_completion.d


post-install:
	@find "${PREFIX}/man" -name '*.?.gz' -type f -print0 | xargs -0 gunzip
	@cd "${PREFIX}/man/man1" && rm notmuch-setup.1.gz
	@cd "${PREFIX}/man/man1" && ln -sf notmuch.1 notmuch-setup.1


.include <bsd.port.mk>
