From 1ebc702923d4398652e684960cfbb8b026e895c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 30 Jan 2022 23:11:06 +0100 Subject: gnu: Add Lokke. * gnu/packages/guile.scm (guile-3.0-for-lokke): New variable. * gnu/packages/guile-xyz.scm (lokke): New variable. * gnu/packages/patches/guile-3.0.7-psyntax-nil.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/guile-xyz.scm | 48 ++++++++++++++++- gnu/packages/guile.scm | 11 ++++ gnu/packages/patches/guile-3.0.7-psyntax-nil.patch | 63 ++++++++++++++++++++++ 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/guile-3.0.7-psyntax-nil.patch diff --git a/gnu/local.mk b/gnu/local.mk index fc1cd93fb2..1788c4e110 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1228,6 +1228,7 @@ dist_patch_DATA = \ %D%/packages/patches/guile-3.0-relocatable.patch \ %D%/packages/patches/guile-linux-syscalls.patch \ %D%/packages/patches/guile-3.0-linux-syscalls.patch \ + %D%/packages/patches/guile-3.0.7-psyntax-nil.patch \ %D%/packages/patches/guile-fibers-destroy-peer-schedulers.patch \ %D%/packages/patches/guile-gdbm-ffi-support-gdbm-1.14.patch \ %D%/packages/patches/guile-git-adjust-for-libgit2-1.2.0.patch \ diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm index 5b485b0a4a..38c6def1fc 100644 --- a/gnu/packages/guile-xyz.scm +++ b/gnu/packages/guile-xyz.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès +;;; Copyright © 2012-2022 Ludovic Courtès ;;; Copyright © 2014, 2015, 2018 Mark H Weaver ;;; Copyright © 2015, 2017 Christine Lemmer-Webber ;;; Copyright © 2016 Alex Sassmannshausen @@ -97,6 +97,7 @@ #:use-module (gnu packages nss) #:use-module (gnu packages package-management) #:use-module (gnu packages password-utils) + #:use-module (gnu packages pcre) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) @@ -4924,3 +4925,48 @@ features a parser to parse and serialize GraphQL documents, a type system to create GraphQL schemas, an execution engine to execute GraphQL queries, and a HTTP handler to implement a HTTP GraphQL endpoint.") (license license:agpl3+))) + +(define-public lokke + (let ((commit "92d36370dc6d218ff3bf315e56ebef93808c1b79") + (revision "1")) + (package + (name "lokke") + (version (git-version "0.0.0" revision commit)) + (home-page "https://github.com/lokke-org/lokke") + (source (origin + (method git-fetch) + (uri (git-reference (url home-page) (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1c913md4dcfb0x4n26wbx9wdw453wxg3c5rn49k3f6j8zjqv63yv")))) + (build-system gnu-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'bootstrap 'pre-bootstrap + (lambda _ + (for-each patch-shebang + '("setup" "gen-makefile" + "dev/gen-module-paths" + "dev/refresh")) + (invoke "./setup"))) + (add-before 'build 'set-home + (lambda _ + (setenv "HOME" (getcwd))))))) + (native-inputs + (list autoconf + automake + libtool + gnu-gettext + pkg-config + guile-3.0-for-lokke)) + (inputs + (list pcre2)) + (synopsis "Clojure implementation in Guile") + (description + "Lokke intends to provide a full dialect of Clojure for Guile. It also +consists of a set of Guile modules providing some of Clojure's functionality +in two different guises.") + ;; Dual license: LGPLv2.1+ or EPLv1.0+ at the user's option. + (license (list license:lgpl2.1+ license:epl1.0))))) diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm index 6cfd609916..7597845dd6 100644 --- a/gnu/packages/guile.scm +++ b/gnu/packages/guile.scm @@ -391,6 +391,17 @@ without requiring the source code to be rewritten.") (define-public guile-3.0-latest guile-3.0) +(define-public guile-3.0-for-lokke + ;; Work around a bug in 3.0.7 regarding #nil handling by psyntax: + ;; . TODO: Replace by 3.0.8 when it's out. + (hidden-package + (package/inherit guile-3.0 + (version (string-append (package-version guile-3.0) ".1")) + (source (origin + (inherit (package-source guile-3.0)) + (patches (cons (search-patch "guile-3.0.7-psyntax-nil.patch") + (origin-patches (package-source guile-3.0))))))))) + (define-public guile-3.0/libgc-7 ;; Using libgc-7 avoid crashes that can occur, particularly when loading ;; data in to the Guix Data Service: diff --git a/gnu/packages/patches/guile-3.0.7-psyntax-nil.patch b/gnu/packages/patches/guile-3.0.7-psyntax-nil.patch new file mode 100644 index 0000000000..7a24e6e9ef --- /dev/null +++ b/gnu/packages/patches/guile-3.0.7-psyntax-nil.patch @@ -0,0 +1,63 @@ +commit d79a226359d28f4a1dc5df136e5544d699903a96 +Author: Rob Browning +Date: Sat Jul 3 14:01:12 2021 -0500 + + Fix crash on #nil in syntaxes + + In 3.0.7 (after 0cc799185576712d69f11fc794454f2f5447bef7 "Ensure + that (syntax ()) results in ("), the use of #nil in syntax-rules + expansions like this: + + (define-syntax foo + (syntax-rules () + ((_ x) (eq? #nil x)))) + + (foo #t) + + could cause a crash that looks like this: + + ice-9/psyntax.scm:2795:12: In procedure syntax-violation: + Syntax error: + unknown location: unexpected syntax in form () + + To fix it, add another special case (the commit mentioned above + special-cased the empty list) to preserve #nil + + * module/ice-9/psyntax.scm (gen-syntax): Preserve #nil. + * test-suite/tests/syntax.test: Test #nil in syntax expansions. + + Closes: 49305 + +diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm +index 663d9275a..bd4bd6723 100644 +--- a/module/ice-9/psyntax.scm ++++ b/module/ice-9/psyntax.scm +@@ -2157,6 +2157,7 @@ + (lambda () + (gen-syntax src #'(e1 e2 ...) r maps ellipsis? mod)) + (lambda (e maps) (values (gen-vector e) maps)))) ++ (x (eq? (syntax->datum #'x) #nil) (values '(quote #nil) maps)) + (() (values '(quote ()) maps)) + (_ (values `(quote ,e) maps)))))) + +diff --git a/test-suite/tests/syntax.test b/test-suite/tests/syntax.test +index a2999ac43..510e7104d 100644 +--- a/test-suite/tests/syntax.test ++++ b/test-suite/tests/syntax.test +@@ -1684,6 +1684,16 @@ + (hash interpreted most-positive-fixnum) + (hash compiled most-positive-fixnum)))) + ++(with-test-prefix "#nil in syntaxes" ++ (pass-if-equal "does not crash" ++ 42 ++ (let () ++ (define-syntax foo ++ (syntax-rules () ++ ;; In 3.0.7 this would crash with ++ ;; unknown location: unexpected syntax in form () ++ ((_ x) (when (eq? x #nil) 42)))) ++ (foo #nil)))) + + ;;; Local Variables: + ;;; eval: (put 'pass-if-syntax-error 'scheme-indent-function 1) -- cgit v1.2.3