aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2021-12-04 20:40:46 +0300
committerLudovic Courtès <ludo@gnu.org>2021-12-04 22:45:27 +0100
commitac872546fc6a7f26870a6ab8407904c66adb0751 (patch)
tree2793c2e931fa2fec61e2f92b0b08d2fdd8509cd3 /gnu
parentf044ffc1c4bab326e310ef742d21900d3f66d071 (diff)
downloadguix-ac872546fc6a7f26870a6ab8407904c66adb0751.tar
guix-ac872546fc6a7f26870a6ab8407904c66adb0751.tar.gz
gnu: Add guile-smc
* gnu/packages/guile-xyz.scm (guile-smc): New variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/guile-xyz.scm88
1 files changed, 88 insertions, 0 deletions
diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index cbc3ffa595..508b4b44d5 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -58,6 +58,7 @@
(define-module (gnu packages guile-xyz)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (gnu packages)
+ #:use-module (gnu packages admin)
#:use-module (gnu packages algebra)
#:use-module (gnu packages aspell)
#:use-module (gnu packages autotools)
@@ -4856,3 +4857,90 @@ high-level API for network management that uses rtnetlink.")
as well as the @samp{gitlab-cli} command line tool for interacting with a
GitLab instance.")
(license license:gpl3)))
+
+(define-public guile-smc
+ (package
+ (name "guile-smc")
+ (version "0.3.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/artyom-poptsov/guile-smc")
+ (commit (string-append "v" version))))
+ (file-name (string-append name "-" version))
+ (sha256
+ (base32
+ "0szkjmasi70m1vppck7nhdxg4lnxzjq6mihi6r1552s8sxm5z008"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
+ #:modules (((guix build guile-build-system)
+ #:select (target-guile-effective-version))
+ ,@%gnu-build-system-modules)
+ #:imported-modules ((guix build guile-build-system)
+ ,@%gnu-build-system-modules)
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'strip)
+ (add-after 'configure 'patch
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute* "modules/smc/core/log.scm"
+ ((" #:use-module \\(logging logger\\)")
+ (string-append
+ " #:use-module (logging logger)\n"
+ " #:use-module (logging rotating-log)"))
+ (("#:init-value \"logger\"")
+ (format #f
+ "#:init-value \"~a/bin/logger\""
+ (assoc-ref inputs "inetutils")))
+ (("\\(add-handler! %logger %syslog\\)")
+ (string-append
+ "(add-handler! %logger\n"
+ " (make <rotating-log>\n"
+ " #:file-name \"smc.log\"))\n")))
+ #t))
+ (add-after 'install 'wrap-program
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin"))
+ (guile-lib (assoc-ref inputs "guile-lib"))
+ (version (target-guile-effective-version))
+ (scm (string-append "/share/guile/site/"
+ version))
+ (go (string-append "/lib/guile/"
+ version "/site-ccache")))
+ (wrap-program (string-append bin "/smc")
+ `("GUILE_LOAD_PATH" prefix
+ (,(string-append out scm)
+ ,(string-append guile-lib scm)))
+ `("GUILE_LOAD_COMPILED_PATH" prefix
+ (,(string-append out go)
+ ,(string-append guile-lib go)))))
+ #t)))))
+ (native-inputs
+ `(("autoconf" ,autoconf)
+ ("automake" ,automake)
+ ("pkg-config" ,pkg-config)
+ ("texinfo" ,texinfo)))
+ (inputs
+ `(("bash" ,bash-minimal)
+ ("guile" ,guile-3.0)
+ ("guile-lib" ,guile-lib)
+ ("inetutils" ,inetutils)))
+ (home-page "https://github.com/artyom-poptsov/guile-smc")
+ (synopsis "GNU Guile state machine compiler")
+ (description
+ "Guile-SMC is a state machine compiler that allows users to describe
+finite state machines (FSMs) in Scheme in terms of transition tables. It is
+capable to generate such transition tables from a @url{https://plantuml.com/,
+PlantUML} state diagrams.
+
+A transition table can be verified and checked for dead-ends and infinite
+loops. Also Guile-SMC FSMs gather statistics when they run.
+
+Guile-SMC comes with a Scheme program called @command{smc} -- a state machine
+compiler itself. It produces a Scheme code for an FSM from the PlantUML
+format. This tool is meant to be called on a PlantUML file when a program
+with a FSM is being built (for example, from a Makefile.)")
+ (license license:gpl3)))