mes.scm 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. ;;; GNU Mes --- Maxwell Equations of Software
  2. ;;; Copyright © 2016,2017,2018,2019,2020,2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Mes.
  5. ;;;
  6. ;;; Also borrowing code from:
  7. ;;; guile-sdl2 --- FFI bindings for SDL2
  8. ;;; Copyright © 2015 David Thompson <davet@gnu.org>
  9. ;;;
  10. ;;; GNU Mes 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 Mes 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 Mes. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (mes)
  23. #:use-module (srfi srfi-1)
  24. #:use-module (srfi srfi-26)
  25. #:use-module (ice-9 match)
  26. #:use-module (ice-9 popen)
  27. #:use-module (ice-9 rdelim)
  28. #:use-module (gnu packages)
  29. #:use-module (gnu packages base)
  30. #:use-module (gnu packages commencement)
  31. #:use-module (gnu packages cross-base)
  32. #:use-module (gnu packages gcc)
  33. #:use-module (gnu packages graphviz)
  34. #:use-module (gnu packages guile)
  35. #:use-module (gnu packages man)
  36. #:use-module (gnu packages mes)
  37. #:use-module (gnu packages package-management)
  38. #:use-module (gnu packages version-control)
  39. #:use-module (gnu packages perl)
  40. #:use-module (gnu packages pkg-config)
  41. #:use-module (gnu packages texinfo)
  42. #:use-module (guix build-system gnu)
  43. #:use-module (guix build-system trivial)
  44. #:use-module (guix gexp)
  45. #:use-module (guix download)
  46. #:use-module (guix git-download)
  47. #:use-module (guix licenses)
  48. #:use-module (guix packages)
  49. #:use-module (guix utils))
  50. (define %source-dir (getcwd))
  51. (define-public mescc-tools
  52. (package
  53. (name "mescc-tools")
  54. (version "1.1.0")
  55. (source
  56. (origin
  57. (method url-fetch)
  58. (uri (string-append
  59. "https://git.savannah.nongnu.org/cgit/mescc-tools.git/snapshot/"
  60. name "-Release_" version
  61. ".tar.gz"))
  62. (file-name (string-append name "-" version ".tar.gz"))
  63. (sha256
  64. (base32
  65. "12cjryqfd6m6j807pvhk7i4vr2q0jiibpfrpnq5s67iq9l4rrc6b"))))
  66. (build-system gnu-build-system)
  67. (supported-systems
  68. '("aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux"))
  69. (arguments
  70. `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  71. (string-append "CC=" ,(cc-for-target)))
  72. #:test-target "test"
  73. #:phases (modify-phases %standard-phases
  74. (delete 'configure)
  75. (add-after 'unpack 'patch-prefix
  76. (lambda _
  77. (substitute* "sha256.sh"
  78. (("\\$\\(which sha256sum\\)") (which "sha256sum")))
  79. #t)))))
  80. (synopsis "Tools for the full source bootstrapping process")
  81. (description
  82. "Mescc-tools is a collection of tools for use in a full source
  83. bootstrapping process. It consists of the M1 macro assembler, the hex2
  84. linker, the blood-elf symbol table generator, the kaem shell, exec_enable and
  85. get_machine.")
  86. (home-page "https://savannah.nongnu.org/projects/mescc-tools")
  87. (license gpl3+)))
  88. (define-public m2-planet
  89. (let ((commit "46cf81af8303119236cdab5536204d3da3b487de")
  90. (revision "0"))
  91. (package
  92. (name "m2-planet")
  93. (version (git-version "1.7.0" revision commit))
  94. (source
  95. (origin
  96. (method git-fetch)
  97. (uri (git-reference
  98. (url "https://github.com/oriansj/m2-planet.git")
  99. (commit commit)))
  100. (file-name (git-file-name name version))
  101. (sha256
  102. (base32 "1qa4qnwgflc4h0z0wyvqx9idr67r4r0yn595b0x6nigp4sij4b32"))))
  103. (native-inputs
  104. `(("mescc-tools" ,mescc-tools)))
  105. (build-system gnu-build-system)
  106. (arguments
  107. `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  108. (string-append "CC=" ,(cc-for-target)))
  109. #:tests? #f
  110. #:phases (modify-phases %standard-phases
  111. (delete 'bootstrap)
  112. (delete 'configure)
  113. (add-after 'unpack 'patch-prefix
  114. (lambda _
  115. (substitute* "sha256.sh"
  116. (("\\$\\(which sha256sum\\)") (which "sha256sum")))
  117. #t)))))
  118. (synopsis "The PLAtform NEutral Transpiler")
  119. (description
  120. "M2-Planet, The PLAtform NEutral Transpiler, when combined with
  121. mescc-tools compiles a subset of the C language into working binaries
  122. with introspective steps inbetween.")
  123. (home-page "https://github.com/oriansj/m2-planet")
  124. (license gpl3+))))
  125. (define-public mes-m2
  126. (let ((commit "fd1a1755a1adc65abbada9e8a3273821cb55bcfc")
  127. (revision "1"))
  128. (package
  129. (name "mes-m2")
  130. (version (git-version "0" revision commit))
  131. (source
  132. (origin
  133. (method git-fetch)
  134. (uri (git-reference
  135. (url "https://gitlab.com/janneke/mes-m2.git")
  136. (commit commit)))
  137. (file-name (git-file-name name version))
  138. (sha256
  139. (base32 "1d70lcw2mdxp0yx3ksswacc80yilwzkrzkjk9z43b9z5gbylwfyr"))))
  140. (build-system gnu-build-system)
  141. (propagated-inputs
  142. `(("mescc-tools" ,mescc-tools)
  143. ("nyacc" ,nyacc)))
  144. (native-inputs
  145. `(("guile" ,guile-3.0-latest)
  146. ("m2-planet" ,m2-planet)))
  147. (arguments
  148. `(#:strip-binaries? #f ; binutil's strip b0rkes MesCC/M1/hex2 binaries
  149. #:tests? #f
  150. #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  151. (string-append "CC=" ,(cc-for-target))
  152. "mes-m2-boot")
  153. #:phases (modify-phases %standard-phases
  154. (delete 'bootstrap)
  155. (delete 'configure))))
  156. (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
  157. (description
  158. "GNU Mes--Maxwell Equations of Software--brings the Reduced Binary Seed
  159. bootstrap to Guix and aims to help create full source bootstrapping for
  160. GNU/Linux distributions. It consists of a mutual self-hosting Scheme
  161. interpreter in C and a Nyacc-based C compiler in Scheme and is compatible with
  162. Guile.")
  163. (home-page "https://www.gnu.org/software/mes")
  164. (license gpl3+))))
  165. (define-public mes-m2.git
  166. (let ((version "0")
  167. (revision "0")
  168. (commit (read-string
  169. (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ))))
  170. (package
  171. (inherit mes-m2)
  172. (name "mes-m2.git")
  173. (version (string-append version "-" revision "." (string-take commit 7)))
  174. (source (local-file %source-dir
  175. #:recursive? #t
  176. #:select? (git-predicate %source-dir))))))