[PATCH 1/2] gnu: dovecot: Prevent cross-compile errors.

  • Open
  • quality assurance status badge
Details
2 participants
  • Clément Lassieur
  • Herman Rimm
Owner
unassigned
Submitted by
Herman Rimm
Severity
normal
H
H
Herman Rimm wrote on 17 Jan 18:37 +0100
(address . guix-patches@gnu.org)(name . Herman Rimm)(address . herman@rimm.ee)
a88bf4bb9a0e756fe8b2f08d4c48ee8bcbb6235d.1705512974.git.herman@rimm.ee
* 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

Toggle diff (230 lines)
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
+

base-commit: 8ca490e6600c55b2dab5db12cf1aefa2b1b27f9a
prerequisite-patch-id: 80cc6bb367fd6671f325eb5f88b030db5979b74b
prerequisite-patch-id: 60a91900bd16347223fd517454ca7c20c655ae2e
--
2.41.0
H
H
Herman Rimm wrote on 17 Jan 18:50 +0100
[PATCH 2/2] gnu: dovecot: Apply guix style.
(address . 68541@debbugs.gnu.org)(name . Herman Rimm)(address . herman@rimm.ee)
8961185a443ea28a4a26c545a334a2ebd5dcbf40.1705512974.git.herman@rimm.ee
* gnu/packages/mail.scm (dovecot): Apply guix style.

Change-Id: I2f50fa15ccbd2391be1f6f12e13e62aff707c54a
---
gnu/packages/mail.scm | 88 +++++++++++++++++++++++--------------------
1 file changed, 47 insertions(+), 41 deletions(-)

Toggle diff (111 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index b522943294..5bbe4ca7ea 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2011,57 +2011,63 @@ (define-public dovecot
(origin
(method url-fetch)
(uri (string-append "https://www.dovecot.org/releases/"
- (version-major+minor version) "/"
- "dovecot-" version ".tar.gz"))
+ (version-major+minor version)
+ "/"
+ "dovecot-"
+ version
+ ".tar.gz"))
(sha256
(base32 "0bah6rn5ihczai8q50p6pqxwj73j21smib89ycp7q8qwly9i1c85"))
- (patches
- (search-patches "dovecot-bootstrap-cross-compile.patch"
- "dovecot-opensslv3.patch"))
+ (patches (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 autoconf automake gettext-minimal libtool pkg-config))
- (inputs
- (list bzip2
- icu4c
- libsodium ; extra password algorithms
- libstemmer
- libunwind
- linux-pam
- lz4
- openssl
- sqlite
- zlib
- `(,zstd "lib")))
+ (native-inputs (list autoconf automake gettext-minimal libtool pkg-config))
+ (inputs (list bzip2
+ icu4c
+ libsodium ;extra password algorithms
+ libstemmer
+ libunwind
+ linux-pam
+ lz4
+ openssl
+ sqlite
+ zlib
+ `(,zstd "lib")))
(arguments
- `(#:configure-flags '("--sysconfdir=/etc"
- "--localstatedir=/var"
- "--with-sqlite") ; not auto-detected
+ `(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var"
+ "--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.
#:make-flags (list "LDFLAGS=-rdynamic")
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'patch-file-names
- (lambda _
- (substitute* "src/lib-program-client/test-program-client-local.c"
- (("(/bin/| )cat") (which "cat"))
- (("/bin/echo") (which "echo"))
- (("/bin/false") (which "false"))
- (("/bin/sh") (which "bash"))
- (("head") (which "head"))
- (("sleep") (which "sleep")))
- (substitute* (list "src/lib-smtp/test-bin/sendmail-exit-1.sh"
- "src/lib-smtp/test-bin/sendmail-success.sh")
- (("cat") (which "cat")))))
- (replace 'install
- (lambda* (#:key make-flags #:allow-other-keys)
- ;; Simple hack to avoid installing a trivial README in /etc.
- (apply invoke "make" "install" "sysconfdir=/tmp/bogus"
- make-flags))))))
+ #:phases (modify-phases %standard-phases
+ (add-after 'unpack 'patch-file-names
+ (lambda _
+ (substitute* "src/lib-program-client/test-program-client-local.c"
+ (("(/bin/| )cat")
+ (which "cat"))
+ (("/bin/echo")
+ (which "echo"))
+ (("/bin/false")
+ (which "false"))
+ (("/bin/sh")
+ (which "bash"))
+ (("head")
+ (which "head"))
+ (("sleep")
+ (which "sleep")))
+ (substitute* (list
+ "src/lib-smtp/test-bin/sendmail-exit-1.sh"
+ "src/lib-smtp/test-bin/sendmail-success.sh")
+ (("cat")
+ (which "cat")))))
+ (replace 'install
+ (lambda* (#:key make-flags #:allow-other-keys)
+ ;; Simple hack to avoid installing a trivial README in /etc.
+ (apply invoke "make" "install" "sysconfdir=/tmp/bogus"
+ make-flags))))))
(home-page "https://www.dovecot.org")
(synopsis "Secure POP3/IMAP server")
(description
--
2.41.0
C
C
Clément Lassieur wrote on 18 Jan 00:47 +0100
(name . Herman Rimm via Guix-patches via)(address . guix-patches@gnu.org)
87h6jbiktw.fsf@lassieur.org
On Wed, Jan 17 2024, Herman Rimm via Guix-patches via wrote:

Toggle quote (7 lines)
> * gnu/packages/mail.scm (dovecot): Apply guix style.
>
> Change-Id: I2f50fa15ccbd2391be1f6f12e13e62aff707c54a
> ---
> gnu/packages/mail.scm | 88 +++++++++++++++++++++++--------------------
> 1 file changed, 47 insertions(+), 41 deletions(-)

Hi, "guix style" is not perfect, and in this case the previous style
was, I believe, way better. I think it's meant to help people automate
some stuff, but not to reformat the whole source tree.

Thanks! And sorry :)
Clément

