1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
5 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages racket)
23 #:use-module ((guix licenses)
24 #:select (asl2.0 expat lgpl3+))
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix utils)
29 #:use-module (guix gexp)
30 #:use-module (guix build-system gnu)
31 #:use-module (srfi srfi-1)
32 #:use-module (ice-9 match)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages bash)
35 #:use-module ((gnu packages chez)
36 #:select (chez-scheme))
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages databases)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages gl)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages libedit)
45 #:use-module (gnu packages multiprecision)
46 #:use-module (gnu packages sqlite)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages xorg))
53 (version "8.0") ; note: remember to also update racket-minimal!
56 (uri (list (string-append "https://mirror.racket-lang.org/installers/"
57 version "/racket-src.tgz")
58 ;; this mirror seems to have broken HTTPS:
60 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
61 version "/racket-src.tgz")))
64 "047wpjblfzmf1msz7snrp2c2h0zxyzlmbsqr9bwsyvz3frcg0888"))
65 (patches (search-patches
66 "racket-sh-via-rktio.patch"))))
67 (build-system gnu-build-system)
70 `(,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
71 (assoc-ref %build-inputs "sh")
76 ((guix build gnu-build-system)
80 (modify-phases %standard-phases
81 (add-after 'unpack 'patch-chez-configure
82 (lambda* (#:key inputs outputs #:allow-other-keys)
83 (substitute* "src/cs/c/Makefile.in"
84 (("/bin/sh") (which "sh")))
85 ;; TODO: Racket CS uses a fork of Chez Scheme.
86 ;; Most of this is copy-pasted from the "chez.scm",
87 ;; but maybe there's a way to reuse more directly.
88 (with-directory-excursion "src/ChezScheme"
89 (substitute* (find-files "mats" "Mf-.*")
90 (("^[[:space:]]+(cc ) *") "\tgcc "))
92 (find-files "." (string-append
95 "|Makefile[a-zA-Z0-9.]*"
102 ;;"|[a-zA-Z0-9.]+\\.ms" ; guile can't read
104 (("/bin/rm") (which "rm"))
105 (("/bin/ln") (which "ln"))
106 (("/bin/cp") (which "cp"))
107 (("/bin/echo") (which "echo")))
108 (substitute* "makefiles/installsh"
109 (("/bin/true") (which "true"))))
111 (add-before 'configure 'pre-configure-minimal
112 (lambda* (#:key inputs #:allow-other-keys)
115 (add-after 'build 'patch-config.rktd-lib-search-dirs
116 (lambda* (#:key inputs outputs #:allow-other-keys)
117 ;; We do this between the `build` and `install` phases
118 ;; so that we have racket to read and write the hash table,
119 ;; but it comes before `raco setup`, when foreign libraries
120 ;; are needed to build the documentation.
121 (define out (assoc-ref outputs "out"))
129 (current-command-line-arguments)))
131 (extra-lib-search-dirs (cdr args)))
137 (append dirs extra-lib-search-dirs))
139 #:exists 'truncate/replace
143 (filter-map (lambda (lib)
145 ((assoc-ref inputs lib)
147 (string-append pth "/lib")))
167 ;; XXX: how to run them?
170 `(;; sqlite and libraries for `racket/draw' are needed to build the doc.
173 ("zlib:static" ,zlib "static")
175 ("lz4:static" ,lz4 "static")
177 ("fontconfig" ,fontconfig)
181 ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg
182 ("libjpeg" ,libjpeg-turbo)
190 ("unixodbc" ,unixodbc)
191 ("libedit" ,libedit)))
192 (home-page "https://racket-lang.org")
193 (synopsis "A programmable programming language in the Scheme family")
195 "Racket is a general-purpose programming language in the Scheme family,
196 with a large set of libraries and a compiler based on Chez Scheme. Racket is
197 also a platform for language-oriented programming, from small domain-specific
198 languages to complete language implementations.
200 The main Racket distribution comes with many bundled packages, including the
201 DrRacket IDE, libraries for GUI and web programming, and implementations of
202 languages such as Typed Racket, R5RS and R6RS Scheme, Algol 60, and Datalog.")
203 ;; https://download.racket-lang.org/license.html
204 (license (list lgpl3+ asl2.0 expat))))
206 (define-public racket-minimal
209 (name "racket-minimal")
210 (version (package-version racket))
213 (inherit (package-source racket))
214 (uri (list (string-append "https://mirror.racket-lang.org/installers/"
215 version "/racket-minimal-src.tgz")
216 ;; this mirror seems to have broken HTTPS:
218 "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
219 version "/racket-minimal-src.tgz")))
220 (sha256 "0mwyffw4gcci8wmzxa3j28h03h0gsz55aard8qrk3lri8r2xyg21")))
221 (synopsis "Racket without bundled packages such as DrRacket")
223 `(("openssl" ,openssl)
227 ("zlib:static" ,zlib "static")
229 ("lz4:static" ,lz4 "static")))
231 "Racket is a general-purpose programming language in the Scheme family,
232 with a large set of libraries and a compiler based on Chez Scheme. Racket is
233 also a platform for language-oriented programming, from small domain-specific
234 languages to complete language implementations.
236 The ``minimal Racket'' distribution includes just enough of Racket for you to
237 use @command{raco pkg} to install more. Bundled packages, such as the
238 DrRacket IDE, are not included.")))