guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[shepherd] 06/32: build: Drop support for Guile 2.0.


From: Ludovic Courtès
Subject: [shepherd] 06/32: build: Drop support for Guile 2.0.
Date: Wed, 30 Mar 2022 11:01:27 -0400 (EDT)

civodul pushed a commit to branch master
in repository shepherd.

commit 3edbcaedbe4c456097a46a6214ddd249b014b0cf
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Mar 21 10:17:41 2022 +0100

    build: Drop support for Guile 2.0.
    
    * configure.ac: Drop Guile 2.0 support.
    * modules/shepherd/support.scm (if-2.0): Remove.
    (buffering-mode): Remove 'if-2.0' uses.
    (initialize-cli): Likewise.
    * modules/shepherd/system.scm.in (%set-automatic-finalization-enabled?!):
    (without-automatic-finalization): Define unconditionally; remove
    2.0-specific 'cond-expand' branch.
---
 configure.ac                   |  8 ++---
 modules/shepherd/support.scm   | 19 ++---------
 modules/shepherd/system.scm.in | 73 ++++++++++++++----------------------------
 3 files changed, 29 insertions(+), 71 deletions(-)

diff --git a/configure.ac b/configure.ac
index 317e2e4..ac6493d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,17 +21,13 @@ AC_CANONICAL_HOST
 AC_PROG_MKDIR_P
 AC_PROG_SED
 
-dnl Check for Guile 2.x+.
+dnl Check for Guile 2.2+.
 m4_pattern_forbid([^GUILE_PKG$])
-GUILE_PKG([3.0 2.2 2.0])
+GUILE_PKG([3.0 2.2])
 
 dnl Checks for programs.
 GUILE_PROGS
 
-if test "x$GUILE_EFFECTIVE_VERSION" = "x2.0"; then
-  PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.13])
-fi
-
 guilemoduledir="${datarootdir}/guile/site/$GUILE_EFFECTIVE_VERSION"
 guileobjectdir="${libdir}/guile/$GUILE_EFFECTIVE_VERSION/site-ccache"
 AC_SUBST([guilemoduledir])
diff --git a/modules/shepherd/support.scm b/modules/shepherd/support.scm
index 8dc7ecb..57e96fe 100644
--- a/modules/shepherd/support.scm
+++ b/modules/shepherd/support.scm
@@ -66,22 +66,13 @@
 
             verify-dir))
 
-(define-syntax-rule (if-2.0 subsequent alternate)
-  "Expand to SUBSEQUENT when using Guile 2.0, and to ALTERNATE otherwise."
-  (cond-expand
-    ((and guile-2 (not guile-2.2)) subsequent)
-    (else alternate)))
-
 (define-syntax buffering-mode
   (syntax-rules (line block none)
     "Return the appropriate buffering mode depending on whether we're on Guile
 2.0 or later."
-    ((_ line)
-     (if-2.0 _IOLBF 'line))
-    ((_ block)
-     (if-2.0 _IOFBF 'block))
-    ((_ none)
-     (if-2.0 _IONBF 'none))))
+    ((_ line) 'line)
+    ((_ block) 'block)
+    ((_ none) 'none)))
 
 ;; Report the caught error.
 ;; FIXME: Needs some more work.
@@ -209,10 +200,6 @@ output port, and PROC's result is returned."
   (unless (getenv "GUILE_WARN_DEPRECATED")
     (debug-disable 'warn-deprecated))
 
-  ;; In Guile 2.2+, the locale is installed by default.
-  (if-2.0 (false-if-exception (setlocale LC_ALL ""))
-          #t)
-
   (bindtextdomain %gettext-domain %localedir)
   (textdomain %gettext-domain)
   (setvbuf (current-output-port) (buffering-mode line))
diff --git a/modules/shepherd/system.scm.in b/modules/shepherd/system.scm.in
index d606573..2562764 100644
--- a/modules/shepherd/system.scm.in
+++ b/modules/shepherd/system.scm.in
@@ -1,5 +1,5 @@
 ;; system.scm -- Low-level operating system interface.
-;; Copyright (C) 2013, 2014, 2016, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
+;; Copyright (C) 2013-2014, 2016, 2018, 2020, 2022 Ludovic Courtès 
<ludo@gnu.org>
 ;; Copyright (C) 2018 Carlo Zancanaro <carlo@zancanaro.id.au>
 ;; Copyright (C) 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;
@@ -251,53 +251,28 @@ current thread."
 ;;; Guile shenanigans.
 ;;;
 
-(cond-expand
-  (guile-2.2
-   (define %set-automatic-finalization-enabled?!
-     ;; When using a statically-linked Guile, for instance in the initrd, we
-     ;; cannot resolve this symbol, but most of the time we don't need it
-     ;; anyway.  Thus, delay it.
-     (let ((proc (delay
-                   (pointer->procedure int
-                                       (dynamic-func
-                                        
"scm_set_automatic_finalization_enabled"
-                                        (dynamic-link))
-                                       (list int)))))
-       (lambda (enabled?)
-         "Switch on or off automatic finalization in a separate thread.
+(define %set-automatic-finalization-enabled?!
+  ;; When using a statically-linked Guile, for instance in the initrd, we
+  ;; cannot resolve this symbol, but most of the time we don't need it
+  ;; anyway.  Thus, delay it.
+  (let ((proc (delay
+                (pointer->procedure int
+                                    (dynamic-func
+                                     "scm_set_automatic_finalization_enabled"
+                                     (dynamic-link))
+                                    (list int)))))
+    (lambda (enabled?)
+      "Switch on or off automatic finalization in a separate thread.
 Turning finalization off shuts down the finalization thread as a side effect."
-         (->bool ((force proc) (if enabled? 1 0))))))
-
-   (define-syntax-rule (without-automatic-finalization exp ...)
-     "Turn off automatic finalization within the dynamic extent of EXP."
-     (let ((enabled? #t))
-       (dynamic-wind
-         (lambda ()
-           (set! enabled? (%set-automatic-finalization-enabled?! #f)))
-         (lambda ()
-           exp ...)
-         (lambda ()
-           (%set-automatic-finalization-enabled?! enabled?))))))
-
-  (else
-   (define-syntax-rule (without-automatic-finalization exp ...)
-     ;; Nothing to do here: Guile 2.0 does not have a separate finalization
-     ;; thread.
-     (begin exp ...))))
-
-(cond-expand
-  ((and guile-2 (not guile-2.2))
-   ;; On Guile 2.0, 'select' throws upon EINTR or EAGAIN.  The trick below
-   ;; enables the sane behavior found on 2.2/3.0.
-   (set! select
-     (let ((real-select select))
-       (lambda args
-         (catch 'system-error
-           (lambda ()
-             (apply real-select args))
-           (lambda args
-             (if (memv (system-error-errno args) (list EINTR EAGAIN))
-                 '(() () ())
-                 (apply throw args))))))))
-  (else #t))
+      (->bool ((force proc) (if enabled? 1 0))))))
 
+(define-syntax-rule (without-automatic-finalization exp ...)
+  "Turn off automatic finalization within the dynamic extent of EXP."
+  (let ((enabled? #t))
+    (dynamic-wind
+      (lambda ()
+        (set! enabled? (%set-automatic-finalization-enabled?! #f)))
+      (lambda ()
+        exp ...)
+      (lambda ()
+        (%set-automatic-finalization-enabled?! enabled?)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]