Toggle quote (16 lines)
> diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
> index b522943294..5bbe4ca7ea 100644
> --- a/gnu/packages/mail.scm
> +++ b/gnu/packages/mail.scm
> @@ -2011,57 +2011,63 @@ (define-public dovecot
> (origin
> (method url-fetch)
> (uri (string-append "https://www.dovecot.org/releases/"
> - (version-major+minor version) "/"
> - "dovecot-" version ".tar.gz"))
> + (version-major+minor version)
> + "/"
> + "dovecot-"
> + version
> + ".tar.gz"))

This is not readable :/

Toggle quote (82 lines)
> (sha256
> (base32 "0bah6rn5ihczai8q50p6pqxwj73j21smib89ycp7q8qwly9i1c85"))
> - (patches
> - (search-patches "dovecot-bootstrap-cross-compile.patch"
> - "dovecot-opensslv3.patch"))
> + (patches (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 autoconf automake gettext-minimal libtool pkg-config))
> - (inputs
> - (list bzip2
> - icu4c
> - libsodium ; extra password algorithms
> - libstemmer
> - libunwind
> - linux-pam
> - lz4
> - openssl
> - sqlite
> - zlib
> - `(,zstd "lib")))
> + (native-inputs (list autoconf automake gettext-minimal libtool pkg-config))
> + (inputs (list bzip2
> + icu4c
> + libsodium ;extra password algorithms
> + libstemmer
> + libunwind
> + linux-pam
> + lz4
> + openssl
> + sqlite
> + zlib
> + `(,zstd "lib")))
> (arguments
> - `(#:configure-flags '("--sysconfdir=/etc"
> - "--localstatedir=/var"
> - "--with-sqlite") ; not auto-detected
> + `(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var"
> + "--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.
> #:make-flags (list "LDFLAGS=-rdynamic")
> - #:phases
> - (modify-phases %standard-phases
> - (add-after 'unpack 'patch-file-names
> - (lambda _
> - (substitute* "src/lib-program-client/test-program-client-local.c"
> - (("(/bin/| )cat") (which "cat"))
> - (("/bin/echo") (which "echo"))
> - (("/bin/false") (which "false"))
> - (("/bin/sh") (which "bash"))
> - (("head") (which "head"))
> - (("sleep") (which "sleep")))
> - (substitute* (list "src/lib-smtp/test-bin/sendmail-exit-1.sh"
> - "src/lib-smtp/test-bin/sendmail-success.sh")
> - (("cat") (which "cat")))))
> - (replace 'install
> - (lambda* (#:key make-flags #:allow-other-keys)
> - ;; Simple hack to avoid installing a trivial README in /etc.
> - (apply invoke "make" "install" "sysconfdir=/tmp/bogus"
> - make-flags))))))
> + #:phases (modify-phases %standard-phases
> + (add-after 'unpack 'patch-file-names
> + (lambda _
> + (substitute* "src/lib-program-client/test-program-client-local.c"
> + (("(/bin/| )cat")
> + (which "cat"))
> + (("/bin/echo")
> + (which "echo"))
> + (("/bin/false")
> + (which "false"))
> + (("/bin/sh")
> + (which "bash"))
> + (("head")
> + (which "head"))
> + (("sleep")
> + (which "sleep")))

Same here, the previous version was more readable.

Toggle quote (13 lines)
> + (substitute* (list
> + "src/lib-smtp/test-bin/sendmail-exit-1.sh"
> + "src/lib-smtp/test-bin/sendmail-success.sh")
> + (("cat")
> + (which "cat")))))
> + (replace 'install
> + (lambda* (#:key make-flags #:allow-other-keys)
> + ;; Simple hack to avoid installing a trivial README in /etc.
> + (apply invoke "make" "install" "sysconfdir=/tmp/bogus"
> + make-flags))))))
> (home-page "https://www.dovecot.org")
> (synopsis "Secure POP3/IMAP server")
> (description
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 68541@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 68541
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch