mes.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. ;;; Copyright © 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
  6. ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (gnu packages mes)
  23. #:use-module (gnu packages)
  24. #:use-module (gnu packages base)
  25. #:use-module (gnu packages bash)
  26. #:use-module (gnu packages bootstrap)
  27. #:use-module (gnu packages compression)
  28. #:use-module (gnu packages cross-base)
  29. #:use-module (gnu packages gcc)
  30. #:use-module (gnu packages graphviz)
  31. #:use-module (gnu packages guile)
  32. #:use-module (gnu packages man)
  33. #:use-module (gnu packages package-management)
  34. #:use-module (gnu packages perl)
  35. #:use-module (gnu packages pkg-config)
  36. #:use-module (gnu packages texinfo)
  37. #:use-module (guix build-system gnu)
  38. #:use-module (guix download)
  39. #:use-module (guix git-download)
  40. #:use-module (guix licenses)
  41. #:use-module (guix packages)
  42. #:use-module (guix utils))
  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 (list guile-2.2))
  58. (synopsis "LALR(1) Parser Generator in Guile")
  59. (description
  60. "NYACC is an LALR(1) parser generator implemented in Guile.
  61. The syntax and nomenclature should be considered not stable. It comes with
  62. extensive examples, including parsers for the Javascript and C99 languages.")
  63. (home-page "https://savannah.nongnu.org/projects/nyacc")
  64. (license (list gpl3+ lgpl3+))))
  65. (define-public nyacc-0.99
  66. (package
  67. (inherit nyacc-0.86)
  68. (version "0.99.0")
  69. (source (origin
  70. (method url-fetch)
  71. (uri (string-append "mirror://savannah/nyacc/nyacc-"
  72. version ".tar.gz"))
  73. (sha256
  74. (base32
  75. "0hl5qxx19i4x1r0839sxm19ziqq65g4hy97yik81cc2yb9yvgyv3"))
  76. (modules '((guix build utils)))
  77. (snippet
  78. '(begin
  79. (substitute* (find-files "." "^Makefile\\.in$")
  80. (("^SITE_SCM_DIR =.*")
  81. "SITE_SCM_DIR = \
  82. @prefix@/share/guile/site/@GUILE_EFFECTIVE_VERSION@\n")
  83. (("^SITE_SCM_GO_DIR =.*")
  84. "SITE_SCM_GO_DIR = \
  85. @prefix@/lib/guile/@GUILE_EFFECTIVE_VERSION@/site-ccache\n")
  86. (("^INFODIR =.*")
  87. "INFODIR = @prefix@/share/info\n")
  88. (("^DOCDIR =.*")
  89. "DOCDIR = @prefix@/share/doc/$(PACKAGE_TARNAME)\n"))
  90. #t))))
  91. (native-inputs (list pkg-config))
  92. (inputs (list guile-2.2))))
  93. (define-public nyacc
  94. (package
  95. (inherit nyacc-0.99)
  96. (version "1.04.0")
  97. (source (origin
  98. (method url-fetch)
  99. (uri (string-append "mirror://savannah/nyacc/nyacc-"
  100. version ".tar.gz"))
  101. (sha256
  102. (base32
  103. "0m3mcdaslvvr2iav8ga146hzsja2hdj4656pszljb4q2q7h25ip5"))
  104. (modules '((guix build utils)))
  105. (snippet
  106. '(begin
  107. (substitute* "configure"
  108. (("GUILE_GLOBAL_SITE=\\$prefix.*")
  109. "GUILE_GLOBAL_SITE=\
  110. $prefix/share/guile/site/$GUILE_EFFECTIVE_VERSION\n"))
  111. #t))))
  112. (inputs (list guile-3.0))
  113. (description
  114. "@acronym{NYACC, Not Yet Another Compiler Compiler} is set of Guile modules
  115. for generating parsers and lexical analyzers. It provides sample parsers,
  116. pretty-printers using SXML trees as an intermediate representation, a decent C
  117. parser and an `FFI Helper' tool to help create Guile Scheme bindings for C-based
  118. libraries. It also provides (partially implemented) compilers based on these
  119. parsers to allow execution with Guile as extension languages.")))
  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 (list guile-3.0))))
  147. (define-public mes
  148. (package
  149. (name "mes")
  150. (version "0.23")
  151. (source (origin
  152. (method url-fetch)
  153. (uri (string-append "mirror://gnu/mes/"
  154. "mes-" version ".tar.gz"))
  155. (sha256
  156. (base32
  157. "0mnryfkl0dwbr5gxp16j5s95gw7z1vm1fqa1pxabp0aiar1hw53s"))))
  158. (supported-systems '("armhf-linux" "i686-linux" "x86_64-linux"))
  159. (propagated-inputs (list mescc-tools nyacc-1.00.2))
  160. (native-inputs
  161. (append (list guile-3.0)
  162. (let ((target-system (or (%current-target-system)
  163. (%current-system))))
  164. (cond
  165. ((string-prefix? "x86_64-linux" target-system)
  166. ;; Use cross-compiler rather than #:system "i686-linux" to get
  167. ;; MesCC 64 bit .go files installed ready for use with Guile.
  168. (list (cross-binutils "i686-unknown-linux-gnu")
  169. (cross-gcc "i686-unknown-linux-gnu")))
  170. (else
  171. '())))
  172. (list graphviz help2man
  173. perl ;build-aux/gitlog-to-changelog
  174. texinfo)))
  175. (build-system gnu-build-system)
  176. (arguments
  177. `(#:strip-binaries? #f)) ; binutil's strip b0rkes MesCC/M1/hex2 binaries
  178. (native-search-paths
  179. (list (search-path-specification
  180. (variable "C_INCLUDE_PATH")
  181. (files '("include")))
  182. (search-path-specification
  183. (variable "LIBRARY_PATH")
  184. (files '("lib")))
  185. (search-path-specification
  186. (variable "MES_PREFIX")
  187. (separator #f)
  188. (files '("")))))
  189. (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
  190. (description
  191. "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed
  192. bootstrap to Guix and aims to help create full source bootstrapping for
  193. GNU/Linux distributions. It consists of a mutual self-hosting Scheme
  194. interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
  195. Guile.")
  196. (home-page "https://www.gnu.org/software/mes/")
  197. (license gpl3+)))
  198. (define-public mescc-tools
  199. (package
  200. (name "mescc-tools")
  201. (version "1.2.0")
  202. (source (origin
  203. (method git-fetch)
  204. (uri (git-reference
  205. (url "https://git.savannah.nongnu.org/r/mescc-tools.git")
  206. (commit (string-append "Release_" version))
  207. (recursive? #t))) ;for M2libc
  208. (file-name (git-file-name name version))
  209. (sha256
  210. (base32
  211. "1xkn5sspfxldy4wm8fq8gd8kwn46578zhfl12c16pq74x21zb198"))))
  212. (build-system gnu-build-system)
  213. (supported-systems '("i686-linux" "x86_64-linux"
  214. "armhf-linux" "aarch64-linux"
  215. "powerpc64le-linux"))
  216. (arguments
  217. `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  218. #:test-target "test"
  219. #:phases (modify-phases %standard-phases
  220. (delete 'configure))))
  221. (native-inputs (list which))
  222. (synopsis "Tools for the full source bootstrapping process")
  223. (description
  224. "Mescc-tools is a collection of tools for use in a full source
  225. bootstrapping process. It consists of the M1 macro assembler, the hex2
  226. linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
  227. get_machine.")
  228. (home-page "https://savannah.nongnu.org/projects/mescc-tools")
  229. (license gpl3+)))
  230. (define-public m2-planet
  231. (package
  232. (name "m2-planet")
  233. (version "1.8.0")
  234. (source (origin
  235. (method git-fetch)
  236. (uri (git-reference
  237. (url "https://github.com/oriansj/m2-planet")
  238. (commit (string-append "Release_" version))
  239. (recursive? #t))) ;for M2libc
  240. (file-name (git-file-name name version))
  241. (sha256
  242. (base32
  243. "0525fhijrjljgaabmgsjy8yk2pmh5zf8lwa44wpvkjc18knl7nza"))))
  244. (native-inputs (list mescc-tools))
  245. (build-system gnu-build-system)
  246. (arguments
  247. `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  248. ,(string-append "CC=" (cc-for-target)))
  249. #:tests? #f
  250. #:phases (modify-phases %standard-phases
  251. (delete 'bootstrap)
  252. (delete 'configure))))
  253. (synopsis "The PLAtform NEutral Transpiler")
  254. (description
  255. "M2-Planet, the PLAtform NEutral Transpiler, when combined with
  256. mescc-tools, compiles a subset of the C language into working binaries with
  257. introspective steps in between. It is self-hosting and for bootstrapping it
  258. also has an implementation in the M1 macro assembly language. M2-Planet is
  259. built as Phase-5 of the full source bootstrapping process and is capable of
  260. building GNU Mes.")
  261. (home-page "https://github.com/oriansj/m2-planet")
  262. (license gpl3+)))