1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018, 2019, 2020 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>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
21 (define-module (gnu packages mes)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages base)
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages bootstrap)
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages cross-base)
28 #:use-module (gnu packages gcc)
29 #:use-module (gnu packages graphviz)
30 #:use-module (gnu packages guile)
31 #:use-module (gnu packages man)
32 #:use-module (gnu packages package-management)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages texinfo)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix download)
38 #:use-module (guix git-download)
39 #:use-module (guix licenses)
40 #:use-module (guix packages)
41 #:use-module (guix utils))
43 (define-public nyacc-0.86
44 ;; Nyacc used for bootstrap.
50 (uri (string-append "mirror://savannah/nyacc/"
51 name "-" version ".tar.gz"))
52 (patches (search-patches "nyacc-binary-literals.patch"))
55 "0lkd9lyspvhxlfs0496gsllwinh62jk9wij6gpadvx9gwz6yavd9"))))
56 (build-system gnu-build-system)
58 `(("guile" ,guile-2.2)))
59 (synopsis "LALR(1) Parser Generator in Guile")
61 "NYACC is an LALR(1) parser generator implemented in Guile.
62 The syntax and nomenclature should be considered not stable. It comes with
63 extensive examples, including parsers for the Javascript and C99 languages.")
64 (home-page "https://savannah.nongnu.org/projects/nyacc")
65 (license (list gpl3+ lgpl3+))))
67 (define-public nyacc-0.99
73 (uri (string-append "mirror://savannah/nyacc/nyacc-"
77 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
78 (modules '((guix build utils)))
81 (substitute* (find-files "." "^Makefile\\.in$")
82 (("^SITE_SCM_DIR =.*")
84 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
85 (("^SITE_SCM_GO_DIR =.*")
87 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
89 "INFODIR = @prefix@/share/info\n")
91 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
94 `(("pkg-config" ,pkg-config)))
96 `(("guile" ,guile-2.2)))))
104 (uri (string-append "mirror://savannah/nyacc/nyacc-"
108 "1vdiqpm3p0ndmpmkzcpkpjvgklfsk4wxrhkixdxbczpafdfl635p"))
109 (modules '((guix build utils)))
112 (substitute* "configure"
113 (("GUILE_GLOBAL_SITE=\\$prefix.*")
115 $prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION\n"))
118 `(("guile" ,guile-3.0)))))
120 (define-public nyacc-1.00.2
126 (uri (string-append "mirror://savannah/nyacc/nyacc-"
128 (modules '((guix build utils)))
131 (substitute* (find-files "." "^Makefile\\.in$")
132 (("^SITE_SCM_DIR =.*")
134 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
135 (("^SITE_SCM_GO_DIR =.*")
137 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
139 "INFODIR = @prefix@/share/info\n")
141 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
145 "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"))))
147 `(("guile" ,guile-2.2)))))
149 (define-public mes-0.19
150 ;; Mes used for bootstrap.
156 (uri (string-append "mirror://gnu/mes/"
157 "mes-" version ".tar.gz"))
160 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
161 (build-system gnu-build-system)
162 (supported-systems '("i686-linux" "x86_64-linux"))
164 `(("mescc-tools" ,mescc-tools-0.5.2)
165 ("nyacc" ,nyacc-0.86)))
167 `(("guile" ,guile-2.2)
168 ,@(let ((target-system (or (%current-target-system)
171 ((string-prefix? "x86_64-linux" target-system)
172 ;; Use cross-compiler rather than #:system "i686-linux" to get
173 ;; MesCC 64 bit .go files installed ready for use with Guile.
174 `(("i686-linux-binutils" ,(cross-binutils "i686-unknown-linux-gnu"))
175 ("i686-linux-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))))
178 ("graphviz" ,graphviz)
179 ("help2man" ,help2man)
180 ("perl" ,perl) ; build-aux/gitlog-to-changelog
181 ("texinfo" ,texinfo)))
183 `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
184 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
186 "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed
187 bootstrap to Guix and aims to help create full source bootstrapping for
188 GNU/Linux distributions. It consists of a mutual self-hosting Scheme
189 interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
191 (home-page "https://www.gnu.org/software/mes/")
200 (uri (string-append "mirror://gnu/mes/"
201 "mes-" version ".tar.gz"))
204 "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
206 `(("mescc-tools" ,mescc-tools)
207 ("nyacc" ,nyacc-0.99)))
209 (list (search-path-specification
210 (variable "C_INCLUDE_PATH")
211 (files '("include")))
212 (search-path-specification
213 (variable "LIBRARY_PATH")
215 (search-path-specification
216 (variable "MES_PREFIX")
220 (define-public mes-rb5
221 ;; This is the Reproducible-Builds summit 5's Mes, also built on Debian
222 ;; GNU/Linux and NixOS to produce the same, bit-for-bit identical result.
227 (propagated-inputs '())
230 ("coreutils" ,coreutils)
235 ("locales" ,glibc-utf8-locales)
238 ("mescc-tools" ,mescc-tools)
239 ("nyacc" ,nyacc-0.99)
242 (supported-systems '("i686-linux"))
244 `(#:implicit-inputs? #f
245 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
246 #:modules ((guix build gnu-build-system)
251 (modify-phases %standard-phases
252 (add-before 'configure 'setenv
254 (setenv "AR" "mesar")
255 (setenv "CC" "mescc")
256 (setenv "GUILD" "true")
257 (setenv "SCHEME" "mes")
258 (setenv "LC_ALL" "en_US.UTF-8")
262 (let ((out (assoc-ref %outputs "out")))
263 (invoke "sh" "configure.sh"
264 (string-append "--prefix=" out)
265 "--host=i686-unkown-linux-gnu"
269 (invoke "sh" "bootstrap.sh")))
272 (copy-file "bin/mes-mescc" "bin/mes-mescc-0.21")
273 (system* "sed" "-i" "s/0\\.22/0\\.21/" "bin/mes-mescc-0.21")
277 (open-pipe* OPEN_READ "sha256sum" "bin/mes-mescc-0.21"))))
281 "9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb")
282 (throw 'error "mes checksum failure"))
286 (invoke "sh" "install.sh"))))))))
288 (define-public mescc-tools-0.5.2
289 ;; Mescc-tools used for bootstrap.
290 (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
295 (version (git-version version revision commit))
299 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
301 (file-name (git-file-name name version))
304 "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff"))))
305 (build-system gnu-build-system)
306 (supported-systems '("i686-linux" "x86_64-linux"))
308 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
310 #:phases (modify-phases %standard-phases
311 (delete 'configure))))
312 (synopsis "Tools for the full source bootstrapping process")
314 "Mescc-tools is a collection of tools for use in a full source
315 bootstrapping process. It consists of the M1 macro assembler, the hex2
316 linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
318 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
321 (define-public mescc-tools
323 (inherit mescc-tools-0.5.2)
330 "http://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/"
331 name "-Release_" version
333 (file-name (string-append name "-" version ".tar.gz"))
336 "1p1ijia4rm3002f5sypidl9v5gq0mlch9b0n61rpxkdsaaxjqax3"))))
338 (substitute-keyword-arguments (package-arguments mescc-tools-0.5.2)
340 `(list (string-append "PREFIX=" (assoc-ref %outputs "out"))
343 `(modify-phases ,phases
344 (add-after 'unpack 'patch-prefix
346 (substitute* "sha256.sh"
347 (("/usr/bin/sha256sum") (which "sha256sum")))
350 (define-public m2-planet
351 (let ((commit "b87ddb0051b168ea45f8d49a610dcd069263336a")
355 (version (string-append "1.4.0-" revision "." (string-take commit 7)))
359 (url "https://github.com/oriansj/m2-planet")
361 (file-name (git-file-name name version))
364 "0yyc0fcbbxi9jqa1n76x0rwspdrwmc8g09jlmsw9c35nflrhmz8q"))))
366 `(("mescc-tools" ,mescc-tools)))
367 (build-system gnu-build-system)
369 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
371 #:phases (modify-phases %standard-phases
373 (delete 'configure))))
374 (synopsis "The PLAtform NEutral Transpiler")
376 "M2-Planet, the PLAtform NEutral Transpiler, when combined with
377 mescc-tools, compiles a subset of the C language into working binaries with
378 introspective steps in between. It is self-hosting and for bootstrapping it
379 also has an implementation in the M1 macro assembly language. M2-Planet is
380 built as Phase-5 of the full source bootstrapping process and is capable of
382 (home-page "https://github.com/oriansj/m2-planet")