aboutsummaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2024-08-19 12:37:51 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2024-08-19 12:42:56 +0000
commit20cf6fa9f15bae0e2abad3f76f3f284d8aaaca23 (patch)
tree2f25f418efb98af4b8afb839a834c56898dc99af /mail
parenta02f5f0aef7920b52b7eab7bbd1a2a0056bc0edf (diff)
downloadports-20cf6fa9f15bae0e2abad3f76f3f284d8aaaca23.tar.gz
ports-20cf6fa9f15bae0e2abad3f76f3f284d8aaaca23.zip
mail/cyrus-imapd310: Add new port -- Cyrus IMAP 3.10
Diffstat (limited to 'mail')
-rw-r--r--mail/Makefile1
-rw-r--r--mail/cyrus-imapd310/Makefile273
-rw-r--r--mail/cyrus-imapd310/distinfo3
-rw-r--r--mail/cyrus-imapd310/files/cyrus-imapd-man.conf.in1
-rw-r--r--mail/cyrus-imapd310/files/imapd.conf372
-rw-r--r--mail/cyrus-imapd310/files/imapd.in32
-rw-r--r--mail/cyrus-imapd310/files/patch-Makefile.in11
-rw-r--r--mail/cyrus-imapd310/files/patch-configure22
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__http_client.h11
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__httpd.h11
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__jmap_calendar.c29
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__jmap_mail_submission.c11
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__jmap_mailbox.c11
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__notify.c48
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__relocate_by_id.c10
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__tls.c14
-rw-r--r--mail/cyrus-imapd310/files/patch-imap__xapian_wrap.cpp14
-rw-r--r--mail/cyrus-imapd310/files/patch-lib__cyr_qsort_r.c19
-rw-r--r--mail/cyrus-imapd310/files/patch-lib__imapoptions20
-rw-r--r--mail/cyrus-imapd310/files/patch-lib__libcyr_cfg.c13
-rw-r--r--mail/cyrus-imapd310/files/patch-notifyd__notifyd.c44
-rw-r--r--mail/cyrus-imapd310/files/patch-sieve__interp.c16
-rw-r--r--mail/cyrus-imapd310/files/patch-tools__mkimap36
-rw-r--r--mail/cyrus-imapd310/files/pkg-deinstall.in40
-rw-r--r--mail/cyrus-imapd310/files/pkg-install.in41
-rw-r--r--mail/cyrus-imapd310/files/pkg-message.in10
-rw-r--r--mail/cyrus-imapd310/pkg-descr19
-rw-r--r--mail/cyrus-imapd310/pkg-plist165
28 files changed, 1297 insertions, 0 deletions
diff --git a/mail/Makefile b/mail/Makefile
index d86307825e46..92f95a369463 100644
--- a/mail/Makefile
+++ b/mail/Makefile
@@ -79,6 +79,7 @@
SUBDIR += cvsmail
SUBDIR += cyrus-imapd25
SUBDIR += cyrus-imapd30
+ SUBDIR += cyrus-imapd310
SUBDIR += cyrus-imapd32
SUBDIR += cyrus-imapd34
SUBDIR += cyrus-imapd36
diff --git a/mail/cyrus-imapd310/Makefile b/mail/cyrus-imapd310/Makefile
new file mode 100644
index 000000000000..457824493a45
--- /dev/null
+++ b/mail/cyrus-imapd310/Makefile
@@ -0,0 +1,273 @@
+PORTNAME= cyrus-imapd
+DISTVERSION= 3.10.0
+PORTREVISION= 0
+CATEGORIES= mail
+MASTER_SITES= https://github.com/cyrusimap/cyrus-imapd/releases/download/${PORTNAME}-${DISTVERSION}/
+PKGNAMESUFFIX= ${CYRUS_IMAPD_VER}
+
+MAINTAINER= ume@FreeBSD.org
+COMMENT= Cyrus mail server, supporting POP3 and IMAP4 protocols ${COMMENT_${FLAVOR}}
+WWW= https://www.cyrusimap.org/
+COMMENT_http= (with HTTP)
+
+LICENSE= BSD4CLAUSE
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+BROKEN_riscv64= fails to build: lib/chartable.c: Error 1
+
+FLAVORS= basic http
+http_PKGNAMESUFFIX= ${CYRUS_IMAPD_VER}-http
+
+CYRUS_IMAPD_VER= 310
+
+LIB_DEPENDS= libsasl2.so:security/cyrus-sasl2 \
+ libicuuc.so:devel/icu \
+ libjansson.so:devel/jansson \
+ libuuid.so:misc/e2fsprogs-libuuid \
+ libical.so:devel/libical
+
+CONFLICTS_INSTALL= cyrus-imapd2? cyrus-imapd3[0-9] cyrus-imapd3[0-9]-http
+
+USES= compiler:c11 cpe gmake libtool perl5 pkgconfig ssl
+USE_RC_SUBR= imapd
+CYRUS_PREFIX= ${PREFIX}/cyrus
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS= --libexecdir=${CYRUS_PREFIX}/libexec \
+ --sbindir=${CYRUS_PREFIX}/sbin \
+ --sysconfdir=${PREFIX}/etc \
+ --with-cyrus-user=${CYRUS_USER} \
+ --with-sasl=${LOCALBASE} \
+ --with-com_err \
+ --with-openssl=${OPENSSLBASE} \
+ --with-perl=${PERL}
+CONFIGURE_ENV+= LIBS="-L${LOCALBASE}/lib"
+CPPFLAGS+= -I${LOCALBASE}/include
+MAKE_JOBS_UNSAFE= yes
+
+USES+= shebangfix
+SHEBANG_FILES= imap/cyr_cd.sh imap/promdatagen tools/config2header \
+ tools/masssievec tools/mkimap tools/translatesieve \
+ perl/sieve/scripts/*.pl
+
+CPE_VENDOR= cmu
+CPE_PRODUCT= cyrus_imap_server
+
+OPTIONS_DEFINE= AUTOCREATE BACKUP CLAMAV CLD2 HTTP IDLED JMAP LDAP \
+ MURDER MYSQL NNTP PCRE2 PGSQL REPLICATION SQLITE SQUAT \
+ SRS XAPIAN DOCS
+OPTIONS_DEFAULT= AUTOCREATE IDLED PCRE2 READLINE_GNU REPLICATION SQLITE \
+ SQUAT SRS
+.if ${FLAVOR:U} == http
+OPTIONS_DEFAULT+= HTTP
+.endif
+OPTIONS_SUB= yes
+AUTOCREATE_DESC= Enable autocreate support
+AUTOCREATE_CONFIGURE_ENABLE= autocreate
+BACKUP_DESC= Enable backup support (experimental)
+BACKUP_CONFIGURE_ENABLE=backup
+CLAMAV_DESC= Use ClamAV
+CLAMAV_CONFIGURE_WITH= clamav
+CLAMAV_LIB_DEPENDS= libclamav.so:security/clamav
+CLD2_DESC= Use CLD2
+CLD2_CONFIGURE_WITH= cld2
+CLD2_CONFIGURE_ENV= CLD2_CFLAGS="-I${LOCALBASE}/include" \
+ CLD2_LIBS="-L${LOCALBASE}/lib -lcld2"
+CLD2_LIB_DEPENDS= libcld2.so:devel/cld2
+HTTP_DESC= Enable HTTP support
+HTTP_IMPLIES= SQLITE
+HTTP_CONFIGURE_ENABLE= http
+HTTP_LIB_DEPENDS= libnghttp2.so:www/libnghttp2 \
+ libshp.so:devel/shapelib \
+ libbrotlidec.so:archivers/brotli \
+ libwslay_shared.so:www/wslay \
+ libzstd.so:archivers/zstd
+HTTP_BUILD_DEPENDS= xxd:sysutils/xxd
+HTTP_RUN_DEPENDS= ${HTTP_BUILD_DEPENDS}
+HTTP_CONFIGURE_ENV= WSLAY_CFLAGS="-I${LOCALBASE}/include" \
+ WSLAY_LIBS="-L${LOCALBASE}/lib -lwslay_shared"
+# Need additional patch to opendkim
+#HTTP_LIB_DEPENDS+= libopendkim.so:mail/opendkim
+#HTTP_CPPFLAGS+= -I${LOCALBASE}/include/opendkim
+HTTP_USES= gnome
+HTTP_USE= GNOME=libxml2
+# XXX: HTTP requires JMAP
+HTTP_IMPLIES= JMAP
+IDLED_DESC= Enable IMAP idled support
+IDLED_CONFIGURE_ENABLE= idled
+JMAP_DESC= Enable JMAP support
+JMAP_CONFIGURE_ENABLE= jmap
+JMAP_IMPLIES= HTTP XAPIAN
+LDAP_DESC= Enable LDAP support (experimental)
+LDAP_USES= ldap
+LDAP_CONFIGURE_ON= --with-ldap=${LOCALBASE}
+LDAP_CONFIGURE_OFF= --without-ldap
+MURDER_DESC= Enable IMAP Murder support
+MURDER_CONFIGURE_ENABLE=murder
+MURDER_MAKE_ENV= PTHREAD_LIBS="-lpthread"
+MYSQL_USES= mysql
+MYSQL_CONFIGURE_WITH= mysql
+NNTP_DESC= Enable NNTP support
+NNTP_CONFIGURE_ENABLE= nntp
+PCRE2_DESC= Use PCRE2 rather than PCRE
+PCRE2_LIB_DEPENDS= libpcre2-posix.so:devel/pcre2
+PCRE2_LIB_DEPENDS_OFF= libpcre.so:devel/pcre
+PCRE2_CONFIGURE_ON= --disable-pcre
+PCRE2_CONFIGURE_OFF= --disable-pcre2
+PGSQL_USES= pgsql
+PGSQL_CONFIGURE_ON= --with-pgsql=${LOCALBASE}
+PGSQL_CONFIGURE_OFF= --without-pgsql
+REPLICATION_DESC= Enable replication
+REPLICATION_CONFIGURE_ENABLE=replication
+SRS_DESC= Enable Sender Rewriting Scheme support
+SRS_CONFIGURE_ENABLE= srs
+SRS_LIB_DEPENDS= libsrs2.so:mail/libsrs2
+SQLITE_USES= sqlite
+SQLITE_CONFIGURE_ON= --with-sqlite=${LOCALBASE}
+SQLITE_CONFIGURE_OFF= --without-sqlite
+SQLITE_BROKEN_OFF= SQLITE is required
+SQUAT_DESC= Enable Squat support
+SQUAT_CONFIGURE_OFF= --disable-squat
+XAPIAN_DESC= Enable Xapian support
+XAPIAN_CONFIGURE_ENABLE=xapian
+XAPIAN_LIB_DEPENDS= libxapian.so:databases/xapian-core
+XAPIAN_BUILD_DEPENDS= rsync:net/rsync
+XAPIAN_RUN_DEPENDS= ${XAPIAN_BUILD_DEPENDS}
+
+OPTIONS_RADIO= GSSAPI READLINE
+OPTIONS_RADIO_GSSAPI= GSSAPI_HEIMDAL GSSAPI_MIT
+.if exists(/usr/lib/libkrb5.a)
+OPTIONS_RADIO_GSSAPI+= GSSAPI_BASE
+OPTIONS_DEFAULT+= GSSAPI_BASE
+.endif
+GSSAPI_BASE_USES= gssapi
+GSSAPI_BASE_CONFIGURE_ON= --enable-gssapi="${GSSAPIBASEDIR}" \
+ --with-gss_impl=heimdal
+GSSAPI_HEIMDAL_USES= gssapi:heimdal,flags
+GSSAPI_HEIMDAL_CONFIGURE_ON= --enable-gssapi="${GSSAPIBASEDIR}" \
+ --with-gss_impl=heimdal
+GSSAPI_MIT_USES= gssapi:mit
+GSSAPI_MIT_CONFIGURE_ON= --enable-gssapi="${GSSAPIBASEDIR}" \
+ --with-gss_impl=mit
+
+OPTIONS_RADIO_READLINE= READLINE_GNU READLINE_PERL
+READLINE_GNU_DESC= Use Term::Readline::GNU for cyradm
+READLINE_GNU_RUN_DEPENDS= p5-Term-ReadLine-Gnu>=0:devel/p5-Term-ReadLine-Gnu
+READLINE_PERL_DESC= Use Term::Readline::Perl for cyradm
+READLINE_PERL_RUN_DEPENDS= p5-Term-ReadLine-Perl>=0:devel/p5-Term-ReadLine-Perl
+
+MANDIRS= ${CYRUS_PREFIX}/man
+
+PORTDOCS= *
+
+SUB_FILES= pkg-message pkg-install pkg-deinstall cyrus-imapd-man.conf
+
+SUB_LIST= CYRUS_USER=${CYRUS_USER} CYRUS_GROUP=${CYRUS_GROUP}
+
+CYRUS_USER?= cyrus
+CYRUS_GROUP?= cyrus
+
+MAN_MAN1= httptest imtest installsieve lmtptest mupdatetest nntptest \
+ pop3test sieveshell sivtest smtptest synctest
+MAN_MAN3= imclient
+MAN_MAN5= cyrus.conf imapd.conf krb.equiv
+
+CYRUS_MAN8= arbitron backupd chk_cyrus ctl_backups ctl_conversationsdb \
+ ctl_cyrusdb ctl_deliver ctl_mboxlist cvt_cyrusdb \
+ cvt_xlist_specialuse cyr_backup cyr_buildinfo cyr_dbtool \
+ cyr_deny cyr_df cyr_expire cyr_info cyr_ls cyr_synclog \
+ cyr_userseen cyr_virusscan cyradm cyrdump deliver fud idled \
+ imapd ipurge lmtpd lmtpproxyd master mbexamine mbpath mbtool \
+ notifyd pop3d pop3proxyd promstatsd proxyd ptdump ptexpire \
+ ptloader quota reconstruct relocate_by_id restore sievec \
+ sieved smmapd timsieved tls_prune unexpunge
+CYRUS_PERL_MAN1=cyradm
+CYRUS_PERL_MAN3=Cyrus::Annotator::Daemon Cyrus::Annotator::Message \
+ Cyrus::IMAP Cyrus::IMAP::Admin Cyrus::IMAP::Shell \
+ Cyrus::SIEVE::managesieve
+
+INSTALL_TARGET= install-strip
+
+REINPLACE_ARGS= -i ''
+
+.include <bsd.port.options.mk>
+
+.if !${PORT_OPTIONS:MGSSAPI_BASE} && !${PORT_OPTIONS:MGSSAPI_HEIMDAL} && \
+ !${PORT_OPTIONS:MGSSAPI_MIT}
+CONFIGURE_ARGS+=--disable-gssapi
+.endif
+
+.if ${PORT_OPTIONS:MHTTP}
+CYRUS_MAN8+= ctl_zoneinfo httpd
+MAN_MAN1+= dav_reconstruct
+.endif
+.if ${PORT_OPTIONS:MNNTP}
+CYRUS_MAN8+= fetchnews nntpd
+.endif
+.if ${PORT_OPTIONS:MMURDER}
+CYRUS_MAN8+= mupdate
+.endif
+.if ${PORT_OPTIONS:MREPLICATION}
+CYRUS_MAN8+= sync_client sync_reset sync_server
+.endif
+.if ${PORT_OPTIONS:MSQUAT} || ${PORT_OPTIONS:MXAPIAN}
+CYRUS_MAN8+= squatter
+PLIST_SUB+= SQUATTER=""
+.else
+PLIST_SUB+= SQUATTER="@comment "
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e "s|/etc/|${PREFIX}/etc/|" \
+ -e "s|%%CYRUS_USER%%|${CYRUS_USER}|g" \
+ -e "s|%%CYRUS_GROUP%%|${CYRUS_GROUP}|g" \
+ ${WRKSRC}/tools/mkimap
+.for f in masssievec translatesieve
+ @${REINPLACE_CMD} -e "s|/etc/|${PREFIX}/etc/|g" \
+ -e "s|/usr/sieve|/var/imap/sieve|g" \
+ ${WRKSRC}/tools/${f}
+.endfor
+ @${REINPLACE_CMD} \
+ -e 's|$$(libdir)/\(pkgconfig\)|${PREFIX}/libdata/\1|g' \
+ -e 's|$$(mandir)/\(man[8]\)|${PREFIX}/cyrus/man/\1|g' \
+ ${WRKSRC}/Makefile.in
+
+post-install:
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}/auto/Cyrus/IMAP/IMAP.so
+ ${STRIP_CMD} ${STAGEDIR}${PREFIX}/${SITE_ARCH_REL}/auto/Cyrus/SIEVE/managesieve/managesieve.so
+ ${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+ ${INSTALL_DATA} ${FILESDIR}/imapd.conf \
+ ${STAGEDIR}${EXAMPLESDIR}
+ ${SED} -e 's,/run/cyrus/socket,/var/imap/socket,' \
+ ${WRKSRC}/doc/examples/cyrus_conf/normal.conf \
+ > ${STAGEDIR}${EXAMPLESDIR}/cyrus.conf
+.if !${PORT_OPTIONS:MHTTP}
+ ${REINPLACE_CMD} -e 's/^\( http\)/#\1/' \
+ ${STAGEDIR}${EXAMPLESDIR}/cyrus.conf
+.endif
+.for f in mkimap masssievec translatesieve
+ ${INSTALL_SCRIPT} ${WRKSRC}/tools/${f} \
+ ${STAGEDIR}${CYRUS_PREFIX}/sbin/${f}
+.endfor
+ ${INSTALL_DATA} ${WRKDIR}/cyrus-imapd-man.conf \
+ ${STAGEDIR}${PREFIX}/etc/man.d/cyrus-imapd.conf
+.for s in 1 3 5
+. for m in ${MAN_MAN${s}}
+ @${ECHO_CMD} share/man/man${s}/${m}.${s}.gz >> ${TMPPLIST}
+. endfor
+.endfor
+.for s in 1 3
+. for m in ${CYRUS_PERL_MAN${s}}
+ @${ECHO_CMD} ${SITE_MAN${s}}/${m}.${s}.gz >> ${TMPPLIST}
+. endfor
+.endfor
+.for m in ${CYRUS_MAN8}
+ @${ECHO_CMD} ${CYRUS_PREFIX}/man/man8/${m}.8.gz >> ${TMPPLIST}
+.endfor
+
+post-install-DOCS-on:
+ ${MKDIR} ${STAGEDIR}${DOCSDIR}
+ cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} \
+ "! ( -path */html/_sources* -o -name .buildinfo )"
+ ${RM} -r ${STAGEDIR}${DOCSDIR}/rst ${STAGEDIR}${DOCSDIR}/source
+
+.include <bsd.port.mk>
diff --git a/mail/cyrus-imapd310/distinfo b/mail/cyrus-imapd310/distinfo
new file mode 100644
index 000000000000..3fe40a3bfae5
--- /dev/null
+++ b/mail/cyrus-imapd310/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1724066645
+SHA256 (cyrus-imapd-3.10.0.tar.gz) = bef0fefa776862629c17cdde268c9b8d17ae1ae6fd087a4c5e52524c66c33a23
+SIZE (cyrus-imapd-3.10.0.tar.gz) = 14953680
diff --git a/mail/cyrus-imapd310/files/cyrus-imapd-man.conf.in b/mail/cyrus-imapd310/files/cyrus-imapd-man.conf.in
new file mode 100644
index 000000000000..b7ba70fcce77
--- /dev/null
+++ b/mail/cyrus-imapd310/files/cyrus-imapd-man.conf.in
@@ -0,0 +1 @@
+MANPATH %%PREFIX%%/cyrus/man
diff --git a/mail/cyrus-imapd310/files/imapd.conf b/mail/cyrus-imapd310/files/imapd.conf
new file mode 100644
index 000000000000..2ba85ce1d63e
--- /dev/null
+++ b/mail/cyrus-imapd310/files/imapd.conf
@@ -0,0 +1,372 @@
+# Sample configurations file for Cyrus IMAPd
+# Most lines in this file are commented; in this case the default is used.
+# The commented lines (usually) contain the default value
+
+# The pathname of the IMAP configuration directory
+#
+configdirectory: /var/imap
+
+# The partition name used by default for new mailboxes
+#
+#defaultpartition: default
+
+# The directory for the different partitions
+#
+partition-default: /var/spool/imap
+
+# Use the UNIX separator character '/' for delimiting levels of
+# mailbox hierarchy. The default is to use the netnews separator
+# character '.'.
+#unixhierarchysep: yes
+
+# Use the alternate IMAP namespace, where personal folders reside at
+# the same level in the hierarchy as INBOX.
+#
+#altnamespace: yes
+
+# If using the alternate IMAP namespace, the prefix for the other
+# users namespace. The hierarchy delimiter will be automatically
+# appended.
+#
+#userprefix: Other Users
+
+# If using the alternate IMAP namespace, the prefix for the shared
+# namespace. The hierarchy delimiter will be automatically appended.
+#
+#sharedprefix: Shared Folders
+
+# The umask value used by various Cyrus IMAP programs
+#
+#umask: 077
+
+# This is the hostname visible in the greeting messages of the POP,
+# IMAP and LMTP daemons. If it is unset, then the result returned from
+# gethostname(2) is used.
+#
+#servername: <result returned by gethostname(2)>
+
+# Whether to allow anonymous logins
+#
+#allowanonymouslogin: no
+
+# Allow the use of cleartext passwords on the wire.
+#
+#allowplaintext: yes
+
+# The percent of quota utilization over which the server generates
+# warnings.
+#
+#quotawarn: 90
+
+# The length of the IMAP server's inactivity autologout timer, in minutes.
+# The minimum value is 30, the default.
+#
+#timeout: 30
+
+# The interval (in seconds) for polling the mailbox for changes while
+# running the IDLE command. This option is used when idled can not be
+# contacted or when polling is used exclusively. The minimum value is
+# 1. A value of 0 will disable polling (and disable IDLE if polling
+# is the only method available).
+#
+#imapidlepoll: 60
+
+# If enabled, the server responds to an ID command with a parameter
+# list containing: version, vendor, support-url, os, os-version,
+# command, arguments, environment. Otherwise the server returns NIL.
+#
+#imapidresponse: yes
+
+# Set the length of the POP server's inactivity autologout timer, in
+# minutes. The minimum value is 10, the default.
+#
+#poptimeout: 10
+
+# Set the minimum amount of time the server forces users to wait between
+# successive POP logins, in minutes. The default is 0.
+#
+#popminpoll: 0
+
+# The number of days advertised as being the minimum a message may be
+# left on the POP server before it is deleted (via the CAPA command,
+# defined in the POP3 Extension Mechanism, which some clients may
+# support). "NEVER", the default, may be specified with a negative
+# number. The Cyrus POP3 server never deletes mail, no matter what
+# the value of this parameter is. However, if a site implements a
+# less liberal policy, it needs to change this parameter accordingly.
+#
+#popexpiretime: 0
+
+# The list of userids with administrative rights. Separate each userid
+# with a space. We recommend that administrator userids be separate from
+# standard userids. Sites using Kerberos authentication may use separate
+# "admin" instances.
+#
+#admins: <none>
+
+# A list of users and groups that are allowed to proxy for other
+# users, seperated by spaces. Any user listed in this will be allowed
+# to login for any other user: use with caution.
+#
+#proxyservers: <none>
+
+# The Access Control List (ACL) placed on a newly-created (non-user)
+# mailbox that does not have a parent mailbox.
+#
+#defaultacl: anyone lrs
+
+# The pathname of the news spool directory. Only used if the partition-news
+# configuration option is set.
+#
+#newsspool: <no default>
+
+# Prefix to be prepended to newsgroup names to make the corresponding IMAP
+# mailbox names.
+#
+#newsprefix: <none>
+
+# If set to a value of zero or higher, users have their INBOX folders
+# created upon a successful login event or upon lmtpd(8) message
+# delivery if autocreate_post is enabled, provided their INBOX did
+# not yet already exist.
+#
+# The user's quota is set to the value if it is greater than zero,
+# otherwise the user has unlimited quota.
+#
+# Note that quota is specified in kilobytes.
+#
+#autocreate_quota: -1
+
+# Include notations in the protocol telemetry logs indicating the number
+# of seconds since the last command or response.
+#
+#logtimestamps: no
+
+# Number of seconds to pause after a successful plaintext login. For systems
+# that support strong authentication, this permits users to perceive a cost
+# of using plaintext passwords.
+#
+#plaintextloginpause: 0
+
+# The pathname of srvtab file containing the server's private key.
+# This option is passed to the SASL library and overrides its default
+# setting.
+#
+#srvtab: /etc/srvtab
+
+# The list of remote realms whose users may log in using cross-realm
+# authentications. Seperate each realm name by a space. This option is
+# only used when the server is compiled with Kerberos authentication.
+#
+#loginrealms: <none>
+
+# If enabled, any authentication identity which has a rights on a user's
+# INBOX may log in as that user. This option is only used when the server
+# is compiled with Kerberos authentication.
+#
+#loginuseacl: no
+
+# If enabled, lmtpd attempts to only write one copy of a message per
+# partition and create hard links, resulting in a potentially large
+# disk savings.
+#
+#singleinstancestore: yes
+
+# If enabled, lmtpd will suppress delivery of a message to a mailbox
+# if a message with the same message-id (or resent-message-id) is
+# recorded as having already been delivered to the mailbox. Records
+# the mailbox and message-id/resent-message-id of all successful
+# deliveries.
+#
+#duplicatesuppression: yes
+
+# If enabled, lmtpd rejects messages with 8-bit characters in the
+# headers. Otherwise, 8-bit characters are changed to `X'. (A proper
+# soultion to non-ASCII characters in headers is offered by RFC 2047
+# and its predecessors.)
+#
+#reject8bit: no
+
+# Maximum incoming LMTP message size. If set, lmtpd will reject
+# messages larger than maxmessagesize bytes. The default is to allow
+# messages of any size.
+#
+#maxmessagesize: <unlimited>
+
+# Userid used to deliver messages to shared folders. For example, if
+# set to "bb", email sent to "bb+shared.blah" would be delivered to
+# the "shared.blah" folder. By default, an email address of
+# "+shared.blah" would be used.
+#postuser: <none>
+
+# If enabled at compile time, this specifies a URL to reply when
+# Netscape asks the server where the mail administration HTTP server
+# is. The default is a site at CMU with a hopefully informative
+# message; administrators should set this to a local resource with
+# some information of greater use.
+#
+#netscapeurl: http://andrew2.andrew.cmu.edu/cyrus/imapd/netscapeadmin.html
+
+# Notifyd(8) method to use for "MAIL" notifications. If not set,
+# "MAIL" notifications are disabled.
+#
+#mailnotifier: <no default>
+
+# Notifyd(8) method to use for "SIEVE" notifications. If not set,
+# "SIEVE" notifications are disabled.
+#
+# This method is only used when no method is specified in the script.
+#
+#sievenotifier: <no default>
+
+# If enabled, lmtpd will look for Sieve scripts in user's home
+# directories: ~user/.sieve.
+#
+sieveusehomedir: false
+
+# If sieveusehomedir is false, this directory is searched for Sieve scripts.
+# The active Sieve script is s called "default", placed in the users sieve
+# sieve directory (ie. /var/imap/sieve/u/user).
+#
+sievedir: /var/imap/sieve
+
+# The pathname of the sendmail executable. Sieve uses sendmail for
+# sending rejections, redirects and vaca- tion responses.
+#
+#sendmail: /usr/sbin/sendmail
+
+# Username that is used as the 'From' address in rejection MDNs
+# produced by sieve.
+#
+#postmaster: postmaster
+
+# If enabled, the partitions will also be hashed, in addition to the hashing
+# done on configuration directories. This is recommended if one partition has
+# a very bushy mailbox tree.
+#
+#hashimapspool: false
+
+# Maximum size (in kilobytes) any sieve script can be, enforced at
+# submission by timsieved(8).
+#
+#sieve_maxscriptsize: 32
+
+# Maximum number of sieve scripts any user may have, enforced at
+# submission by timsieved(8).
+#
+#sieve_maxscripts: 5
+
+# The cyrusdb backend to use for mailbox annotations.
+# Allowed values: skiplist, twoskip
+#
+#annotation_db: twoskip
+
+# The cyrusdb backend to use for the duplicate delivery suppression
+# and sieve.
+# Allowed values: skiplist, sql, twoskip
+#
+#duplicate_db: twoskip
+
+# The cyrusdb backend to use for the mailbox list.
+# Allowed values: skiplist, twoskip
+#
+#mboxlist_db: twoskip
+
+# The cyrusdb backend to use for the pts cache.
+# Allowed values: skiplist, twoskip
+#
+#ptscache_db: twoskip
+
+# The cyrusdb backend to use for the seen state.
+# Allowed values: flat, skiplist, twoskip
+#
+#seenstate_db: twoskip
+
+# The cyrusdb backend to use for the imap status cache.
+# Allowed values: skiplist, sql, twoskip
+#
+#statuscache_db: twoskip
+
+# The cyrusdb backend to use for the subscriptions list.
+# Allowed values: flat, skiplist, twoskip
+#
+#subscription_db: flat
+
+# Maximum SSF (security strength factor) that the server will allow a
+# client to negotiate.
+#
+#sasl_maximum_layer: 256
+
+# The minimum SSF that the server will allow a client to negotiate. A
+# value of 1 requires integrity protection; any higher value requires
+# some amount of encryption.
+#
+#sasl_minimum_layer: 0
+
+# The mechanism used by the server to verify plaintext passwords. Possible
+# values include "auxprop" or "saslauthd"
+#
+sasl_pwcheck_method: auxprop
+
+# If enabled, the SASL library will automatically create authentication
+# secrets when given a plaintext password. See the SASL documentation.
+#
+#sasl_auto_transition: no
+
+# Whitespace separated list of mechanisms to allow (e.g. 'plain otp').
+# Used to restrict the mechanisms to a subset of the installed
+# plugins. The default is all available.
+#
+#sasl_mech_list: cram-md5 digest-md5
+
+# Location of the opiekeys file
+#
+#sasl_opiekeys: /etc/opiekeys
+
+# File containing the global certificate used for ALL services (imap,
+# pop3, lmtp).
+#
+#tls_server_cert: <none>
+
+# File containing the private key belonging to the global server
+# certificate.
+#
+#tls_server_key: <none>
+
+# File containing one or more Certificate Authority (CA) certificates.
+#
+#tls_client_ca_file: <none>
+
+# Path to directory with certificates of CAs.
+#
+#tls_client_ca_dir: <none>
+
+# The cyrusdb backend to use for the TLS cache.
+# Allowed values: skiplist, sql, twoskip
+#
+#tls_sessions_db: twoskip
+
+# The length of time (in minutes) that a TLS session will be cached
+# for later reuse. The maximum value is 1440 (24 hours), the default.
+# A value of 0 will disable session caching.
+#
+#tls_session_timeout: 1440
+
+# The right that a user needs to delete a mailbox.
+#
+#deleteright: c
+
+# Unix domain socket that lmtpd listens on, used by deliver(8).
+#
+#lmtpsocket: /var/imap/socket/lmtp
+
+# Unix domain socket that idled listens on.
+#
+#idlesocket: /var/imap/socket/idle
+
+# Unix domain socket that the new mail notification daemon listens on.
+#
+#notifysocket: /var/imap/socket/notify
+
+#
+# EOF
diff --git a/mail/cyrus-imapd310/files/imapd.in b/mail/cyrus-imapd310/files/imapd.in
new file mode 100644
index 000000000000..1fda8d76f980
--- /dev/null
+++ b/mail/cyrus-imapd310/files/imapd.in
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Start or stop cyrus-imapd
+
+# PROVIDE: cyrus_imapd imap
+# REQUIRE: DAEMON
+# BEFORE: mail
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable Cyrus IMAP:
+#
+# cyrus_imapd_enable="YES"
+
+. /etc/rc.subr
+
+: ${cyrus_imapd_enable="NO"}
+
+name="cyrus_imapd"
+rcvar=cyrus_imapd_enable
+pidfile="/var/run/cyrus-master.pid"
+command="%%PREFIX%%/cyrus/libexec/master"
+command_args="-d -p ${pidfile}"
+required_files="%%PREFIX%%/etc/cyrus.conf %%PREFIX%%/etc/imapd.conf"
+stop_postcmd="cyrus_imapd_poststop"
+extra_commands="reload"
+
+cyrus_imapd_poststop() {
+ /bin/rm -f ${pidfile}
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/mail/cyrus-imapd310/files/patch-Makefile.in b/mail/cyrus-imapd310/files/patch-Makefile.in
new file mode 100644
index 000000000000..2308f736fdf6
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-Makefile.in
@@ -0,0 +1,11 @@
+--- Makefile.in.orig 2020-06-22 03:08:46 UTC
++++ Makefile.in
+@@ -2348,7 +2348,7 @@ com_err_et_libcyrus_com_err_la_CFLAGS = $(AM_CFLAGS) $
+ # MD5 algorithms, without needing SSL. Currently we have no way of
+ # minimally linking such code.
+ LD_BASIC_ADD = lib/libcyrus.la lib/libcyrus_min.la ${LIBS} \
+- ${LIB_SASL} $(SSL_LIBS) $(GCOV_LIBS)
++ ${LIB_SASL} $(SSL_LIBS) $(GCOV_LIBS) -lm
+
+
+ # UTILITY is the libraries that utility programs which use Cyrus'
diff --git a/mail/cyrus-imapd310/files/patch-configure b/mail/cyrus-imapd310/files/patch-configure
new file mode 100644
index 000000000000..4d3deee12dcf
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-configure
@@ -0,0 +1,22 @@
+Index: configure
+diff -u configure.orig configure
+--- configure.orig 2010-10-18 21:36:00.000000000 +0900
++++ configure 2010-10-18 23:50:45.966557478 +0900
+@@ -9501,7 +9501,7 @@
+ $as_echo_n "(cached) " >&6
+ else
+ ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lgssapi ${GSSAPIBASE_LIBS} -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET} $LIBS"
++LIBS="-lgssapi ${GSSAPIBASE_LIBS} -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err ${LIB_SOCKET} -lhx509 $LIBS"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+@@ -9803,7 +9803,7 @@
+ GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_LIBS $gssapi_dir/libgssapi_krb5.a $gssapi_dir/libkrb5.a $gssapi_dir/libk5crypto.a $gssapi_dir/libcom_err.a ${K5SUPSTATIC}"
+ elif test "$gss_impl" = "heimdal"; then
+ CPPFLAGS="$CPPFLAGS -DKRB5_HEIMDAL"
+- GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err"
++ GSSAPIBASE_LIBS="$GSSAPIBASE_LIBS -lgssapi -lkrb5 -lasn1 -lroken ${LIB_CRYPT} ${LIB_DES} -lcom_err -lhx509"
+ GSSAPIBASE_STATIC_LIBS="$GSSAPIBASE_STATIC_LIBS $gssapi_dir/libgssapi.a $gssapi_dir/libkrb5.a $gssapi_dir/libasn1.a $gssapi_dir/libroken.a $gssapi_dir/libcom_err.a ${LIB_CRYPT}"
+ elif test "$gss_impl" = "cybersafe03"; then
+ # Version of CyberSafe with two libraries
diff --git a/mail/cyrus-imapd310/files/patch-imap__http_client.h b/mail/cyrus-imapd310/files/patch-imap__http_client.h
new file mode 100644
index 000000000000..113854e9913d
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__http_client.h
@@ -0,0 +1,11 @@
+--- imap/http_client.h.orig 2016-04-11 02:02:11 UTC
++++ imap/http_client.h
+@@ -57,7 +57,7 @@ struct body_t {
+ unsigned char framing; /* Message framing */
+ unsigned char te; /* Transfer-Encoding */
+ unsigned max; /* Max allowed len */
+- ulong len; /* Content-Length */
++ unsigned long len; /* Content-Length */
+ struct buf payload; /* Payload */
+ };
+
diff --git a/mail/cyrus-imapd310/files/patch-imap__httpd.h b/mail/cyrus-imapd310/files/patch-imap__httpd.h
new file mode 100644
index 000000000000..f50f66fc0cdb
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__httpd.h
@@ -0,0 +1,11 @@
+--- imap/httpd.h.orig 2016-04-11 02:02:11 UTC
++++ imap/httpd.h
+@@ -264,7 +264,7 @@ struct patch_doc_t {
+
+ /* Meta-data for response body (payload & representation headers) */
+ struct resp_body_t {
+- ulong len; /* Content-Length */
++ unsigned long len; /* Content-Length */
+ struct range *range; /* Content-Range */
+ const char *fname; /* Content-Dispo */
+ unsigned char enc; /* Content-Encoding */
diff --git a/mail/cyrus-imapd310/files/patch-imap__jmap_calendar.c b/mail/cyrus-imapd310/files/patch-imap__jmap_calendar.c
new file mode 100644
index 000000000000..d5eb4d5e34dc
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__jmap_calendar.c
@@ -0,0 +1,29 @@
+--- imap/jmap_calendar.c.orig 2024-03-18 02:20:35 UTC
++++ imap/jmap_calendar.c
+@@ -6962,7 +6962,7 @@ static int eventquery_textsearch_run(jmap_req_t *req,
+ if (!expandrecur) {
+ struct eventquery_cmp_rock rock = { sort, nsort };
+ cyr_qsort_r(matches->data, matches->count, sizeof(void*),
+- (int(*)(const void*, const void*, void*))eventquery_cmp, &rock);
++ (int(*)QSORT_R_COMPAR_ARGS(const void*, const void*, void*))eventquery_cmp, &rock);
+ }
+
+ r = 0;
+@@ -9591,7 +9591,7 @@ static void principal_getavailability(jmap_req_t *req,
+ * different “busyStatus” properties the server MUST choose the value in
+ * the following order: confirmed > unavailable > tentative. */
+ cyr_qsort_r(busyperiods->data, busyperiods->count, sizeof(struct busyperiod),
+- (int(*)(const void*, const void*, void*))busyperiod_cmp, NULL);
++ (int(*)QSORT_R_COMPAR_ARGS(const void*, const void*, void*))busyperiod_cmp, NULL);
+ int count = dynarray_size(busyperiods) ? 1 : 0;
+ int i;
+ for (i = 1; i < dynarray_size(busyperiods); i++) {
+@@ -9907,7 +9907,7 @@ static void notifsearch_run(const char *userid,
+ if (search->sort) {
+ cyr_qsort_r(entries->data, entries->count,
+ sizeof(struct notifsearch_entry),
+- (int(*)(const void*, const void*, void*))search->sort,
++ (int(*)QSORT_R_COMPAR_ARGS(const void*, const void*, void*))search->sort,
+ search->sortrock);
+ }
+
diff --git a/mail/cyrus-imapd310/files/patch-imap__jmap_mail_submission.c b/mail/cyrus-imapd310/files/patch-imap__jmap_mail_submission.c
new file mode 100644
index 000000000000..56b26563b6b2
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__jmap_mail_submission.c
@@ -0,0 +1,11 @@
+--- imap/jmap_mail_submission.c.orig 2023-03-01 02:54:30 UTC
++++ imap/jmap_mail_submission.c
+@@ -229,7 +229,7 @@ static int _emailsubmission_address_parse(json_t *addr
+ if (holduntil) {
+ if (!strcasecmp(key, "HOLDFOR")) {
+ char *endptr = (char *) val;
+- ulong interval = val ? strtoul(val, &endptr, 10) : ULONG_MAX;
++ unsigned long interval = val ? strtoul(val, &endptr, 10) : ULONG_MAX;
+ time_t now = time(0);
+
+ if (endptr == val || *endptr != '\0' ||
diff --git a/mail/cyrus-imapd310/files/patch-imap__jmap_mailbox.c b/mail/cyrus-imapd310/files/patch-imap__jmap_mailbox.c
new file mode 100644
index 000000000000..ad097332221e
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__jmap_mailbox.c
@@ -0,0 +1,11 @@
+--- imap/jmap_mailbox.c.orig 2024-03-18 02:20:35 UTC
++++ imap/jmap_mailbox.c
+@@ -1327,7 +1327,7 @@ static int _mboxquery_run(mboxquery_t *query, const mb
+
+ /* Apply comparators */
+ cyr_qsort_r(query->result.data, query->result.count, sizeof(void*),
+- (int(*)(const void*, const void*, void*)) _mboxquery_compar, query);
++ (int(*)QSORT_R_COMPAR_ARGS(const void*, const void*, void*)) _mboxquery_compar, query);
+
+ /* Build in-memory tree */
+ hash_table recs_by_parentid = HASH_TABLE_INITIALIZER;
diff --git a/mail/cyrus-imapd310/files/patch-imap__notify.c b/mail/cyrus-imapd310/files/patch-imap__notify.c
new file mode 100644
index 000000000000..e093378fc10d
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__notify.c
@@ -0,0 +1,48 @@
+--- imap/notify.c.orig 2021-05-10 04:34:24 UTC
++++ imap/notify.c
+@@ -49,6 +49,9 @@
+ #include <syslog.h>
+ #include <sys/mman.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -209,6 +212,27 @@ EXPORTED void notify(const char *method,
+ FNAME_NOTIFY_SOCK, sizeof(sun_data.sun_path));
+ }
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING,
++ "NOTIFY(%s): unable to sysctlbyname(kern.ipc.maxsockbuf): %m",
++ loginfo);
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING,
++ "NOTIFY(%s): unable to setsockopt(SO_SNDBUF) on socket: %m",
++ loginfo);
++ }
++#else
+ /* Get send buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, &optlen);
+@@ -221,6 +245,7 @@ EXPORTED void notify(const char *method,
+
+ /* Use minimum of 1/10 of send buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ /*
+ * build request of the form:
diff --git a/mail/cyrus-imapd310/files/patch-imap__relocate_by_id.c b/mail/cyrus-imapd310/files/patch-imap__relocate_by_id.c
new file mode 100644
index 000000000000..e9c771c10420
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__relocate_by_id.c
@@ -0,0 +1,10 @@
+--- imap/relocate_by_id.c.orig 2023-02-27 02:08:04 UTC
++++ imap/relocate_by_id.c
+@@ -46,6 +46,7 @@
+ #include <unistd.h>
+ #endif
+ #include <getopt.h>
++#include <libgen.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <errno.h>
diff --git a/mail/cyrus-imapd310/files/patch-imap__tls.c b/mail/cyrus-imapd310/files/patch-imap__tls.c
new file mode 100644
index 000000000000..2d9b8d36b1df
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__tls.c
@@ -0,0 +1,14 @@
+--- imap/tls.c.orig 2024-03-13 02:47:44 UTC
++++ imap/tls.c
+@@ -257,7 +257,11 @@ static DH *get_dh1024(void)
+ dh = DH_new();
+ if (!dh) return NULL;
+
++#if defined(LIBRESSL_VERSION_NUMBER)
++ p = BN_get_rfc2409_prime_1024(NULL);
++#else
+ p = get_rfc2409_prime_1024(NULL);
++#endif
+ BN_dec2bn(&g, "2");
+
+ if (DH_set0_pqg(dh, p, NULL, g))
diff --git a/mail/cyrus-imapd310/files/patch-imap__xapian_wrap.cpp b/mail/cyrus-imapd310/files/patch-imap__xapian_wrap.cpp
new file mode 100644
index 000000000000..3a7eaaace548
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-imap__xapian_wrap.cpp
@@ -0,0 +1,14 @@
+--- imap/xapian_wrap.cpp.orig 2022-02-23 00:13:21 UTC
++++ imap/xapian_wrap.cpp
+@@ -32,7 +32,11 @@ extern "C" {
+ #include <xapian.h>
+
+ #ifdef HAVE_CLD2
++#ifdef __FreeBSD__
++#include <cld/public/compact_lang_det.h>
++#else
+ #include <cld2/public/compact_lang_det.h>
++#endif
+ #endif
+
+ // from global.h
diff --git a/mail/cyrus-imapd310/files/patch-lib__cyr_qsort_r.c b/mail/cyrus-imapd310/files/patch-lib__cyr_qsort_r.c
new file mode 100644
index 000000000000..536076a6a530
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-lib__cyr_qsort_r.c
@@ -0,0 +1,19 @@
+--- lib/cyr_qsort_r.c.orig 2019-12-04 02:17:01 UTC
++++ lib/cyr_qsort_r.c
+@@ -18,14 +18,14 @@ EXPORTED void cyr_qsort_r(void *base, size_t nmemb, si
+ // NOTE: this is kinda ugly, but it's OK if you're not multithreaded
+
+ static void *qsort_r_thunk;
+-static int (*qsort_r_compar)(const void *, const void *, void *);
++static int (*qsort_r_compar)QSORT_R_COMPAR_ARGS(const void *, const void *, void *);
+ static int qsort_r_compar_func(const void *a, const void *b)
+ {
+ return qsort_r_compar(a, b, qsort_r_thunk);
+ }
+
+ EXPORTED void cyr_qsort_r(void *base, size_t nmemb, size_t size,
+- int (*compar)(const void *, const void *, void *),
++ int (*compar)QSORT_R_COMPAR_ARGS(const void *, const void *, void *),
+ void *thunk)
+ {
+ qsort_r_thunk = thunk;
diff --git a/mail/cyrus-imapd310/files/patch-lib__imapoptions b/mail/cyrus-imapd310/files/patch-lib__imapoptions
new file mode 100644
index 000000000000..6fd98f52abd1
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-lib__imapoptions
@@ -0,0 +1,20 @@
+--- lib/imapoptions.orig 2020-02-06 22:38:20 UTC
++++ lib/imapoptions
+@@ -2230,7 +2230,7 @@ If all partitions are over that limit, this feature is
+ { "seenstate_db", "twoskip", STRINGLIST("flat", "skiplist", "twoskip", "zeroskip"), "3.1.6" }
+ /* The cyrusdb backend to use for the seen state. */
+
+-{ "sendmail", "/usr/lib/sendmail", STRING, "2.3.17" }
++{ "sendmail", "/usr/sbin/sendmail", STRING, "2.3.17" }
+ /* The pathname of the sendmail executable. Sieve invokes sendmail
+ for sending rejections, redirects and vacation responses. */
+
+@@ -2363,7 +2363,7 @@ product version in the capabilities
+ For backward compatibility, if no unit is specified, seconds is
+ assumed. */
+
+-{ "sievedir", "/usr/sieve", STRING, "2.3.17" }
++{ "sievedir", "/var/imap/sieve", STRING, "2.3.17" }
+ /* If sieveusehomedir is false, this directory is searched for Sieve
+ scripts. */
+
diff --git a/mail/cyrus-imapd310/files/patch-lib__libcyr_cfg.c b/mail/cyrus-imapd310/files/patch-lib__libcyr_cfg.c
new file mode 100644
index 000000000000..5cbb64001209
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-lib__libcyr_cfg.c
@@ -0,0 +1,13 @@
+Index: lib/libcyr_cfg.c
+diff -u -p lib/libcyr_cfg.c.orig lib/libcyr_cfg.c
+--- lib/libcyr_cfg.c.orig Wed Mar 10 00:05:58 2004
++++ lib/libcyr_cfg.c Fri Feb 25 00:06:44 2005
+@@ -52,7 +52,7 @@
+ #include "libcyr_cfg.h"
+ #include "cyrusdb.h"
+
+-#if defined(__GNUC__) && __GNUC__ > 1
++#if defined(__GNUC__) && __GNUC__ > 1 && !defined(__INTEL_COMPILER)
+ /* We can use the GCC union constructor extension */
+ #define CFGVAL(t,v) (union cyrus_config_value)((t)(v))
+ #else
diff --git a/mail/cyrus-imapd310/files/patch-notifyd__notifyd.c b/mail/cyrus-imapd310/files/patch-notifyd__notifyd.c
new file mode 100644
index 000000000000..0719b98c13f6
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-notifyd__notifyd.c
@@ -0,0 +1,44 @@
+--- notifyd/notifyd.c.orig 2021-05-05 03:21:59 UTC
++++ notifyd/notifyd.c
+@@ -50,6 +50,9 @@
+ #include <sysexits.h>
+ #include <syslog.h>
+ #include <sys/types.h>
++#if defined(__FreeBSD__)
++#include <sys/sysctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <sys/un.h>
+@@ -111,6 +114,23 @@ static int do_notify(void)
+ unsigned bufsiz;
+ socklen_t optlen;
+
++#if defined(__FreeBSD__)
++ size_t maxsockbuf;
++ size_t len = sizeof(maxsockbuf);
++ r = sysctlbyname("kern.ipc.maxsockbuf", &maxsockbuf, &len, NULL, 0);
++ if (r == 0) {
++ bufsiz = MIN(maxsockbuf, NOTIFY_MAXSIZE);
++ } else {
++ syslog(LOG_WARNING, "unable to sysctlbyname(kern.ipc.maxsockbuf): %m");
++ bufsiz = NOTIFY_MAXSIZE;
++ }
++
++ optlen = sizeof(bufsiz);
++ r = setsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, optlen);
++ if (r == -1) {
++ syslog(LOG_WARNING, "unable to setsockopt(SO_RCVBUF) on notify socket: %m");
++ }
++#else
+ /* Get receive buffer size */
+ optlen = sizeof(bufsiz);
+ r = getsockopt(soc, SOL_SOCKET, SO_RCVBUF, &bufsiz, &optlen);
+@@ -121,6 +141,7 @@ static int do_notify(void)
+
+ /* Use minimum of 1/10 of receive buffer size (-overhead) NOTIFY_MAXSIZE */
+ bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
++#endif
+
+ while (1) {
+ method = class = priority = user = mailbox = message = reply = NULL;
diff --git a/mail/cyrus-imapd310/files/patch-sieve__interp.c b/mail/cyrus-imapd310/files/patch-sieve__interp.c
new file mode 100644
index 000000000000..19969d7d3683
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-sieve__interp.c
@@ -0,0 +1,16 @@
+--- sieve/interp.c.orig 2023-12-01 06:24:31 UTC
++++ sieve/interp.c
+@@ -749,11 +749,13 @@ unsigned long long extension_isactive(sieve_interp_t *
+ (config_ext & IMAP_ENUM_SIEVE_EXTENSIONS_VND_CYRUS_LOG))) capa = 0;
+ break;
+
++#ifdef WITH_JMAP
+ case SIEVE_CAPA_JMAPQUERY:
+ if (!(interp->jmapquery &&
+ (config_ext & IMAP_ENUM_SIEVE_EXTENSIONS_VND_CYRUS_JMAPQUERY)))
+ capa = 0;
+ break;
++#endif
+
+ case SIEVE_CAPA_SNOOZE:
+ if (!(interp->snooze &&
diff --git a/mail/cyrus-imapd310/files/patch-tools__mkimap b/mail/cyrus-imapd310/files/patch-tools__mkimap
new file mode 100644
index 000000000000..e0cb5fe46ae7
--- /dev/null
+++ b/mail/cyrus-imapd310/files/patch-tools__mkimap
@@ -0,0 +1,36 @@
+--- tools/mkimap.orig 2022-10-06 22:58:05 UTC
++++ tools/mkimap
+@@ -75,6 +75,9 @@ sub read_conf {
+
+ $imapdconf = shift || "/etc/imapd.conf";
+
++$cyrus_user = $ENV{CYRUS_USER} || "%%CYRUS_USER%%";
++$cyrus_group = $ENV{CYRUS_GROUP} || "%%CYRUS_GROUP%%";
++
+ push @configs, $imapdconf;
+
+ while ($conf = shift @configs) {
+@@ -87,6 +90,7 @@ $d = $confdir;
+
+ print "configuring $d...\n";
+
++mkdir $d, 0755;
+ chdir $d or die "couldn't change to $d";
+
+ mkdir "proc", 0755 || warn "can't create $d/proc: $!";
+@@ -97,12 +101,15 @@ mkdir "msg", 0755 || warn "can't create $d/msg: $!";
+ mkdir "ptclient", 0755 || warn "can't create $d/ptclient: $!";
+ mkdir "sync", 0755 || warn "can't create $d/sync: $!";
+
++system "/usr/sbin/chown -R $cyrus_user:$cyrus_group .";
++
+ while ($part = shift @parts) {
+ print "creating $part...\n";
+ mkdir $part, 0755 || warn "can't create $part: $!";
+ chdir $part or die "couldn't change to partition $part";
+ mkdir "stage.", 0755 || warn "can't create $part/stage.: $!";
+ mkdir "sync.", 0755 || warn "can't create $part/sync.: $!";
++ system "/usr/sbin/chown -R $cyrus_user:$cyrus_group $part";
+ }
+
+ print "done\n";
diff --git a/mail/cyrus-imapd310/files/pkg-deinstall.in b/mail/cyrus-imapd310/files/pkg-deinstall.in
new file mode 100644
index 000000000000..e56484fd6b2b
--- /dev/null
+++ b/mail/cyrus-imapd310/files/pkg-deinstall.in
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Created by: hetzels@westbend.net
+
+#set -vx
+
+PKG_BATCH=${BATCH:=NO}
+CYRUS_USER=${CYRUS_USER:=%%CYRUS_USER%%}
+
+#
+# Modify the 'cyrus' user created from the cyrus-sasl port
+#
+
+modify_cyrus_user() {
+ USER=${CYRUS_USER}
+ PW=/usr/sbin/pw
+ if [ -x /usr/sbin/nologin ]; then
+ shell=/usr/sbin/nologin
+ elif [ -x /sbin/nologin ]; then
+ shell=/sbin/nologin
+ else
+ shell=/nonexistent
+ fi
+ uhome=/nonexistent
+
+ if ! ${PW} mod user ${USER} -d "${uhome}" -s "${shell}"; then
+ echo "*** Failed to update user \`${USER}'."
+ else
+ echo "*** Updated user \`${USER}'."
+ fi
+}
+
+case $2 in
+ DEINSTALL)
+ ;;
+ POST-DEINSTALL)
+ modify_cyrus_user
+ ;;
+
+esac
diff --git a/mail/cyrus-imapd310/files/pkg-install.in b/mail/cyrus-imapd310/files/pkg-install.in
new file mode 100644
index 000000000000..c806a61ad6cc
--- /dev/null
+++ b/mail/cyrus-imapd310/files/pkg-install.in
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#set -vx
+
+PKG_BATCH=${BATCH:=NO}
+PKG_PREFIX=${PKG_PREFIX:=%%PREFIX%%}
+CYRUS_USER=${CYRUS_USER:=%%CYRUS_USER%%}
+
+#
+# Modify the 'cyrus' user created from the cyrus-sasl port
+#
+
+modify_cyrus_user() {
+ USER=${CYRUS_USER}
+ PW=/usr/sbin/pw
+ shell=/bin/csh
+ uhome=${PKG_PREFIX}/cyrus
+
+ if ! ${PW} mod user ${USER} -d "${uhome}" -s "${shell}"; then
+ echo "*** Failed to update user \`${USER}'."
+ else
+ echo "*** Updated user \`${USER}'."
+ fi
+}
+
+case $2 in
+ PRE-INSTALL)
+ ;;
+
+ POST-INSTALL)
+ modify_cyrus_user
+ if grep 'sieve' /etc/services; then
+ echo
+ else
+ echo
+ echo "** Please add an entry for the sieve protocol (4190/tcp)"
+ echo " to /etc/services"
+ echo
+ fi
+ ;;
+esac
diff --git a/mail/cyrus-imapd310/files/pkg-message.in b/mail/cyrus-imapd310/files/pkg-message.in
new file mode 100644
index 000000000000..70a4a9f76a97
--- /dev/null
+++ b/mail/cyrus-imapd310/files/pkg-message.in
@@ -0,0 +1,10 @@
+[
+{ type: install
+ message: <<EOM
+To setup mail spool, modify %%PREFIX%%/etc/imapd.conf appropriately,
+then run %%PREFIX%%/cyrus/sbin/mkimap.
+To run Cyrus IMAPd from startup, add cyrus_imapd_enable="YES" in your
+/etc/rc.conf.
+EOM
+}
+]
diff --git a/mail/cyrus-imapd310/pkg-descr b/mail/cyrus-imapd310/pkg-descr
new file mode 100644
index 000000000000..9ecf98285090
--- /dev/null
+++ b/mail/cyrus-imapd310/pkg-descr
@@ -0,0 +1,19 @@
+The Cyrus IMAP (Internet Message Access Protocol) server provides access to
+personal mail and system-wide bulletin boards through the IMAP protocol.
+The Cyrus IMAP server is a scaleable enterprise mail system designed for use
+from small to large enterprise environments using standards-based
+technologies.
+
+A full Cyrus IMAP implementation allows a seamless mail and bulletin board
+environment to be set up across multiple servers. It differs from other
+IMAP server implementations in that it is run on "sealed" servers, where
+users are not normally permitted to log in. The mailbox database is stored
+in parts of the filesystem that are private to the Cyrus IMAP system. All
+user access to mail is through software using the IMAP, POP3, or KPOP
+protocols.
+
+The private mailbox database design gives the server large advantages in
+efficiency, scalability, and administratability. Multiple concurrent
+read/write connections to the same mailbox are permitted. The server
+supports access control lists on mailboxes and storage quotas on mailbox
+hierarchies.
diff --git a/mail/cyrus-imapd310/pkg-plist b/mail/cyrus-imapd310/pkg-plist
new file mode 100644
index 000000000000..278b71bc9c81
--- /dev/null
+++ b/mail/cyrus-imapd310/pkg-plist
@@ -0,0 +1,165 @@
+bin/cyradm
+bin/httptest
+bin/imtest
+bin/installsieve
+bin/lmtptest
+bin/mupdatetest
+bin/nntptest
+bin/pop3test
+bin/sieveshell
+bin/sivtest
+bin/smtptest
+bin/synctest
+%%BACKUP%%cyrus/libexec/backupd
+cyrus/libexec/fud
+%%HTTP%%cyrus/libexec/httpd
+%%IDLED%%cyrus/libexec/idled
+cyrus/libexec/imapd
+cyrus/libexec/lmtpd
+cyrus/libexec/lmtpproxyd
+cyrus/libexec/master
+%%MURDER%%cyrus/libexec/mupdate
+%%NNTP%%cyrus/libexec/nntpd
+cyrus/libexec/notifyd
+cyrus/libexec/pop3d
+cyrus/libexec/pop3proxyd
+cyrus/libexec/promstatsd
+cyrus/libexec/proxyd
+cyrus/libexec/ptloader
+cyrus/libexec/smmapd
+%%REPLICATION%%cyrus/libexec/sync_server
+cyrus/libexec/timsieved
+cyrus/sbin/arbitron
+cyrus/sbin/chk_cyrus
+%%BACKUP%%cyrus/sbin/ctl_backups
+cyrus/sbin/ctl_conversationsdb
+cyrus/sbin/ctl_cyrusdb
+cyrus/sbin/ctl_deliver
+cyrus/sbin/ctl_mboxlist
+%%HTTP%%cyrus/sbin/ctl_zoneinfo
+cyrus/sbin/cvt_cyrusdb
+cyrus/sbin/cvt_xlist_specialuse
+%%BACKUP%%cyrus/sbin/cyr_backup
+cyrus/sbin/cyr_buildinfo
+cyrus/sbin/cyr_cd.sh
+cyrus/sbin/cyr_dbtool
+cyrus/sbin/cyr_deny
+cyrus/sbin/cyr_df
+cyrus/sbin/cyr_expire
+cyrus/sbin/cyr_info
+cyrus/sbin/cyr_ls
+cyrus/sbin/cyr_pwd
+cyrus/sbin/cyr_synclog
+cyrus/sbin/cyr_userseen
+cyrus/sbin/cyr_virusscan
+cyrus/sbin/cyrdump
+%%HTTP%%cyrus/sbin/dav_reconstruct
+cyrus/sbin/deliver
+%%NNTP%%cyrus/sbin/fetchnews
+cyrus/sbin/ipurge
+cyrus/sbin/masssievec
+cyrus/sbin/mbexamine
+cyrus/sbin/mbpath
+cyrus/sbin/mbtool
+cyrus/sbin/mkimap
+cyrus/sbin/ptdump
+cyrus/sbin/ptexpire
+cyrus/sbin/quota
+cyrus/sbin/reconstruct
+cyrus/sbin/relocate_by_id
+%%BACKUP%%cyrus/sbin/restore
+cyrus/sbin/sievec
+cyrus/sbin/sieved
+%%SQUATTER%%cyrus/sbin/squatter
+%%REPLICATION%%cyrus/sbin/sync_client
+%%REPLICATION%%cyrus/sbin/sync_reset
+cyrus/sbin/tls_prune
+cyrus/sbin/translatesieve
+cyrus/sbin/unexpunge
+etc/man.d/cyrus-imapd.conf
+include/cyrus/acl.h
+include/cyrus/arrayu64.h
+include/cyrus/assert.h
+include/cyrus/auth.h
+include/cyrus/auth_pts.h
+include/cyrus/bitvector.h
+include/cyrus/bloom.h
+include/cyrus/bsearch.h
+include/cyrus/bufarray.h
+include/cyrus/charset.h
+include/cyrus/chartable.h
+include/cyrus/command.h
+include/cyrus/crc32.h
+include/cyrus/cyr_lock.h
+include/cyrus/cyr_qsort_r.h
+include/cyrus/cyrusdb.h
+include/cyrus/dynarray.h
+include/cyrus/glob.h
+include/cyrus/gmtoff.h
+include/cyrus/hash.h
+include/cyrus/hashset.h
+include/cyrus/hashu64.h
+include/cyrus/imapopts.h
+include/cyrus/imapurl.h
+include/cyrus/imclient.h
+include/cyrus/imparse.h
+include/cyrus/iostat.h
+include/cyrus/iptostring.h
+include/cyrus/libcyr_cfg.h
+include/cyrus/lsort.h
+include/cyrus/map.h
+include/cyrus/mappedfile.h
+include/cyrus/mkgmtime.h
+include/cyrus/mpool.h
+include/cyrus/murmurhash2.h
+include/cyrus/nonblock.h
+include/cyrus/parseaddr.h
+include/cyrus/proc.h
+include/cyrus/procinfo.h
+include/cyrus/retry.h
+include/cyrus/rfc822tok.h
+include/cyrus/seqset.h
+include/cyrus/sieve/sieve_err.h
+include/cyrus/sieve/sieve_interface.h
+include/cyrus/signals.h
+include/cyrus/smallarrayu64.h
+include/cyrus/sqldb.h
+include/cyrus/strarray.h
+include/cyrus/strhash.h
+include/cyrus/stristr.h
+include/cyrus/times.h
+include/cyrus/tok.h
+include/cyrus/vparse.h
+include/cyrus/wildmat.h
+include/cyrus/xmalloc.h
+include/cyrus/xunlink.h
+lib/libcyrus.so
+lib/libcyrus.so.0
+lib/libcyrus.so.0.0.0
+lib/libcyrus_com_err.so
+lib/libcyrus_com_err.so.0
+lib/libcyrus_com_err.so.0.0.0
+lib/libcyrus_imap.so
+lib/libcyrus_imap.so.0
+lib/libcyrus_imap.so.0.0.0
+lib/libcyrus_min.so
+lib/libcyrus_min.so.0
+lib/libcyrus_min.so.0.0.0
+lib/libcyrus_sieve.so
+lib/libcyrus_sieve.so.0
+lib/libcyrus_sieve.so.0.0.0
+%%SITE_PERL%%/Cyrus/Annotator/AnnotateInlinedCIDs.pm
+%%SITE_PERL%%/Cyrus/Annotator/Daemon.pm
+%%SITE_PERL%%/Cyrus/Annotator/Message.pm
+%%SITE_ARCH%%/Cyrus/IMAP.pm
+%%SITE_ARCH%%/Cyrus/IMAP/Admin.pm
+%%SITE_ARCH%%/Cyrus/IMAP/Shell.pm
+%%SITE_ARCH%%/Cyrus/SIEVE/managesieve.pm
+%%SITE_ARCH%%/auto/Cyrus/IMAP/IMAP.so
+%%SITE_ARCH%%/auto/Cyrus/SIEVE/managesieve/managesieve.so
+libdata/pkgconfig/libcyrus.pc
+libdata/pkgconfig/libcyrus_imap.pc
+libdata/pkgconfig/libcyrus_min.pc
+libdata/pkgconfig/libcyrus_sieve.pc
+@sample %%EXAMPLESDIR%%/imapd.conf etc/imapd.conf
+@sample %%EXAMPLESDIR%%/cyrus.conf etc/cyrus.conf