aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-08-12 18:43:16 -0400
committerGravatar Peter McGoron 2025-08-12 18:43:16 -0400
commit4fc83397a58bec9efc63292b5d737eab43fdefea (patch)
treebf6277b8edce51ba6771455d5935088e0f115222
parentpatch foment to respect new envar R7RS_LIBRARY_PATH (diff)
patch chibi to use R7RS_LIBRARY_PATH
-rw-r--r--README.md1
-rw-r--r--mcgoron/guix/chibi.scm52
-rw-r--r--mcgoron/guix/patches/chibi-scheme-0.11-library-path.patch21
-rw-r--r--mcgoron/guix/scheme-packages.scm38
4 files changed, 57 insertions, 55 deletions
diff --git a/README.md b/README.md
index ce4d9d7..6389e5b 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ use the `portable-r7rs-build-system` (`portable-r6rs-build-system`).
* Library: `(mcgoron guix chibi)`
* Package: `chibi-scheme-with-path`
* Pure Scheme: `chibi-scheme-build-system`
+* Supports `portable-r7rs-build-system`
## Foment
diff --git a/mcgoron/guix/chibi.scm b/mcgoron/guix/chibi.scm
deleted file mode 100644
index beb432d..0000000
--- a/mcgoron/guix/chibi.scm
+++ /dev/null
@@ -1,52 +0,0 @@
-#| Copyright (C) 2025 Peter McGoron
- |
- | This program is free software: you can redistribute it and/or modify it
- | under the terms of the GNU General Public License as published by the
- | Free Software Foundation, either version 3 of the License, or (at your
- | option) any later version.
- |
- | This program is distributed in the hope that it will be useful, but
- | WITHOUT ANY WARRANTY; without even the implied warranty of
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- | General Public License for more details.
- |
- | You should have received a copy of the GNU General Public License along
- | with this program. If not, see <https://www.gnu.org/licenses/>.
- |#
-
-(define-module (mcgoron guix chibi)
- #:use-module (guix build-system)
- #:use-module (guix build-system copy)
- #:use-module (guix packages)
- #:use-module (gnu packages scheme)
- #:use-module (guix gexp))
-
-(define-public chibi-scheme-build-system
- (let ((lower* (build-system-lower copy-build-system)))
- (build-system
- (name 'chibi-pure)
- (description "Build system for copying Scheme libraries to Chibi module directory")
- (lower
- (lambda args
- (apply lower*
- (if (memq #:install-plan args)
- args
- (append
- args
- (list
- #:install-plan
- `'(("." ,(string-append chibi-lib-dir
- "/"))))))))))))
-
-(define-public chibi-lib-dir "share/guix-chibi")
-(define-public chibi-binlib-dir "lib/guix-chibi")
-
-(define-public chibi-scheme-with-path
- (package
- (inherit chibi-scheme)
- (name "chibi-scheme-with-path")
- (native-search-paths
- (list (search-path-specification
- (variable "CHIBI_MODULE_PATH")
- (files (list chibi-lib-dir chibi-binlib-dir)))))))
-
diff --git a/mcgoron/guix/patches/chibi-scheme-0.11-library-path.patch b/mcgoron/guix/patches/chibi-scheme-0.11-library-path.patch
new file mode 100644
index 0000000..309681b
--- /dev/null
+++ b/mcgoron/guix/patches/chibi-scheme-0.11-library-path.patch
@@ -0,0 +1,21 @@
+diff --git a/eval.c b/eval.c
+index 8a7f0de2..41239fa4 100644
+--- a/eval.c
++++ b/eval.c
+@@ -509,9 +509,16 @@ void sexp_init_eval_context_globals (sexp ctx) {
+ sexp_init_eval_context_bytecodes(ctx);
+ #endif
+ sexp_global(ctx, SEXP_G_MODULE_PATH) = SEXP_NULL;
++
++
++ user_path = getenv("R7RS_LIBRARY_PATH");
++ if (user_path)
++ sexp_add_path(ctx, user_path);
++
+ user_path = getenv(SEXP_MODULE_PATH_VAR);
+ if (!user_path) user_path = sexp_default_user_module_path;
+ sexp_add_path(ctx, user_path);
++
+ no_sys_path = getenv(SEXP_NO_SYSTEM_PATH_VAR);
+ if (!no_sys_path || strcmp(no_sys_path, "0")==0)
+ sexp_add_path(ctx, sexp_default_module_path);
diff --git a/mcgoron/guix/scheme-packages.scm b/mcgoron/guix/scheme-packages.scm
index bbec95b..648f654 100644
--- a/mcgoron/guix/scheme-packages.scm
+++ b/mcgoron/guix/scheme-packages.scm
@@ -25,6 +25,7 @@
#:use-module (guix build-system gnu)
#:use-module (guix build-system)
#:use-module (guix build-system copy)
+ #:use-module (gnu packages scheme)
#:use-module (guix gexp))
(define-public r7rs-lib-dir "share/scheme/r7rs")
@@ -65,6 +66,10 @@
(method url-fetch)
(uri "https://florida.moe/ftp/hello-world-r7rs/1.0.0.tar.gz")
(sha256 (base32 "1cx9p2mz3cmn02imp137vqmq8aw3mh5s23ybprgkc8pshgmaf8jn"))))))
+(define-public r7rs-search-path-specification
+ (search-path-specification
+ (variable "R7RS_LIBRARY_PATH")
+ (files (list r7rs-lib-dir))))
(define-public foment-lib-dir "share/foment")
(define-public foment-build-system
@@ -88,9 +93,7 @@
(search-path-specification
(variable "FOMENT_LIBPATH")
(files (list foment-lib-dir)))
- (search-path-specification
- (variable "R7RS_LIBRARY_PATH")
- (files (list r7rs-lib-dir)))))
+ r7rs-search-path-specification))
(arguments
(list
@@ -136,3 +139,32 @@
(native-inputs (list bash))
(description "Foment is an implementation of Scheme.")))
+(define-public chibi-lib-dir "share/guix-chibi")
+(define-public chibi-binlib-dir "lib/guix-chibi")
+
+(define-public chibi-scheme-build-system
+ (default-copying-build-system 'chibi-scheme
+ "Copy Scheme libraries into Chibi Scheme directory"
+ foment-lib-dir))
+
+(define-public chibi-scheme-with-path
+ (package
+ (inherit chibi-scheme)
+ (name "chibi-scheme-with-path")
+ (home-page "https://github.com/ashinn/chibi-scheme")
+ (version "0.11")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url home-page) (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "02zq35hdbi03rmmamx6ml4ihsigdl4mmbf6d9ysazv8ciiln5v4b"))
+ (patches (search-patches "mcgoron/guix/patches/chibi-scheme-0.11-library-path.patch"))))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CHIBI_MODULE_PATH")
+ (files (list chibi-lib-dir chibi-binlib-dir)))
+ r7rs-search-path-specification))))
+
+