fix(guix): avoid broken guile-gcrypt sha256 configure probe

This commit is contained in:
vxtls 2026-03-05 21:09:24 -05:00
parent 079b6fddac
commit 913ebb3ba8
3 changed files with 47 additions and 26 deletions

View file

@ -34,21 +34,3 @@ src_compile() {
src_install() {
default_src_install
}
src_postprocess() {
local guile_site_path guile_site_ccache guile_core_ccache
default_src_postprocess
guile_site_path="${DESTDIR}${PREFIX}/share/guile/site/3.0:${PREFIX}/share/guile/site/3.0:${PREFIX}/share/guile/3.0"
guile_site_ccache="${DESTDIR}${LIBDIR}/guile/3.0/site-ccache:${LIBDIR}/guile/3.0/site-ccache"
guile_core_ccache="${LIBDIR}/guile/3.0/ccache"
PATH="${PREFIX}/bin:/usr/bin:/bin" \
LD_LIBRARY_PATH="${DESTDIR}${LIBDIR}:${DESTDIR}${PREFIX}/lib:${LIBDIR}:${PREFIX}/lib:${LD_LIBRARY_PATH}" \
GUILE_LOAD_PATH="${guile_site_path}" \
GUILE_LOAD_COMPILED_PATH="${guile_site_ccache}:${guile_core_ccache}" \
GUILE_SYSTEM_PATH="${guile_site_path}" \
GUILE_SYSTEM_COMPILED_PATH="${guile_site_ccache}:${guile_core_ccache}" \
"${DESTDIR}${PREFIX}/bin/guile" -c "(use-modules (gcrypt hash)) (unless (equal? (hash-algorithm sha256) (lookup-hash-algorithm 'sha256)) (error \"guile-gcrypt sha256 lookup mismatch\")) (display \"gcrypt-module-ok\n\")"
}

View file

@ -98,13 +98,6 @@ probe_guile_module() {
find_module='git'
probe_expression="(use-modules (git)) (display \"git-module-ok\\n\")"
;;
gcrypt)
probe_label="gcrypt-related"
probe_pkg_config="libgcrypt"
find_name='*gcrypt*'
find_module='gcrypt'
probe_expression="(use-modules (gcrypt hash)) (unless (equal? (hash-algorithm sha256) (lookup-hash-algorithm 'sha256)) (error \"guile-gcrypt sha256 lookup mismatch\")) (display \"gcrypt-module-ok\\n\")"
;;
gnutls)
probe_label="gnutls-related"
probe_pkg_config="gnutls"
@ -172,7 +165,6 @@ src_configure() {
guile_libs="$(PKG_CONFIG_LIBDIR="${pkg_config_path}" PKG_CONFIG_PATH="${pkg_config_path}" \
/usr/bin/pkg-config --libs guile-3.0)"
probe_guile_module gcrypt
probe_guile_module gnutls
probe_guile_module git

View file

@ -0,0 +1,47 @@
--- guix-1.5.0/m4/guix.m4
+++ guix-1.5.0/m4/guix.m4
@@ -206,9 +206,17 @@
AC_CACHE_CHECK([whether Guile-Gcrypt is available and recent enough],
[guix_cv_have_recent_guile_gcrypt],
[GUILE_CHECK([retval],
- [(use-modules (gcrypt hash))
- (equal? (hash-algorithm sha256)
- (lookup-hash-algorithm 'sha256))])
+ [(eval-when (expand load eval)
+ (use-modules (gcrypt hash)
+ (rnrs bytevectors)))
+ (let ((algorithm (lookup-hash-algorithm 'sha256)))
+ (and algorithm
+ (eq? 'sha256 (hash-algorithm-name algorithm))
+ (= 32 (hash-size algorithm))
+ (bytevector=?
+ (sha256 #vu8(97 98 99))
+ #vu8(186 120 22 191 143 1 207 234
+ 65 65 64 222 93 174 34 35
+ 176 3 97 163 150 23 122 156
+ 180 16 255 97 242 0 21 173))))])
if test "$retval" = 0; then
guix_cv_have_recent_guile_gcrypt="yes"
else
--- guix-1.5.0/configure
+++ guix-1.5.0/configure
@@ -8378,7 +8378,15 @@
- $GUILE -c "(use-modules (gcrypt hash))
- (equal? (hash-algorithm sha256)
- (lookup-hash-algorithm 'sha256))" > /dev/null 2>&1
+ $GUILE -c "(eval-when (expand load eval)
+ (use-modules (gcrypt hash)
+ (rnrs bytevectors)))
+ (let ((algorithm (lookup-hash-algorithm 'sha256)))
+ (and algorithm
+ (eq? 'sha256 (hash-algorithm-name algorithm))
+ (= 32 (hash-size algorithm))
+ (bytevector=?
+ (sha256 #vu8(97 98 99))
+ #vu8(186 120 22 191 143 1 207 234
+ 65 65 64 222 93 174 34 35
+ 176 3 97 163 150 23 122 156
+ 180 16 255 97 242 0 21 173))))" > /dev/null 2>&1
retval=$?