diff mbox series

[bug#68541,1/2] gnu: dovecot: Prevent cross-compile errors.

Message ID a88bf4bb9a0e756fe8b2f08d4c48ee8bcbb6235d.1705512974.git.herman@rimm.ee
State New
Headers show
Series [bug#68541,1/2] gnu: dovecot: Prevent cross-compile errors. | expand

Commit Message

Herman Rimm Jan. 17, 2024, 5:37 p.m. UTC
* gnu/local.mk: Register patch.
* gnu/packages/mail.scm (dovecot): Fix cross-compile.
[arguments]: Remove '--with-clucene' configure flag.
[inputs]: Remove clucene.
[native-inputs]: Add autoconf, automake, gettext-minimal, libtool.
[patches]: Add patch to configure for cross-compiling.
* gnu/packages/patches/dovecot-bootstrap-cross-compile.patch: New file.

Change-Id: Iec697ccd92cc55652b83a683aa46f9955df9e15c
---
The first patch enables cross-compilation, at least on x86_64 targeting
Aarch64. The second patch runs guix style. Guix lint outputs:
dovecot@2.3.21: label 'zstd' does not match package name 'zstd:lib'.
Do I need to specify the 'lib' output of zstd in a different way?

 gnu/local.mk                                  |   1 +
 gnu/packages/mail.scm                         |  12 +-
 .../dovecot-bootstrap-cross-compile.patch     | 165 ++++++++++++++++++
 3 files changed, 173 insertions(+), 5 deletions(-)
 create mode 100644 gnu/packages/patches/dovecot-bootstrap-cross-compile.patch


base-commit: 8ca490e6600c55b2dab5db12cf1aefa2b1b27f9a
prerequisite-patch-id: 80cc6bb367fd6671f325eb5f88b030db5979b74b
prerequisite-patch-id: 60a91900bd16347223fd517454ca7c20c655ae2e
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 34bed91fc3..35e4d6b7ed 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1088,6 +1088,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/docbook-xsl-support-old-url.patch	\
   %D%/packages/patches/doc++-include-directives.patch		\
   %D%/packages/patches/doc++-segfault-fix.patch			\
+  %D%/packages/patches/dovecot-bootstrap-cross-compile.patch	\
   %D%/packages/patches/dovecot-opensslv3.patch			\
   %D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch	\
   %D%/packages/patches/doxygen-hurd.patch			\
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 4466e5e6d9..b522943294 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -54,6 +54,7 @@ 
 ;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
 ;;; Copyright © 2023 Arjan Adriaanse <arjan@adriaan.se>
 ;;; Copyright © 2023 Wilko Meyer <w@wmeyer.eu>
+;;; Copyright © 2023 Herman Rimm <herman@rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2015,13 +2016,15 @@  (define-public dovecot
        (sha256
         (base32 "0bah6rn5ihczai8q50p6pqxwj73j21smib89ycp7q8qwly9i1c85"))
        (patches
-        (search-patches "dovecot-opensslv3.patch"))))
+        (search-patches "dovecot-bootstrap-cross-compile.patch"
+                        "dovecot-opensslv3.patch"))
+       (modules '((guix build utils)))
+       (snippet '(delete-file "configure"))))
     (build-system gnu-build-system)
     (native-inputs
-     (list pkg-config))
+     (list autoconf automake gettext-minimal libtool pkg-config))
     (inputs
      (list bzip2
-           clucene
            icu4c
            libsodium ; extra password algorithms
            libstemmer
@@ -2035,8 +2038,7 @@  (define-public dovecot
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc"
                            "--localstatedir=/var"
-                           "--with-sqlite"  ; not auto-detected
-                           "--with-lucene") ; not auto-detected
+                           "--with-sqlite") ; not auto-detected
        ;; The -rdynamic linker flag is needed for the backtrace() function to
        ;; have symbol names rather than just addresses.  Dovecot's tests rely
        ;; on this, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962630.
diff --git a/gnu/packages/patches/dovecot-bootstrap-cross-compile.patch b/gnu/packages/patches/dovecot-bootstrap-cross-compile.patch
new file mode 100644
index 0000000000..5b268082a0
--- /dev/null
+++ b/gnu/packages/patches/dovecot-bootstrap-cross-compile.patch
@@ -0,0 +1,165 @@ 
+Upstream status: sent to dovecot@dovecot.org.
+
+From f53b92560ed86144b880919b66c096ce74a0a9e6 Mon Sep 17 00:00:00 2001
+From: Herman Rimm <herman@rimm.ee>
+Date: Wed, 17 Jan 2024 17:59:08 +0100
+Subject: [PATCH] m4: Fill in 'action-if-cross-compiling' for every
+ AC_RUN_IFELSE.
+
+---
+ m4/c99_vsnprintf.m4 | 1 +
+ m4/fd_passing.m4    | 4 ++++
+ m4/glibc.m4         | 2 ++
+ m4/gmtime_max.m4    | 5 ++++-
+ m4/ioloop.m4        | 2 ++
+ m4/mmap_write.m4    | 2 ++
+ m4/mntctl.m4        | 2 ++
+ m4/vararg.m4        | 9 ++++++---
+ m4/want_gssapi.m4   | 2 ++
+ 9 files changed, 25 insertions(+), 4 deletions(-)
+
+diff --git a/m4/c99_vsnprintf.m4 b/m4/c99_vsnprintf.m4
+index e642083..3a5d21f 100644
+--- a/m4/c99_vsnprintf.m4
++++ b/m4/c99_vsnprintf.m4
+@@ -21,6 +21,7 @@ AC_DEFUN([DOVECOT_C99_VSNPRINTF], [
+       return f("hello %s%d", "world", 1);
+     }]])],
+     [i_cv_c99_vsnprintf=yes],
++    [i_cv_c99_vsnprintf=no],
+     [i_cv_c99_vsnprintf=no])
+   ])
+   if test $i_cv_c99_vsnprintf = no; then
+diff --git a/m4/fd_passing.m4 b/m4/fd_passing.m4
+index 6b96c0f..dc7e180 100644
+--- a/m4/fd_passing.m4
++++ b/m4/fd_passing.m4
+@@ -72,6 +72,10 @@ AC_DEFUN([DOVECOT_FD_PASSING], [
+         dnl no, try with BUGGY_CMSG_MACROS
+         CFLAGS=$old_cflags
+         i_cv_fd_passing=no
++      ], [
++        dnl no, try with BUGGY_CMSG_MACROS
++        CFLAGS=$old_cflags
++        i_cv_fd_passing=buggy_cmsg_macros
+       ])
+     done
+   ]);
+diff --git a/m4/glibc.m4 b/m4/glibc.m4
+index 5d722aa..1dee501 100644
+--- a/m4/glibc.m4
++++ b/m4/glibc.m4
+@@ -41,6 +41,8 @@ AC_DEFUN([DOVECOT_GLIBC], [
+       i_cv_posix_fallocate_works=yes
+     ], [
+       i_cv_posix_fallocate_works=no
++    ], [
++      i_cv_posix_fallocate_works=no
+     ])
+   ])
+   if test $i_cv_posix_fallocate_works = yes; then
+diff --git a/m4/gmtime_max.m4 b/m4/gmtime_max.m4
+index 1613cb2..1c193e5 100644
+--- a/m4/gmtime_max.m4
++++ b/m4/gmtime_max.m4
+@@ -36,7 +36,10 @@ AC_DEFUN([DOVECOT_GMTIME_MAX], [
+     ], [
+       printf "check failed, assuming "
+       i_cv_gmtime_max_time_t=31
+-    ],[])
++    ], [
++      printf "check failed, assuming "
++      i_cv_gmtime_max_time_t=31
++    ])
+   ])
+   AC_DEFINE_UNQUOTED(TIME_T_MAX_BITS, $i_cv_gmtime_max_time_t, [max. time_t bits gmtime() can handle])
+ ])
+diff --git a/m4/ioloop.m4 b/m4/ioloop.m4
+index 0f7dde0..3ec0902 100644
+--- a/m4/ioloop.m4
++++ b/m4/ioloop.m4
+@@ -15,6 +15,8 @@ AC_DEFUN([DOVECOT_IOLOOP], [
+         i_cv_epoll_works=yes
+       ], [
+         i_cv_epoll_works=no
++      ], [
++        i_cv_epoll_works=no
+       ])
+     ])
+     if test $i_cv_epoll_works = yes; then
+diff --git a/m4/mmap_write.m4 b/m4/mmap_write.m4
+index 3352c3a..f922957 100644
+--- a/m4/mmap_write.m4
++++ b/m4/mmap_write.m4
+@@ -36,6 +36,8 @@ AC_DEFUN([DOVECOT_MMAP_WRITE], [
+       i_cv_mmap_plays_with_write=yes
+     ], [
+       i_cv_mmap_plays_with_write=no
++    ], [
++      i_cv_mmap_plays_with_write=no
+     ])
+   ])
+   if test $i_cv_mmap_plays_with_write = no; then
+diff --git a/m4/mntctl.m4 b/m4/mntctl.m4
+index 9d0dde1..4ad18f2 100644
+--- a/m4/mntctl.m4
++++ b/m4/mntctl.m4
+@@ -25,6 +25,8 @@ AC_DEFUN([DOVECOT_MNTCTL], [
+       AC_MSG_RESULT($size)
+     ],[
+       AC_MSG_RESULT(default)
++    ],[
++      AC_MSG_RESULT(default)
+     ])
+   fi
+ ])
+diff --git a/m4/vararg.m4 b/m4/vararg.m4
+index 6bc8dcc..79ce983 100644
+--- a/m4/vararg.m4
++++ b/m4/vararg.m4
+@@ -16,7 +16,8 @@ AC_DEFUN([DOVECOT_VA_COPY], [
+             return 0;
+           }]])],
+           [lib_cv_va_copy=yes],
+-          [lib_cv_va_copy=no],[])
++          [lib_cv_va_copy=no],
++          [lib_cv_va_copy=yes])
+   ])
+   AC_CACHE_CHECK([for an implementation of __va_copy()],lib_cv___va_copy,[
+           AC_RUN_IFELSE([AC_LANG_SOURCE([[
+@@ -35,7 +36,8 @@ AC_DEFUN([DOVECOT_VA_COPY], [
+             return 0;
+           }]])],
+           [lib_cv___va_copy=yes],
+-          [lib_cv___va_copy=no],[])
++          [lib_cv___va_copy=no],
++          [lib_cv___va_copy=no])
+   ])
+   
+   if test "x$lib_cv_va_copy" = "xyes"; then
+@@ -68,7 +70,8 @@ AC_DEFUN([DOVECOT_VA_COPY_BYVAL], [
+             return 0;
+           }]])],
+           [lib_cv_va_val_copy=yes],
+-          [lib_cv_va_val_copy=no],[])
++          [lib_cv_va_val_copy=no],
++          [lib_cv_va_val_copy=no])
+   ])
+   
+   if test "x$lib_cv_va_val_copy" = "xno"; then
+diff --git a/m4/want_gssapi.m4 b/m4/want_gssapi.m4
+index 7866aba..c318b0a 100644
+--- a/m4/want_gssapi.m4
++++ b/m4/want_gssapi.m4
+@@ -82,6 +82,8 @@ AC_DEFUN([DOVECOT_WANT_GSSAPI], [
+   				    i_cv_gssapi_spnego=yes
+   				  ], [
+   				    i_cv_gssapi_spnego=no
++  				  ], [
++  				    i_cv_gssapi_spnego=no
+   				  ])
+   				])
+   				if test "$i_cv_gssapi_spnego" = "yes"; then
+-- 
+2.41.0
+