blob: 648f654dd63d369d7f3211abb7cbbaa215bc6223 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
#| 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 scheme-packages)
#:use-module (guix packages)
#:use-module (gnu packages)
#:use-module (guix licenses)
#:use-module (guix git-download)
#:use-module (guix download)
#:use-module (gnu packages version-control)
#:use-module (gnu packages bash)
#: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")
(define-public r6rs-lib-dir "share/scheme/r6rs")
(define-public (default-copying-build-system name desc dir)
(let ((lower* (build-system-lower copy-build-system)))
(build-system
(name name)
(description desc)
(lower
(lambda args
(apply lower*
(if (memq #:install-plan args)
args
(append
args
(list
#:install-plan
`'(("." ,(string-append dir "/"))))))))))))
(define-public portable-r7rs-build-system
(default-copying-build-system 'r7rs
"Copy Scheme libraries into R7RS directory"
r7rs-lib-dir))
(define-public hello-world-r7rs
(package
(name "hello-world-r7rs")
(version "1.0.0")
(synopsis "Prints hello world")
(description "A test library for packages that respect R7RS_LIBRARY_PATH")
(license public-domain)
(home-page "https://example.com")
(build-system portable-r7rs-build-system)
(source
(origin
(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
(default-copying-build-system 'foment-scheme
"Copy Scheme libraries into Foment Scheme directory"
foment-lib-dir))
(define-public foment
(package
(name "foment")
(version "0.4.1-1.6089c3c")
(source
(origin
(method git-fetch)
(uri (git-reference (url "https://github.com/leftmike/foment")
(commit "6089c3c9e762875f619ef382d27943819bbe002b")))
(sha256 (base32 "1a6q8qfd6ggc6fl9lf1d8m20q8k498jrswc4qcn3bb7rkq4w258a"))
(patches (search-patches "mcgoron/guix/patches/foment-0.4.1-library-path.patch"))))
(build-system gnu-build-system)
(native-search-paths (list
(search-path-specification
(variable "FOMENT_LIBPATH")
(files (list foment-lib-dir)))
r7rs-search-path-specification))
(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://github.com/leftmike/foment")
(synopsis "Foment is an implementation of R7RS Scheme.")
(license expat)
(inputs '())
(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))))
|