gnu: nyacc: Add 1.03.0.
[jackhill/guix/guix.git] / gnu / packages / mes.scm
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>
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)
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))
42
43 (define-public nyacc-0.86
44 ;; Nyacc used for bootstrap.
45 (package
46 (name "nyacc")
47 (version "0.86.0")
48 (source (origin
49 (method url-fetch)
50 (uri (string-append "mirror://savannah/nyacc/"
51 name "-" version ".tar.gz"))
52 (patches (search-patches "nyacc-binary-literals.patch"))
53 (sha256
54 (base32
55 "0lkd9lyspvhxlfs0496gsllwinh62jk9wij6gpadvx9gwz6yavd9"))))
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.
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+))))
66
67 (define-public nyacc-0.99
68 (package
69 (inherit nyacc-0.86)
70 (version "0.99.0")
71 (source (origin
72 (method url-fetch)
73 (uri (string-append "mirror://savannah/nyacc/nyacc-"
74 version ".tar.gz"))
75 (sha256
76 (base32
77 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
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
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
108 "1vdiqpm3p0ndmpmkzcpkpjvgklfsk4wxrhkixdxbczpafdfl635p"))))
109 (inputs
110 `(("guile" ,guile-3.0)))))
111
112 (define-public mes-0.19
113 ;; Mes used for bootstrap.
114 (package
115 (name "mes")
116 (version "0.19")
117 (source (origin
118 (method url-fetch)
119 (uri (string-append "mirror://gnu/mes/"
120 "mes-" version ".tar.gz"))
121 (sha256
122 (base32
123 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
124 (build-system gnu-build-system)
125 (supported-systems '("i686-linux" "x86_64-linux"))
126 (propagated-inputs
127 `(("mescc-tools" ,mescc-tools-0.5.2)
128 ("nyacc" ,nyacc-0.86)))
129 (native-inputs
130 `(("guile" ,guile-2.2)
131 ,@(let ((target-system (or (%current-target-system)
132 (%current-system))))
133 (cond
134 ((string-prefix? "x86_64-linux" target-system)
135 ;; Use cross-compiler rather than #:system "i686-linux" to get
136 ;; MesCC 64 bit .go files installed ready for use with Guile.
137 `(("i686-linux-binutils" ,(cross-binutils "i686-unknown-linux-gnu"))
138 ("i686-linux-gcc" ,(cross-gcc "i686-unknown-linux-gnu"))))
139 (else
140 '())))
141 ("graphviz" ,graphviz)
142 ("help2man" ,help2man)
143 ("perl" ,perl) ; build-aux/gitlog-to-changelog
144 ("texinfo" ,texinfo)))
145 (arguments
146 `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
147 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
148 (description
149 "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed
150 bootstrap to Guix and aims to help create full source bootstrapping for
151 GNU/Linux distributions. It consists of a mutual self-hosting Scheme
152 interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
153 Guile.")
154 (home-page "https://www.gnu.org/software/mes/")
155 (license gpl3+)))
156
157 (define-public mes
158 (package
159 (inherit mes-0.19)
160 (version "0.22")
161 (source (origin
162 (method url-fetch)
163 (uri (string-append "mirror://gnu/mes/"
164 "mes-" version ".tar.gz"))
165 (sha256
166 (base32
167 "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
168 (propagated-inputs
169 `(("mescc-tools" ,mescc-tools)
170 ("nyacc" ,nyacc-0.99)))
171 (native-search-paths
172 (list (search-path-specification
173 (variable "C_INCLUDE_PATH")
174 (files '("include")))
175 (search-path-specification
176 (variable "LIBRARY_PATH")
177 (files '("lib")))
178 (search-path-specification
179 (variable "MES_PREFIX")
180 (separator #f)
181 (files '("")))))))
182
183 (define-public mes-rb5
184 ;; This is the Reproducible-Builds summit 5's Mes, also built on Debian
185 ;; GNU/Linux and NixOS to produce the same, bit-for-bit identical result.
186 (package
187 (inherit mes)
188 (name "mes-rb5")
189 (inputs '())
190 (propagated-inputs '())
191 (native-inputs
192 `(("bash" ,bash)
193 ("coreutils" ,coreutils)
194 ("grep" ,grep)
195 ("guile" ,guile-2.2)
196 ("gzip" ,gzip)
197 ("libc" ,glibc)
198 ("locales" ,glibc-utf8-locales)
199 ("make" ,gnu-make)
200 ("mes" ,mes)
201 ("mescc-tools" ,mescc-tools)
202 ("nyacc" ,nyacc-0.99)
203 ("sed" ,sed)
204 ("tar" ,tar)))
205 (supported-systems '("i686-linux"))
206 (arguments
207 `(#:implicit-inputs? #f
208 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
209 #:modules ((guix build gnu-build-system)
210 (guix build utils)
211 (ice-9 popen)
212 (ice-9 rdelim))
213 #:phases
214 (modify-phases %standard-phases
215 (add-before 'configure 'setenv
216 (lambda _
217 (setenv "AR" "mesar")
218 (setenv "CC" "mescc")
219 (setenv "GUILD" "true")
220 (setenv "SCHEME" "mes")
221 (setenv "LC_ALL" "en_US.UTF-8")
222 #t))
223 (replace 'configure
224 (lambda _
225 (let ((out (assoc-ref %outputs "out")))
226 (invoke "sh" "configure.sh"
227 (string-append "--prefix=" out)
228 "--host=i686-unkown-linux-gnu"
229 "--with-courage"))))
230 (replace 'build
231 (lambda _
232 (invoke "sh" "bootstrap.sh")))
233 (replace 'check
234 (lambda _
235 (copy-file "bin/mes-mescc" "bin/mes-mescc-0.21")
236 (system* "sed" "-i" "s/0\\.22/0\\.21/" "bin/mes-mescc-0.21")
237 (let ((sha256sum
238 (read-delimited
239 " "
240 (open-pipe* OPEN_READ "sha256sum" "bin/mes-mescc-0.21"))))
241 (unless
242 (equal?
243 sha256sum
244 "9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb")
245 (throw 'error "mes checksum failure"))
246 #t)))
247 (replace 'install
248 (lambda _
249 (invoke "sh" "install.sh"))))))))
250
251 (define-public mescc-tools-0.5.2
252 ;; Mescc-tools used for bootstrap.
253 (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
254 (revision "0")
255 (version "0.5.2"))
256 (package
257 (name "mescc-tools")
258 (version (git-version version revision commit))
259 (source (origin
260 (method git-fetch)
261 (uri (git-reference
262 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
263 (commit commit)))
264 (file-name (git-file-name name version))
265 (sha256
266 (base32
267 "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff"))))
268 (build-system gnu-build-system)
269 (supported-systems '("i686-linux" "x86_64-linux"))
270 (arguments
271 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
272 #:test-target "test"
273 #:phases (modify-phases %standard-phases
274 (delete 'configure))))
275 (synopsis "Tools for the full source bootstrapping process")
276 (description
277 "Mescc-tools is a collection of tools for use in a full source
278 bootstrapping process. It consists of the M1 macro assembler, the hex2
279 linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
280 get_machine.")
281 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
282 (license gpl3+))))
283
284 (define-public mescc-tools
285 (package
286 (inherit mescc-tools-0.5.2)
287 (name "mescc-tools")
288 (version "0.6.1")
289 (source (origin
290 (method git-fetch)
291 (uri (git-reference
292 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
293 (commit (string-append "Release_" version))))
294 (file-name (string-append "mescc-tools-" version "-checkout"))
295 (sha256
296 (base32
297 "1cgxcdza6ws725x84i31la7jxmlk5a3nsij5shz1zljg0i36kj99"))))
298 (arguments
299 (substitute-keyword-arguments (package-arguments mescc-tools-0.5.2)
300 ((#:make-flags _)
301 `(list (string-append "PREFIX=" (assoc-ref %outputs "out"))
302 "CC=gcc"))))))
303
304 (define-public m2-planet
305 (let ((commit "b87ddb0051b168ea45f8d49a610dcd069263336a")
306 (revision "2"))
307 (package
308 (name "m2-planet")
309 (version (string-append "1.4.0-" revision "." (string-take commit 7)))
310 (source (origin
311 (method git-fetch)
312 (uri (git-reference
313 (url "https://github.com/oriansj/m2-planet")
314 (commit commit)))
315 (file-name (git-file-name name version))
316 (sha256
317 (base32
318 "0yyc0fcbbxi9jqa1n76x0rwspdrwmc8g09jlmsw9c35nflrhmz8q"))))
319 (native-inputs
320 `(("mescc-tools" ,mescc-tools)))
321 (build-system gnu-build-system)
322 (arguments
323 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
324 #:tests? #f
325 #:phases (modify-phases %standard-phases
326 (delete 'bootstrap)
327 (delete 'configure))))
328 (synopsis "The PLAtform NEutral Transpiler")
329 (description
330 "M2-Planet, the PLAtform NEutral Transpiler, when combined with
331 mescc-tools, compiles a subset of the C language into working binaries with
332 introspective steps in between. It is self-hosting and for bootstrapping it
333 also has an implementation in the M1 macro assembly language. M2-Planet is
334 built as Phase-5 of the full source bootstrapping process and is capable of
335 building GNU Mes.")
336 (home-page "https://github.com/oriansj/m2-planet")
337 (license gpl3+))))