Commit | Line | Data |
---|---|---|
3df04eb0 PM |
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> | |
6 | ;;; | |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
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. | |
13 | ;;; | |
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. | |
18 | ;;; | |
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/>. | |
21 | ||
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) | |
3df04eb0 PM |
35 | #:use-module (gnu packages compression) |
36 | #:use-module (gnu packages databases) | |
37 | #:use-module (gnu packages fontutils) | |
38 | #:use-module (gnu packages gl) | |
39 | #:use-module (gnu packages glib) | |
40 | #:use-module (gnu packages gtk) | |
41 | #:use-module (gnu packages image) | |
42 | #:use-module (gnu packages libedit) | |
43 | #:use-module (gnu packages multiprecision) | |
44 | #:use-module (gnu packages sqlite) | |
45 | #:use-module (gnu packages tls) | |
46 | #:use-module (gnu packages xorg)) | |
47 | ||
0ca37f3c PM |
48 | |
49 | (define %installer-mirrors | |
50 | ;; Source: | |
51 | ;; https://github.com/racket/racket-lang-org/blob/master/download/data.rkt#L58 | |
52 | ;; Matthew Flatt says: "note that many are commented out" | |
53 | ;; INVARIANT: End with a trailing "/"! | |
54 | '("https://mirror.racket-lang.org/installers/" | |
55 | "https://www.cs.utah.edu/plt/installers/" | |
56 | "https://plt.cs.northwestern.edu/racket-mirror/" | |
57 | "https://mirror.csclub.uwaterloo.ca/racket/racket-installers/" | |
58 | ;; Universität Tübingen is using a self-signed HTTPS certificate: | |
59 | "http://mirror.informatik.uni-tuebingen.de/mirror/racket/" | |
60 | "https://racket.infogroep.be/" | |
61 | )) | |
62 | ||
63 | ||
93867cb3 | 64 | (define-public racket-minimal |
3df04eb0 | 65 | (package |
93867cb3 | 66 | (name "racket-minimal") |
b12bb7d2 | 67 | (version "8.1") ; note: remember to also update racket! |
93867cb3 PM |
68 | (source |
69 | (origin | |
70 | (method url-fetch) | |
0ca37f3c PM |
71 | (uri (map (lambda (base) |
72 | (string-append base version "/racket-minimal-src.tgz")) | |
73 | %installer-mirrors)) | |
b12bb7d2 | 74 | (sha256 "04zzqybpxss50n1jrwwq98539gw0y0ygpw9civl2sq3s4ww7m8l3") |
93867cb3 PM |
75 | (patches (search-patches |
76 | "racket-sh-via-rktio.patch")))) | |
77 | (home-page "https://racket-lang.org") | |
78 | (synopsis "Racket without bundled packages such as DrRacket") | |
79 | (inputs | |
80 | `(("openssl" ,openssl) | |
81 | ("sqlite" ,sqlite) | |
82 | ("sh" ,bash-minimal) | |
83 | ("zlib" ,zlib) | |
84 | ("zlib:static" ,zlib "static") | |
85 | ("lz4" ,lz4) | |
86 | ("lz4:static" ,lz4 "static"))) | |
3df04eb0 PM |
87 | (build-system gnu-build-system) |
88 | (arguments | |
89 | `(#:configure-flags | |
90 | `(,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" | |
91 | (assoc-ref %build-inputs "sh") | |
92 | "/bin/sh") | |
93 | "--enable-libz" | |
94 | "--enable-liblz4") | |
95 | #:modules | |
96 | ((guix build gnu-build-system) | |
97 | (guix build utils) | |
98 | (srfi srfi-1)) | |
99 | #:phases | |
100 | (modify-phases %standard-phases | |
3df04eb0 PM |
101 | (add-before 'configure 'pre-configure-minimal |
102 | (lambda* (#:key inputs #:allow-other-keys) | |
103 | (chdir "src") | |
104 | #t)) | |
105 | (add-after 'build 'patch-config.rktd-lib-search-dirs | |
106 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
107 | ;; We do this between the `build` and `install` phases | |
108 | ;; so that we have racket to read and write the hash table, | |
109 | ;; but it comes before `raco setup`, when foreign libraries | |
110 | ;; are needed to build the documentation. | |
111 | (define out (assoc-ref outputs "out")) | |
112 | (apply invoke | |
113 | "./cs/c/racketcs" | |
114 | "-e" | |
115 | ,(format #f | |
116 | "~s" | |
117 | '(let* ((args | |
118 | (vector->list | |
119 | (current-command-line-arguments))) | |
120 | (file (car args)) | |
121 | (extra-lib-search-dirs (cdr args))) | |
122 | (write-to-file | |
123 | (hash-update | |
124 | (file->value file) | |
125 | 'lib-search-dirs | |
126 | (lambda (dirs) | |
127 | (append dirs extra-lib-search-dirs)) | |
128 | null) | |
129 | #:exists 'truncate/replace | |
130 | file))) | |
131 | "--" | |
132 | "../etc/config.rktd" | |
133 | (filter-map (lambda (lib) | |
134 | (cond | |
135 | ((assoc-ref inputs lib) | |
136 | => (lambda (pth) | |
137 | (string-append pth "/lib"))) | |
138 | (else | |
139 | #f))) | |
140 | '("cairo" | |
141 | "fontconfig" | |
142 | "glib" | |
143 | "glu" | |
144 | "gmp" | |
145 | "gtk+" | |
146 | "libjpeg" | |
147 | "libpng" | |
148 | "libx11" | |
149 | "mesa" | |
150 | "mpfr" | |
151 | "openssl" | |
152 | "pango" | |
153 | "sqlite" | |
154 | "unixodbc" | |
155 | "libedit"))) | |
156 | #t))) | |
93867cb3 PM |
157 | ;; Tests are in packages like racket-test-core and |
158 | ;; main-distribution-test that aren't part of the main distribution. | |
3df04eb0 | 159 | #:tests? #f)) |
93867cb3 PM |
160 | (description |
161 | "Racket is a general-purpose programming language in the Scheme family, | |
162 | with a large set of libraries and a compiler based on Chez Scheme. Racket is | |
163 | also a platform for language-oriented programming, from small domain-specific | |
164 | languages to complete language implementations. | |
165 | ||
166 | The ``minimal Racket'' distribution includes just enough of Racket for you to | |
167 | use @command{raco pkg} to install more. Bundled packages, such as the | |
168 | DrRacket IDE, are not included.") | |
169 | ;; https://download.racket-lang.org/license.html | |
170 | (license (list lgpl3+ asl2.0 expat)))) | |
171 | ||
172 | ||
173 | (define-public racket | |
dbcf2b61 MB |
174 | (package |
175 | (inherit racket-minimal) | |
93867cb3 PM |
176 | (name "racket") |
177 | (version (package-version racket-minimal)) ; needed for origin uri to work | |
178 | (source | |
179 | (origin | |
180 | (inherit (package-source racket-minimal)) | |
0ca37f3c PM |
181 | (uri (map (lambda (base) |
182 | (string-append base version "/racket-src.tgz")) | |
183 | %installer-mirrors)) | |
93867cb3 PM |
184 | (sha256 |
185 | (base32 | |
b12bb7d2 | 186 | "0xdqwrwm604bbnr97h75dps2ixxz2svlw0fn0f674bn04dcfd60f")))) |
3df04eb0 PM |
187 | (inputs |
188 | `(;; sqlite and libraries for `racket/draw' are needed to build the doc. | |
3df04eb0 PM |
189 | ("cairo" ,cairo) |
190 | ("fontconfig" ,fontconfig) | |
191 | ("glib" ,glib) | |
192 | ("glu" ,glu) | |
193 | ("gmp" ,gmp) | |
194 | ("gtk+" ,gtk+) ; propagates gdk-pixbuf+svg | |
195 | ("libjpeg" ,libjpeg-turbo) | |
196 | ("libpng" ,libpng) | |
197 | ("libx11" ,libx11) | |
198 | ("mesa" ,mesa) | |
199 | ("mpfr" ,mpfr) | |
3df04eb0 | 200 | ("pango" ,pango) |
3df04eb0 | 201 | ("unixodbc" ,unixodbc) |
93867cb3 PM |
202 | ("libedit" ,libedit) |
203 | ,@(package-inputs racket-minimal))) | |
3df04eb0 PM |
204 | (synopsis "A programmable programming language in the Scheme family") |
205 | (description | |
206 | "Racket is a general-purpose programming language in the Scheme family, | |
207 | with a large set of libraries and a compiler based on Chez Scheme. Racket is | |
208 | also a platform for language-oriented programming, from small domain-specific | |
209 | languages to complete language implementations. | |
210 | ||
211 | The main Racket distribution comes with many bundled packages, including the | |
212 | DrRacket IDE, libraries for GUI and web programming, and implementations of | |
93867cb3 | 213 | languages such as Typed Racket, R5RS and R6RS Scheme, Algol 60, and Datalog."))) |