gnu: cvs-fast-export: Update to 1.56.
[jackhill/guix/guix.git] / gnu / packages / mes.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
3 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
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 mes)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages base)
25 #:use-module (gnu packages bash)
26 #:use-module (gnu packages bootstrap)
27 #:use-module (gnu packages compression)
28 #:use-module (gnu packages cross-base)
29 #:use-module (gnu packages gcc)
30 #:use-module (gnu packages graphviz)
31 #:use-module (gnu packages guile)
32 #:use-module (gnu packages man)
33 #:use-module (gnu packages package-management)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages texinfo)
37 #:use-module (guix build-system gnu)
38 #:use-module (guix download)
39 #:use-module (guix git-download)
40 #:use-module (guix licenses)
41 #:use-module (guix packages)
42 #:use-module (guix utils))
43
44 (define-public nyacc-0.86
45 ;; Nyacc used for bootstrap.
46 (package
47 (name "nyacc")
48 (version "0.86.0")
49 (source (origin
50 (method url-fetch)
51 (uri (string-append "mirror://savannah/nyacc/"
52 name "-" version ".tar.gz"))
53 (patches (search-patches "nyacc-binary-literals.patch"))
54 (sha256
55 (base32
56 "0lkd9lyspvhxlfs0496gsllwinh62jk9wij6gpadvx9gwz6yavd9"))))
57 (build-system gnu-build-system)
58 (native-inputs
59 `(("guile" ,guile-2.2)))
60 (synopsis "LALR(1) Parser Generator in Guile")
61 (description
62 "NYACC is an LALR(1) parser generator implemented in Guile.
63 The syntax and nomenclature should be considered not stable. It comes with
64 extensive examples, including parsers for the Javascript and C99 languages.")
65 (home-page "https://savannah.nongnu.org/projects/nyacc")
66 (license (list gpl3+ lgpl3+))))
67
68 (define-public nyacc-0.99
69 (package
70 (inherit nyacc-0.86)
71 (version "0.99.0")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "mirror://savannah/nyacc/nyacc-"
75 version ".tar.gz"))
76 (sha256
77 (base32
78 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
79 (modules '((guix build utils)))
80 (snippet
81 '(begin
82 (substitute* (find-files "." "^Makefile\\.in$")
83 (("^SITE_SCM_DIR =.*")
84 "SITE_SCM_DIR = \
85 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
86 (("^SITE_SCM_GO_DIR =.*")
87 "SITE_SCM_GO_DIR = \
88 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
89 (("^INFODIR =.*")
90 "INFODIR = @prefix@/share/info\n")
91 (("^DOCDIR =.*")
92 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
93 #t))))
94 (native-inputs
95 `(("pkg-config" ,pkg-config)))
96 (inputs
97 `(("guile" ,guile-2.2)))))
98
99 (define-public nyacc
100 (package
101 (inherit nyacc-0.99)
102 (version "1.03.6")
103 (source (origin
104 (method url-fetch)
105 (uri (string-append "mirror://savannah/nyacc/nyacc-"
106 version ".tar.gz"))
107 (sha256
108 (base32
109 "1s7kli288l4pizjaarx8m6jg7g0mgfy8rpbs9lpzg8la7wr5rvp4"))
110 (modules '((guix build utils)))
111 (snippet
112 '(begin
113 (substitute* "configure"
114 (("GUILE_GLOBAL_SITE=\\$prefix.*")
115 "GUILE_GLOBAL_SITE=\
116 $prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION\n"))
117 #t))))
118 (inputs
119 `(("guile" ,guile-3.0)))))
120
121 (define-public nyacc-1.00.2
122 (package
123 (inherit nyacc)
124 (version "1.00.2")
125 (source (origin
126 (method url-fetch)
127 (uri (string-append "mirror://savannah/nyacc/nyacc-"
128 version ".tar.gz"))
129 (modules '((guix build utils)))
130 (snippet
131 '(begin
132 (substitute* (find-files "." "^Makefile\\.in$")
133 (("^SITE_SCM_DIR =.*")
134 "SITE_SCM_DIR = \
135 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
136 (("^SITE_SCM_GO_DIR =.*")
137 "SITE_SCM_GO_DIR = \
138 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
139 (("^INFODIR =.*")
140 "INFODIR = @prefix@/share/info\n")
141 (("^DOCDIR =.*")
142 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
143 #t))
144 (sha256
145 (base32
146 "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"))))
147 (inputs
148 `(("guile" ,guile-2.2)))))
149
150 (define-public mes-0.19
151 ;; Mes used for bootstrap.
152 (package
153 (name "mes")
154 (version "0.19")
155 (source (origin
156 (method url-fetch)
157 (uri (string-append "mirror://gnu/mes/"
158 "mes-" version ".tar.gz"))
159 (sha256
160 (base32
161 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
162 (build-system gnu-build-system)
163 (supported-systems '("i686-linux" "x86_64-linux"))
164 (propagated-inputs
165 `(("mescc-tools" ,mescc-tools-0.5.2)
166 ("nyacc" ,nyacc-0.86)))
167 (native-inputs
168 `(("guile" ,guile-2.2)
169 ,@(let ((target-system (or (%current-target-system)
170 (%current-system))))
171 (cond
172 ((string-prefix? "x86_64-linux" target-system)
173 ;; Use cross-compiler rather than #:system "i686-linux" to get
174 ;; MesCC 64 bit .go files installed ready for use with Guile.
175 `(("i686-linux-binutils" ,(cross-binutils "i686-unknown-linux-gnu"))
176 ("i686-linux-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))))
177 (else
178 '())))
179 ("graphviz" ,graphviz)
180 ("help2man" ,help2man)
181 ("perl" ,perl) ; build-aux/gitlog-to-changelog
182 ("texinfo" ,texinfo)))
183 (arguments
184 `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
185 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
186 (description
187 "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed
188 bootstrap to Guix and aims to help create full source bootstrapping for
189 GNU/Linux distributions. It consists of a mutual self-hosting Scheme
190 interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
191 Guile.")
192 (home-page "https://www.gnu.org/software/mes/")
193 (license gpl3+)))
194
195 (define-public mes
196 (package
197 (inherit mes-0.19)
198 (version "0.23")
199 (source (origin
200 (method url-fetch)
201 (uri (string-append "mirror://gnu/mes/"
202 "mes-" version ".tar.gz"))
203 (sha256
204 (base32
205 "0mnryfkl0dwbr5gxp16j5s95gw7z1vm1fqa1pxabp0aiar1hw53s"))))
206 (supported-systems '("armhf-linux" "i686-linux" "x86_64-linux"))
207 (propagated-inputs
208 `(("mescc-tools" ,mescc-tools)
209 ("nyacc" ,nyacc-1.00.2)))
210 (native-search-paths
211 (list (search-path-specification
212 (variable "C_INCLUDE_PATH")
213 (files '("include")))
214 (search-path-specification
215 (variable "LIBRARY_PATH")
216 (files '("lib")))
217 (search-path-specification
218 (variable "MES_PREFIX")
219 (separator #f)
220 (files '("")))))))
221
222 (define-public mes-rb5
223 ;; This is the Reproducible-Builds summit 5's Mes, also built on Debian
224 ;; GNU/Linux and NixOS to produce the same, bit-for-bit identical result.
225 (package
226 (inherit mes)
227 (name "mes-rb5")
228 (version "0.22")
229 (source (origin
230 (method url-fetch)
231 (uri (string-append "mirror://gnu/mes/"
232 "mes-" version ".tar.gz"))
233 (sha256
234 (base32
235 "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
236 (supported-systems '("i686-linux" "x86_64-linux"))
237 (inputs '())
238 (propagated-inputs '())
239 (native-inputs
240 `(("bash" ,bash)
241 ("coreutils" ,coreutils)
242 ("grep" ,grep)
243 ("guile" ,guile-2.2)
244 ("gzip" ,gzip)
245 ("libc" ,glibc)
246 ("locales" ,glibc-utf8-locales)
247 ("make" ,gnu-make)
248 ("mes" ,mes)
249 ("mescc-tools" ,mescc-tools)
250 ("nyacc" ,nyacc-0.99)
251 ("sed" ,sed)
252 ("tar" ,tar)))
253 (supported-systems '("i686-linux"))
254 (arguments
255 `(#:implicit-inputs? #f
256 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
257 #:modules ((guix build gnu-build-system)
258 (guix build utils)
259 (ice-9 popen)
260 (ice-9 rdelim))
261 #:phases
262 (modify-phases %standard-phases
263 (add-before 'configure 'setenv
264 (lambda _
265 (setenv "AR" "mesar")
266 (setenv "CC" "mescc")
267 (setenv "GUILD" "true")
268 (setenv "SCHEME" "mes")
269 (setenv "LC_ALL" "en_US.UTF-8")
270 #t))
271 (replace 'configure
272 (lambda _
273 (let ((out (assoc-ref %outputs "out")))
274 (invoke "sh" "configure.sh"
275 (string-append "--prefix=" out)
276 "--host=i686-unkown-linux-gnu"
277 "--with-courage"))))
278 (replace 'build
279 (lambda _
280 (invoke "sh" "bootstrap.sh")))
281 (replace 'check
282 (lambda _
283 (copy-file "bin/mes-mescc" "bin/mes-mescc-0.21")
284 (system* "sed" "-i" "s/0\\.22/0\\.21/" "bin/mes-mescc-0.21")
285 (let ((sha256sum
286 (read-delimited
287 " "
288 (open-pipe* OPEN_READ "sha256sum" "bin/mes-mescc-0.21"))))
289 (unless
290 (equal?
291 sha256sum
292 "9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb")
293 (throw 'error "mes checksum failure"))
294 #t)))
295 (replace 'install
296 (lambda _
297 (invoke "sh" "install.sh"))))))))
298
299 (define-public mescc-tools-0.5.2
300 ;; Mescc-tools used for bootstrap.
301 (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
302 (revision "0")
303 (version "0.5.2"))
304 (package
305 (name "mescc-tools")
306 (version (git-version version revision commit))
307 (source (origin
308 (method git-fetch)
309 (uri (git-reference
310 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
311 (commit commit)))
312 (file-name (git-file-name name version))
313 (sha256
314 (base32
315 "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff"))))
316 (build-system gnu-build-system)
317 (supported-systems '("i686-linux" "x86_64-linux"))
318 (arguments
319 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
320 #:test-target "test"
321 #:phases (modify-phases %standard-phases
322 (delete 'configure))))
323 (synopsis "Tools for the full source bootstrapping process")
324 (description
325 "Mescc-tools is a collection of tools for use in a full source
326 bootstrapping process. It consists of the M1 macro assembler, the hex2
327 linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
328 get_machine.")
329 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
330 (license gpl3+))))
331
332 (define-public mescc-tools
333 (package
334 (inherit mescc-tools-0.5.2)
335 (name "mescc-tools")
336 (version "0.7.0")
337 (source
338 (origin
339 (method url-fetch)
340 (uri (string-append
341 "http://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/"
342 name "-Release_" version
343 ".tar.gz"))
344 (file-name (string-append name "-" version ".tar.gz"))
345 (sha256
346 (base32
347 "1p1ijia4rm3002f5sypidl9v5gq0mlch9b0n61rpxkdsaaxjqax3"))))
348 (supported-systems '("armhf-linux" "aarch64-linux"
349 "i686-linux" "x86_64-linux"))
350 (arguments
351 (substitute-keyword-arguments (package-arguments mescc-tools-0.5.2)
352 ((#:make-flags _)
353 `(list (string-append "PREFIX=" (assoc-ref %outputs "out"))
354 "CC=gcc"))
355 ((#:phases phases)
356 `(modify-phases ,phases
357 (add-after 'unpack 'patch-prefix
358 (lambda _
359 (substitute* "sha256.sh"
360 (("/usr/bin/sha256sum") (which "sha256sum")))
361 #t))))))))
362
363 (define-public m2-planet
364 (let ((commit "b87ddb0051b168ea45f8d49a610dcd069263336a")
365 (revision "2"))
366 (package
367 (name "m2-planet")
368 (version (string-append "1.4.0-" revision "." (string-take commit 7)))
369 (source (origin
370 (method git-fetch)
371 (uri (git-reference
372 (url "https://github.com/oriansj/m2-planet")
373 (commit commit)))
374 (file-name (git-file-name name version))
375 (sha256
376 (base32
377 "0yyc0fcbbxi9jqa1n76x0rwspdrwmc8g09jlmsw9c35nflrhmz8q"))))
378 (native-inputs
379 `(("mescc-tools" ,mescc-tools)))
380 (build-system gnu-build-system)
381 (arguments
382 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
383 #:tests? #f
384 #:phases (modify-phases %standard-phases
385 (delete 'bootstrap)
386 (delete 'configure))))
387 (synopsis "The PLAtform NEutral Transpiler")
388 (description
389 "M2-Planet, the PLAtform NEutral Transpiler, when combined with
390 mescc-tools, compiles a subset of the C language into working binaries with
391 introspective steps in between. It is self-hosting and for bootstrapping it
392 also has an implementation in the M1 macro assembly language. M2-Planet is
393 built as Phase-5 of the full source bootstrapping process and is capable of
394 building GNU Mes.")
395 (home-page "https://github.com/oriansj/m2-planet")
396 (license gpl3+))))