diff options
| author | 2025-08-11 07:47:14 -0400 | |
|---|---|---|
| committer | 2025-08-11 07:47:14 -0400 | |
| commit | c57fab3dbf2953ae02b968dfd20bb7c2fe221ca6 (patch) | |
| tree | 05aa9edd56b94980c1e9690f0460203eb0d52a7d | |
| parent | sagittarius (diff) | |
gauche
| -rw-r--r-- | README.md | 46 | ||||
| -rw-r--r-- | examples-src/hello-world/hello-world.sld | 6 | ||||
| -rw-r--r-- | mcgoron/guix/chibi.scm (renamed from lib/mcgoron/guix/chibi.scm) | 1 | ||||
| -rw-r--r-- | mcgoron/guix/foment.scm (renamed from lib/mcgoron/guix/foment.scm) | 2 | ||||
| -rw-r--r-- | mcgoron/guix/gauche-build-system.scm | 98 | ||||
| -rw-r--r-- | mcgoron/guix/gauche.scm | 52 | ||||
| -rw-r--r-- | mcgoron/guix/sagittarius.scm (renamed from lib/mcgoron/guix/sagittarius.scm) | 0 | ||||
| -rw-r--r-- | mcgoron/guix/scheme-hello-world.scm (renamed from examples-lib/mcgoron/guix/mcgoron-hello-world.scm) | 52 |
8 files changed, 226 insertions, 31 deletions
@@ -3,26 +3,46 @@ Run Scheme implementations in Guix containers/environments, and package libraries for them. -## Chibi Scheme +TODO: portable r7rs and r6rs install location. Use a dummy library and +patches. -Chibi is meant to be embedded and doesn't have a modifiable global -library path of its own. Instead it uses a modified package definition -of `chibi-scheme` with the module path `share/guix-chibi` (interpreted) -and `lib/guix-chibi/` (shared objects). To use this modified Chibi, pass -`-f guix/mcgoron/guix/chibi.scm` to `guix` in place of `chibi-scheme`. +## Chibi Scheme -Packages of only Scheme code intended for use in Chibi should use the -`chibi-scheme-build-system` build system, which will simply copy files -to the appropriate directory. Code that contains shared objects (from -`chibi-ffi`) should use `gnu-build-system` and copy the files in an -input. Pass `-L guix` to load the included Guix libraries. +* Library: `(mcgoron guix chibi)` +* Package: `chibi-scheme-with-path` +* Pure Scheme: `chibi-scheme-build-system` ## Foment -Located at `(mcgoron guix foment)`. +* Library: `(mcgoron guix foment)` +* Package: `foment` +* Pure Scheme: `foment-build-system` The build script here will build [Foment](https://github.com/leftmike/foment). The last release of Foment was a long time ago, so the build is for the current HEAD at the time of writing (6089c3c). -Use `foment-build-system` to copy files into the Foment library directory. +## Sagittarius + +* Library: `(mcgoron guix sagittarius)` +* Package: `sagittarius-scheme` +* Pure Scheme: `sagittarius-build-system` + +## Gauche + +* Library: `(mcgoron guix gauche)` +* Package: `gauche-with-path` +* Pure Scheme: `gauche-pure-scheme-build-system` +* Gauche Packages: `gauche-package-build-system` + +TODO: gauche build systems + +## Planned + +* Loko, STKlos, TR7, Mosh (should be simple) +* Chez, and other R6RS, even unmaintained ones +* Kawa (Scheme source only, don't know enough about Java) +* The Javascipt ones +* Racket, Gambit, MIT-Scheme (need to understand how they work) +* Every R6RS/R7RS with a library load path mechanism + diff --git a/examples-src/hello-world/hello-world.sld b/examples-src/hello-world/hello-world.sld deleted file mode 100644 index 234a593..0000000 --- a/examples-src/hello-world/hello-world.sld +++ /dev/null @@ -1,6 +0,0 @@ -(define-library (hello-world) - (import (scheme base) (scheme write)) - (export hello-world) - (begin - (define (hello-world) - (display "hello, world\n"))))
\ No newline at end of file diff --git a/lib/mcgoron/guix/chibi.scm b/mcgoron/guix/chibi.scm index 9419013..beb432d 100644 --- a/lib/mcgoron/guix/chibi.scm +++ b/mcgoron/guix/chibi.scm @@ -50,4 +50,3 @@ (variable "CHIBI_MODULE_PATH") (files (list chibi-lib-dir chibi-binlib-dir))))))) - diff --git a/lib/mcgoron/guix/foment.scm b/mcgoron/guix/foment.scm index 77cdd70..56db217 100644 --- a/lib/mcgoron/guix/foment.scm +++ b/mcgoron/guix/foment.scm @@ -48,7 +48,7 @@ (define-public foment (package (name "foment") - (version "6089c3c") + (version "0.4.1-0.6089c3c") (source (origin (method git-fetch) diff --git a/mcgoron/guix/gauche-build-system.scm b/mcgoron/guix/gauche-build-system.scm new file mode 100644 index 0000000..6a4b8f5 --- /dev/null +++ b/mcgoron/guix/gauche-build-system.scm @@ -0,0 +1,98 @@ +#| 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 gauche-build-system) + #:use-module (guix build utils)) + +(define-public gauche-configure +(lambda* (#:key build target outputs + (configure-flags '()) out-of-source? + (configure-file-name "configure") + #:allow-other-keys) + ;; Copied from gnu-build-system.scm, rev. f0c0769189d11debf7b237a02695c44c9773d52a + ;; modified for Gauche. + ;; Allows for the configure file to have a different name (not tested). + (define (package-name) + (let* ((out (assoc-ref outputs "out")) + (base (basename out)) + (dash (string-rindex base #\-))) + ;; XXX: We'd rather use `package-name->name+version' or similar. + (string-drop (if dash + (substring base 0 dash) + base) + (+ 1 (string-index base #\-))))) + + (let* ((prefix (assoc-ref outputs "out")) + (bindir (assoc-ref outputs "bin")) + (libdir (assoc-ref outputs "lib")) + (includedir (assoc-ref outputs "include")) + (docdir (assoc-ref outputs "doc")) + (flags `(,@(if target ; cross building + '("CC_FOR_BUILD=gcc") + '()) + ,(string-append "--prefix=" prefix) + ;; Produce multiple outputs when specific output names + ;; are recognized. + ,@(if bindir + (list (string-append "--bindir=" bindir "/bin")) + '()) + ,@(if libdir + (cons (string-append "--libdir=" libdir "/lib") + (if includedir + '() + (list + (string-append "--includedir=" + libdir "/include")))) + '()) + ,@(if includedir + (list (string-append "--includedir=" + includedir "/include")) + '()) + ,@(if docdir + (list (string-append "--docdir=" docdir + "/share/doc/" (package-name))) + '()) + ,@(if build + (list (string-append "--build=" build)) + '()) + ,@(if target ; cross building + (list (string-append "--host=" target)) + '()) + ,@configure-flags)) + (abs-srcdir (getcwd)) + (srcdir (if out-of-source? + (string-append "../" (basename abs-srcdir)) + "."))) + (format #t "source directory: ~s (relative from build: ~s)~%" + abs-srcdir srcdir) + (if out-of-source? + (begin + (mkdir "../build") + (chdir "../build"))) + (format #t "build directory: ~s~%" (getcwd)) + (format #t "configure flags: ~s~%" flags) + + ;; Gauche configure scripts are written in Gauche. + ;; + ;; Call `configure' with a relative path. Otherwise, GCC's build system + ;; (for instance) records absolute source file names, which typically + ;; contain the hash part of the `.drv' file, leading to a reference leak. + (apply invoke "gosh" + (string-append srcdir "/" configure-file-name) + flags)))) + + + diff --git a/mcgoron/guix/gauche.scm b/mcgoron/guix/gauche.scm new file mode 100644 index 0000000..099b6ec --- /dev/null +++ b/mcgoron/guix/gauche.scm @@ -0,0 +1,52 @@ +#| 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 gauche) + #:use-module (guix packages) + #:use-module (gnu packages scheme) + #:use-module (guix gexp)) + +(define-public gauche-abi-version + (let* ((version (string-split (package-version gauche) #\.)) + (major (string->number (car version))) + (minor (string->number (list-ref version 1))) + (patch (string->number (list-ref version 2)))) + (cond + ((and (= major 0) (= minor 9) (= patch 10)) + "0.97") + ((and (= major 0) (= minor 9) (> patch 11)) + "0.98") + (else (error 'gauche-abi-version "unknown gauche version: patch me!" + major minor patch))))) + +(define-public gauche-lib-dir + (string-append "share/gauche-" gauche-abi-version "/site/lib")) + +;;; TODO: machine triple +(define-public gauche-binlib-dir + (string-append "lib/gauche-" gauche-abi-version "/site/x86_64-unknown-linux-gnu")) + +(define-public gauche-with-path + (package + (inherit gauche) + (name "gauche-with-path") + (native-search-paths + (list (search-path-specification + (variable "GAUCHE_LOAD_PATH") + (files (list gauche-lib-dir))) + (search-path-specification + (variable "GAUCHE_DTNLOAD_PATH") + (files (list gauche-lib-dir))))))) diff --git a/lib/mcgoron/guix/sagittarius.scm b/mcgoron/guix/sagittarius.scm index 880391e..880391e 100644 --- a/lib/mcgoron/guix/sagittarius.scm +++ b/mcgoron/guix/sagittarius.scm diff --git a/examples-lib/mcgoron/guix/mcgoron-hello-world.scm b/mcgoron/guix/scheme-hello-world.scm index ebefb38..1bbef44 100644 --- a/examples-lib/mcgoron/guix/mcgoron-hello-world.scm +++ b/mcgoron/guix/scheme-hello-world.scm @@ -14,49 +14,81 @@ | with this program. If not, see <https://www.gnu.org/licenses/>. |# -(define-module (mcgoron guix mcgoron-hello-world) +(define-module (mcgoron guix scheme-hello-world) #:use-module (guix packages) + #:use-module (guix download) #:use-module (guix licenses) #:use-module (guix gexp) + #:use-module (guix build-system gnu) + #:use-module (gnu packages tls) #:use-module (mcgoron guix chibi) #:use-module (mcgoron guix foment) - #:use-module (mcgoron guix sagittarius)) - -(define hello-world-path "./examples-src/hello-world") + #:use-module (mcgoron guix sagittarius) + #:use-module (mcgoron guix gauche)) + +(define (hello-world-r7rs version) + (origin + (method url-fetch) + (uri (string-append "https://florida.moe/ftp/hello-world-r7rs/" + version ".tar.gz")) + (sha256 (base32 "1cx9p2mz3cmn02imp137vqmq8aw3mh5s23ybprgkc8pshgmaf8jn")))) (define-public hello-world-chibi (package (name "hello-world-chibi") - (version "1.0") + (version "1.0.0") (synopsis "Prints hello world") (description "Prints hello world") (license asl2.0) (home-page "https://example.com") - (source (local-file hello-world-path #:recursive? #t)) + (source (hello-world-r7rs version)) (build-system chibi-scheme-build-system) (inputs (list chibi-scheme-with-path)))) (define-public hello-world-foment (package (name "hello-world-foment") - (version "1.0") + (version "1.0.0") (synopsis "Prints hello world") (description "Prints hello world") (license asl2.0) (home-page "https://example.com") - (source (local-file hello-world-path #:recursive? #t)) + (source (hello-world-r7rs version)) (build-system foment-build-system) (inputs (list foment)))) (define-public hello-world-sagittarius (package (name "hello-world-sagittarius") - (version "1.0") + (version "1.0.0") (synopsis "Prints hello world") (description "Prints hello world") (license asl2.0) (home-page "https://example.com") - (source (local-file hello-world-path #:recursive? #t)) + (source (hello-world-r7rs version)) (build-system sagittarius-build-system) (inputs (list foment)))) +(define-public hello-world-gauche + (package + (name "hello-world-gauche") + (version "1.0.0") + (synopsis "Prints hello world") + (description "Prints hello world") + (license asl2.0) + (home-page "https://example.com") + (source (origin + (method url-fetch) + (uri (string-append "https://florida.moe/ftp/hello-world-gauche/" + version ".tar.gz")) + (sha256 (base32 "0qfjzx5kwf8c5cjh5p72fg7wiyfn6mak4h5wsrhigzn9fzakxv3b")))) + (build-system gnu-build-system) + (arguments + (list + #:imported-modules `(,@%default-gnu-imported-modules (mcgoron guix gauche-build-system)) + #:modules '((mcgoron guix gauche-build-system) (guix build utils) (guix build gnu-build-system)) + #:phases + #~(modify-phases %standard-phases + (replace 'configure gauche-configure)))) + (inputs (list gauche-with-path)) + (native-inputs (list mbedtls gauche-with-path)))) |
