head	1.1;
access;
symbols
	pkgsrc-2026Q2:1.1.0.36
	pkgsrc-2026Q2-base:1.1
	pkgsrc-2026Q1:1.1.0.34
	pkgsrc-2026Q1-base:1.1
	pkgsrc-2025Q4:1.1.0.32
	pkgsrc-2025Q4-base:1.1
	pkgsrc-2025Q3:1.1.0.30
	pkgsrc-2025Q3-base:1.1
	pkgsrc-2025Q2:1.1.0.28
	pkgsrc-2025Q2-base:1.1
	pkgsrc-2025Q1:1.1.0.26
	pkgsrc-2025Q1-base:1.1
	pkgsrc-2024Q4:1.1.0.24
	pkgsrc-2024Q4-base:1.1
	pkgsrc-2024Q3:1.1.0.22
	pkgsrc-2024Q3-base:1.1
	pkgsrc-2024Q2:1.1.0.20
	pkgsrc-2024Q2-base:1.1
	pkgsrc-2024Q1:1.1.0.18
	pkgsrc-2024Q1-base:1.1
	pkgsrc-2023Q4:1.1.0.16
	pkgsrc-2023Q4-base:1.1
	pkgsrc-2023Q3:1.1.0.14
	pkgsrc-2023Q3-base:1.1
	pkgsrc-2023Q2:1.1.0.12
	pkgsrc-2023Q2-base:1.1
	pkgsrc-2023Q1:1.1.0.10
	pkgsrc-2023Q1-base:1.1
	pkgsrc-2022Q4:1.1.0.8
	pkgsrc-2022Q4-base:1.1
	pkgsrc-2022Q3:1.1.0.6
	pkgsrc-2022Q3-base:1.1
	pkgsrc-2022Q2:1.1.0.4
	pkgsrc-2022Q2-base:1.1
	pkgsrc-2022Q1:1.1.0.2
	pkgsrc-2022Q1-base:1.1;
locks; strict;
comment	@# @;


1.1
date	2022.03.14.11.17.22;	author nikita;	state Exp;
branches;
next	;
commitid	8HZRCAAwdWTAVawD;


desc
@@


1.1
log
@guile-haunt: Update to 2.6
@
text
@$NetBSD$

From upstream ab0b722b0719e3370a21359e4d511af9c4f14e60
and 1a91f3d0568fc095d8b0875c6553ef15b76efa4c by the upstream developer.
Do not compile or load inotify module when inotify is not available.

--- haunt/ui/serve.scm.orig	2022-03-14 12:07:00.344862709 +0100
+++ haunt/ui/serve.scm	2022-03-14 12:09:45.775494633 +0100
@@@@ -30,7 +30,6 @@@@
   #:use-module (ice-9 ftw)
   #:use-module (ice-9 threads)
   #:use-module (haunt config)
-  #:use-module (haunt inotify)
   #:use-module (haunt serve web-server)
   #:use-module (haunt site)
   #:use-module (haunt ui)
@@@@ -90,6 +89,21 @@@@
 
 ;; TODO: Detect new directories and watch them, too.
 (define (watch/linux config-file check-dir? check-file?)
+  ;; Lazy load inotify module.  Requiring the module in the
+  ;; define-module definition would cause crashes on non-Linux
+  ;; platforms where the FFI cannot bind to inotify functions.
+  (define inotify-module (resolve-module '(haunt inotify)))
+  (define make-inotify (module-ref inotify-module 'make-inotify))
+  (define inotify-add-watch! (module-ref inotify-module 'inotify-add-watch!))
+  (define inotify-pending-events?
+    (module-ref inotify-module 'inotify-pending-events?))
+  (define inotify-read-event (module-ref inotify-module 'inotify-read-event))
+  (define inotify-watch-file-name
+    (module-ref inotify-module 'inotify-watch-file-name))
+  (define inotify-event-watch (module-ref inotify-module 'inotify-event-watch))
+  (define inotify-event-file-name
+    (module-ref inotify-module 'inotify-event-file-name))
+  (define inotify-event-type (module-ref inotify-module 'inotify-event-type))
   (let ((inotify (make-inotify)))
     (define (no-op name stat result) result)
     (define (watch-directory name stat result)
@
