fix(guile): validate guile-gcrypt before guix configure, fix

This commit is contained in:
vxtls 2026-03-05 19:36:20 -05:00
parent 442e3a2109
commit 079b6fddac
3 changed files with 37 additions and 4 deletions

View file

@ -8,20 +8,22 @@ src_prepare() {
src_configure() {
local host_triplet pkg_config_path
host_triplet="$(gcc -dumpmachine)"
pkg_config_path="${LIBDIR}/pkgconfig"
pkg_config_path="${LIBDIR}/pkgconfig:${PREFIX}/lib/pkgconfig:${PREFIX}/share/pkgconfig"
mkdir -p build
cd build
PATH="${PREFIX}/bin:/usr/bin:/bin" \
PKG_CONFIG="/usr/bin/pkg-config" \
PKG_CONFIG_LIBDIR="${pkg_config_path}" \
PKG_CONFIG_PATH="${pkg_config_path}" \
LD_LIBRARY_PATH="${LIBDIR}:${LD_LIBRARY_PATH}" \
LD_LIBRARY_PATH="${LIBDIR}:${PREFIX}/lib:${LD_LIBRARY_PATH}" \
../configure \
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--host="${host_triplet}" \
--build="${host_triplet}" \
--with-libgcrypt-prefix="${PREFIX}" \
--with-libgcrypt-libdir="${LIBDIR}"
}
@ -32,3 +34,21 @@ 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

@ -79,7 +79,7 @@ src_prepare() {
probe_guile_module() {
local module_name debug_log
local guile_site_path guile_site_ccache guile_core_ccache guile_ext_path
local pkg_config_path probe_label probe_pkg_config
local pkg_config_path probe_label probe_pkg_config probe_expression
local find_name find_module
module_name="$1"
@ -96,18 +96,28 @@ probe_guile_module() {
probe_pkg_config="libgit2"
find_name='libguile-git*'
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"
find_name='libguile-gnutls*'
find_module='gnutls'
probe_expression="(use-modules (gnutls)) (display \"gnutls-module-ok\\n\")"
;;
*)
probe_label="${module_name}-related"
probe_pkg_config=""
find_name="*${module_name}*"
find_module="${module_name}"
probe_expression="(use-modules (${module_name})) (display \"${module_name}-module-ok\\n\")"
;;
esac
@ -140,7 +150,7 @@ probe_guile_module() {
GUILE_SYSTEM_COMPILED_PATH="${guile_site_ccache}:${guile_core_ccache}" \
GUILE_EXTENSIONS_PATH="${guile_ext_path}" \
GNUTLS_GUILE_EXTENSION_DIR="${guile_ext_path}" \
"${PREFIX}/bin/guile" -c "(use-modules (${module_name})) (display \"${module_name}-module-ok\\n\")" \
"${PREFIX}/bin/guile" -c "${probe_expression}" \
>"${debug_log}" 2>&1; then
echo "guix: explicit (${module_name}) probe failed; raw Guile output follows:" >&2
cat "${debug_log}" >&2 || true
@ -162,6 +172,7 @@ 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

@ -14,6 +14,8 @@ src_configure() {
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
--includedir="${PREFIX}/include" \
--enable-shared \
--enable-static \
--host="${host_triplet}" \
--build="${host_triplet}"
}