gnu: axoloti-patcher-next: Fix directory names.
[jackhill/guix/guix.git] / gnu / packages / mes.scm
CommitLineData
1c7a78f1 1;;; GNU Guix --- Functional package management for GNU
6e5fc6c7 2;;; Copyright © 2017, 2018, 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
beb7e659 3;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
05ee5102 4;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
1c7a78f1
JN
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)
4e23d650
JN
24 #:use-module (gnu packages bash)
25 #:use-module (gnu packages bootstrap)
26 #:use-module (gnu packages compression)
1c7a78f1
JN
27 #:use-module (gnu packages cross-base)
28 #:use-module (gnu packages gcc)
256d5c6e 29 #:use-module (gnu packages graphviz)
1c7a78f1 30 #:use-module (gnu packages guile)
00c86a88 31 #:use-module (gnu packages man)
1c7a78f1
JN
32 #:use-module (gnu packages package-management)
33 #:use-module (gnu packages perl)
b8016467 34 #:use-module (gnu packages pkg-config)
00c86a88 35 #:use-module (gnu packages texinfo)
1c7a78f1 36 #:use-module (guix build-system gnu)
4be01412 37 #:use-module (guix download)
1c7a78f1
JN
38 #:use-module (guix git-download)
39 #:use-module (guix licenses)
066cb9ba
JN
40 #:use-module (guix packages)
41 #:use-module (guix utils))
1c7a78f1 42
b8016467 43(define-public nyacc-0.86
bffd8fcd 44 ;; Nyacc used for bootstrap.
4be01412
JN
45 (package
46 (name "nyacc")
445ecce9 47 (version "0.86.0")
4be01412
JN
48 (source (origin
49 (method url-fetch)
50 (uri (string-append "mirror://savannah/nyacc/"
51 name "-" version ".tar.gz"))
445ecce9 52 (patches (search-patches "nyacc-binary-literals.patch"))
4be01412
JN
53 (sha256
54 (base32
445ecce9 55 "0lkd9lyspvhxlfs0496gsllwinh62jk9wij6gpadvx9gwz6yavd9"))))
4be01412
JN
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.
62The syntax and nomenclature should be considered not stable. It comes with
63extensive examples, including parsers for the Javascript and C99 languages.")
64 (home-page "https://savannah.nongnu.org/projects/nyacc")
65 (license (list gpl3+ lgpl3+))))
66
4e896da4 67(define-public nyacc-0.99
b8016467
LC
68 (package
69 (inherit nyacc-0.86)
86c3a506 70 (version "0.99.0")
b8016467
LC
71 (source (origin
72 (method url-fetch)
73 (uri (string-append "mirror://savannah/nyacc/nyacc-"
74 version ".tar.gz"))
75 (sha256
76 (base32
86c3a506 77 "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
b8016467
LC
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
4e896da4
LC
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
bffd8fcd
JN
112(define-public mes-0.19
113 ;; Mes used for bootstrap.
0a01bb55
DM
114 (package
115 (name "mes")
bffd8fcd 116 (version "0.19")
0a01bb55
DM
117 (source (origin
118 (method url-fetch)
119 (uri (string-append "mirror://gnu/mes/"
120 "mes-" version ".tar.gz"))
121 (sha256
122 (base32
bffd8fcd 123 "15h4yhaywdc0djpjlin2jz1kzahpqxfki0r0aav1qm9nxxmnp1l0"))))
0a01bb55
DM
124 (build-system gnu-build-system)
125 (supported-systems '("i686-linux" "x86_64-linux"))
126 (propagated-inputs
bffd8fcd
JN
127 `(("mescc-tools" ,mescc-tools-0.5.2)
128 ("nyacc" ,nyacc-0.86)))
0a01bb55
DM
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
c9941771
JN
150bootstrap to Guix and aims to help create full source bootstrapping for
151GNU/Linux distributions. It consists of a mutual self-hosting Scheme
152interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
153Guile.")
8c0dcf3e 154 (home-page "https://www.gnu.org/software/mes/")
0a01bb55 155 (license gpl3+)))
9ae3fcb9 156
bffd8fcd
JN
157(define-public mes
158 (package
159 (inherit mes-0.19)
6e5fc6c7 160 (version "0.22")
bffd8fcd
JN
161 (source (origin
162 (method url-fetch)
163 (uri (string-append "mirror://gnu/mes/"
164 "mes-" version ".tar.gz"))
165 (sha256
166 (base32
6e5fc6c7 167 "0p1jsrrmcbc0zrvbvnjbb6iyxr0in71km293q8qj6gnar6bw09av"))))
bffd8fcd
JN
168 (propagated-inputs
169 `(("mescc-tools" ,mescc-tools)
4e896da4 170 ("nyacc" ,nyacc-0.99)))
4e23d650
JN
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")
6e5fc6c7
JN
177 (files '("lib")))
178 (search-path-specification
179 (variable "MES_PREFIX")
180 (separator #f)
181 (files '("")))))))
4e23d650
JN
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)
6e5fc6c7 196 ("gzip" ,gzip)
4e23d650
JN
197 ("libc" ,glibc)
198 ("locales" ,glibc-utf8-locales)
199 ("make" ,gnu-make)
200 ("mes" ,mes)
201 ("mescc-tools" ,mescc-tools)
4e896da4 202 ("nyacc" ,nyacc-0.99)
4e23d650 203 ("sed" ,sed)
6e5fc6c7 204 ("tar" ,tar)))
4e23d650
JN
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 _
6e5fc6c7
JN
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")
4e23d650
JN
237 (let ((sha256sum
238 (read-delimited
239 " "
6e5fc6c7 240 (open-pipe* OPEN_READ "sha256sum" "bin/mes-mescc-0.21"))))
4e23d650
JN
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"))))))))
bffd8fcd 250
066cb9ba
JN
251(define-public mescc-tools-0.5.2
252 ;; Mescc-tools used for bootstrap.
7cbf6f1c
JN
253 (let ((commit "bb062b0da7bf2724ca40f9002b121579898d4ef7")
254 (revision "0")
255 (version "0.5.2"))
256 (package
257 (name "mescc-tools")
81a4ca08 258 (version (git-version version revision commit))
7cbf6f1c 259 (source (origin
81a4ca08
LC
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))
7cbf6f1c
JN
265 (sha256
266 (base32
81a4ca08 267 "1nc6rnax66vmhqsjg0kgx23pihdcxmww6v325ywf59vsq1jqjvff"))))
7cbf6f1c
JN
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
8a502c3b
JN
278bootstrapping process. It consists of the M1 macro assembler, the hex2
279linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
280get_machine.")
281 (home-page "https://savannah.nongnu.org/projects/mescc-tools")
7cbf6f1c 282 (license gpl3+))))
9ff87bb9 283
066cb9ba 284(define-public mescc-tools
9ae3fcb9 285 (package
066cb9ba 286 (inherit mescc-tools-0.5.2)
9ae3fcb9 287 (name "mescc-tools")
9aed1de3 288 (version "0.6.1")
9ae3fcb9 289 (source (origin
81a4ca08
LC
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"))
9ae3fcb9
JN
295 (sha256
296 (base32
81a4ca08 297 "1cgxcdza6ws725x84i31la7jxmlk5a3nsij5shz1zljg0i36kj99"))))
066cb9ba
JN
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"))))))
99b340f5
JN
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
b0e7b699 313 (url "https://github.com/oriansj/m2-planet")
99b340f5
JN
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
331mescc-tools, compiles a subset of the C language into working binaries with
71a5a1d1 332introspective steps in between. It is self-hosting and for bootstrapping it
99b340f5
JN
333also has an implementation in the M1 macro assembly language. M2-Planet is
334built as Phase-5 of the full source bootstrapping process and is capable of
335building GNU Mes.")
336 (home-page "https://github.com/oriansj/m2-planet")
337 (license gpl3+))))