fix(guile): preserve gnutls init in final static guile wrapper

This commit is contained in:
vxtls 2026-03-08 22:43:54 -04:00
parent 66a66651b8
commit 6b8aa73507
8 changed files with 104 additions and 6 deletions

View file

@ -28,3 +28,21 @@ src_compile() {
src_install() {
default_src_install
}
src_postprocess() {
local guile_site_path guile_core_site guile_site_ccache guile_core_ccache
default_src_postprocess
guile_site_path="${DESTDIR}${PREFIX}/share/guile/site/3.0"
guile_core_site="${PREFIX}/share/guile/3.0"
guile_site_ccache="${DESTDIR}${LIBDIR}/guile/3.0/site-ccache"
guile_core_ccache="${LIBDIR}/guile/3.0/ccache"
PATH="${DESTDIR}${PREFIX}/bin:${PREFIX}/bin:/usr/bin:/bin" \
GUILE_LOAD_PATH="${guile_site_path}:${guile_core_site}" \
GUILE_LOAD_COMPILED_PATH="${guile_site_ccache}:${guile_core_ccache}" \
GUILE_SYSTEM_PATH="${guile_site_path}:${guile_core_site}" \
GUILE_SYSTEM_COMPILED_PATH="${guile_site_ccache}:${guile_core_ccache}" \
"${DESTDIR}${PREFIX}/bin/guile" -c '(use-modules (lzlib)) (display "lzlib-module-ok\n")'
}

View file

@ -0,0 +1,32 @@
SPDX-License-Identifier: GPL-3.0-or-later
Avoid requiring scm_gc_register_allocation to be exported from the
main Guile executable. Static Guile builds in this bootstrap do not
provide that symbol to dynamic-func, so fall back to a no-op.
--- guile-lzlib/lzlib.scm
+++ guile-lzlib/lzlib.scm
@@ -56,10 +56,15 @@
(define %liblz-handle
(delay (dynamic-link %liblz)))
-(define register-allocation
- ;; Let the GC know that an unmanaged heap allocation took place.
- (pointer->procedure void
- (dynamic-func "scm_gc_register_allocation"
- (dynamic-link))
- (list size_t)))
+(define register-allocation
+ ;; Let the GC know that an unmanaged heap allocation took place.
+ ;; Static Guile builds may not export this symbol from the main program.
+ (match (false-if-exception
+ (dynamic-func "scm_gc_register_allocation"
+ (dynamic-link)))
+ ((? pointer? proc)
+ (pointer->procedure void proc (list size_t)))
+ (#f
+ (lambda (_size)
+ #t))))
(define (lzlib-procedure ret name parameters)
"Return a procedure corresponding to C function NAME in liblz, or #f if