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>
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 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))
44 (define-public nyacc-0.86
45 ;; Nyacc used for bootstrap.
51 (uri (string-append "mirror://savannah/nyacc/"
52 name "-" version ".tar.gz"))
53 (patches (search-patches "nyacc-binary-literals.patch"))
56 "0lkd9lyspvhxlfs0496gsllwinh62jk9wij6gpadvx9gwz6yavd9"))))
57 (build-system gnu-build-system)
59 `(("guile" ,guile-2.2)))
60 (synopsis "LALR(1) Parser Generator in Guile")
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+))))
68 (define-public nyacc-0.99
74 (uri (string-append "mirror://savannah/nyacc/nyacc-"
78 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
79 (modules '((guix build utils)))
82 (substitute* (find-files "." "^Makefile\\.in$")
83 (("^SITE_SCM_DIR =.*")
85 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
86 (("^SITE_SCM_GO_DIR =.*")
88 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
90 "INFODIR = @prefix@/share/info\n")
92 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
95 `(("pkg-config" ,pkg-config)))
97 `(("guile" ,guile-2.2)))))
105 (uri (string-append "mirror://savannah/nyacc/nyacc-"
109 "1s7kli288l4pizjaarx8m6jg7g0mgfy8rpbs9lpzg8la7wr5rvp4"))
110 (modules '((guix build utils)))
113 (substitute* "configure"
114 (("GUILE_GLOBAL_SITE=\\$prefix.*")
116 $prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION\n"))
119 `(("guile" ,guile-3.0)))))
121 (define-public nyacc-1.00.2
127 (uri (string-append "mirror://savannah/nyacc/nyacc-"
129 (modules '((guix build utils)))
132 (substitute* (find-files "." "^Makefile\\.in$")
133 (("^SITE_SCM_DIR =.*")
135 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
136 (("^SITE_SCM_GO_DIR =.*")
138 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
140 "INFODIR = @prefix@/share/info\n")
142 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
146 "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"))))
148 `(("guile" ,guile-2.2)))))
150 (define-public mes-0.19
151 ;; Mes used for bootstrap.
157 (uri (string-append "mirror://gnu/mes/"
158 "mes-" version ".tar.gz"))
161 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
162 (build-system gnu-build-system)
163 (supported-systems '("i686-linux" "x86_64-linux"))
165 `(("mescc-tools" ,mescc-tools-0.5.2)
166 ("nyacc" ,nyacc-0.86)))
168 `(("guile" ,guile-2.2)
169 ,@(let ((target-system (or (%current-target-system)
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"))))
179 ("graphviz" ,graphviz)
180 ("help2man" ,help2man)
181 ("perl" ,perl) ; build-aux/gitlog-to-changelog
182 ("texinfo" ,texinfo)))
184 `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
185 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
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
192 (home-page "https://www.gnu.org/software/mes/")
201 (uri (string-append "mirror://gnu/mes/"
202 "mes-" version ".tar.gz"))
205 "0mnryfkl0dwbr5gxp16j5s95gw7z1vm1fqa1pxabp0aiar1hw53s"))))
206 (supported-systems '("armhf-linux" "i686-linux" "x86_64-linux"))
208 `(("mescc-tools" ,mescc-tools)
209 ("nyacc" ,nyacc-1.00.2)))
211 (list (search-path-specification
212 (variable "C_INCLUDE_PATH")
213 (files '("include")))
214 (search-path-specification
215 (variable "LIBRARY_PATH")
217 (search-path-specification
218 (variable "MES_PREFIX")
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.
231 (uri (string-append "mirror://gnu/mes/"
232 "mes-" version ".tar.gz"))
235 "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
236 (supported-systems '("i686-linux" "x86_64-linux"))
238 (propagated-inputs '())
241 ("coreutils" ,coreutils)
246 ("locales" ,glibc-utf8-locales)
249 ("mescc-tools" ,mescc-tools)
250 ("nyacc" ,nyacc-0.99)
253 (supported-systems '("i686-linux"))
255 `(#:implicit-inputs? #f
256 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
257 #:modules ((guix build gnu-build-system)
262 (modify-phases %standard-phases
263 (add-before 'configure 'setenv
265 (setenv "AR" "mesar")
266 (setenv "CC" "mescc")
267 (setenv "GUILD" "true")
268 (setenv "SCHEME" "mes")
269 (setenv "LC_ALL" "en_US.UTF-8")
273 (let ((out (assoc-ref %outputs "out")))
274 (invoke "sh" "configure.sh"
275 (string-append "--prefix=" out)
276 "--host=i686-unkown-linux-gnu"
280 (invoke "sh" "bootstrap.sh")))
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")
288 (open-pipe* OPEN_READ "sha256sum" "bin/mes-mescc-0.21"))))
292 "9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb")
293 (throw 'error "mes checksum failure"))
297 (invoke "sh" "install.sh"))))))))
299 (define-public mescc-tools-0.5.2
300 ;; Mescc-tools used for bootstrap.
301 (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
306 (version (git-version version revision commit))
310 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
312 (file-name (git-file-name name version))
315 "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff"))))
316 (build-system gnu-build-system)
317 (supported-systems '("i686-linux" "x86_64-linux"))
319 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
321 #:phases (modify-phases %standard-phases
322 (delete 'configure))))
323 (synopsis "Tools for the full source bootstrapping process")
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
329 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
332 (define-public mescc-tools
334 (inherit mescc-tools-0.5.2)
341 "http://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/"
342 name "-Release_" version
344 (file-name (string-append name "-" version ".tar.gz"))
347 "1p1ijia4rm3002f5sypidl9v5gq0mlch9b0n61rpxkdsaaxjqax3"))))
348 (supported-systems '("armhf-linux" "aarch64-linux"
349 "i686-linux" "x86_64-linux"))
351 (substitute-keyword-arguments (package-arguments mescc-tools-0.5.2)
353 `(list (string-append "PREFIX=" (assoc-ref %outputs "out"))
356 `(modify-phases ,phases
357 (add-after 'unpack 'patch-prefix
359 (substitute* "sha256.sh"
360 (("/usr/bin/sha256sum") (which "sha256sum")))
363 (define-public m2-planet
364 (let ((commit "b87ddb0051b168ea45f8d49a610dcd069263336a")
368 (version (string-append "1.4.0-" revision "." (string-take commit 7)))
372 (url "https://github.com/oriansj/m2-planet")
374 (file-name (git-file-name name version))
377 "0yyc0fcbbxi9jqa1n76x0rwspdrwmc8g09jlmsw9c35nflrhmz8q"))))
379 `(("mescc-tools" ,mescc-tools)))
380 (build-system gnu-build-system)
382 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
384 #:phases (modify-phases %standard-phases
386 (delete 'configure))))
387 (synopsis "The PLAtform NEutral Transpiler")
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
395 (home-page "https://github.com/oriansj/m2-planet")