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