aboutsummaryrefslogtreecommitdiffstats
path: root/mcgoron/guix/scheme-packages.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-08-16 21:23:29 -0400
committerGravatar Peter McGoron 2025-08-16 21:23:29 -0400
commit3445a69c5c4e337af581d684c6053fbdaf23ba57 (patch)
treeb339b7478adbc3bcbd4f1d9d4b0d169323f62b78 /mcgoron/guix/scheme-packages.scm
parentSTklos (diff)
tr7
Diffstat (limited to '')
-rw-r--r--mcgoron/guix/scheme-packages.scm93
1 files changed, 93 insertions, 0 deletions
diff --git a/mcgoron/guix/scheme-packages.scm b/mcgoron/guix/scheme-packages.scm
index f386059..b302582 100644
--- a/mcgoron/guix/scheme-packages.scm
+++ b/mcgoron/guix/scheme-packages.scm
@@ -17,6 +17,7 @@
(define-module (mcgoron guix scheme-packages)
#:use-module (rnrs base)
#:use-module (guix packages)
+ #:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (guix licenses)
#:use-module (guix git-download)
@@ -483,3 +484,95 @@
,(append-to "STKLOS_LOAD_PATH" "GUIX_STKLOS_PATH" "R7RS_LIBRARY_PATH")
impl))))
+;;;;;;;;;;;
+;;;; TR7
+;;;;;;;;;;;
+
+(define-public tr7
+ ;; Current guix TR7 is a major version out of date
+ (package
+ (name "tr7")
+ (version "2.0.6")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://gitlab.com/jobol/tr7")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "0z9zjk71294afr5aynnr8q9iih6q6lfsx747swbaz14r5vpjhg3n"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (outputs '("out" "doc"))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ (lambda _
+ (substitute* "Makefile"
+ (("PREFIX = /usr/local")
+ (string-append "PREFIX=" #$output))
+ (("ALL = \\$\\(LIBSTA\\) \\$\\(TR7I\\) tags")
+ "ALL = $(LIBSTA) $(TR7I)"))))
+ (replace 'build
+ (lambda _
+ (setenv "CC" #$(cc-for-target))
+ (invoke "make")))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "make" "test"))))
+ (replace 'install
+ (lambda _
+ (let* ((share (string-append #$output "/share"))
+ (doc (string-append #$output:doc "/share/doc/"))
+ (bin (string-append #$output "/bin"))
+ (lib (string-append #$output "/lib/"))
+ (tr7 (string-append share "/tr7"))
+ (libs (string-append tr7 "/libs")))
+ (for-each mkdir-p (list tr7 libs bin lib doc))
+ (copy-file "tr7i" (string-append bin "/tr7i"))
+ (copy-file "libtr7.a" (string-append lib "/libtr7.a"))
+ #;(copy-file "r7rs.pdf" (string-append doc "/r7rs.pdf"))
+ (copy-recursively "tr7libs" libs)))))))
+ (home-page "https://gitlab.com/jobol/tr7")
+ (synopsis "Embedded R7RS small Scheme interpreter")
+ (description
+ "TR7 is a lightweight Scheme interpreter that implements the revision
+R7RS small of scheme programming language.
+
+It is meant to be used as an embedded scripting interpreter for other
+programs. A lot of functionality in TR7 is included conditionally, to allow
+developers freedom in balancing features and footprint.")
+ (license bsd-0)))
+
+(define-public tr7-lib-dir "share/tr7")
+
+(define-public tr7-build-system
+ (default-copying-build-system 'tr7
+ "Copy Scheme libraries into TR7 directory"
+ tr7-lib-dir))
+
+(define-public tr7-with-path
+ (package/path
+ tr7
+ "tr7"
+ "TR7 interpreter with Guix paths"
+ "Wrapper for TR7 interpreter that adds Guix-managed paths to search path"
+ "/bin/tr7i"
+ "/bin/tr7i"
+ "GUIX_TR7_PATH"
+ (list r7rs-search-path-specification)
+ tr7-lib-dir
+ `(lambda (sh impl)
+ (format #t
+ "#!~a
+
+ ~a
+
+ exec -a $0 \"~a\" \"$@\""
+ sh
+ ,(append-to "TR7_LIB_PATH" "GUIX_TR7_PATH" "R7RS_LIBRARY_PATH")
+ impl))))
+