[PATCH] gnu: Add stklos.

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Ramin Honary
Owner
unassigned
Submitted by
Ramin Honary
Severity
normal
R
R
Ramin Honary wrote on 24 Aug 2023 11:05
(address . guix-patches@gnu.org)
CAFhnQTTRoqarXAcfV_fKmYtSbDhUcgLOiUxuM6CT0V-WF4A5Sg@mail.gmail.com
Dear Guix Package maintainers:

I have created a Guix package for the STklos Scheme compiler. (Thanks
to Andrew Tropin for teaching me how!)

I would appreciate a code review, thank for your time!

Best regards,
-- Ramin Honary
From 465538f4b2824f49d99e4eef799f25f644a37bbc Mon Sep 17 00:00:00 2001
Message-Id: <465538f4b2824f49d99e4eef799f25f644a37bbc.1692867653.git.ramin.honary@cross-compass.com>
From: Ramin Honary <ramin.honary@cross-compass.com>
Date: Thu, 24 Aug 2023 17:57:51 +0900
Subject: [PATCH] gnu: Add stklos.

* gnu/packages/scheme.scm (stklos): New variable.
---
gnu/packages/scheme.scm | 48 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 46 insertions(+), 2 deletions(-)

Toggle diff (67 lines)
diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index c0e2e3ab48..611e0344e0 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -42,8 +42,8 @@
(define-module (gnu packages scheme)
#:use-module (gnu packages)
#:use-module ((guix licenses)
- #:select (gpl2+ lgpl2.0+ lgpl2.1 lgpl2.1+ lgpl3+ asl2.0 bsd-3
- cc-by-sa4.0 non-copyleft expat public-domain))
+ #:select (gpl2 gpl2+ lgpl2.0+ lgpl2.1 lgpl2.1+ lgpl3+ asl2.0
+ bsd-3 cc-by-sa4.0 non-copyleft expat public-domain))
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix download)
@@ -1236,3 +1236,47 @@ (define-public emacs-gerbil-mode
(description
"Gerbil mode provides font-lock, indentation, navigation, and REPL for
Gerbil code within Emacs.")))
+
+(define-public stklos
+ (package
+ (name "stklos")
+ (version "1.70")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://stklos.net/download/stklos-"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "1iw3pgycjz3kz3jd1855v2ngf8ib2almpf8v058n1mkj1qd2b88m"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:modules `((ice-9 ftw)
+ ,@%gnu-build-system-modules)
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'configure 'patch-sh-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((bash-bin (search-input-file inputs "/bin/bash")))
+ (substitute* "configure"
+ (("/bin/sh") bash-bin)))))
+ (add-after 'configure 'patch-rm-paths
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((rm-bin (search-input-file inputs "/bin/rm")))
+ (ftw "."
+ (lambda (filename stat-info f)
+ (when (and
+ (equal? f 'regular)
+ (string=? (basename filename) "Makefile"))
+ (substitute* filename
+ (("/bin/rm") rm-bin)))
+ #t))))))))
+ (home-page "https://stklos.net")
+ (synopsis "R7RS Scheme with CLOS-like object system")
+ (description
+ "STklos is a free Scheme system mostly compliant with the languages
+features defined in R7RS small. The aim of this implementation is to be fast
+as well as light. The implementation is based on an ad-hoc Virtual
+Machine. STklos can also be compiled as a library and embedded in an
+application.")
+ (license gpl2)))

base-commit: 160f78a4d92205df986ed9efcce7d3aac188cb24
--
2.34.1
L
L
Ludovic Courtès wrote on 14 Sep 2023 16:12
(name . Ramin Honary)(address . ramin.honary@gmail.com)(address . 65494-done@debbugs.gnu.org)
877cosc090.fsf@gnu.org
Hi Romain,

Ramin Honary <ramin.honary@gmail.com> skribis:

Toggle quote (8 lines)
> From 465538f4b2824f49d99e4eef799f25f644a37bbc Mon Sep 17 00:00:00 2001
> Message-Id: <465538f4b2824f49d99e4eef799f25f644a37bbc.1692867653.git.ramin.honary@cross-compass.com>
> From: Ramin Honary <ramin.honary@cross-compass.com>
> Date: Thu, 24 Aug 2023 17:57:51 +0900
> Subject: [PATCH] gnu: Add stklos.
>
> * gnu/packages/scheme.scm (stklos): New variable.

I went ahead and committed with the changes below. I used ‘which’
instead of ‘(search-input-file inputs …)’ because we really want the
native bash and rm here. The license is GPLv2+ because files under lib/
explicitly say “or any later version”.

Last, I noticed that the tarball comes with copies of libgc, libffi, and
PCRE. Could you send patches to “unbundle” them—i.e., add these
packages to the ‘inputs’ field and ensure the build system picks them
up?

Thanks!

Ludo’.
Toggle diff (51 lines)
diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 0165875b93..ad06d7db06 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -1242,6 +1242,7 @@ (define-public stklos
(version "1.70")
(source (origin
(method url-fetch)
+ ;; TODO: Unbundle pcre, libgc, and libffi.
(uri (string-append "https://stklos.net/download/stklos-"
version ".tar.gz"))
(sha256
@@ -1254,22 +1255,18 @@ (define-public stklos
,@%gnu-build-system-modules)
#:phases
#~(modify-phases %standard-phases
- (add-before 'configure 'patch-sh-paths
+ (add-before 'configure 'patch-sh-references
(lambda* (#:key inputs #:allow-other-keys)
- (let ((bash-bin (search-input-file inputs "/bin/bash")))
+ (let ((bash (which "bash")))
(substitute* "configure"
- (("/bin/sh") bash-bin)))))
- (add-after 'configure 'patch-rm-paths
- (lambda* (#:key inputs #:allow-other-keys)
- (let ((rm-bin (search-input-file inputs "/bin/rm")))
- (ftw "."
- (lambda (filename stat-info f)
- (when (and
- (equal? f 'regular)
- (string=? (basename filename) "Makefile"))
- (substitute* filename
- (("/bin/rm") rm-bin)))
- #t))))))))
+ (("/bin/sh") bash)))))
+ (add-after 'configure 'patch-rm-references
+ (lambda _
+ (let ((rm (which "rm")))
+ (substitute* (find-files "." "^Makefile$")
+ (("/bin/rm") rm))))))))
+ (properties
+ '((release-monitoring-url . "https://stklos.net/download.html")))
(home-page "https://stklos.net")
(synopsis "R7RS Scheme with CLOS-like object system")
(description
@@ -1278,4 +1275,4 @@ (define-public stklos
as well as light. The implementation is based on an ad-hoc Virtual
Machine. STklos can also be compiled as a library and embedded in an
application.")
- (license gpl2)))
+ (license gpl2+)))
Closed
?