1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018, 2019, 2020, 2021, 2022 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 © 2020, 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
7 ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages mes)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages bash)
28 #:use-module (gnu packages bootstrap)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages cross-base)
31 #:use-module (gnu packages gcc)
32 #:use-module (gnu packages graphviz)
33 #:use-module (gnu packages guile)
34 #:use-module (gnu packages man)
35 #:use-module (gnu packages package-management)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages texinfo)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix download)
41 #:use-module (guix git-download)
42 #:use-module (guix licenses)
43 #:use-module (guix packages)
44 #:use-module (guix utils))
46 (define-public nyacc-0.86
47 ;; Nyacc used for bootstrap.
53 (uri (string-append "mirror://savannah/nyacc/"
54 name "-" version ".tar.gz"))
55 (patches (search-patches "nyacc-binary-literals.patch"))
58 "0lkd9lyspvhxlfs0496gsllwinh62jk9wij6gpadvx9gwz6yavd9"))))
59 (build-system gnu-build-system)
60 (native-inputs (list guile-2.2))
61 (synopsis "LALR(1) Parser Generator in Guile")
63 "NYACC is an LALR(1) parser generator implemented in Guile.
64 The syntax and nomenclature should be considered not stable. It comes with
65 extensive examples, including parsers for the Javascript and C99 languages.")
66 (home-page "https://savannah.nongnu.org/projects/nyacc")
67 (license (list gpl3+ lgpl3+))))
69 (define-public nyacc-0.99
75 (uri (string-append "mirror://savannah/nyacc/nyacc-"
79 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
80 (modules '((guix build utils)))
83 (substitute* (find-files "." "^Makefile\\.in$")
84 (("^SITE_SCM_DIR =.*")
86 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
87 (("^SITE_SCM_GO_DIR =.*")
89 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
91 "INFODIR = @prefix@/share/info\n")
93 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
95 (native-inputs (list pkg-config))
96 (inputs (list guile-2.2))))
104 (uri (string-append "mirror://savannah/nyacc/nyacc-"
108 "01qb6h6bk684z8xda5d71q5f5l2z3q9jjz36if3jbpjc7b8dxjap"))
109 (modules '((guix build utils)))
111 '(substitute* "configure"
112 (("GUILE_GLOBAL_SITE=\\$prefix.*")
114 $prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION\n")))))
117 (modify-phases %standard-phases
118 ;; See https://savannah.nongnu.org/bugs/index.php?60474
119 (add-after 'unpack 'fix-60474
121 (substitute* "module/nyacc/lang/c99/parser.scm"
122 (("\\(memq \\(car stmt\\) '\\(include include-next\\)\\)")
123 "(memq (car stmt) '(include include-next define))")))))))
124 (inputs (list guile-3.0))
125 (propagated-inputs (list guile-bytestructures))
127 "@acronym{NYACC, Not Yet Another Compiler Compiler} is set of Guile modules
128 for generating parsers and lexical analyzers. It provides sample parsers,
129 pretty-printers using SXML trees as an intermediate representation, a decent C
130 parser and an `FFI Helper' tool to help create Guile Scheme bindings for C-based
131 libraries. It also provides (partially implemented) compilers based on these
132 parsers to allow execution with Guile as extension languages.")))
134 (define-public nyacc-1.00.2
140 (uri (string-append "mirror://savannah/nyacc/nyacc-"
142 (modules '((guix build utils)))
145 (substitute* (find-files "." "^Makefile\\.in$")
146 (("^SITE_SCM_DIR =.*")
148 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
149 (("^SITE_SCM_GO_DIR =.*")
151 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
153 "INFODIR = @prefix@/share/info\n")
155 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
159 "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"))))
161 ;; XXX: Remove GUILE-BYTESTRUCTURES, an optional dependency needed to
162 ;; build the FFI helper, because it fails to build.
163 (propagated-inputs '())
165 (inputs (list guile-3.0))))
173 (uri (string-append "mirror://gnu/mes/"
174 "mes-" version ".tar.gz"))
177 "00lrpm4x5qg0l840zhbf9mr67mqhp8gljcl24j5dy0y109gf32w2"))))
178 (supported-systems '("armhf-linux" "i686-linux" "x86_64-linux"))
179 (propagated-inputs (list mescc-tools nyacc-1.00.2))
181 (append (list guile-3.0)
182 (let ((target-system (or (%current-target-system)
185 ((string-prefix? "x86_64-linux" target-system)
186 ;; Use cross-compiler rather than #:system "i686-linux" to get
187 ;; MesCC 64 bit .go files installed ready for use with Guile.
188 (list (cross-binutils "i686-unknown-linux-gnu")
189 (cross-gcc "i686-unknown-linux-gnu")))
192 (list graphviz help2man
194 perl ;build-aux/gitlog-to-changelog
196 (build-system gnu-build-system)
198 `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
200 (list (search-path-specification
201 (variable "C_INCLUDE_PATH")
202 (files '("include")))
203 (search-path-specification
204 (variable "LIBRARY_PATH")
206 (search-path-specification
207 (variable "MES_PREFIX")
210 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
212 "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed
213 bootstrap to Guix and aims to help create full source bootstrapping for
214 GNU/Linux distributions. It consists of a mutual self-hosting Scheme
215 interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
217 (home-page "https://www.gnu.org/software/mes/")
220 (define-public mescc-tools
227 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
228 (commit (string-append "Release_" version))
229 (recursive? #t))) ;for M2libc
230 (file-name (git-file-name name version))
233 "0z2ni2qn2np1walcaqlxz8sinzb78d4hiq9glddzf26wxc226hs4"))))
234 (build-system gnu-build-system)
235 (supported-systems '("i686-linux" "x86_64-linux"
236 "armhf-linux" "aarch64-linux"
237 "riscv32-linux" "riscv64-linux"))
239 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
241 #:phases (modify-phases %standard-phases
242 (delete 'configure))))
243 (native-inputs (list which))
244 (synopsis "Tools for the full source bootstrapping process")
246 "Mescc-tools is a collection of tools for use in a full source
247 bootstrapping process. It consists of the M1 macro assembler, the hex2
248 linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
250 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
253 (define-public m2-planet
260 (url "https://github.com/oriansj/m2-planet")
261 (commit (string-append "Release_" version))
262 (recursive? #t))) ;for M2libc
263 (file-name (git-file-name name version))
266 "0cgvvq91cbxxm93k8ayyvhpaf3c2lv10qw4wyqwn3hc1qb1cfyvr"))))
267 (native-inputs (list mescc-tools))
268 (build-system gnu-build-system)
270 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
271 ,(string-append "CC=" (cc-for-target)))
273 #:phases (modify-phases %standard-phases
275 (delete 'configure))))
276 (synopsis "The PLAtform NEutral Transpiler")
278 "M2-Planet, the PLAtform NEutral Transpiler, when combined with
279 mescc-tools, compiles a subset of the C language into working binaries with
280 introspective steps in between. It is self-hosting and for bootstrapping it
281 also has an implementation in the M1 macro assembly language. M2-Planet is
282 built as Phase-5 of the full source bootstrapping process and is capable of
284 (home-page "https://github.com/oriansj/m2-planet")