* [bug#65934] [PATCH] gnu: Add smithforth.
@ 2023-09-14 5:27 B. Wilson via Guix-patches via
2023-10-05 12:46 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: B. Wilson via Guix-patches via @ 2023-09-14 5:27 UTC (permalink / raw)
To: 65934; +Cc: B. Wilson
* gnu/packages/forth (smithforth): New variable.
---
gnu/packages/forth.scm | 55 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/forth.scm b/gnu/packages/forth.scm
index 8cb6ac8391..9910243ac1 100644
--- a/gnu/packages/forth.scm
+++ b/gnu/packages/forth.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Nikita <nikita@n0.is>
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
+;;; Copyright © 2023 B. Wilson <elaexuotee@wilsonb.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22,7 +23,9 @@ (define-module (gnu packages forth)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
- #:use-module (gnu packages m4))
+ #:use-module (guix build-system trivial)
+ #:use-module (gnu packages m4)
+ #:use-module (gnu packages vim))
(define-public gforth
(package
@@ -58,3 +61,53 @@ (define-public gforth
included.")
(home-page "https://www.gnu.org/software/gforth/")
(license license:gpl3+)))
+
+(define-public smithforth
+ (package
+ (name "smithforth")
+ (version "220711")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://dacvs.neocities.org/SF/SForth"
+ version "dmp.txt"))
+ (sha256
+ (base32 "0a39pv7529llsa3f48fmvwvlcp3f9v8qkn5ziw2l6kxf0qvli3lm"))))
+ (build-system trivial-build-system)
+ (inputs
+ `(("system.fs"
+ ,(origin
+ (method url-fetch)
+ (uri (string-append "https://dacvs.neocities.org/SF/system"
+ version "fs.txt"))
+ (sha256
+ (base32
+ "17v1pp64s6n8q8w3kg48nd7zdcx2208y4svr5fpfms5lkyzg7z1m"))))))
+ (native-inputs (list xxd))
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils)
+ (ice-9 textual-ports))
+ (let* ((sforth.dmp (assoc-ref %build-inputs "source"))
+ (system.fs (assoc-ref %build-inputs "system.fs"))
+ (xxd (string-append (assoc-ref %build-inputs "xxd")
+ "/bin/xxd"))
+ (bin (string-append (assoc-ref %outputs "out") "/bin")))
+ (copy-file sforth.dmp "sforth.dmp")
+ (substitute* "sforth.dmp" (("#.*$") "\n"))
+ (with-output-to-file "sforth"
+ (lambda _
+ (invoke xxd "-p" "-r" "sforth.dmp")
+ (call-with-input-file system.fs
+ (lambda (port) (display (get-string-all port)))))
+ #:binary #t)
+ (chmod "sforth" #o755)
+ (install-file "sforth" bin)))))
+ (home-page "https://dacvs.neocities.org/SF/")
+ (synopsis "Forth programming language for x86-64 desktop computers")
+ (description "SmithForth is an implementation of the Forth programming
+language for x86-64 desktop computers. SmithForth is a text interpreter that
+runs in a Linux text console.")
+ (license license:expat-0)))
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#65934] [PATCH] gnu: Add smithforth.
2023-09-14 5:27 [bug#65934] [PATCH] gnu: Add smithforth B. Wilson via Guix-patches via
@ 2023-10-05 12:46 ` Ludovic Courtès
2023-10-05 14:35 ` B. Wilson via Guix-patches via
2023-10-05 15:01 ` B. Wilson via Guix-patches via
0 siblings, 2 replies; 5+ messages in thread
From: Ludovic Courtès @ 2023-10-05 12:46 UTC (permalink / raw)
To: B. Wilson; +Cc: 65934
Hi,
"B. Wilson" <elaexuotee@wilsonb.com> skribis:
> * gnu/packages/forth (smithforth): New variable.
[…]
> +(define-public smithforth
> + (package
> + (name "smithforth")
> + (version "220711")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (string-append "https://dacvs.neocities.org/SF/SForth"
> + version "dmp.txt"))
> + (sha256
> + (base32 "0a39pv7529llsa3f48fmvwvlcp3f9v8qkn5ziw2l6kxf0qvli3lm"))))
> + (build-system trivial-build-system)
> + (inputs
> + `(("system.fs"
> + ,(origin
> + (method url-fetch)
> + (uri (string-append "https://dacvs.neocities.org/SF/system"
> + version "fs.txt"))
> + (sha256
> + (base32
> + "17v1pp64s6n8q8w3kg48nd7zdcx2208y4svr5fpfms5lkyzg7z1m"))))))
Is this a binary VM image dump?
If so, is there source available, a way to bootstrap it?
> + (native-inputs (list xxd))
> + (arguments
> + `(#:modules ((guix build utils))
> + #:builder
> + (begin
> + (use-modules (guix build utils)
> + (ice-9 textual-ports))
> + (let* ((sforth.dmp (assoc-ref %build-inputs "source"))
> + (system.fs (assoc-ref %build-inputs "system.fs"))
Please use a gexp here for #:builder and instead of the (assoc-ref …)
expressions above, use:
#~(begin
;; …
(let* ((sforth.dmp #$(package-source this-package))
(system.fs #$(origin …)))
…))
> + (home-page "https://dacvs.neocities.org/SF/")
> + (synopsis "Forth programming language for x86-64 desktop computers")
Please add a ‘supported-systems’ field so the package is clearly marked
as unsupported on architectures other than x86_64.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#65934] [PATCH] gnu: Add smithforth.
2023-10-05 12:46 ` Ludovic Courtès
@ 2023-10-05 14:35 ` B. Wilson via Guix-patches via
2023-10-05 15:01 ` B. Wilson via Guix-patches via
1 sibling, 0 replies; 5+ messages in thread
From: B. Wilson via Guix-patches via @ 2023-10-05 14:35 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 65934
Thanks for taking a look.
> Is this a binary VM image dump?
>
> If so, is there source available, a way to bootstrap it?
The binary is the source, per se. The author hand-wrote x86_64 opcodes in hex,
which is what dmp.txt contains. This is "compiled" by using xxd to write those
bytes out to a file. Then system.fs is just a blob of Forth source that gets
appended to the binary.
It's kind of magical that this scheme works at all, but that's Forth for ya.
> Please use a gexp here for #:builder and instead of the (assoc-ref …)
> expressions above, use:
>
> #~(begin
> ;; …
> (let* ((sforth.dmp #$(package-source this-package))
> (system.fs #$(origin …)))
> …))
>
> > + (home-page "https://dacvs.neocities.org/SF/")
> > + (synopsis "Forth programming language for x86-64 desktop computers")
Ah, nice. Thanks. Will do.
> Please add a ‘supported-systems’ field so the package is clearly marked
> as unsupported on architectures other than x86_64.
Perfect. I didn't realize we had such a field. Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug#65934] [PATCH] gnu: Add smithforth.
2023-10-05 12:46 ` Ludovic Courtès
2023-10-05 14:35 ` B. Wilson via Guix-patches via
@ 2023-10-05 15:01 ` B. Wilson via Guix-patches via
2023-10-08 21:38 ` bug#65934: " Ludovic Courtès
1 sibling, 1 reply; 5+ messages in thread
From: B. Wilson via Guix-patches via @ 2023-10-05 15:01 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 65934
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-gnu-Add-smithforth.patch --]
[-- Type: text/x-patch, Size: 3942 bytes --]
From de5655662415acb600f9074c6efe70d3949ac21e Mon Sep 17 00:00:00 2001
From: "B. Wilson" <elaexuotee@wilsonb.com>
Date: Thu, 14 Sep 2023 14:26:49 +0900
Subject: [PATCH] gnu: Add smithforth.
* gnu/packages/forth (smithforth): New variable.
---
gnu/packages/forth.scm | 60 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 57 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/forth.scm b/gnu/packages/forth.scm
index 8cb6ac8391..6e8d8cdc4c 100644
--- a/gnu/packages/forth.scm
+++ b/gnu/packages/forth.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Nikita <nikita@n0.is>
;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
+;;; Copyright © 2023 B. Wilson <elaexuotee@wilsonb.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -18,11 +19,14 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages forth)
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
+ #:use-module (guix download)
+ #:use-module (guix gexp)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
- #:use-module (guix download)
- #:use-module (guix build-system gnu)
- #:use-module (gnu packages m4))
+ #:use-module (gnu packages m4)
+ #:use-module (gnu packages vim))
(define-public gforth
(package
@@ -58,3 +62,53 @@ (define-public gforth
included.")
(home-page "https://www.gnu.org/software/gforth/")
(license license:gpl3+)))
+
+(define-public smithforth
+ (package
+ (name "smithforth")
+ (version "220711")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://dacvs.neocities.org/SF/SForth"
+ version "dmp.txt"))
+ (sha256
+ (base32 "0a39pv7529llsa3f48fmvwvlcp3f9v8qkn5ziw2l6kxf0qvli3lm"))))
+ (build-system trivial-build-system)
+ (native-inputs (list xxd))
+ (arguments
+ (list
+ #:modules '((guix build utils))
+ #:builder
+ #~(begin
+ (use-modules (guix build utils)
+ (ice-9 textual-ports))
+ (let* ((sforth.dmp #$(package-source this-package))
+ (system.fs #$(origin
+ (method url-fetch)
+ (uri (string-append
+ "https://dacvs.neocities.org/SF/system"
+ version "fs.txt"))
+ (sha256
+ (base32
+ "17v1pp64s6n8q8w3kg48nd7zdcx2208y4svr5fpfms5lkyzg7z1m"))))
+ (xxd (string-append (assoc-ref %build-inputs "xxd")
+ "/bin/xxd"))
+ (bin (string-append (assoc-ref %outputs "out") "/bin")))
+ (copy-file sforth.dmp "sforth.dmp")
+ (substitute* "sforth.dmp" (("#.*$") "\n"))
+ (with-output-to-file "sforth"
+ (lambda _
+ (invoke xxd "-p" "-r" "sforth.dmp")
+ (call-with-input-file system.fs
+ (lambda (port) (display (get-string-all port)))))
+ #:binary #t)
+ (chmod "sforth" #o755)
+ (install-file "sforth" bin)))))
+ (home-page "https://dacvs.neocities.org/SF/")
+ (synopsis "Forth programming language for x86-64 desktop computers")
+ (description "SmithForth is an implementation of the Forth programming
+language for x86-64 desktop computers. SmithForth is a text interpreter that
+runs in a Linux text console.")
+ (supported-systems '("x86_64-linux"))
+ (license license:expat-0)))
base-commit: 2afa9353a0f69dabf4ddec54b58b60308092c794
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#65934: [PATCH] gnu: Add smithforth.
2023-10-05 15:01 ` B. Wilson via Guix-patches via
@ 2023-10-08 21:38 ` Ludovic Courtès
0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2023-10-08 21:38 UTC (permalink / raw)
To: B. Wilson; +Cc: 65934-done
Hi,
"B. Wilson" <elaexuotee@wilsonb.com> skribis:
> From de5655662415acb600f9074c6efe70d3949ac21e Mon Sep 17 00:00:00 2001
> From: "B. Wilson" <elaexuotee@wilsonb.com>
> Date: Thu, 14 Sep 2023 14:26:49 +0900
> Subject: [PATCH] gnu: Add smithforth.
>
> * gnu/packages/forth (smithforth): New variable.
Applied, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-08 21:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-14 5:27 [bug#65934] [PATCH] gnu: Add smithforth B. Wilson via Guix-patches via
2023-10-05 12:46 ` Ludovic Courtès
2023-10-05 14:35 ` B. Wilson via Guix-patches via
2023-10-05 15:01 ` B. Wilson via Guix-patches via
2023-10-08 21:38 ` bug#65934: " Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).