Commit | Line | Data |
---|---|---|
3df04eb0 | 1 | ;;; GNU Guix --- Functional package management for GNU |
8918ce6d | 2 | ;;; Copyright © 2013-2016, 2018, 2020-2022 Ludovic Courtès <ludo@gnu.org> |
3df04eb0 PM |
3 | ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
4 | ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz> | |
daa91a49 | 5 | ;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com> |
6de284e8 | 6 | ;;; Copyright © 2021 jgart <jgart@dismail.de> |
3df04eb0 PM |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
11 | ;;; under the terms of the GNU General Public License as published by | |
12 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
13 | ;;; your option) any later version. | |
14 | ;;; | |
15 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;;; GNU General Public License for more details. | |
19 | ;;; | |
20 | ;;; You should have received a copy of the GNU General Public License | |
21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
22 | ||
23 | (define-module (gnu packages racket) | |
3df04eb0 PM |
24 | #:use-module (guix packages) |
25 | #:use-module (guix download) | |
26 | #:use-module (guix git-download) | |
27 | #:use-module (guix utils) | |
28 | #:use-module (guix gexp) | |
9e5e413c | 29 | #:use-module (guix build-system copy) |
3df04eb0 | 30 | #:use-module (guix build-system gnu) |
8918ce6d LC |
31 | #:use-module (guix diagnostics) |
32 | #:use-module (guix i18n) | |
3df04eb0 | 33 | #:use-module (srfi srfi-1) |
81e532ff | 34 | #:use-module (srfi srfi-26) |
8918ce6d | 35 | #:use-module (srfi srfi-34) |
3df04eb0 PM |
36 | #:use-module (ice-9 match) |
37 | #:use-module (gnu packages) | |
db2c7e70 | 38 | #:use-module (gnu packages autotools) |
db2c7e70 | 39 | #:use-module (gnu packages chez) |
3df04eb0 PM |
40 | #:use-module (gnu packages compression) |
41 | #:use-module (gnu packages databases) | |
42 | #:use-module (gnu packages fontutils) | |
43 | #:use-module (gnu packages gl) | |
44 | #:use-module (gnu packages glib) | |
45 | #:use-module (gnu packages gtk) | |
46 | #:use-module (gnu packages image) | |
47 | #:use-module (gnu packages libedit) | |
db2c7e70 | 48 | #:use-module (gnu packages libffi) |
3df04eb0 | 49 | #:use-module (gnu packages multiprecision) |
56cf53fb | 50 | #:use-module (gnu packages ncurses) |
3df04eb0 PM |
51 | #:use-module (gnu packages sqlite) |
52 | #:use-module (gnu packages tls) | |
0ff69fa1 PM |
53 | #:use-module (gnu packages xorg) |
54 | #:use-module ((guix licenses) #:prefix license:)) | |
3df04eb0 | 55 | |
9647296c | 56 | ;; COMMENTARY: |
db2c7e70 | 57 | ;; |
035562b7 PM |
58 | ;; Anatomy of Racket: |
59 | ;; ------------------ | |
60 | ;; | |
61 | ;; The main Racket Git repository (<https://github.com/racket/racket>) is | |
62 | ;; organized broadly like this: | |
63 | ;; | |
64 | ;; . | |
65 | ;; ├── Makefile | |
66 | ;; ├── pkgs/ | |
67 | ;; └── racket/ | |
68 | ;; ├── collects/ | |
69 | ;; └── src/ | |
70 | ;; ├── configure | |
71 | ;; ├── Makefile.in | |
72 | ;; ├── bc/ | |
73 | ;; ├── cs/ | |
74 | ;; ├── ChezScheme/ | |
9647296c | 75 | ;; ├── zuo/ |
035562b7 PM |
76 | ;; └── ... |
77 | ;; | |
78 | ;; The 'racket/src/' directory contains the source of the runtime system, core | |
79 | ;; compiler, and primitives for the major Racket implementations: this layer | |
9647296c PM |
80 | ;; is called the ``Racket VM''. It is basically a normal Autoconf project, |
81 | ;; except that the makefiles just run Zuo to do the real work. (Even when | |
82 | ;; Racket VM implementations use components implemented in Racket, they are | |
83 | ;; compiled in special modes to produce VM primitives.) (There are or have | |
84 | ;; been experimental Racket VM implementations elsewhere, | |
035562b7 PM |
85 | ;; e.g. <https://github.com/pycket/pycket>.) |
86 | ;; | |
87 | ;; The 'racket/collects/' directory contains ``built in'' Racket libraries | |
88 | ;; that are not part of any package, including the implementation of | |
89 | ;; 'racket/base': in particular, it must contain enough to implement `raco pkg | |
90 | ;; install'. It is theoretically possible to use the Racket VM layer without | |
91 | ;; the main collections, but it is not stable or useful. | |
92 | ;; | |
93 | ;; The 'pkgs/' directory contains Racket packages that are especially closely | |
94 | ;; tied to the implementation of the Racket VM, including 'compiler-lib', | |
95 | ;; 'racket-doc', and 'racket-test'. Some of these packages depend on Racket | |
96 | ;; packages that are developed in other Git repositories, predominantly but | |
97 | ;; not exclusively under the 'racket' GitHub organization. Conversely, not all | |
98 | ;; of the packages developed in the main Git repository are part of the main | |
99 | ;; Racket distribution. (Additionally, components of the Racket VM that are | |
100 | ;; implemented in Racket can be installed as packages, mostly for ease of | |
101 | ;; development.) | |
102 | ;; | |
103 | ;; The top-level 'Makefile' is more like a directory of scripts: it has | |
104 | ;; convienience targets for developing Racket, and it cooperates with the | |
9647296c PM |
105 | ;; 'distro-build' package to assemble custom Racket distributions. (Again, |
106 | ;; the makefile just delegates to Zuo.) It is not part of Racket source | |
107 | ;; distributions: the root of a source distribution is basically 'racket/src' | |
108 | ;; with some extra package sources and configuration added. | |
035562b7 PM |
109 | ;; |
110 | ;; A ''minimal Racket'' installation includes two packages: 'base', which is a | |
111 | ;; sort of bridge between the current ``built-in'' collections and the package | |
112 | ;; system's model of dependencies, and 'racket-lib', which, for installations | |
113 | ;; that can not rely on a system package manager, pulls in the SQLite and | |
114 | ;; OpenSSL shared libraries as platform-specific dependencies for use by the | |
115 | ;; ``built-in'' collections. | |
116 | ;; | |
117 | ;; The main Racket distribution consists of installing the 'main-distribution' | |
118 | ;; package and all of its dependencies. | |
119 | ;; | |
120 | ;; The default mode when building Racket (or installing it with the released | |
121 | ;; installers) is an ``in-place build'', which produces a self-contained, | |
122 | ;; relocatable, roughly FHS-like directory. (Racket also supports | |
123 | ;; ``Unix-style'' installations, which rearrange the parts of an in-place | |
124 | ;; build into Racket-specific subdirectories and generally tries to work for | |
125 | ;; installation into an FHS-based system.) Certain tools, e.g. 'distro-build' | |
126 | ;; and 'raco cross', are able to work with an in-place Racket build. | |
127 | ;; | |
128 | ;; This file defines the packages 'racket-vm-cgc', 'racket-vm-bc', and | |
129 | ;; 'racket-vm-cs'. All three are in-place builds of 'racket/src/' and | |
130 | ;; 'racket/collects/' and are installed to 'opt/racket-vm/' in the store | |
ed24d6b4 | 131 | ;; output. |
035562b7 | 132 | ;; |
ed24d6b4 | 133 | ;; Using 'racket-vm-cs', we then define the packages 'racket-minimal' and |
9647296c PM |
134 | ;; 'racket'. These use Racket's support for ``layered installations'', which |
135 | ;; allow an immutable base layer to be extended with additional packages. | |
136 | ;; They use the layer configuration directly provide ready-to-install FHS-like | |
137 | ;; trees, rather than relying on the built in ``Unix-style install'' | |
138 | ;; mechanism. | |
035562b7 PM |
139 | ;; |
140 | ;; Bootstrapping Racket: | |
141 | ;; --------------------- | |
142 | ;; | |
143 | ;; Here's how bootstrapping Racket works: | |
db2c7e70 PM |
144 | ;; |
145 | ;; - Racket BC [CGC] can be built with only a C compiler (except for | |
146 | ;; one caveat discussed below). | |
147 | ;; - Racket BC [3M] needs an existing Racket to run "xform", | |
148 | ;; which transforms its own C source code to add additional annotations | |
149 | ;; for the precise garbage collector. | |
150 | ;; - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme. | |
151 | ;; It also needs an existing Racket to compile Racket-implemented | |
152 | ;; parts of the runtime system to R6RS libraries. | |
153 | ;; - Chez Scheme also needs bootfiles for itself, but Racket can simulate | |
154 | ;; enough of Chez Scheme to load Racket's fork of the Chez Scheme compiler | |
155 | ;; purely from source into Racket and apply the compiler to itself, | |
156 | ;; producing the needed bootfiles (albeit very slowly). | |
157 | ;; Any variant of Racket since version 7.1 can run the simulation. | |
158 | ;; | |
159 | ;; So, we build CGC to build 3M to build bootfiles and CS. | |
160 | ;; | |
035562b7 PM |
161 | ;; (Note: since the CGC variant is basically only for bootstrapping, we |
162 | ;; often use "BC" to mean "3M", consistent with `(banner)` and the | |
163 | ;; suffixes used on executables when more than one variant co-exists.) | |
164 | ;; | |
db2c7e70 PM |
165 | ;; One remaining bootstrapping limitation is that Racket's reader, module |
166 | ;; system, and macro expander are implemented in Racket. For Racket CS, | |
167 | ;; they are compiled to R6RS libraries as discussed above. This note from the | |
168 | ;; README file applies to all such subsystems: | |
169 | ;; | |
170 | ;; The Racket version must be practically the same as the current Racket | |
171 | ;; verson, although it can be the Racket BC implementation (instead of | |
172 | ;; the Racket CS implementation). | |
173 | ;; | |
174 | ;; Unlike Chez Scheme boot files, the files generated in "schemified" | |
175 | ;; are human-readable and -editable Scheme code. That provides a way | |
176 | ;; out of bootstrapping black holes, even without BC. | |
177 | ;; | |
178 | ;; However, other Racket subsystems implemented in Racket for Racket CS | |
179 | ;; use older C implementations for Racket BC, whereas the reader, expander, | |
180 | ;; and module system were completely replaced with the Racket implementation | |
9647296c | 181 | ;; as of Racket 7.0. See also <https://racket.discourse.group/t/951/4>. |
db2c7e70 PM |
182 | ;; |
183 | ;; For Racket BC, the compiled "linklet" s-expressions (primitive modules) | |
184 | ;; are embeded in C as a static string constant. Eventually, they are further | |
185 | ;; compiled by the C-implemented Racket BC bytecode and JIT compilers. | |
db2c7e70 | 186 | ;; |
9647296c PM |
187 | ;; Zuo is notably *not* a problem for bootstrapping. The implementation is a |
188 | ;; single hand-written C file designed to build with just `cc -o zuo zuo.c`, | |
189 | ;; even with very old or limited compilers. (We use the Autoconf support for | |
190 | ;; convienience.) | |
191 | ;; | |
192 | ;; CODE: | |
0ca37f3c | 193 | |
9647296c | 194 | (define %racket-version "8.6") ; Remember to update chez-scheme-for-racket! |
07a8440f | 195 | (define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c |
56cf53fb PM |
196 | (define %racket-commit |
197 | (string-append "v" %racket-version)) | |
198 | (define %racket-origin | |
199 | (origin | |
200 | (method git-fetch) | |
201 | (uri (git-reference | |
202 | (url "https://github.com/racket/racket") | |
203 | (commit %racket-commit))) | |
204 | (sha256 | |
9647296c | 205 | (base32 "1lw6h70dk8zqpl96zz0hmhn8vjcc0c7gw4prkfz2wid5bkq4mhg4")) |
56cf53fb | 206 | (file-name (git-file-name "racket" %racket-version)) |
9647296c PM |
207 | (patches (search-patches "racket-backport-8.6-cross-install.patch" |
208 | "racket-backport-8.6-docindex-write.patch" | |
209 | "racket-backport-8.6-hurd.patch" | |
210 | "racket-backport-8.6-zuo.patch" | |
211 | "racket-chez-scheme-bin-sh.patch" | |
212 | "racket-rktio-bin-sh.patch" | |
213 | "racket-zuo-bin-sh.patch")) | |
56cf53fb PM |
214 | (modules '((guix build utils))) |
215 | (snippet | |
216 | #~(begin | |
217 | (use-modules (guix build utils)) | |
218 | ;; Unbundle Chez submodules. | |
219 | (with-directory-excursion "racket/src/ChezScheme" | |
220 | ;; TODO: consider putting this in a (guix ...) or (guix build ...) | |
221 | ;; module so it can be shared with the upstream Chez Scheme origin | |
222 | ;; without cyclic issues. | |
223 | (for-each (lambda (dir) | |
224 | (when (directory-exists? dir) | |
225 | (delete-file-recursively dir))) | |
226 | '("stex" | |
227 | "nanopass" | |
228 | "lz4" | |
229 | "zlib"))) | |
230 | ;; Unbundle libffi. | |
231 | (delete-file-recursively "racket/src/bc/foreign/libffi"))))) | |
232 | ||
07a8440f PM |
233 | |
234 | (define-public zuo | |
235 | (let ((revision #f)) | |
236 | (package | |
237 | (name "zuo") | |
238 | (version (string-append %zuo-version | |
239 | "-racket" | |
9647296c | 240 | %racket-version |
07a8440f PM |
241 | (if revision "-guix" "") |
242 | (or revision ""))) | |
9647296c | 243 | (source %racket-origin) |
07a8440f PM |
244 | (outputs '("out" "debug")) |
245 | (build-system gnu-build-system) | |
246 | (arguments | |
247 | (list | |
248 | #:out-of-source? #t | |
249 | #:phases | |
250 | #~(modify-phases %standard-phases | |
251 | (add-after 'unpack 'chdir | |
252 | (lambda args | |
253 | (chdir "racket/src/zuo")))))) | |
254 | (home-page "https://github.com/racket/zuo") | |
255 | ;; ^ This is downstream of https://github.com/racket/racket, | |
256 | ;; but it's designed to be a friendly landing place | |
257 | (synopsis "Tiny Racket for build scripts") | |
38e83738 | 258 | (description "Zuo is a tiny Racket with primitives for dealing |
07a8440f PM |
259 | with files and running processes. It comes with a @command{make}-like |
260 | embedded DSL, which is used to build Racket itself. | |
261 | ||
262 | Zuo is a Racket variant in the sense that program files start with | |
263 | @code{#lang}, and the module path after @code{#lang} determines the parsing | |
264 | and expansion of the file content. That's how the @command{make}-like DSL is | |
265 | defined, and even the base Zuo language is defined by layers of @code{#lang}s. | |
266 | One of the early layers implements macros.") | |
267 | (license (list license:asl2.0 license:expat))))) | |
268 | ||
269 | ||
911768b6 | 270 | (define racket-vm-common-configure-flags |
9e5e413c PM |
271 | #~`(,@(cond |
272 | ((false-if-exception | |
273 | (search-input-file %build-inputs "/bin/libtool")) | |
274 | => (lambda (libtool) | |
275 | (list (string-append "--enable-lt=" libtool)))) | |
276 | (else | |
277 | '())) | |
278 | ,@(cond | |
279 | ((false-if-exception | |
035562b7 | 280 | (search-input-file %build-inputs "/opt/racket-vm/bin/racket")) |
9e5e413c PM |
281 | => (lambda (racket) |
282 | (list (string-append "--enable-racket=" racket)))) | |
283 | (else | |
284 | '())) | |
035562b7 | 285 | "--disable-strip" |
af375c63 PM |
286 | ;; Using --enable-origtree lets us distinguish the VM from subsequent |
287 | ;; layers and produces a build with the shape expected by tools such as | |
288 | ;; "distro-build" and "raco-cross". Removing these flags would require | |
289 | ;; changes, especially to 'configure-layer.rkt' (defined below). | |
035562b7 PM |
290 | "--enable-origtree" |
291 | ,(string-append "--prefix=" #$output "/opt/racket-vm"))) | |
db2c7e70 | 292 | |
035562b7 | 293 | (define-public racket-vm-cgc |
ec031b3c PM |
294 | ;; Eventually, it may make sense for some vm packages to not be hidden, |
295 | ;; but this one is especially likely to remain hidden. | |
296 | (hidden-package | |
297 | (package | |
035562b7 | 298 | (name "racket-vm-cgc") |
ec031b3c PM |
299 | (version %racket-version) |
300 | (source %racket-origin) | |
035562b7 | 301 | (inputs (list ncurses ;; <- common to all variants (for #%terminal) |
a15d72f8 | 302 | libffi)) ;; <- for BC and non-native CS variants |
cb0d1065 PM |
303 | (native-inputs (cons* zuo ;; <- for all variants |
304 | libtool ;; <- only for BC variants | |
305 | (if (%current-target-system) | |
306 | (list this-package) | |
307 | '()))) | |
049a27d8 | 308 | (outputs '("out" "debug")) |
ec031b3c PM |
309 | (build-system gnu-build-system) |
310 | (arguments | |
311 | (list | |
312 | #:configure-flags | |
035562b7 | 313 | #~(cons "--enable-cgcdefault" |
911768b6 | 314 | #$racket-vm-common-configure-flags) |
9647296c PM |
315 | #:make-flags |
316 | #~(list (string-append "ZUO=" | |
317 | #+(this-package-native-input "zuo") | |
318 | "/bin/zuo")) | |
ec031b3c PM |
319 | ;; Tests are in packages like racket-test-core and |
320 | ;; main-distribution-test that aren't part of the main | |
321 | ;; distribution. | |
322 | #:tests? #f | |
544fbdcc PM |
323 | ;; Upstream recommends #:out-of-source?, and it |
324 | ;; helps a lot with debugging. | |
325 | #:out-of-source? #t | |
ec031b3c PM |
326 | #:modules '((ice-9 match) |
327 | (ice-9 regex) | |
328 | (guix build gnu-build-system) | |
329 | (guix build utils)) | |
035562b7 PM |
330 | #:strip-directories #~'("opt/racket-vm/bin" |
331 | "opt/racket-vm/lib") | |
ec031b3c PM |
332 | #:phases |
333 | #~(modify-phases %standard-phases | |
334 | (add-before 'configure 'initialize-config.rktd | |
335 | (lambda* (#:key inputs #:allow-other-keys) | |
336 | (define (write-racket-hash alist) | |
337 | ;; inside must use dotted pair notation | |
338 | (display "#hash(") | |
339 | (for-each (match-lambda | |
340 | ((k . v) | |
341 | (format #t "(~s . ~s)" k v))) | |
342 | alist) | |
343 | (display ")\n")) | |
344 | (define maybe-release-catalog | |
345 | (let ((v #$(package-version this-package))) | |
346 | (if (string-match "^[0-9]+\\.[0-9]+($|\\.[0-8][0-9]*$)" | |
347 | v) | |
348 | `(,(string-append | |
349 | "https://download.racket-lang.org/releases/" | |
350 | v | |
351 | "/catalog/")) | |
352 | '()))) | |
353 | (mkdir-p "racket/etc") | |
354 | (with-output-to-file "racket/etc/config.rktd" | |
355 | (lambda () | |
356 | (write-racket-hash | |
035562b7 | 357 | `((build-stamp . "") |
ec031b3c PM |
358 | (catalogs ,@maybe-release-catalog |
359 | #f))))))) | |
360 | (add-before 'configure 'chdir | |
361 | (lambda _ | |
544fbdcc PM |
362 | (chdir "racket/src"))) |
363 | (replace 'install-license-files | |
364 | ;; The #:out-of-source? mode for install-license-files fails | |
365 | ;; to find the srcdir: as a workaround, navigate there ourselves. | |
366 | (let ((install-license-files | |
367 | (assoc-ref %standard-phases 'install-license-files))) | |
368 | (lambda args | |
369 | (with-directory-excursion "../src" | |
370 | (apply install-license-files | |
371 | `(,@args | |
372 | ;; if there are duplicate keywords, last is used | |
373 | #:out-of-source? #f))))))))) | |
ec031b3c PM |
374 | (home-page "https://racket-lang.org") |
375 | (synopsis "Old Racket implementation used for bootstrapping") | |
376 | (description "This variant of the Racket BC (``before Chez'' or | |
daa91a49 PM |
377 | ``bytecode'') implementation is not recommended for general use. It uses |
378 | CGC (a ``Conservative Garbage Collector''), which was succeeded as default in | |
379 | PLT Scheme version 370 (which translates to 3.7 in the current versioning | |
380 | scheme) by the 3M variant, which in turn was succeeded in version 8.0 by the | |
381 | Racket CS implementation. | |
93867cb3 | 382 | |
035562b7 | 383 | Racket CGC is primarily used for bootstrapping Racket BC [3M]. It may |
daa91a49 PM |
384 | also be used for embedding applications without the annotations needed in C |
385 | code to use the 3M garbage collector.") | |
ec031b3c PM |
386 | ;; https://download.racket-lang.org/license.html |
387 | ;; The LGPL components are only used by Racket BC. | |
388 | (license (list license:lgpl3+ license:asl2.0 license:expat))))) | |
db2c7e70 | 389 | |
035562b7 | 390 | (define-public racket-vm-bc |
ec031b3c | 391 | (package |
035562b7 PM |
392 | (inherit racket-vm-cgc) |
393 | (name "racket-vm-bc") | |
ec031b3c | 394 | (native-inputs |
cb0d1065 PM |
395 | (if (%current-target-system) |
396 | (package-native-inputs racket-vm-cgc) | |
397 | (modify-inputs (package-native-inputs racket-vm-cgc) | |
398 | (prepend racket-vm-cgc)))) | |
ec031b3c | 399 | (arguments |
035562b7 | 400 | (substitute-keyword-arguments (package-arguments racket-vm-cgc) |
ec031b3c PM |
401 | ((#:configure-flags _ '()) |
402 | #~(cons "--enable-bconly" | |
64a27e16 PM |
403 | #$(cond |
404 | ((target-ppc64le?) | |
405 | ;; Attempt to avoid a problem bootstrapping Chez Scheme: | |
406 | ;; see <https://issues.guix.gnu.org/57050#19> | |
407 | ;; and <https://racket.discourse.group/t/950/30>. | |
408 | #~(map | |
409 | (lambda (flag) | |
410 | (if (string-prefix? "CPPFLAGS=" flag) | |
411 | (string-append flag | |
412 | " -DSTACK_SAFETY_MARGIN=2000000") | |
413 | flag)) | |
414 | #$racket-vm-common-configure-flags)) | |
415 | (else | |
416 | racket-vm-common-configure-flags)))))) | |
035562b7 | 417 | (synopsis "Racket BC [3M] implementation") |
ec031b3c | 418 | (description "The Racket BC (``before Chez'' or ``bytecode'') |
db2c7e70 PM |
419 | implementation was the default before Racket 8.0. It uses a compiler written |
420 | in C targeting architecture-independent bytecode, plus a JIT compiler on most | |
a15d72f8 PM |
421 | platforms. Racket BC has a different C API than the current default runtime |
422 | system, Racket CS (based on ``Chez Scheme''). | |
db2c7e70 PM |
423 | |
424 | This package is the normal implementation of Racket BC with a precise garbage | |
425 | collector, 3M (``Moving Memory Manager'').") | |
ec031b3c PM |
426 | ;; https://download.racket-lang.org/license.html |
427 | ;; The LGPL components are only used by Racket BC. | |
428 | (license (list license:lgpl3+ license:asl2.0 license:expat)))) | |
db2c7e70 | 429 | |
035562b7 | 430 | (define-public racket-vm-cs |
db2c7e70 | 431 | (package |
035562b7 PM |
432 | (inherit racket-vm-bc) |
433 | (name "racket-vm-cs") | |
daa91a49 | 434 | (inputs |
a15d72f8 PM |
435 | (let ((inputs (modify-inputs (package-inputs racket-vm-cgc) |
436 | (prepend zlib lz4)))) | |
437 | (if (racket-cs-native-supported-system?) | |
438 | (modify-inputs inputs | |
439 | (delete "libffi")) | |
440 | inputs))) | |
daa91a49 | 441 | (native-inputs |
cb0d1065 PM |
442 | (let ((native-inputs (package-native-inputs racket-vm-cgc))) |
443 | (modify-inputs (if (%current-target-system) | |
444 | (modify-inputs native-inputs | |
445 | (delete "racket-vm-cgc")) | |
446 | native-inputs) | |
447 | (delete "libtool") | |
448 | (prepend chez-scheme-for-racket | |
449 | chez-nanopass-bootstrap | |
450 | (if (%current-target-system) | |
451 | racket-vm-cs | |
452 | racket-vm-bc))))) | |
db2c7e70 | 453 | (arguments |
035562b7 PM |
454 | (substitute-keyword-arguments (package-arguments racket-vm-cgc) |
455 | ((#:phases those-phases #~%standard-phases) | |
456 | #~(modify-phases #$those-phases | |
daa91a49 PM |
457 | (add-after 'unpack 'unpack-nanopass+stex |
458 | (lambda args | |
459 | (with-directory-excursion "racket/src/ChezScheme" | |
992ed3b4 | 460 | #$unpack-nanopass+stex))))) |
db2c7e70 | 461 | ((#:configure-flags _ '()) |
daa91a49 PM |
462 | #~(cons* "--enable-csonly" |
463 | "--enable-libz" | |
464 | "--enable-lz4" | |
992ed3b4 | 465 | (string-append "--enable-scheme=" |
cb0d1065 | 466 | #+(this-package-native-input |
992ed3b4 PM |
467 | "chez-scheme-for-racket") |
468 | "/bin/scheme") | |
a15d72f8 PM |
469 | #$@(if (racket-cs-native-supported-system?) |
470 | #~() | |
471 | #~(#$(string-append "--enable-mach=" | |
472 | (nix-system->pbarch-machine-type)) | |
473 | "--enable-pb")) | |
911768b6 | 474 | #$racket-vm-common-configure-flags)))) |
035562b7 PM |
475 | (synopsis "Racket CS implementation") |
476 | (description "The Racket CS implementation, which uses ``Chez Scheme'' as | |
477 | its core compiler and runtime system, has been the default Racket VM | |
a504a446 | 478 | implementation since Racket 8.0. It performs better than the Racket BC |
a15d72f8 PM |
479 | implementation for most programs. On systems for which Racket CS cannot |
480 | generate machine code, this package uses a variant of its ``portable | |
481 | bytecode'' backend specialized for word size and endianness. | |
db2c7e70 | 482 | |
035562b7 PM |
483 | Using the Racket VM packages directly is not recommended: instead, install the |
484 | @code{racket-minimal} or @code{racket} packages.") | |
daa91a49 PM |
485 | ;; https://download.racket-lang.org/license.html |
486 | ;; The LGPL components are only used by Racket BC. | |
487 | (license (list license:asl2.0 license:expat)))) | |
db2c7e70 | 488 | |
81e532ff PM |
489 | (define (racket-packages-origin name origin specs) |
490 | "Extract from ORIGIN the sources for the Racket packages specified by SPECS, | |
491 | a non-empty list of package specifications. In the resulting file-like | |
492 | object, each package's source will be in the directory | |
493 | \"/share/racket/pkgs/PKG/\", where PKG is the Racket name for the package. | |
494 | The NAME will be used in the store file name for the resulting file-like | |
495 | object. | |
db2c7e70 | 496 | |
81e532ff | 497 | A package specification is a list of the form: |
db2c7e70 | 498 | |
81e532ff | 499 | (PKG PATH) |
93867cb3 | 500 | |
81e532ff PM |
501 | where PATH is the path to the package source relative to ORIGIN---possibly |
502 | \".\". As a special case, a package specification may also be a string, which | |
503 | is equivalent to: | |
504 | ||
505 | (PKG PKG) | |
506 | ||
507 | Examples: | |
508 | ||
509 | - \"expeditor\" | |
510 | - (\"main-distribution\" \".\") | |
511 | - (\"racket-lib\" \"pkgs/racket-lib\")" | |
512 | (computed-file | |
513 | (string-append "racket-pkg-" name "-sources") | |
514 | (with-imported-modules `((guix build utils)) | |
515 | #~(begin | |
516 | (use-modules (guix build utils)) | |
517 | (mkdir-p (string-append #$output "/share/racket/pkgs")) | |
518 | (chdir (string-append #$output "/share/racket/pkgs")) | |
519 | #$@(map (match-lambda | |
520 | ((? string? name) | |
521 | #~(copy-recursively #$(file-append origin (string-append "/" name)) | |
522 | #$name)) | |
523 | ((name ".") | |
524 | #~(copy-recursively #$origin #$name)) | |
525 | ((name path) | |
526 | #~(copy-recursively #$(file-append origin (string-append "/" path)) | |
527 | #$name))) | |
528 | specs))))) | |
529 | ||
530 | (define (simple-racket-origin repo hash specs) | |
531 | "Like 'racket-packages-origin', but specialized for packages hosted at | |
532 | \"https://github.com/racket/REPO\" with sha256 checksum HASH. REPO is also | |
533 | used to build the name of the resulting store item." | |
534 | (racket-packages-origin | |
535 | repo | |
536 | (origin | |
537 | (method git-fetch) | |
538 | (uri (git-reference | |
539 | (url (format #f "https://github.com/racket/~a" repo)) | |
540 | (commit %racket-commit))) | |
541 | (sha256 hash) | |
542 | (file-name (git-file-name (string-append "racket-" repo) | |
543 | %racket-version))) | |
544 | specs)) | |
93867cb3 | 545 | |
035562b7 PM |
546 | (define-public racket-minimal |
547 | (package | |
548 | (name "racket-minimal") | |
549 | (version %racket-version) | |
550 | (source #f) | |
551 | ;; For cross-compilation, Matthew Flatt recommends reusing | |
552 | ;; as much of `raco cross` as possible. So, put that off until | |
553 | ;; we have a build system for Racket packages. | |
554 | (inputs | |
555 | (list openssl | |
556 | sqlite | |
ed24d6b4 | 557 | racket-vm-cs |
035562b7 PM |
558 | (racket-packages-origin |
559 | "base" %racket-origin | |
560 | '(("base" "pkgs/base") | |
561 | ("racket-lib" "pkgs/racket-lib"))))) | |
562 | (build-system gnu-build-system) | |
563 | (arguments | |
564 | ;; Here and for the `racket` package, we're using #:configure-flags | |
565 | ;; to pass flags for `configure-layer.rkt` and #:make-flags | |
566 | ;; to pass arguments for `raco pkg install`. | |
567 | (list | |
568 | #:configure-flags | |
569 | #~`("--tethered" | |
570 | "--extra-foreign-lib-search-dirs" | |
571 | ,(format | |
572 | #f "~s" | |
573 | (list #$(file-append (this-package-input "openssl") "/lib") | |
574 | #$(file-append (this-package-input "sqlite") "/lib")))) | |
575 | #:make-flags #~`("racket-lib") | |
576 | #:tests? #f ;; packaged separately | |
577 | #:modules '((guix build gnu-build-system) | |
578 | (guix build utils) | |
579 | (guix build union) | |
580 | (ice-9 match)) | |
581 | #:imported-modules `((guix build union) | |
582 | ,@%gnu-build-system-modules) | |
583 | #:phases | |
584 | #~(modify-phases %standard-phases | |
585 | (delete 'unpack) | |
586 | (replace 'configure | |
587 | (lambda* (#:key inputs configure-flags #:allow-other-keys) | |
588 | (let* ((vm-dir (search-input-directory inputs "opt/racket-vm")) | |
589 | (racket (string-append vm-dir "/bin/racket"))) | |
590 | (apply invoke | |
591 | racket | |
592 | #$configure-layer.rkt | |
593 | `(,@(cond | |
594 | ((false-if-exception | |
595 | (search-input-file | |
596 | inputs "etc/racket/config.rktd")) | |
597 | => (lambda (file) | |
598 | `("--parent" | |
599 | ,(dirname (dirname (dirname file)))))) | |
600 | (else | |
601 | '())) | |
602 | ,@configure-flags | |
603 | ,vm-dir | |
604 | ,#$output)) | |
605 | (invoke racket | |
606 | "--config" (string-append #$output "/etc/racket") | |
607 | "-l" "raco" "setup" | |
608 | "--no-user")))) | |
609 | (replace 'build | |
610 | (lambda* (#:key inputs #:allow-other-keys) | |
611 | ;; We use "share/racket/pkgs" for sources to distinguish them | |
612 | ;; from the "lib/racket/pkgs" of a potential parent layer. | |
613 | (union-build (string-append #$output "/lib/racket/pkgs") | |
614 | (search-path-as-list '("share/racket/pkgs") | |
615 | (map cdr inputs)) | |
616 | #:create-all-directories? #t))) | |
617 | (replace 'install | |
618 | (lambda* (#:key inputs make-flags #:allow-other-keys) | |
619 | (let ((racket | |
620 | (search-input-file inputs "/opt/racket-vm/bin/racket"))) | |
621 | (unless (null? make-flags) | |
622 | (invoke racket | |
623 | "-l-" | |
624 | "pkg/dirs-catalog" | |
625 | "--link" | |
626 | "local-catalog" | |
627 | (string-append #$output "/lib/racket/pkgs")) | |
628 | (apply invoke | |
629 | racket | |
630 | "--config" (string-append #$output "/etc/racket") | |
631 | "-l" "raco" | |
632 | "pkg" "install" | |
633 | "--installation" | |
634 | "--auto" | |
635 | "--catalog" "local-catalog" | |
636 | make-flags)))))))) | |
637 | (home-page "https://racket-lang.org") | |
638 | (synopsis "Racket without bundled packages such as DrRacket") | |
639 | (description | |
640 | "Racket is a general-purpose programming language in the Scheme family, | |
641 | with a large set of libraries and a compiler based on Chez Scheme. Racket is | |
642 | also a platform for language-oriented programming, from small domain-specific | |
643 | languages to complete language implementations. | |
644 | ||
645 | The ``minimal Racket'' distribution includes just enough of Racket for you to | |
646 | use @command{raco pkg} to install more. Bundled packages, such as the | |
647 | DrRacket IDE, are not included.") | |
648 | ;; https://download.racket-lang.org/license.html | |
649 | ;; The LGPL components are only used by Racket BC. | |
650 | (license (list license:asl2.0 license:expat)))) | |
651 | ||
93867cb3 | 652 | (define-public racket |
dbcf2b61 | 653 | (package |
035562b7 | 654 | (inherit racket-minimal) |
93867cb3 | 655 | (name "racket") |
81e532ff PM |
656 | (source #f) |
657 | (native-inputs (list racket-minimal)) ; XXX: conservative estimate, untested | |
3df04eb0 | 658 | (inputs |
81e532ff PM |
659 | (list |
660 | cairo | |
661 | fontconfig | |
662 | glib | |
663 | glu | |
664 | gmp | |
665 | gtk+ ;; propagates gdk-pixbuf+svg | |
666 | libjpeg-turbo | |
667 | libpng | |
668 | libx11 ;; ?? wayland ?? | |
669 | mesa | |
670 | mpfr | |
671 | pango | |
672 | unixodbc | |
673 | libedit ;; TODO reconsider in light of expeditor and readline-gpl | |
674 | racket-minimal ;; <-- TODO non-tethered layer | |
ed24d6b4 | 675 | racket-vm-cs |
81e532ff | 676 | (simple-racket-origin |
af375c63 | 677 | "2d" (base32 "0fb5v6058ls08xw3zbmqyr2ym0psm119gl9ffgmhm9w8rs9i4dq7") |
81e532ff PM |
678 | '("2d" "2d-doc" "2d-lib")) |
679 | (simple-racket-origin | |
680 | "algol60" (base32 "09kj6asypmc24n29w0izc9p0q8hpga2hpkchsypfwn5c8zpvihlx") | |
681 | '(("algol60" "."))) | |
682 | (racket-packages-origin | |
683 | "racket" %racket-origin | |
035562b7 | 684 | '(("at-exp-lib" "pkgs/at-exp-lib") |
81e532ff PM |
685 | ("compiler" "pkgs/compiler") |
686 | ("compiler-lib" "pkgs/compiler-lib") | |
687 | ("net" "pkgs/net") | |
688 | ("net-doc" "pkgs/net-doc") | |
689 | ("net-lib" "pkgs/net-lib") | |
690 | ("racket-doc" "pkgs/racket-doc") | |
691 | ("racket-index" "pkgs/racket-index") | |
692 | ("sandbox-lib" "pkgs/sandbox-lib") | |
693 | ("zo-lib" "pkgs/zo-lib"))) | |
694 | (simple-racket-origin | |
695 | "cext-lib" (base32 "00w38jpv88fpl4pgj6ndnysvn0s21rjvj0xhznay80msan0vc341") | |
696 | '("cext-lib" "dynext-lib")) | |
697 | (simple-racket-origin | |
698 | "class-iop" (base32 "08z57q83cr7wnh6g8ah3hdhmsmf9zp1jfs7yvxv188l3hzvygy5l") | |
699 | '("class-iop-lib")) | |
700 | (simple-racket-origin | |
701 | "compatibility" (base32 "0bfqwscjpyi325br5pa6g62g9c8lq18a80zp5g3d2qzn3n3mi6x0") | |
702 | '("compatibility" "compatibility-doc" "compatibility-lib")) | |
703 | (simple-racket-origin | |
704 | "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3") | |
705 | '(("contract-profile" "."))) | |
706 | (simple-racket-origin | |
9647296c | 707 | "data" (base32 "08sj4m0g0cp7gwb0nq90m770f0c21b7ydif7nljc8rxmcdprfisc") |
81e532ff PM |
708 | '("data" "data-doc" "data-enumerate-lib" "data-lib")) |
709 | (simple-racket-origin | |
af375c63 | 710 | "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s") |
81e532ff PM |
711 | '(("datalog" "."))) |
712 | (simple-racket-origin | |
9647296c | 713 | "db" (base32 "0jzsbfcdm3xj0g8xxw3ky2swrhiqqsq2aqa3r08m641dc981dmjq") |
81e532ff PM |
714 | '("db" "db-doc" "db-lib")) |
715 | (simple-racket-origin | |
9647296c | 716 | "deinprogramm" (base32 "16ncs3ms3mmdavbk0mkhm2qi62vyyif9cch3sn1y64pij489x34v") |
81e532ff PM |
717 | '("deinprogramm" "deinprogramm-signature")) |
718 | (simple-racket-origin | |
719 | "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0") | |
720 | '("distributed-places" "distributed-places-doc" "distributed-places-lib")) | |
721 | (simple-racket-origin | |
9647296c | 722 | "draw" (base32 "00rq5y4ba6z1d6jh76kl8rwpxrlqqp81a875zyhk3k81i42635sm") |
81e532ff PM |
723 | '("draw" "draw-doc" "draw-lib")) |
724 | (simple-racket-origin | |
9647296c | 725 | "drracket" (base32 "05d7wssi0ry13alb5hl3llpsg30dd0jhyfv5nb1nmg189fn42q62") |
81e532ff PM |
726 | '("drracket" |
727 | "drracket-plugin-lib" | |
728 | "drracket-tool" | |
729 | "drracket-tool-doc" | |
730 | "drracket-tool-lib" | |
731 | "drracket-tool-text-lib")) | |
732 | (simple-racket-origin | |
733 | "ds-store" (base32 "0ajr27kipp4dr1qlisaghsb3h7lhhjwrfw2r79b5myczsa1mp661") | |
734 | '("ds-store" "ds-store-doc" "ds-store-lib")) | |
735 | (simple-racket-origin | |
736 | "eli-tester" (base32 "0icx6wn14gjm8kdmq1jppqgq87sxkras4qb5xmdr6wigxafhjqyk") | |
737 | '(("eli-tester" "."))) | |
738 | (simple-racket-origin | |
739 | "eopl" (base32 "1fmiixj6rxsgzwvgva8lvrvv0gl49v2405mp3s0i7ipis5c4n27s") | |
740 | '(("eopl" "."))) | |
741 | (simple-racket-origin | |
9647296c | 742 | "errortrace" (base32 "0r5630bb2d6hk0fbi95fmyfja54nnwdfcj2zjba124pp6xkjyavx") |
81e532ff PM |
743 | '("errortrace" "errortrace-doc" "errortrace-lib")) |
744 | (simple-racket-origin | |
af375c63 | 745 | "expeditor" (base32 "0mjfwb4wzwsg5xj3k6cmik0va432n56rp5h7rxx1c2yy3prh1j7q") |
81e532ff PM |
746 | '("expeditor" "expeditor-doc" "expeditor-lib")) |
747 | (simple-racket-origin | |
748 | "frtime" (base32 "0ydz2yn8vvv6z7brwlswcyx0f31a6y6d443i89rysfvd2xkhpfd5") | |
749 | '(("frtime" "."))) | |
750 | (simple-racket-origin | |
751 | "future-visualizer" (base32 "1758qq769m0r14xf64sl2ix2l9z340kvapar0j7s5kdg42lmvnhm") | |
752 | '("future-visualizer" | |
753 | "future-visualizer-pict" | |
754 | "future-visualizer-typed")) | |
755 | (simple-racket-origin | |
756 | "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d") | |
757 | '(("games" "."))) | |
af375c63 | 758 | (simple-racket-origin |
9647296c | 759 | "gui" (base32 "18pcnx3wi8f32i2frm8bn9pi08n4y3c5jgqs4gy21w6f84dv401w") |
81e532ff PM |
760 | '("gui" "gui-doc" "gui-lib" "tex-table")) |
761 | (simple-racket-origin | |
762 | "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5") | |
763 | '("gui-pkg-manager-lib")) | |
764 | (simple-racket-origin | |
9647296c | 765 | "htdp" (base32 "173xy6ks55npvwn6cykjs41s9qfb70hc2gfjiqvw91hdsbjykwir") |
81e532ff PM |
766 | '("htdp" "htdp-doc" "htdp-lib")) |
767 | (simple-racket-origin | |
768 | "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x") | |
769 | '("html" "html-doc" "html-lib")) | |
770 | (simple-racket-origin | |
771 | "icons" (base32 "1s5a6j11fg3fdr6b7vm2q7q178d7q8b8igy73bs211r27qrd1gg7") | |
772 | '(("icons" "."))) | |
773 | (simple-racket-origin | |
774 | "images" (base32 "0rpjxqw34bq5m08kh1ldl1mr7s9z1lyydxxcyzb292kqh9qiqvfl") | |
775 | '("images" "images-doc" "images-gui-lib" "images-lib")) | |
776 | (simple-racket-origin | |
777 | "lazy" (base32 "176ylzgbdsbmqknpihaz519afq71pyjkv1h87j5v8jfbpbddyfsf") | |
778 | '(("lazy" "."))) | |
779 | (simple-racket-origin | |
780 | "macro-debugger" (base32 "14hyrwbkffr61fk44l02xb47bhv5zccw0ymaa9kxld86hvyqhqbm") | |
781 | '("macro-debugger" "macro-debugger-text-lib")) | |
782 | (simple-racket-origin | |
783 | "main-distribution" (base32 "0m2n9s32s8a4a2gn4ywrm9l8jycdm5ayi5w9kh5wchhrrw7qzq7y") | |
784 | '(("main-distribution" "."))) | |
785 | (simple-racket-origin | |
786 | "make" (base32 "10852fj30bz5r46c3d99s37fkgy5yh44gb01j29sf3kxnhi0g2sa") | |
787 | '(("make" "."))) | |
788 | (simple-racket-origin | |
9647296c | 789 | "math" (base32 "00ld38in5jfshs1q4zf07w84cyv4yjr40kmw30pyd5wqgs2zq9ai") |
81e532ff PM |
790 | '("math" "math-doc" "math-lib")) |
791 | (simple-racket-origin | |
792 | "mysterx" (base32 "11p9jzrafw0hizhl0cs4sxx7rv281185q8hryic2rpk0kzjdyr48") | |
793 | '(("mysterx" "."))) | |
794 | (simple-racket-origin | |
795 | "mzcom" (base32 "0rc9pfj7gwm5azghqvcibz6si1x5s2v8mr2yngk7ssq9gzfbi6a4") | |
796 | '(("mzcom" "."))) | |
797 | (simple-racket-origin | |
798 | "mzscheme" (base32 "192c52zi726h5wjamxrhivjw2waq1im0zpyxhbrkrxknm8x84bs9") | |
799 | '("mzscheme" "mzscheme-doc" "mzscheme-lib")) | |
800 | (racket-packages-origin | |
801 | "net-cookies" (origin | |
802 | (method git-fetch) | |
803 | (uri (git-reference | |
804 | (url "https://github.com/RenaissanceBug/racket-cookies") | |
805 | (commit %racket-commit))) | |
806 | (sha256 (base32 | |
807 | "0k0hifxhywl5c3hjcaiizc098dpyk001d981p572gly116yvjxc1")) | |
808 | (file-name | |
809 | (git-file-name "RenaissanceBug-racket-cookies" %racket-version))) | |
810 | '("net-cookies" "net-cookies-doc" "net-cookies-lib")) | |
811 | (racket-packages-origin | |
812 | "optimization-coach" | |
813 | (origin | |
814 | (method git-fetch) | |
815 | (uri (git-reference | |
816 | (url "https://github.com/stamourv/optimization-coach") | |
817 | (commit %racket-commit))) | |
818 | (sha256 (base32 | |
819 | "0b27sw48d7rhz0hin88c7rbr9vpg1c23sn82nd4jkmq54h6gasr1")) | |
820 | (file-name | |
821 | (git-file-name "stamourv-optimization-coach" %racket-version))) | |
822 | '(("optimization-coach" "."))) | |
823 | (simple-racket-origin | |
9647296c | 824 | "option-contract" (base32 "07cncg9pi15cm19k7rzv54vx83wq7y42i2m6bgzaqja1h8vnj2ww") |
81e532ff PM |
825 | '("option-contract" "option-contract-doc" "option-contract-lib")) |
826 | (simple-racket-origin | |
9647296c | 827 | "parser-tools" (base32 "04ycihliikh0c47ivp09gayxiql9d9wpl216czic19cj6f7rmcnj") |
81e532ff PM |
828 | '("parser-tools" "parser-tools-doc" "parser-tools-lib")) |
829 | (simple-racket-origin | |
830 | "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1") | |
831 | '("pconvert-lib")) | |
832 | (simple-racket-origin | |
9647296c | 833 | "pict" (base32 "1n0v7kynkiin1v8igs9m8k8vfwjn5cswanhq2imp1pxzjvdyq6sx") |
81e532ff PM |
834 | '("pict" "pict-doc" "pict-lib")) |
835 | (simple-racket-origin | |
836 | "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x") | |
837 | '("pict-snip" "pict-snip-doc" "pict-snip-lib")) | |
838 | (simple-racket-origin | |
839 | "picturing-programs" (base32 "1g6xr39hx1j03gb3d4dljm3v91xcj2gfpq3dgy5xvplzr6cmmxgr") | |
840 | '(("picturing-programs" "."))) | |
841 | (simple-racket-origin | |
842 | "plai" (base32 "0i983sh0r0zm2ng4j44m5aw9669kh5fhp91bzpc9jm280rfcqvyl") | |
843 | '("plai" "plai-doc" "plai-lib")) | |
844 | (simple-racket-origin | |
845 | "planet" (base32 "0r2yqrzrmdjjyr14k6hhlzc5kzrcx3583m1s02mhrcmpfw0s85w9") | |
846 | '("planet" "planet-doc" "planet-lib")) | |
847 | (simple-racket-origin | |
af375c63 | 848 | "plot" (base32 "04871pspbm0q3bz5896sa3jw2rp9i6jf0b5aivrxfp56vxxd2ybb") |
81e532ff PM |
849 | '("plot" "plot-compat" "plot-doc" "plot-gui-lib" "plot-lib")) |
850 | (simple-racket-origin | |
851 | "preprocessor" (base32 "1p5aid58ifnjy4xl0ysh85cq39k25661v975jrpk182z3k5621mg") | |
852 | '(("preprocessor" "."))) | |
853 | (simple-racket-origin | |
854 | "profile" (base32 "179i86lyby29nywz60l4vnadi02w8b12h7501nm5h5g4pq9jjmbb") | |
855 | '("profile" "profile-doc" "profile-lib")) | |
856 | (racket-packages-origin | |
857 | "quickscript" (origin | |
858 | (method git-fetch) | |
859 | (uri (git-reference | |
860 | (url "https://github.com/Metaxal/quickscript") | |
861 | (commit %racket-commit))) | |
862 | (sha256 (base32 | |
af375c63 | 863 | "00sf5nw09aacd0l4a4cknnffvcs95p596im3blsdvfz5ck6jdwl8")) |
81e532ff PM |
864 | (file-name (git-file-name "Metaxal-quickscript" %racket-version))) |
865 | '(("quickscript" "."))) | |
866 | (simple-racket-origin | |
867 | "r5rs" (base32 "1g3cysj7z88r38vkzvi8g2fb2hn4yg1fdhy5smxw303jxgl3inp6") | |
868 | '("r5rs" "r5rs-doc" "r5rs-lib")) | |
869 | (simple-racket-origin | |
870 | "r6rs" (base32 "0b1ymzdp10r0flw2acbidjsh5ma1pm5hy54jss37sxf89z3xbvm4") | |
871 | '("r6rs" "r6rs-doc" "r6rs-lib")) | |
872 | (racket-packages-origin | |
873 | "racket-cheat" (origin | |
874 | (method git-fetch) | |
875 | (uri (git-reference | |
876 | (url "https://github.com/jeapostrophe/racket-cheat") | |
877 | (commit %racket-commit))) | |
878 | (sha256 (base32 | |
879 | "06wcj558rzkbl2bwkmikyspya9v1f4iwlzwnwxpkc33h2xapwabr")) | |
880 | (file-name | |
881 | (git-file-name "jeapostrophe-racket-cheat" %racket-version))) | |
882 | '(("racket-cheat" "."))) | |
883 | (simple-racket-origin | |
af375c63 | 884 | "racklog" (base32 "0fbq0fpfb3l6h7h772dvkmlzlk2dnq5f8296xx1qxhhwypibqzr9") |
81e532ff PM |
885 | '(("racklog" "."))) |
886 | (simple-racket-origin | |
9647296c | 887 | "rackunit" (base32 "1gpz9sgnm8hrc0cb3rii0wzbcwp9mgy5k1amnxidy7gyzl7prn81") |
81e532ff PM |
888 | '("rackunit" |
889 | "rackunit-doc" | |
890 | "rackunit-gui" | |
891 | "rackunit-lib" | |
892 | "rackunit-plugin-lib" | |
893 | "rackunit-typed" | |
894 | "schemeunit" | |
895 | "testing-util-lib")) | |
896 | (simple-racket-origin | |
897 | "readline" (base32 "13kbcn2wchv82d709mw3r8n37bk8iwq0y4kpvm9dbzx0w2pxkfwn") | |
898 | '("readline" "readline-doc" "readline-lib")) | |
899 | (simple-racket-origin | |
9647296c | 900 | "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g") |
81e532ff PM |
901 | '(("realm" "."))) |
902 | (simple-racket-origin | |
9647296c | 903 | "redex" (base32 "06dhyqmin0qdm6b6sdvgzpy3pa4svlw42ld9k2h1dxcr852czil7") |
81e532ff PM |
904 | '("redex" |
905 | "redex-benchmark" | |
906 | "redex-doc" | |
907 | "redex-examples" | |
908 | "redex-gui-lib" | |
909 | "redex-lib" | |
910 | "redex-pict-lib")) | |
911 | (simple-racket-origin | |
912 | "sasl" (base32 "0ibh4wb4gn8pggx6gkv4vk4d6rwzn5nrvjibhvkzhaynf6lhb824") | |
913 | '("sasl" "sasl-doc" "sasl-lib")) | |
914 | (simple-racket-origin | |
915 | "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x") | |
916 | '(("scheme-lib" "."))) | |
917 | (simple-racket-origin | |
9647296c | 918 | "scribble" (base32 "0a11kvcnzp04mp4xxq68rkl09jv00hv81k2nmwkmwpfx9b2acvd3") |
81e532ff PM |
919 | '("scribble" |
920 | "scribble-doc" | |
921 | "scribble-html-lib" | |
922 | "scribble-lib" | |
923 | "scribble-text-lib")) | |
924 | (simple-racket-origin | |
925 | "serialize-cstruct-lib" | |
926 | (base32 "1rq3n1fa7ldjwx3lrh9ybhig7jlsw1crpzyklbzp3xqdw6jymfnz") | |
927 | '(("serialize-cstruct-lib" "."))) | |
928 | (simple-racket-origin | |
929 | "sgl" (base32 "0nkymhdyjrwi5h199j4w5zh7y3x3ai42gsiwxzh0hy7yqrqqg9zv") | |
930 | '(("sgl" "."))) | |
931 | (simple-racket-origin | |
932 | "shell-completion" (base32 "04m144gy2mp4fiq6rcbf12wjr8mws8k9scfhg9lc38vqppp4lxsj") | |
933 | '(("shell-completion" "."))) | |
934 | (simple-racket-origin | |
935 | "simple-tree-text-markup" | |
936 | (base32 "0fyd9gfz6bnv0m1901wv5mnhc05rm8hw9i6ddrqx33hs6qsg2zqr") | |
937 | '("simple-tree-text-markup" | |
938 | "simple-tree-text-markup-doc" | |
939 | "simple-tree-text-markup-lib")) | |
940 | (simple-racket-origin | |
941 | "slatex" (base32 "0pkm2isbbdk63slrbsxcql7rr0wdrw5kapw1xq4ps5k8dhlzv8x0") | |
942 | '(("slatex" "."))) | |
943 | (simple-racket-origin | |
944 | "slideshow" (base32 "1znv1i2d0610hhy71q932xy7wka00q3q50in1xfnk8ibg7nzkagm") | |
945 | '("slideshow" "slideshow-doc" "slideshow-exe" "slideshow-lib" "slideshow-plugin")) | |
946 | (simple-racket-origin | |
947 | "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj") | |
948 | '("snip" "snip-lib")) | |
949 | (simple-racket-origin | |
9647296c | 950 | "typed-racket" (base32 "03wsz647fi58brbg33fw1xavp100gzfvngdy8bk7bdc0jfg8a18l") |
81e532ff PM |
951 | '("source-syntax" |
952 | "typed-racket" | |
953 | "typed-racket-compatibility" | |
954 | "typed-racket-doc" | |
955 | "typed-racket-lib" | |
956 | "typed-racket-more")) | |
af375c63 PM |
957 | (simple-racket-origin |
958 | "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn") | |
81e532ff PM |
959 | '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib")) |
960 | (simple-racket-origin | |
9647296c | 961 | "string-constants" (base32 "1kg3vxq2hcd0vl76brgpzdwbrb65a4nrrkc6hj4az5lfbbdvqz47") |
81e532ff PM |
962 | '("string-constants" "string-constants-doc" "string-constants-lib")) |
963 | (simple-racket-origin | |
9647296c | 964 | "swindle" (base32 "03n9ymjhrw45h7hxkw4nq8nidnvs9mfzb4228s2cjfaqbgqxvsyb") |
81e532ff PM |
965 | '(("swindle" "."))) |
966 | (simple-racket-origin | |
9647296c | 967 | "syntax-color" (base32 "02dcd4yvdnw35m3srvfd43csxffxw3j4rk6zi379b8dsvbbrjyq1") |
81e532ff PM |
968 | '("syntax-color" "syntax-color-doc" "syntax-color-lib")) |
969 | (simple-racket-origin | |
970 | "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia") | |
971 | '(("trace" "."))) | |
972 | (simple-racket-origin | |
973 | "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y") | |
974 | '("unix-socket" "unix-socket-doc" "unix-socket-lib")) | |
975 | (simple-racket-origin | |
9647296c | 976 | "web-server" (base32 "104lnzjykkd6f3gxpv7p14l94if6zac33nmb4sj5jxmd6r3fwcpf") |
81e532ff PM |
977 | '("web-server" "web-server-doc" "web-server-lib")) |
978 | (simple-racket-origin | |
979 | "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b") | |
980 | '("wxme" "wxme-lib")) | |
981 | (simple-racket-origin | |
af375c63 | 982 | "xrepl" (base32 "19svg0jfs656bld5ikqipz3a5szk5k02zq5fh43209qw527dnfbk") |
81e532ff PM |
983 | '("xrepl" "xrepl-doc" "xrepl-lib")))) |
984 | (build-system gnu-build-system) | |
65bad4d0 | 985 | (arguments |
035562b7 PM |
986 | (substitute-keyword-arguments (package-arguments racket-minimal) |
987 | ((#:make-flags _ '()) | |
988 | #~`("main-distribution")) | |
989 | ((#:configure-flags _ '()) | |
990 | #~`("--tethered" | |
991 | "--extra-foreign-lib-search-dirs" | |
992 | ,(format #f "~s" | |
993 | '(#$@(map (lambda (name) | |
994 | (cond | |
995 | ((this-package-input name) | |
996 | => (cut file-append <> "/lib")) | |
997 | (else | |
8918ce6d LC |
998 | (raise |
999 | (formatted-message | |
1000 | (G_ "missing input '~a' to the 'racket' package") | |
1001 | name))))) | |
035562b7 PM |
1002 | '("cairo" |
1003 | "fontconfig-minimal" ;; aka fontconfig | |
1004 | "glib" | |
1005 | "glu" | |
1006 | "gmp" | |
1007 | "gtk+" | |
1008 | "libjpeg-turbo" | |
1009 | "libpng" | |
1010 | "libx11" | |
1011 | "mesa" | |
1012 | "mpfr" | |
1013 | "pango" | |
1014 | "unixodbc" | |
1015 | "libedit")))))))) | |
c47a45ca | 1016 | (synopsis "Programmable programming language in the Scheme family") |
3df04eb0 PM |
1017 | (description |
1018 | "Racket is a general-purpose programming language in the Scheme family, | |
1019 | with a large set of libraries and a compiler based on Chez Scheme. Racket is | |
1020 | also a platform for language-oriented programming, from small domain-specific | |
1021 | languages to complete language implementations. | |
1022 | ||
1023 | The main Racket distribution comes with many bundled packages, including the | |
1024 | DrRacket IDE, libraries for GUI and web programming, and implementations of | |
035562b7 | 1025 | languages such as Typed Racket, R5RS and R6RS Scheme, Algol 60, and Datalog."))) |
65bad4d0 | 1026 | |
81e532ff | 1027 | (define configure-layer.rkt |
65bad4d0 | 1028 | (scheme-file |
81e532ff | 1029 | "configure-layer.rkt" |
65bad4d0 | 1030 | `(module |
81e532ff | 1031 | configure-layer racket/base |
65bad4d0 PM |
1032 | (require racket/cmdline |
1033 | racket/match | |
1034 | racket/file | |
81e532ff | 1035 | racket/port |
65bad4d0 PM |
1036 | racket/list |
1037 | racket/pretty) | |
65bad4d0 PM |
1038 | (define (build-path-string . args) |
1039 | (path->string (apply build-path args))) | |
1040 | (define rx:racket | |
1041 | ;; Guile's reader doesn't support #rx"racket" | |
1042 | (regexp "racket")) | |
035562b7 PM |
1043 | (define tethered? #f) |
1044 | (define parent #f) | |
81e532ff | 1045 | (define extra-foreign-lib-search-dirs '()) |
035562b7 | 1046 | (define-values [vm-dir prefix] |
f6cd4279 PM |
1047 | (command-line |
1048 | #:once-each | |
035562b7 PM |
1049 | [("--tethered") "create a tethered layer" |
1050 | (set! tethered? #t)] | |
1051 | [("--parent") dir "path of parent layer, if any" | |
1052 | (set! parent dir)] | |
f6cd4279 PM |
1053 | [("--extra-foreign-lib-search-dirs") dir-list |
1054 | "foreign library directories, as a list of strings in `read` syntax" | |
1055 | (set! extra-foreign-lib-search-dirs | |
1056 | (call-with-input-string dir-list read))] | |
035562b7 PM |
1057 | #:args (vm-dir prefix) |
1058 | (values vm-dir prefix))) | |
f6cd4279 PM |
1059 | (let* ([config |
1060 | (for/fold | |
035562b7 PM |
1061 | ([config (file->value |
1062 | (if parent | |
1063 | (build-path parent "etc/racket/config.rktd") | |
1064 | (build-path vm-dir "etc/config.rktd")))]) | |
1065 | ([spec | |
1066 | (in-list | |
1067 | '((lib-dir lib-search-dirs "lib/racket" "lib") | |
1068 | (share-dir share-search-dirs "share/racket" "share") | |
1069 | (links-file links-search-files | |
1070 | "lib/racket/links.rktd" | |
1071 | "share/links.rktd") | |
1072 | (pkgs-dir pkgs-search-dirs "lib/racket/pkgs" "share/pkgs") | |
1073 | ;; Partial workaround for: | |
1074 | ;; https://github.com/racket/racket/issues/4133 | |
1075 | #;(bin-dir bin-search-dirs "bin" "bin") | |
1076 | (bin-dir bin-search-dirs | |
1077 | "lib/racket/bogus-untethered-bin" | |
1078 | "bin") | |
1079 | (man-dir man-search-dirs "share/man" "share/man") | |
1080 | (doc-dir doc-search-dirs "share/doc/racket" "doc") | |
1081 | (include-dir include-search-dirs | |
1082 | "include/racket" | |
1083 | "include")))]) | |
1084 | (match-define (list main-key search-key pth vm-pth) spec) | |
f6cd4279 PM |
1085 | (hash-set* |
1086 | config | |
1087 | main-key | |
1088 | (build-path-string prefix pth) | |
1089 | search-key | |
1090 | (list* #f | |
1091 | (hash-ref config | |
1092 | main-key | |
035562b7 PM |
1093 | (lambda () |
1094 | (if parent | |
1095 | (build-path-string parent pth) | |
1096 | (build-path-string vm-dir vm-pth)))) | |
f6cd4279 PM |
1097 | (filter values (hash-ref config search-key null)))))] |
1098 | [config | |
1099 | (hash-update config | |
1100 | 'lib-search-dirs | |
1101 | (lambda (dirs) | |
1102 | ;; add after other layers, but before older | |
1103 | ;; foreign lib search directories | |
1104 | (define-values [rkt old-foreign-dirs] | |
1105 | (partition (lambda (pth) | |
1106 | (or (not pth) | |
1107 | (regexp-match? rx:racket pth))) | |
1108 | dirs)) | |
1109 | (append rkt | |
1110 | extra-foreign-lib-search-dirs | |
1111 | old-foreign-dirs)))] | |
1112 | [config | |
1113 | (hash-set* config | |
1114 | 'apps-dir | |
1115 | (build-path-string prefix "share/applications") | |
1116 | 'absolute-installation? #t | |
1117 | ;; Let Guix coexist with other installation | |
1118 | ;; methods without clobbering user-specific packages. | |
1119 | ;; This could be set in various places, but doing | |
1120 | ;; it here is convienient, at least until we support | |
1121 | ;; cross-compilation. | |
1122 | 'installation-name | |
1123 | (string-append (version) | |
1124 | "-guix" | |
1125 | (match (system-type 'gc) | |
1126 | ['cgc "-cgc"] | |
1127 | ;; workaround Guile reader/printer: | |
1128 | ['|3m| "-bc"] | |
1129 | [_ ""])))] | |
f6cd4279 | 1130 | [config |
035562b7 PM |
1131 | (cond |
1132 | [tethered? | |
1133 | ;; Partial workaround for: | |
1134 | ;; https://github.com/racket/racket/issues/4133 | |
1135 | #;(define bin-dir (hash-ref config 'bin-dir)) | |
1136 | (define bin-dir (build-path-string prefix "bin")) | |
1137 | (hash-set* config | |
1138 | 'config-tethered-apps-dir (hash-ref config 'apps-dir) | |
1139 | 'config-tethered-console-bin-dir bin-dir | |
1140 | 'config-tethered-gui-bin-dir bin-dir)] | |
1141 | [else | |
1142 | config])]) | |
1143 | (define new-config-pth | |
1144 | (build-path prefix "etc/racket/config.rktd")) | |
f6cd4279 PM |
1145 | (make-parent-directory* new-config-pth) |
1146 | (call-with-output-file* | |
1147 | new-config-pth | |
1148 | (lambda (out) | |
1149 | (pretty-write config out))))))) |