gnu: cyrus-sasl: Fix time.h check.

This is needed for cross-compiling.

* gnu/packages/patches/cyrus-sasl-fix-time-h.patch: New file.
* gnu/packages/cyrus-sasl.scm (dist_patch_DATA): Register it.
* gnu/packages/cyrus-sasl.scm (cyrus-sasl)[source]: Use the patch.
[native-inputs]: Add autoconf, automake and libtool.
[arguments]<#:phases>{autoreconf}: New phase.

Change-Id: I46e3801d50758f79df0447dd3bd483b427277e12
Signed-off-by: Andreas Enge <andreas@enge.fr>
This commit is contained in:
aragaer 2025-04-30 17:35:43 +03:00 committed by Andreas Enge
parent 443e22f44a
commit 940ac8eb62
No known key found for this signature in database
GPG key ID: F7D5C9BF765C61E3
3 changed files with 68 additions and 2 deletions

View file

@ -1161,6 +1161,7 @@ dist_patch_DATA = \
%D%/packages/patches/curlftpfs-fix-no_verify_hostname.patch \
%D%/packages/patches/cursynth-wave-rand.patch \
%D%/packages/patches/cvs-CVE-2017-12836.patch \
%D%/packages/patches/cyrus-sasl-fix-time-h.patch \
%D%/packages/patches/d-feet-drop-unused-meson-argument.patch \
%D%/packages/patches/daemontools-gcc14.patch \
%D%/packages/patches/dante-non-darwin.patch \

View file

@ -45,9 +45,11 @@
"/cyrus-sasl-" version ".tar.gz"))
(sha256
(base32
"135kbgyfpa1mwqp5dm223yr6ddzi4vjm7cr414d7rmhys2mwdkvw"))))
"135kbgyfpa1mwqp5dm223yr6ddzi4vjm7cr414d7rmhys2mwdkvw"))
(patches (search-patches "cyrus-sasl-fix-time-h.patch"))))
(build-system gnu-build-system)
(inputs (list gdbm libxcrypt mit-krb5 openssl))
(native-inputs (list autoconf automake libtool))
(arguments
(list
#:configure-flags #~(list (string-append
@ -62,7 +64,11 @@
#$@(if (%current-target-system)
'("ac_cv_gssapi_supports_spnego=yes")
'()))
#:phases
#~(modify-phases %standard-phases
(add-before 'configure 'autoreconf
(lambda _
(invoke "autoreconf" "-vfi"))))
;; The 'plugins' directory has shared source files, such as
;; 'plugin_common.c'. When building the shared libraries there, libtool
;; ends up doing "ln -s plugin_common.lo plugin_common.o", which can

View file

@ -0,0 +1,59 @@
Patch applied upstream afer the 2.1.28 release.
From 266f0acf7f5e029afbb3e263437039e50cd6c262 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 23 Feb 2022 00:45:15 +0000
Subject: [PATCH] Fix <time.h> check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We're conditionally including based on HAVE_TIME_H in a bunch of places,
but we're not actually checking for time.h, so that's never going to be defined.
While at it, add in a missing include in the cram plugin.
This fixes a bunch of implicit declaration warnings:
```
* cyrus-sasl-2.1.28/lib/saslutil.c:280:3: warning: implicit declaration of function time [-Wimplicit-function-declaration]
* cyrus-sasl-2.1.28/lib/saslutil.c:364:41: warning: implicit declaration of function clock [-Wimplicit-function-declaration]
* cyrus-sasl-2.1.28/plugins/cram.c:132:7: warning: implicit declaration of function time [-Wimplicit-function-declaration]
* cyrus-sasl-2.1.28/lib/saslutil.c:280:3: warning: implicit declaration of function time [-Wimplicit-function-declaration]
* cyrus-sasl-2.1.28/lib/saslutil.c:364:41: warning: implicit declaration of function clock [-Wimplicit-function-declaration]
* cyrus-sasl-2.1.28/plugins/cram.c:132:7: warning: implicit declaration of function time [-Wimplicit-function-declaration]
```
Signed-off-by: Sam James <sam@gentoo.org>
---
configure.ac | 2 +-
plugins/cram.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index e1bf53b6..ad781830 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1290,7 +1290,7 @@ AC_CHECK_HEADERS_ONCE([sys/time.h])
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h krb5.h)
+AC_CHECK_HEADERS(crypt.h des.h dlfcn.h fcntl.h limits.h malloc.h paths.h strings.h sys/file.h sys/time.h syslog.h time.h unistd.h inttypes.h sys/uio.h sys/param.h sysexits.h stdarg.h varargs.h krb5.h)
IPv6_CHECK_SS_FAMILY()
IPv6_CHECK_SA_LEN()
diff --git a/plugins/cram.c b/plugins/cram.c
index d02e9baa..695aaa91 100644
--- a/plugins/cram.c
+++ b/plugins/cram.c
@@ -53,6 +53,10 @@
#endif
#include <fcntl.h>
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
#include <sasl.h>
#include <saslplug.h>
#include <saslutil.h>