From e27438f14082ae2f5fee3353033b0396175c855b Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Sun, 18 Aug 2019 13:18:44 +0200 Subject: [PATCH] dovecot: Improve packaging and include configs - Add dovenull user, otherwise, dovecot doesn't start - Build docs to have configuration files for dovecot - Remove init script as conffile - Move build options from Makefile to Config.in - Install section to be more readable - Refresh patches Signed-off-by: Josef Schlehofer --- mail/dovecot/Config.in | 40 ++++++++++++ mail/dovecot/Makefile | 65 ++++++------------- mail/dovecot/patches/001-configure_in.patch | 41 +++++------- ...fix-dovecot-config-for-cross-compile.patch | 6 +- .../patches/100-openssl-deprecated.patch | 12 ++-- mail/dovecot/patches/110-openssl-engine.patch | 10 +-- 6 files changed, 90 insertions(+), 84 deletions(-) create mode 100644 mail/dovecot/Config.in diff --git a/mail/dovecot/Config.in b/mail/dovecot/Config.in new file mode 100644 index 0000000000..0f48b9f18b --- /dev/null +++ b/mail/dovecot/Config.in @@ -0,0 +1,40 @@ +menu "Select dovecot build options" + depends on PACKAGE_dovecot + +config DOVECOT_GSSAPI + bool "GSSAPI support" + default n + help + Implements GSSAPI support in dovecot. + +config DOVECOT_LDAP + bool "LDAP support" + default n + help + Implements LDAP support in dovecot. + +config DOVECOT_MYSQL + bool "MYSQL support" + default n + help + Implements MYSQL support in dovecot. + +config DOVECOT_PGSQL + bool "PostgreSQL support" + default n + help + Implements PostgreSQL support in dovecot. + +config DOVECOT_SQLITE + bool "SQLite support" + default n + help + Implements SQLite DB support in dovecot. + +config DOVECOT_ICU +bool "Enable i18n features" + default n + help + Enable ICU (International Components for Unicode) support. + +endmenu diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile index 08bd1e6ddb..1bb85e5ae6 100644 --- a/mail/dovecot/Makefile +++ b/mail/dovecot/Makefile @@ -40,10 +40,11 @@ include $(INCLUDE_DIR)/nls.mk define Package/dovecot SECTION:=mail CATEGORY:=Mail - DEPENDS:=+DOVECOT_GSSAPI:krb5-libs +DOVECOT_LDAP:libopenldap +DOVECOT_MYSQL:libmysqlclient +DOVECOT_PGSQL:libpq +DOVECOT_SQLITE:libsqlite3 +libopenssl +librt +zlib +libbz2 +libcap +DOVECOT_ICU:icu $(ICONV_DEPENDS) TITLE:=An IMAP and POP3 daemon URL:=https://www.dovecot.org/ + DEPENDS:=+DOVECOT_GSSAPI:krb5-libs +DOVECOT_LDAP:libopenldap +DOVECOT_MYSQL:libmysqlclient +DOVECOT_PGSQL:libpq +DOVECOT_SQLITE:libsqlite3 +libopenssl +librt +zlib +libbz2 +libcap +DOVECOT_ICU:icu $(ICONV_DEPENDS) USERID:=dovecot=59:dovecot=59 + USERID:=dovenull=60:dovenull=60 ABI_VERSION:=$(PKG_VERSION) endef @@ -52,43 +53,10 @@ define Package/dovecot/description endef define Package/dovecot/config - menu "Select dovecot build options" - depends on PACKAGE_dovecot - config DOVECOT_GSSAPI - bool "GSSAPI support" - default n - help - Implements GSSAPI support in dovecot. - config DOVECOT_LDAP - bool "LDAP support" - default n - help - Implements LDAP support in dovecot. - config DOVECOT_MYSQL - bool "MYSQL support" - default n - help - Implements MYSQL support in dovecot. - config DOVECOT_PGSQL - bool "PostgreSQL support" - default n - help - Implements PostgreSQL support in dovecot. - config DOVECOT_SQLITE - bool "SQLite support" - default n - help - Implements SQLite DB support in dovecot. - config DOVECOT_ICU - bool "Enable i18n features" - default n - help - Enable ICU (International Components for Unicode) support. - endmenu + source "$(SOURCE)/Config.in" endef define Package/dovecot/conffiles -/etc/init.d/dovecot /etc/dovecot/ endef @@ -106,7 +74,6 @@ CONFIGURE_ARGS += \ --without-lzma \ --without-lz4 \ --without-sodium \ - --without-docs \ $(if $(CONFIG_DOVECOT_GSSAPI),--with-gssapi=yes,--with-gssapi=no) \ $(if $(CONFIG_DOVECOT_LDAP),--with-ldap=yes,--with-ldap=no) \ $(if $(CONFIG_DOVECOT_MYSQL),--with-mysql=yes,--with-mysql=no) \ @@ -132,24 +99,30 @@ define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/include/dovecot $(1)/usr/include/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/dovecot $(1)/usr/lib/ - rm -f $(1)/usr/lib/dovecot/*.la + $(call libtool_remove_files,$(1)) endef define Package/dovecot/install - $(INSTALL_DIR) $(1)/etc/init.d \ - $(1)/etc/dovecot \ - $(1)/usr/lib/dovecot \ - $(1)/usr/libexec/dovecot \ - $(1)/usr/bin \ - $(1)/usr/sbin + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/dovecot.init $(1)/etc/init.d/dovecot + + $(INSTALL_DIR) $(1)/etc/dovecot + $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/dovecot/example-config/* $(1)/etc/dovecot/ + + $(INSTALL_DIR) $(1)/usr/lib/dovecot $(CP) $(PKG_INSTALL_DIR)/usr/lib/dovecot/* $(1)/usr/lib/dovecot/ + rm $(1)/usr/lib/dovecot/dovecot-config + find $(1)/usr/lib/dovecot/ -name "*.a" -o -name "*.la" | $(XARGS) rm -f + + $(INSTALL_DIR) $(1)/usr/libexec/dovecot $(CP) $(PKG_INSTALL_DIR)/usr/libexec/dovecot/* $(1)/usr/libexec/dovecot/ + + $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/doveconf $(1)/usr/bin/ + + $(INSTALL_DIR) $(1)/usr/sbin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/ - $(INSTALL_BIN) ./files/dovecot.init $(1)/etc/init.d/dovecot - rm $(1)/usr/lib/dovecot/dovecot-config - find $(1)/usr/lib/dovecot/ -name "*.a" -o -name "*.la" | xargs rm endef define Package/dovecot-utils/install diff --git a/mail/dovecot/patches/001-configure_in.patch b/mail/dovecot/patches/001-configure_in.patch index 650c5c6258..11c31b87ef 100644 --- a/mail/dovecot/patches/001-configure_in.patch +++ b/mail/dovecot/patches/001-configure_in.patch @@ -1,7 +1,6 @@ -diff -u --recursive dovecot-2.3.1-vanilla/m4/fd_passing.m4 dovecot-2.3.1/m4/fd_passing.m4 ---- dovecot-2.3.1-vanilla/m4/fd_passing.m4 2018-06-08 20:02:15.849850956 -0400 -+++ dovecot-2.3.1/m4/fd_passing.m4 2018-06-08 20:04:28.947016370 -0400 -@@ -8,7 +8,7 @@ +--- a/m4/fd_passing.m4 ++++ b/m4/fd_passing.m4 +@@ -8,7 +8,7 @@ AC_DEFUN([DOVECOT_FD_PASSING], [ CFLAGS="$CFLAGS -DBUGGY_CMSG_MACROS" fi @@ -10,7 +9,7 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/fd_passing.m4 dovecot-2.3.1/m4/fd_p #include #include #include -@@ -16,7 +16,7 @@ +@@ -16,7 +16,7 @@ AC_DEFUN([DOVECOT_FD_PASSING], [ #include #include #include "fdpass.h" @@ -19,10 +18,9 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/fd_passing.m4 dovecot-2.3.1/m4/fd_p static int nopen(void) { -diff -u --recursive dovecot-2.3.1-vanilla/m4/glibc.m4 dovecot-2.3.1/m4/glibc.m4 ---- dovecot-2.3.1-vanilla/m4/glibc.m4 2018-06-08 20:02:15.850850957 -0400 -+++ dovecot-2.3.1/m4/glibc.m4 2018-06-08 20:04:00.780981363 -0400 -@@ -17,7 +17,7 @@ +--- a/m4/glibc.m4 ++++ b/m4/glibc.m4 +@@ -17,7 +17,7 @@ AC_DEFUN([DOVECOT_GLIBC], [ dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it. dnl * It may also be broken in AIX. AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[ @@ -31,7 +29,7 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/glibc.m4 dovecot-2.3.1/m4/glibc.m4 #define _XOPEN_SOURCE 600 #include #include -@@ -26,6 +26,7 @@ +@@ -26,6 +26,7 @@ AC_DEFUN([DOVECOT_GLIBC], [ #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7) possibly broken posix_fallocate #endif @@ -39,10 +37,9 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/glibc.m4 dovecot-2.3.1/m4/glibc.m4 int main() { int fd = creat("conftest.temp", 0600); int ret; -diff -u --recursive dovecot-2.3.1-vanilla/m4/ioloop.m4 dovecot-2.3.1/m4/ioloop.m4 ---- dovecot-2.3.1-vanilla/m4/ioloop.m4 2018-06-08 20:02:15.850850957 -0400 -+++ dovecot-2.3.1/m4/ioloop.m4 2018-06-08 20:03:31.666945181 -0400 -@@ -4,9 +4,9 @@ +--- a/m4/ioloop.m4 ++++ b/m4/ioloop.m4 +@@ -4,9 +4,9 @@ AC_DEFUN([DOVECOT_IOLOOP], [ if test "$ioloop" = "best" || test "$ioloop" = "epoll"; then AC_CACHE_CHECK([whether we can use epoll],i_cv_epoll_works,[ @@ -54,9 +51,8 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/ioloop.m4 dovecot-2.3.1/m4/ioloop.m int main() { return epoll_create(5) < 1; -diff -u --recursive dovecot-2.3.1-vanilla/m4/mmap_write.m4 dovecot-2.3.1/m4/mmap_write.m4 ---- dovecot-2.3.1-vanilla/m4/mmap_write.m4 2018-06-08 20:02:15.850850957 -0400 -+++ dovecot-2.3.1/m4/mmap_write.m4 2018-06-08 20:03:27.369939841 -0400 +--- a/m4/mmap_write.m4 ++++ b/m4/mmap_write.m4 @@ -1,7 +1,7 @@ dnl * If mmap() plays nicely with write() AC_DEFUN([DOVECOT_MMAP_WRITE], [ @@ -66,7 +62,7 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/mmap_write.m4 dovecot-2.3.1/m4/mmap #include #include #include -@@ -9,6 +9,7 @@ +@@ -9,6 +9,7 @@ AC_DEFUN([DOVECOT_MMAP_WRITE], [ #include #include #include @@ -74,10 +70,9 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/mmap_write.m4 dovecot-2.3.1/m4/mmap int main() { /* return 0 if we're signed */ int f = open("conftest.mmap", O_RDWR|O_CREAT|O_TRUNC, 0600); -diff -u --recursive dovecot-2.3.1-vanilla/m4/want_gssapi.m4 dovecot-2.3.1/m4/want_gssapi.m4 ---- dovecot-2.3.1-vanilla/m4/want_gssapi.m4 2018-06-08 20:02:15.850850957 -0400 -+++ dovecot-2.3.1/m4/want_gssapi.m4 2018-06-08 20:04:13.204996804 -0400 -@@ -54,7 +54,7 @@ +--- a/m4/want_gssapi.m4 ++++ b/m4/want_gssapi.m4 +@@ -54,7 +54,7 @@ AC_DEFUN([DOVECOT_WANT_GSSAPI], [ # does the kerberos library support SPNEGO? AC_CACHE_CHECK([whether GSSAPI supports SPNEGO],i_cv_gssapi_spnego,[ @@ -86,7 +81,7 @@ diff -u --recursive dovecot-2.3.1-vanilla/m4/want_gssapi.m4 dovecot-2.3.1/m4/wan #ifdef HAVE_GSSAPI_H # include #else -@@ -62,6 +62,7 @@ +@@ -62,6 +62,7 @@ AC_DEFUN([DOVECOT_WANT_GSSAPI], [ #endif #include #include diff --git a/mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch b/mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch index 6c0bc743db..2fd49d9b26 100644 --- a/mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch +++ b/mail/dovecot/patches/050-fix-dovecot-config-for-cross-compile.patch @@ -33,10 +33,8 @@ LIBDOVECOT_LIBFTS=-ldovecot-fts This patch modifed dovecot-config that gets installed on the assumption that users of libdovecot will also be cross-compiled (a safe bet). -Index: dovecot-2.3.2.1/Makefile.am -=================================================================== ---- dovecot-2.3.2.1.orig/Makefile.am -+++ dovecot-2.3.2.1/Makefile.am +--- a/Makefile.am ++++ b/Makefile.am @@ -73,7 +73,7 @@ install-exec-hook: grep -v '^LIBDOVECOT_.*_INCLUDE' dovecot-config | \ grep -v '^LIBDOVECOT.*_DEPS' | sed \ diff --git a/mail/dovecot/patches/100-openssl-deprecated.patch b/mail/dovecot/patches/100-openssl-deprecated.patch index 72d447425b..e0d40e1e19 100644 --- a/mail/dovecot/patches/100-openssl-deprecated.patch +++ b/mail/dovecot/patches/100-openssl-deprecated.patch @@ -10,7 +10,7 @@ --- a/src/lib-ssl-iostream/dovecot-openssl-common.c +++ b/src/lib-ssl-iostream/dovecot-openssl-common.c -@@ -63,9 +63,11 @@ void dovecot_openssl_common_global_ref(void) +@@ -63,9 +63,11 @@ void dovecot_openssl_common_global_ref(v /*i_warning("CRYPTO_set_mem_functions() was called too late");*/ } @@ -22,7 +22,7 @@ } bool dovecot_openssl_common_global_unref(void) -@@ -79,6 +81,7 @@ bool dovecot_openssl_common_global_unref(void) +@@ -79,6 +81,7 @@ bool dovecot_openssl_common_global_unref ENGINE_finish(dovecot_openssl_engine); dovecot_openssl_engine = NULL; } @@ -30,14 +30,14 @@ /* OBJ_cleanup() is called automatically by EVP_cleanup() in newer versions. Doesn't hurt to call it anyway. */ OBJ_cleanup(); -@@ -100,6 +103,7 @@ bool dovecot_openssl_common_global_unref(void) - ERR_free_strings(); +@@ -101,6 +104,7 @@ bool dovecot_openssl_common_global_unref #ifdef HAVE_OPENSSL_CLEANUP OPENSSL_cleanup(); -+#endif #endif ++#endif return FALSE; } + --- a/src/lib-ssl-iostream/iostream-openssl-context.c +++ b/src/lib-ssl-iostream/iostream-openssl-context.c @@ -6,6 +6,9 @@ @@ -50,7 +50,7 @@ #include #include #include -@@ -510,8 +513,10 @@ ssl_proxy_ctx_set_crypto_params(SSL_CTX *ssl_ctx, +@@ -514,8 +517,10 @@ ssl_proxy_ctx_set_crypto_params(SSL_CTX int nid; const char *curve_name; #endif diff --git a/mail/dovecot/patches/110-openssl-engine.patch b/mail/dovecot/patches/110-openssl-engine.patch index 19326fb13b..6f8d47119c 100644 --- a/mail/dovecot/patches/110-openssl-engine.patch +++ b/mail/dovecot/patches/110-openssl-engine.patch @@ -14,7 +14,7 @@ #include "dcrypt.h" #include "dcrypt-private.h" -@@ -179,11 +181,13 @@ static bool dcrypt_openssl_error(const char **error_r) +@@ -179,11 +181,13 @@ static bool dcrypt_openssl_error(const c static bool dcrypt_openssl_initialize(const struct dcrypt_settings *set, const char **error_r) { @@ -47,7 +47,7 @@ #ifdef HAVE_SSL_NEW_MEM_FUNCS static void *dovecot_openssl_malloc(size_t size, const char *u0 ATTR_UNUSED, int u1 ATTR_UNUSED) -@@ -77,10 +80,12 @@ bool dovecot_openssl_common_global_unref(void) +@@ -77,10 +80,12 @@ bool dovecot_openssl_common_global_unref if (--openssl_init_refcount > 0) return TRUE; @@ -60,7 +60,7 @@ #if OPENSSL_VERSION_NUMBER < 0x10100000L /* OBJ_cleanup() is called automatically by EVP_cleanup() in newer versions. Doesn't hurt to call it anyway. */ -@@ -88,7 +93,9 @@ bool dovecot_openssl_common_global_unref(void) +@@ -88,7 +93,9 @@ bool dovecot_openssl_common_global_unref #ifdef HAVE_SSL_COMP_FREE_COMPRESSION_METHODS SSL_COMP_free_compression_methods(); #endif @@ -70,7 +70,7 @@ EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); #ifdef HAVE_OPENSSL_AUTO_THREAD_DEINIT -@@ -111,6 +118,7 @@ bool dovecot_openssl_common_global_unref(void) +@@ -111,6 +118,7 @@ bool dovecot_openssl_common_global_unref int dovecot_openssl_common_global_set_engine(const char *engine, const char **error_r) { @@ -78,7 +78,7 @@ if (dovecot_openssl_engine != NULL) return 1; -@@ -132,5 +140,6 @@ int dovecot_openssl_common_global_set_engine(const char *engine, +@@ -132,5 +140,6 @@ int dovecot_openssl_common_global_set_en dovecot_openssl_engine = NULL; return -1; } -- 2.30.2