gnu: nyacc: Use versioned Guile site directory.
[jackhill/guix/guix.git] / gnu / packages / mes.scm
CommitLineData
1c7a78f1 1;;; GNU Guix --- Functional package management for GNU
6e5fc6c7 2;;; Copyright © 2017, 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
beb7e659 3;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
05ee5102 4;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
1c7a78f1
JN
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages mes)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages base)
4e23d650
JN
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages bootstrap)
26 #:use-module (gnu packages compression)
1c7a78f1
JN
27 #:use-module (gnu packages cross-base)
28 #:use-module (gnu packages gcc)
256d5c6e 29 #:use-module (gnu packages graphviz)
1c7a78f1 30 #:use-module (gnu packages guile)
00c86a88 31 #:use-module (gnu packages man)
1c7a78f1
JN
32 #:use-module (gnu packages package-management)
33 #:use-module (gnu packages perl)
b8016467 34 #:use-module (gnu packages pkg-config)
00c86a88 35 #:use-module (gnu packages texinfo)
1c7a78f1 36 #:use-module (guix build-system gnu)
4be01412 37 #:use-module (guix download)
1c7a78f1
JN
38 #:use-module (guix git-download)
39 #:use-module (guix licenses)
066cb9ba
JN
40 #:use-module (guix packages)
41 #:use-module (guix utils))
1c7a78f1 42
b8016467 43(define-public nyacc-0.86
bffd8fcd 44 ;; Nyacc used for bootstrap.
4be01412
JN
45 (package
46 (name "nyacc")
445ecce9 47 (version "0.86.0")
4be01412
JN
48 (source (origin
49 (method url-fetch)
50 (uri (string-append "mirror://savannah/nyacc/"
51 name "-" version ".tar.gz"))
445ecce9 52 (patches (search-patches "nyacc-binary-literals.patch"))
4be01412
JN
53 (sha256
54 (base32
445ecce9 55 "0lkd9lyspvhxlfs0496gsllwinh62jk9wij6gpadvx9gwz6yavd9"))))
4be01412
JN
56 (build-system gnu-build-system)
57 (native-inputs
58 `(("guile" ,guile-2.2)))
59 (synopsis "LALR(1) Parser Generator in Guile")
60 (description
61 "NYACC is an LALR(1) parser generator implemented in Guile.
62The syntax and nomenclature should be considered not stable. It comes with
63extensive examples, including parsers for the Javascript and C99 languages.")
64 (home-page "https://savannah.nongnu.org/projects/nyacc")
65 (license (list gpl3+ lgpl3+))))
66
4e896da4 67(define-public nyacc-0.99
b8016467
LC
68 (package
69 (inherit nyacc-0.86)
86c3a506 70 (version "0.99.0")
b8016467
LC
71 (source (origin
72 (method url-fetch)
73 (uri (string-append "mirror://savannah/nyacc/nyacc-"
74 version ".tar.gz"))
75 (sha256
76 (base32
86c3a506 77 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
b8016467
LC
78 (modules '((guix build utils)))
79 (snippet
80 '(begin
81 (substitute* (find-files "." "^Makefile\\.in$")
82 (("^SITE_SCM_DIR =.*")
83 "SITE_SCM_DIR = \
84@prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
85 (("^SITE_SCM_GO_DIR =.*")
86 "SITE_SCM_GO_DIR = \
87@prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
88 (("^INFODIR =.*")
89 "INFODIR = @prefix@/share/info\n")
90 (("^DOCDIR =.*")
91 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
92 #t))))
93 (native-inputs
94 `(("pkg-config" ,pkg-config)))
95 (inputs
96 `(("guile" ,guile-2.2)))))
97
4e896da4
LC
98(define-public nyacc
99 (package
100 (inherit nyacc-0.99)
101 (version "1.03.0")
102 (source (origin
103 (method url-fetch)
104 (uri (string-append "mirror://savannah/nyacc/nyacc-"
105 version ".tar.gz"))
106 (sha256
107 (base32
95b16cd8
RW
108 "1vdiqpm3p0ndmpmkzcpkpjvgklfsk4wxrhkixdxbczpafdfl635p"))
109 (modules '((guix build utils)))
110 (snippet
111 '(begin
112 (substitute* "configure"
113 (("GUILE_GLOBAL_SITE=\\$prefix.*")
114 "GUILE_GLOBAL_SITE=\
115$prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION\n"))
116 #t))))
4e896da4
LC
117 (inputs
118 `(("guile" ,guile-3.0)))))
119
bffd8fcd
JN
120(define-public mes-0.19
121 ;; Mes used for bootstrap.
0a01bb55
DM
122 (package
123 (name "mes")
bffd8fcd 124 (version "0.19")
0a01bb55
DM
125 (source (origin
126 (method url-fetch)
127 (uri (string-append "mirror://gnu/mes/"
128 "mes-" version ".tar.gz"))
129 (sha256
130 (base32
bffd8fcd 131 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
0a01bb55
DM
132 (build-system gnu-build-system)
133 (supported-systems '("i686-linux" "x86_64-linux"))
134 (propagated-inputs
bffd8fcd
JN
135 `(("mescc-tools" ,mescc-tools-0.5.2)
136 ("nyacc" ,nyacc-0.86)))
0a01bb55
DM
137 (native-inputs
138 `(("guile" ,guile-2.2)
139 ,@(let ((target-system (or (%current-target-system)
140 (%current-system))))
141 (cond
142 ((string-prefix? "x86_64-linux" target-system)
143 ;; Use cross-compiler rather than #:system "i686-linux" to get
144 ;; MesCC 64 bit .go files installed ready for use with Guile.
145 `(("i686-linux-binutils" ,(cross-binutils "i686-unknown-linux-gnu"))
146 ("i686-linux-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))))
147 (else
148 '())))
149 ("graphviz" ,graphviz)
150 ("help2man" ,help2man)
151 ("perl" ,perl) ; build-aux/gitlog-to-changelog
152 ("texinfo" ,texinfo)))
153 (arguments
154 `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
155 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
156 (description
157 "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed
c9941771
JN
158bootstrap to Guix and aims to help create full source bootstrapping for
159GNU/Linux distributions. It consists of a mutual self-hosting Scheme
160interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
161Guile.")
8c0dcf3e 162 (home-page "https://www.gnu.org/software/mes/")
0a01bb55 163 (license gpl3+)))
9ae3fcb9 164
bffd8fcd
JN
165(define-public mes
166 (package
167 (inherit mes-0.19)
6e5fc6c7 168 (version "0.22")
bffd8fcd
JN
169 (source (origin
170 (method url-fetch)
171 (uri (string-append "mirror://gnu/mes/"
172 "mes-" version ".tar.gz"))
173 (sha256
174 (base32
6e5fc6c7 175 "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
bffd8fcd
JN
176 (propagated-inputs
177 `(("mescc-tools" ,mescc-tools)
4e896da4 178 ("nyacc" ,nyacc-0.99)))
4e23d650
JN
179 (native-search-paths
180 (list (search-path-specification
181 (variable "C_INCLUDE_PATH")
182 (files '("include")))
183 (search-path-specification
184 (variable "LIBRARY_PATH")
6e5fc6c7
JN
185 (files '("lib")))
186 (search-path-specification
187 (variable "MES_PREFIX")
188 (separator #f)
189 (files '("")))))))
4e23d650
JN
190
191(define-public mes-rb5
192 ;; This is the Reproducible-Builds summit 5's Mes, also built on Debian
193 ;; GNU/Linux and NixOS to produce the same, bit-for-bit identical result.
194 (package
195 (inherit mes)
196 (name "mes-rb5")
197 (inputs '())
198 (propagated-inputs '())
199 (native-inputs
200 `(("bash" ,bash)
201 ("coreutils" ,coreutils)
202 ("grep" ,grep)
203 ("guile" ,guile-2.2)
6e5fc6c7 204 ("gzip" ,gzip)
4e23d650
JN
205 ("libc" ,glibc)
206 ("locales" ,glibc-utf8-locales)
207 ("make" ,gnu-make)
208 ("mes" ,mes)
209 ("mescc-tools" ,mescc-tools)
4e896da4 210 ("nyacc" ,nyacc-0.99)
4e23d650 211 ("sed" ,sed)
6e5fc6c7 212 ("tar" ,tar)))
4e23d650
JN
213 (supported-systems '("i686-linux"))
214 (arguments
215 `(#:implicit-inputs? #f
216 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
217 #:modules ((guix build gnu-build-system)
218 (guix build utils)
219 (ice-9 popen)
220 (ice-9 rdelim))
221 #:phases
222 (modify-phases %standard-phases
223 (add-before 'configure 'setenv
224 (lambda _
225 (setenv "AR" "mesar")
226 (setenv "CC" "mescc")
227 (setenv "GUILD" "true")
228 (setenv "SCHEME" "mes")
229 (setenv "LC_ALL" "en_US.UTF-8")
230 #t))
231 (replace 'configure
232 (lambda _
233 (let ((out (assoc-ref %outputs "out")))
234 (invoke "sh" "configure.sh"
235 (string-append "--prefix=" out)
236 "--host=i686-unkown-linux-gnu"
237 "--with-courage"))))
238 (replace 'build
239 (lambda _
240 (invoke "sh" "bootstrap.sh")))
241 (replace 'check
242 (lambda _
6e5fc6c7
JN
243 (copy-file "bin/mes-mescc" "bin/mes-mescc-0.21")
244 (system* "sed" "-i" "s/0\\.22/0\\.21/" "bin/mes-mescc-0.21")
4e23d650
JN
245 (let ((sha256sum
246 (read-delimited
247 " "
6e5fc6c7 248 (open-pipe* OPEN_READ "sha256sum" "bin/mes-mescc-0.21"))))
4e23d650
JN
249 (unless
250 (equal?
251 sha256sum
252 "9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb")
253 (throw 'error "mes checksum failure"))
254 #t)))
255 (replace 'install
256 (lambda _
257 (invoke "sh" "install.sh"))))))))
bffd8fcd 258
066cb9ba
JN
259(define-public mescc-tools-0.5.2
260 ;; Mescc-tools used for bootstrap.
7cbf6f1c
JN
261 (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
262 (revision "0")
263 (version "0.5.2"))
264 (package
265 (name "mescc-tools")
81a4ca08 266 (version (git-version version revision commit))
7cbf6f1c 267 (source (origin
81a4ca08
LC
268 (method git-fetch)
269 (uri (git-reference
270 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
271 (commit commit)))
272 (file-name (git-file-name name version))
7cbf6f1c
JN
273 (sha256
274 (base32
81a4ca08 275 "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff"))))
7cbf6f1c
JN
276 (build-system gnu-build-system)
277 (supported-systems '("i686-linux" "x86_64-linux"))
278 (arguments
279 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
280 #:test-target "test"
281 #:phases (modify-phases %standard-phases
282 (delete 'configure))))
283 (synopsis "Tools for the full source bootstrapping process")
284 (description
285 "Mescc-tools is a collection of tools for use in a full source
8a502c3b
JN
286bootstrapping process. It consists of the M1 macro assembler, the hex2
287linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
288get_machine.")
289 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
7cbf6f1c 290 (license gpl3+))))
9ff87bb9 291
066cb9ba 292(define-public mescc-tools
9ae3fcb9 293 (package
066cb9ba 294 (inherit mescc-tools-0.5.2)
9ae3fcb9 295 (name "mescc-tools")
9aed1de3 296 (version "0.6.1")
9ae3fcb9 297 (source (origin
81a4ca08
LC
298 (method git-fetch)
299 (uri (git-reference
300 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
301 (commit (string-append "Release_" version))))
302 (file-name (string-append "mescc-tools-" version "-checkout"))
9ae3fcb9
JN
303 (sha256
304 (base32
81a4ca08 305 "1cgxcdza6ws725x84i31la7jxmlk5a3nsij5shz1zljg0i36kj99"))))
066cb9ba
JN
306 (arguments
307 (substitute-keyword-arguments (package-arguments mescc-tools-0.5.2)
308 ((#:make-flags _)
309 `(list (string-append "PREFIX=" (assoc-ref %outputs "out"))
310 "CC=gcc"))))))
99b340f5
JN
311
312(define-public m2-planet
313 (let ((commit "b87ddb0051b168ea45f8d49a610dcd069263336a")
314 (revision "2"))
315 (package
316 (name "m2-planet")
317 (version (string-append "1.4.0-" revision "." (string-take commit 7)))
318 (source (origin
319 (method git-fetch)
320 (uri (git-reference
b0e7b699 321 (url "https://github.com/oriansj/m2-planet")
99b340f5
JN
322 (commit commit)))
323 (file-name (git-file-name name version))
324 (sha256
325 (base32
326 "0yyc0fcbbxi9jqa1n76x0rwspdrwmc8g09jlmsw9c35nflrhmz8q"))))
327 (native-inputs
328 `(("mescc-tools" ,mescc-tools)))
329 (build-system gnu-build-system)
330 (arguments
331 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
332 #:tests? #f
333 #:phases (modify-phases %standard-phases
334 (delete 'bootstrap)
335 (delete 'configure))))
336 (synopsis "The PLAtform NEutral Transpiler")
337 (description
338 "M2-Planet, the PLAtform NEutral Transpiler, when combined with
339mescc-tools, compiles a subset of the C language into working binaries with
71a5a1d1 340introspective steps in between. It is self-hosting and for bootstrapping it
99b340f5
JN
341also has an implementation in the M1 macro assembly language. M2-Planet is
342built as Phase-5 of the full source bootstrapping process and is capable of
343building GNU Mes.")
344 (home-page "https://github.com/oriansj/m2-planet")
345 (license gpl3+))))