aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-08-08 10:42:27 -0400
committerGravatar Peter McGoron 2025-08-08 10:42:27 -0400
commit44433f42f14eb0c86b87555710c3d950dd300099 (patch)
tree6bacee719592db24f6e86ec2818ab06bd01429db
parentupdate README.md (diff)
rationalize packages, add foment
-rw-r--r--README.md11
-rw-r--r--examples-lib/gnu/packages/mcgoron-hello-world.scm51
-rw-r--r--examples-src/hello-world/hello-world.sld (renamed from examples/hello-world/hello-world.scm)0
-rw-r--r--examples/pffi-chibi.scm83
-rw-r--r--examples/pffi-guile.scm64
-rw-r--r--lib/gnu/packages/chibi-scheme-with-path.scm (renamed from examples/hello-world.scm)28
-rw-r--r--lib/gnu/packages/foment.scm87
-rw-r--r--lib/mcgoron/guix/chibi.scm (renamed from guix/mcgoron/guix/chibi.scm)22
-rw-r--r--lib/mcgoron/guix/foment.scm40
9 files changed, 203 insertions, 183 deletions
diff --git a/README.md b/README.md
index 38f8693..109f7b2 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,12 @@ 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.
-## Guile
+## Foment
-Guix is the package manager for Guile so everything is already taken care
-of for us.
+Located at `(mcgoron guix foment)`.
+
+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.
diff --git a/examples-lib/gnu/packages/mcgoron-hello-world.scm b/examples-lib/gnu/packages/mcgoron-hello-world.scm
new file mode 100644
index 0000000..bb6caca
--- /dev/null
+++ b/examples-lib/gnu/packages/mcgoron-hello-world.scm
@@ -0,0 +1,51 @@
+#| 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 (gnu packages mcgoron-hello-world)
+ #:use-module (guix packages)
+ #:use-module (guix licenses)
+ #:use-module (guix gexp)
+ #:use-module (gnu packages chibi-scheme-with-path)
+ #:use-module (mcgoron guix chibi)
+ #:use-module (gnu packages foment)
+ #:use-module (mcgoron guix foment))
+
+(define hello-world-path "./examples-src/hello-world")
+
+(define-public hello-world-chibi
+ (package
+ (name "hello-world-chibi")
+ (version "1.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))
+ (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")
+ (synopsis "Prints hello world")
+ (description "Prints hello world")
+ (license asl2.0)
+ (home-page "https://example.com")
+ (source (local-file hello-world-path #:recursive? #t))
+ (build-system foment-build-system)
+ (inputs (list foment))))
+
diff --git a/examples/hello-world/hello-world.scm b/examples-src/hello-world/hello-world.sld
index 234a593..234a593 100644
--- a/examples/hello-world/hello-world.scm
+++ b/examples-src/hello-world/hello-world.sld
diff --git a/examples/pffi-chibi.scm b/examples/pffi-chibi.scm
deleted file mode 100644
index e68224d..0000000
--- a/examples/pffi-chibi.scm
+++ /dev/null
@@ -1,83 +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/>.
- |#
-
-(use-modules (mcgoron guix chibi)
- (gnu packages libffi)
- (gnu packages commencement)
- (gnu packages base)
- (guix git-download)
- (guix build-system gnu)
- (guix packages)
- (guix gexp)
- (guix licenses))
-
-(package
- (name "pffi-chibi")
- (version "0.5.0")
- (synopsis "Portable Foreign Function Interface for R7RS")
- (description "Portable Foreign Function Interface for R7RS")
- (license lgpl3+)
- (home-page "https://sr.ht/~retropikzel/r7rs-pffi")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://git.sr.ht/~retropikzel/r7rs-pffi/")
- (commit "v0.5.0")))
- (file-name (git-file-name "r7rs-pffi" version))
- (sha256
- (base32 "1ggkafggyqqla6ba8dlhzvvf6v7i6scpa2xyr1mfxxy8iwnl70aa"))))
- (build-system gnu-build-system)
- (inputs (list chibi-scheme-with-path libffi))
- (native-inputs (list gcc-toolchain glibc))
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (delete 'configure)
- (replace 'build
- (lambda* (#:key outputs #:allow-other-keys)
- (invoke "chibi-ffi"
- "retropikzel/r7rs-pffi/r7rs-pffi-chibi.stub")
- (invoke "gcc"
- "-o"
- "retropikzel/r7rs-pffi/r7rs-pffi-chibi.so"
- "-fPIC"
- "-shared"
- "retropikzel/r7rs-pffi/r7rs-pffi-chibi.c"
- "-lchibi-scheme"
- "-lffi")))
- (replace 'check
- (lambda* (#:key (test-target "check") (tests? #t) #:allow-other-keys)
- (display "tests don't work yet\n")
- #;(when tests?
- (invoke "chibi-scheme" "-A" "." "test.scm"))))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (base-dir (string-append out
- "/share/guix-chibi/retropikzel/"))
- (copy (lambda (name)
- (invoke "cp"
- (string-append "retropikzel/" name)
- (string-append base-dir name)))))
- (invoke "mkdir" "-p" (string-append base-dir "/r7rs-pffi"))
- (for-each copy
- '("r7rs-pffi.sld"
- "r7rs-pffi/r7rs-pffi-chibi.so"
- "r7rs-pffi/chibi.scm"
- "r7rs-pffi/main.scm"
- "r7rs-pffi/struct.scm")))))))))
-
diff --git a/examples/pffi-guile.scm b/examples/pffi-guile.scm
deleted file mode 100644
index 8519926..0000000
--- a/examples/pffi-guile.scm
+++ /dev/null
@@ -1,64 +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/>.
- |#
-
-(use-modules (gnu packages guile)
- (guix build-system copy)
- (guix git-download)
- (guix packages)
- (guix gexp)
- (guix licenses))
-
-(package
- (name "pffi-guile")
- (version "0.5.0")
- (synopsis "Portable Foreign Function Interface for R7RS")
- (description "Portable Foreign Function Interface for R7RS")
- (license lgpl3+)
- (home-page "https://sr.ht/~retropikzel/r7rs-pffi")
- (source
- (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://git.sr.ht/~retropikzel/r7rs-pffi/")
- (commit "v0.5.0")))
- (file-name (git-file-name "r7rs-pffi" version))
- (sha256
- (base32 "1ggkafggyqqla6ba8dlhzvvf6v7i6scpa2xyr1mfxxy8iwnl70aa"))))
- (build-system copy-build-system)
- (inputs (list guile-3.0))
- (arguments
- (let* ((base-dir "share/guile/site/3.0/retropikzel/")
- (libdir (string-append base-dir "r7rs-pffi/")))
- ;; Guile doesn't load sld files. It also won't load relative to the
- ;; site directory.
- `(#:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'patch-paths
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (string-append (assoc-ref outputs "out")
- "/"
- ,libdir)))
- (substitute* '("retropikzel/r7rs-pffi.sld")
- (("\\(include \"r7rs-pffi")
- (string-append "(include \""
- out)))))))
- #:install-plan
- '(("retropikzel/r7rs-pffi.sld" ,(string-append
- base-dir
- "r7rs-pffi.scm"))
- ("retropikzel/r7rs-pffi/guile.scm" ,libdir)
- ("retropikzel/r7rs-pffi/main.scm" ,libdir)
- ("retropikzel/r7rs-pffi/struct.scm" ,libdir))))))
diff --git a/examples/hello-world.scm b/lib/gnu/packages/chibi-scheme-with-path.scm
index 29ca55f..cd01b9c 100644
--- a/examples/hello-world.scm
+++ b/lib/gnu/packages/chibi-scheme-with-path.scm
@@ -14,19 +14,19 @@
| with this program. If not, see <https://www.gnu.org/licenses/>.
|#
-(use-modules (mcgoron guix chibi)
- (guix packages)
- (guix gexp)
- (guix licenses))
+(define-module (gnu packages chibi-scheme-with-path)
+ #:use-module (guix packages)
+ #:use-module (gnu packages scheme))
-(package
- (name "hello-world-chibi")
- (version "1.0")
- (synopsis "Prints hello world")
- (description "Prints hello world")
- (license asl2.0)
- (home-page "https://example.com")
- (source (local-file "hello-world" #:recursive? #t))
- (build-system chibi-scheme-build-system)
- (inputs (list chibi-scheme-with-path)))
+(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/lib/gnu/packages/foment.scm b/lib/gnu/packages/foment.scm
new file mode 100644
index 0000000..cbe2885
--- /dev/null
+++ b/lib/gnu/packages/foment.scm
@@ -0,0 +1,87 @@
+#| 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 (gnu packages foment)
+ #:use-module (guix packages)
+ #:use-module (guix licenses)
+ #:use-module (guix git-download)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages bash)
+ #:use-module (guix gexp)
+ #:use-module (guix build-system gnu))
+
+(define-public foment-lib-dir "share/foment")
+
+(define-public foment
+ (package
+ (name "foment")
+ (version "6089c3c")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference (url "https://github.com/leftmike/foment")
+ (commit "6089c3c9e762875f619ef382d27943819bbe002b")))
+ (sha256 (base32 "1a6q8qfd6ggc6fl9lf1d8m20q8k498jrswc4qcn3bb7rkq4w258a"))))
+ (build-system gnu-build-system)
+ (native-search-paths (list
+ (search-path-specification
+ (variable "FOMENT_LIBPATH")
+ (files (list foment-lib-dir)))))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-before 'build 'patch-makefile
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "unix/makefile"
+ (("sudo *") "")
+ (("git rev-parse --abbrev-ref HEAD") "echo \"master\"")
+ (("git rev-parse --short HEAD") "echo 6089c3c"))
+;; Replace hardcoded path /bin/sh with the current interpreter.
+;; This follows what racket does:
+;; https://issues.guix.gnu.org/47180
+ (substitute* "src/base.scm"
+ (("\"/bin/sh\"")
+ (let ((sh (which "sh")))
+ (string-append "(if (file-exists? \"" sh "\")\n"
+ " \"" sh "\"\n"
+ " \"/bin/sh\")"))))))
+ (replace 'build
+ (lambda _
+ (with-directory-excursion "unix"
+ (invoke "make"))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (with-directory-excursion "unix"
+ (invoke "make" "test")
+ (invoke "make" "stress-test")))))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((bin (string-append (assoc-ref outputs "out")
+ "/bin")))
+ (install-file "unix/release/foment" bin)
+ (copy-recursively "unix/debug/foment"
+ (string-append bin "/foment-debug"))))))))
+ (home-page "https://ktakashi.github.io/")
+ (synopsis "Foment is an implementation of R7RS Scheme.")
+ (license expat)
+ (inputs '())
+ (native-inputs (list bash))
+ (description "Foment is an implementation of Scheme.")))
+
diff --git a/guix/mcgoron/guix/chibi.scm b/lib/mcgoron/guix/chibi.scm
index 49e7545..7f256b5 100644
--- a/guix/mcgoron/guix/chibi.scm
+++ b/lib/mcgoron/guix/chibi.scm
@@ -15,26 +15,12 @@
|#
(define-module (mcgoron guix chibi)
- #:use-module (guix packages)
#:use-module (guix build-system)
#:use-module (guix build-system copy)
- #:use-module (gnu packages scheme)
- #:use-module (guix gexp)
- #:export (chibi-scheme-with-path
- chibi-scheme-build-system))
+ #:use-module (gnu packages chibi-scheme-with-path)
+ #:use-module (guix gexp))
-(define chibi-lib-dir "share/guix-chibi")
-(define chibi-binlib-dir "lib/guix-chibi")
-
-(define-public chibi-scheme-with-path
- (package
- (inherit chibi-scheme)
- (native-search-paths
- (list (search-path-specification
- (variable "CHIBI_MODULE_PATH")
- (files (list chibi-lib-dir chibi-binlib-dir)))))))
-
-(define chibi-scheme-build-system
+(define-public chibi-scheme-build-system
(let ((lower* (build-system-lower copy-build-system)))
(build-system
(name 'chibi-pure)
@@ -50,5 +36,3 @@
#:install-plan
`'(("." ,(string-append chibi-lib-dir
"/"))))))))))))
-
-chibi-scheme-with-path
diff --git a/lib/mcgoron/guix/foment.scm b/lib/mcgoron/guix/foment.scm
new file mode 100644
index 0000000..bc38da7
--- /dev/null
+++ b/lib/mcgoron/guix/foment.scm
@@ -0,0 +1,40 @@
+#| 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 foment)
+ #:use-module (guix build-system)
+ #:use-module (guix build-system copy)
+ #:use-module (gnu packages foment)
+ #:use-module (guix gexp))
+
+(define-public foment-build-system
+ (let ((lower* (build-system-lower copy-build-system)))
+ (build-system
+ (name 'foment-scheme)
+ (description "Build system for copying Scheme libraries to Foment module directory")
+ (lower
+ (lambda args
+ (apply lower*
+ (if (memq #:install-plan args)
+ args
+ (append
+ args
+ (list
+ #:install-plan
+ `'(("." ,(string-append foment-lib-dir
+ "/"))))))))))))
+
+