#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"). You may
# only use this file in accordance with the terms of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2023-2026 Friedrich Kink
#

include ../../../make-rules/shared-macros.mk

COMPONENT_NAME=         pigeonhole
COMPONENT_VERSION=      2.4.3
COMPONENT_SUMMARY=      Sieve Support for Dovecot
COMPONENT_DESCRIPTION=	The Pigeonhole project provides Sieve support as a plugin for \
			Dovecot's Local Delivery Agent (LDA) and also for its LMTP \
			service. The plugin implements a Sieve interpreter, which filters \
			incoming messages using a script specified in the Sieve language \
			(RFC 5228). The Sieve script is provided by the user and, using \
			that Sieve script, the user can customize how incoming messages \
			are handled. Messages can be delivered to specific folders, \
			forwarded, rejected, discarded, etc.
COMPONENT_PROJECT_URL=  https://dovecot.org/
COMPONENT_FMRI=         mail/dovecot/pigeonhole
COMPONENT_CLASSIFICATION=Applications/Internet
COMPONENT_SRC=          dovecot-$(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_ARCHIVE=      $(COMPONENT_SRC).tar.gz
#COMPONENT_SIG_URL=	https://pigeonhole.dovecot.org/releases/2.4/$(COMPONENT_ARCHIVE).sig
COMPONENT_ARCHIVE_URL=  https://pigeonhole.dovecot.org/releases/2.4/$(COMPONENT_ARCHIVE)
COMPONENT_ARCHIVE_HASH= sha256:219c472a5fa3e6f7a6cb76ff5118bcbead73e14cd4157d3701425245756cb5f8
COMPONENT_LICENSE=      MIT,LGPLv2.1
COMPONENT_LICENSE_FILE= COPYING

include $(WS_MAKE_RULES)/common.mk

CONFIGURE_ENV+=		PANDOC=false
CONFIGURE_ENV+=		CPPFLAGS=-I/usr/include/openldap

PATH=$(PATH.gnu):/usr/mariadb/11.4/bin

CONFIGURE_OPTIONS+= --sysconfdir=/etc \
		    --libexecdir=/usr/lib \
                    --with-ldap=plugin \
		    --enable-static=no \
		    --with-dovecot=/usr/lib/$(MACH64)/dovecot \
		    --with-dovecot-install-dirs \
		    CFLAGS="-D__XOPEN_OR_POSIX -D__EXTENSIONS__" \
		    LDFLAGS="-Wl,-rpath=/usr/lib/$(MACH64)/dovecot -lldap_r"

COMPONENT_TEST_TRANSFORMS = \
	'-n ' \
        '-e "/: ok$$/p" ' \
        '-e "/tests failed$$/p" ' \
        '-e "/: FAILED$$/p" '

# manually added dependencies
REQUIRED_PACKAGES += developer/debug/valgrind

# Auto-generated dependencies
REQUIRED_PACKAGES += library/openldap
REQUIRED_PACKAGES += mail/dovecot
REQUIRED_PACKAGES += system/library
