gnu: mes: Remove aarch64-linux from supported-systems.
[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 ;;;
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 (modules '((guix build utils)))
110 (snippet
111 '(begin
112 (substitute* "configure"
113 (("GUILE_GLOBAL_SITE=\\$prefix.*")
114 "GUILE_GLOBAL_SITE=\
115 $prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION\n"))
116 #t))))
117 (inputs
118 `(("guile" ,guile-3.0)))))
119
120 (define-public nyacc-1.00.2
121 (package
122 (inherit nyacc)
123 (version "1.00.2")
124 (source (origin
125 (method url-fetch)
126 (uri (string-append "mirror://savannah/nyacc/nyacc-"
127 version ".tar.gz"))
128 (modules '((guix build utils)))
129 (snippet
130 '(begin
131 (substitute* (find-files "." "^Makefile\\.in$")
132 (("^SITE_SCM_DIR =.*")
133 "SITE_SCM_DIR = \
134 @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
135 (("^SITE_SCM_GO_DIR =.*")
136 "SITE_SCM_GO_DIR = \
137 @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
138 (("^INFODIR =.*")
139 "INFODIR = @prefix@/share/info\n")
140 (("^DOCDIR =.*")
141 "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
142 #t))
143 (sha256
144 (base32
145 "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"))))
146 (inputs
147 `(("guile" ,guile-2.2)))))
148
149 (define-public mes-0.19
150 ;; Mes used for bootstrap.
151 (package
152 (name "mes")
153 (version "0.19")
154 (source (origin
155 (method url-fetch)
156 (uri (string-append "mirror://gnu/mes/"
157 "mes-" version ".tar.gz"))
158 (sha256
159 (base32
160 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
161 (build-system gnu-build-system)
162 (supported-systems '("i686-linux" "x86_64-linux"))
163 (propagated-inputs
164 `(("mescc-tools" ,mescc-tools-0.5.2)
165 ("nyacc" ,nyacc-0.86)))
166 (native-inputs
167 `(("guile" ,guile-2.2)
168 ,@(let ((target-system (or (%current-target-system)
169 (%current-system))))
170 (cond
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"))))
176 (else
177 '())))
178 ("graphviz" ,graphviz)
179 ("help2man" ,help2man)
180 ("perl" ,perl) ; build-aux/gitlog-to-changelog
181 ("texinfo" ,texinfo)))
182 (arguments
183 `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
184 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
185 (description
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
190 Guile.")
191 (home-page "https://www.gnu.org/software/mes/")
192 (license gpl3+)))
193
194 (define-public mes
195 (package
196 (inherit mes-0.19)
197 (version "0.23")
198 (source (origin
199 (method url-fetch)
200 (uri (string-append "mirror://gnu/mes/"
201 "mes-" version ".tar.gz"))
202 (sha256
203 (base32
204 "0mnryfkl0dwbr5gxp16j5s95gw7z1vm1fqa1pxabp0aiar1hw53s"))))
205 (supported-systems '("armhf-linux" "i686-linux" "x86_64-linux"))
206 (propagated-inputs
207 `(("mescc-tools" ,mescc-tools)
208 ("nyacc" ,nyacc-1.00.2)))
209 (native-search-paths
210 (list (search-path-specification
211 (variable "C_INCLUDE_PATH")
212 (files '("include")))
213 (search-path-specification
214 (variable "LIBRARY_PATH")
215 (files '("lib")))
216 (search-path-specification
217 (variable "MES_PREFIX")
218 (separator #f)
219 (files '("")))))))
220
221 (define-public mes-rb5
222 ;; This is the Reproducible-Builds summit 5's Mes, also built on Debian
223 ;; GNU/Linux and NixOS to produce the same, bit-for-bit identical result.
224 (package
225 (inherit mes)
226 (name "mes-rb5")
227 (version "0.22")
228 (source (origin
229 (method url-fetch)
230 (uri (string-append "mirror://gnu/mes/"
231 "mes-" version ".tar.gz"))
232 (sha256
233 (base32
234 "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
235 (supported-systems '("i686-linux" "x86_64-linux"))
236 (inputs '())
237 (propagated-inputs '())
238 (native-inputs
239 `(("bash" ,bash)
240 ("coreutils" ,coreutils)
241 ("grep" ,grep)
242 ("guile" ,guile-2.2)
243 ("gzip" ,gzip)
244 ("libc" ,glibc)
245 ("locales" ,glibc-utf8-locales)
246 ("make" ,gnu-make)
247 ("mes" ,mes)
248 ("mescc-tools" ,mescc-tools)
249 ("nyacc" ,nyacc-0.99)
250 ("sed" ,sed)
251 ("tar" ,tar)))
252 (supported-systems '("i686-linux"))
253 (arguments
254 `(#:implicit-inputs? #f
255 #:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
256 #:modules ((guix build gnu-build-system)
257 (guix build utils)
258 (ice-9 popen)
259 (ice-9 rdelim))
260 #:phases
261 (modify-phases %standard-phases
262 (add-before 'configure 'setenv
263 (lambda _
264 (setenv "AR" "mesar")
265 (setenv "CC" "mescc")
266 (setenv "GUILD" "true")
267 (setenv "SCHEME" "mes")
268 (setenv "LC_ALL" "en_US.UTF-8")
269 #t))
270 (replace 'configure
271 (lambda _
272 (let ((out (assoc-ref %outputs "out")))
273 (invoke "sh" "configure.sh"
274 (string-append "--prefix=" out)
275 "--host=i686-unkown-linux-gnu"
276 "--with-courage"))))
277 (replace 'build
278 (lambda _
279 (invoke "sh" "bootstrap.sh")))
280 (replace 'check
281 (lambda _
282 (copy-file "bin/mes-mescc" "bin/mes-mescc-0.21")
283 (system* "sed" "-i" "s/0\\.22/0\\.21/" "bin/mes-mescc-0.21")
284 (let ((sha256sum
285 (read-delimited
286 " "
287 (open-pipe* OPEN_READ "sha256sum" "bin/mes-mescc-0.21"))))
288 (unless
289 (equal?
290 sha256sum
291 "9e0bcb1633c58e7bc415f6ea27cee7951d6b0658e13cdc147e992b31a14625fb")
292 (throw 'error "mes checksum failure"))
293 #t)))
294 (replace 'install
295 (lambda _
296 (invoke "sh" "install.sh"))))))))
297
298 (define-public mescc-tools-0.5.2
299 ;; Mescc-tools used for bootstrap.
300 (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
301 (revision "0")
302 (version "0.5.2"))
303 (package
304 (name "mescc-tools")
305 (version (git-version version revision commit))
306 (source (origin
307 (method git-fetch)
308 (uri (git-reference
309 (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
310 (commit commit)))
311 (file-name (git-file-name name version))
312 (sha256
313 (base32
314 "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff"))))
315 (build-system gnu-build-system)
316 (supported-systems '("i686-linux" "x86_64-linux"))
317 (arguments
318 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
319 #:test-target "test"
320 #:phases (modify-phases %standard-phases
321 (delete 'configure))))
322 (synopsis "Tools for the full source bootstrapping process")
323 (description
324 "Mescc-tools is a collection of tools for use in a full source
325 bootstrapping process. It consists of the M1 macro assembler, the hex2
326 linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
327 get_machine.")
328 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
329 (license gpl3+))))
330
331 (define-public mescc-tools
332 (package
333 (inherit mescc-tools-0.5.2)
334 (name "mescc-tools")
335 (version "0.7.0")
336 (source
337 (origin
338 (method url-fetch)
339 (uri (string-append
340 "http://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/"
341 name "-Release_" version
342 ".tar.gz"))
343 (file-name (string-append name "-" version ".tar.gz"))
344 (sha256
345 (base32
346 "1p1ijia4rm3002f5sypidl9v5gq0mlch9b0n61rpxkdsaaxjqax3"))))
347 (supported-systems '("armhf-linux" "aarch64-linux"
348 "i686-linux" "x86_64-linux"))
349 (arguments
350 (substitute-keyword-arguments (package-arguments mescc-tools-0.5.2)
351 ((#:make-flags _)
352 `(list (string-append "PREFIX=" (assoc-ref %outputs "out"))
353 "CC=gcc"))
354 ((#:phases phases)
355 `(modify-phases ,phases
356 (add-after 'unpack 'patch-prefix
357 (lambda _
358 (substitute* "sha256.sh"
359 (("/usr/bin/sha256sum") (which "sha256sum")))
360 #t))))))))
361
362 (define-public m2-planet
363 (let ((commit "b87ddb0051b168ea45f8d49a610dcd069263336a")
364 (revision "2"))
365 (package
366 (name "m2-planet")
367 (version (string-append "1.4.0-" revision "." (string-take commit 7)))
368 (source (origin
369 (method git-fetch)
370 (uri (git-reference
371 (url "https://github.com/oriansj/m2-planet")
372 (commit commit)))
373 (file-name (git-file-name name version))
374 (sha256
375 (base32
376 "0yyc0fcbbxi9jqa1n76x0rwspdrwmc8g09jlmsw9c35nflrhmz8q"))))
377 (native-inputs
378 `(("mescc-tools" ,mescc-tools)))
379 (build-system gnu-build-system)
380 (arguments
381 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
382 #:tests? #f
383 #:phases (modify-phases %standard-phases
384 (delete 'bootstrap)
385 (delete 'configure))))
386 (synopsis "The PLAtform NEutral Transpiler")
387 (description
388 "M2-Planet, the PLAtform NEutral Transpiler, when combined with
389 mescc-tools, compiles a subset of the C language into working binaries with
390 introspective steps in between. It is self-hosting and for bootstrapping it
391 also has an implementation in the M1 macro assembly language. M2-Planet is
392 built as Phase-5 of the full source bootstrapping process and is capable of
393 building GNU Mes.")
394 (home-page "https://github.com/oriansj/m2-planet")
395 (license gpl3+))))