1 ;;; guix.scm -- Guix package definition
3 ;;; Mes --- Maxwell Equations of Software
4 ;;; Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
6 ;;; Also borrowing code from:
7 ;;; guile-sdl2 --- FFI bindings for SDL2
8 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
11 ;;; guix.scm: This file is part of Mes.
13 ;;; Mes is free software; you can redistribute it and/or modify it
14 ;;; under the terms of the GNU General Public License as published by
15 ;;; the Free Software Foundation; either version 3 of the License, or (at
16 ;;; your option) any later version.
18 ;;; Mes is distributed in the hope that it will be useful, but
19 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;;; GNU General Public License for more details.
23 ;;; You should have received a copy of the GNU General Public License
24 ;;; along with Mes. If not, see <http://www.gnu.org/licenses/>.
28 ;; GNU Guix development package. To build and install, run:
30 ;; guix package -f guix.scm
32 ;; To build it, but not install it, run:
34 ;; guix build -f guix.scm
36 ;; To use as the basis for a development environment, run:
38 ;; guix environment -l guix.scm
42 (use-modules (srfi srfi-1)
49 (gnu packages commencement)
50 (gnu packages cross-base)
54 (gnu packages package-management)
56 ((guix build utils) #:select (with-directory-excursion))
57 (guix build-system gnu)
58 (guix build-system trivial)
65 (define %source-dir (dirname (current-filename)))
68 (let* ((pipe (with-directory-excursion %source-dir
69 (open-pipe* OPEN_READ "git" "ls-files")))
70 (files (let loop ((lines '()))
71 (match (read-line pipe)
75 (loop (cons line lines))))))
76 (status (close-pipe pipe)))
78 (match (stat:type stat)
80 ((or 'regular 'symlink)
81 (any (cut string-suffix? <> file) files))
90 (uri (string-append "mirror://savannah/nyacc/"
91 name "-" version ".tar.gz"))
92 (file-name (string-append name "-" version ".tar.gz"))
95 "0ykz64jlf1kpxz3qqr0nmci57r5yqwyd3s2g93vrmcnpy9d7y22p"))))
96 (build-system gnu-build-system)
98 `(("guile" ,guile-2.2)))
99 (synopsis "LALR(1) Parser Generator in Guile")
101 "NYACC is an LALR(1) parser generator implemented in Guile.
102 The syntax and nomenclature should be considered not stable. It comes with
103 extensive examples, including parsers for the Javascript and C99 languages.")
104 (home-page "https://savannah.nongnu.org/projects/nyacc")
105 (license (list gpl3+ lgpl3+))))
113 (uri (string-append "https://gitlab.com/janneke/nyacc"
114 "/repository/archive.tar.gz?ref=v"
116 (file-name (string-append name "-" version ".tar.gz"))
119 "101k3hy4jk5p109k6w4dpx3bjm0g53zwb1yxvvad8khfq00wb8hd"))))
120 (build-system gnu-build-system)
122 `(("guile" ,guile-2.2)))
123 (synopsis "LALR(1) Parser Generator in Guile")
125 "NYACC is an LALR(1) parser generator implemented in Guile.
126 The syntax and nomenclature should be considered not stable. It comes with
127 extensive examples, including parsers for the Javascript and C99 languages.")
128 (home-page "https://savannah.nongnu.org/projects/nyacc")
129 (license (list gpl3+ lgpl3+))))
131 (define-public mescc-tools
138 "https://github.com/oriansj/mescc-tools/archive/Release_"
141 (file-name (string-append name "-" version ".tar.gz"))
144 "1iwc8xqwzdaqckb4jkkisljrgn8ii4bl7dzk1l2kpv98hsyq9vi1"))))
145 (build-system gnu-build-system)
146 (supported-systems '("i686-linux" "x86_64-linux"))
148 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
150 #:phases (modify-phases %standard-phases
152 (add-after 'install 'install-2
154 (let ((out (assoc-ref %outputs "out")))
155 (copy-file "bin/blood-elf" (string-append out "/bin/blood-elf"))))))))
156 (synopsis "Tools for the full source bootstrapping process")
158 "Mescc-tools is a collection of tools for use in a full source
159 bootstrapping process. Currently consists of the M1 macro assembler and the
161 (home-page "https://github.com/oriansj/mescc-tools")
165 (let ((commit "0330aab202188306aa7676badfa3edafab707403")
167 (triplet "i686-unknown-linux-gnu")
171 (version (string-append version "-" revision "." (string-take commit 7)))
175 (url "https://gitlab.com/janneke/mes")
177 (file-name (string-append name "-" version))
179 (base32 "1jifgmvgds8fxxv0zkna66f2p9cn46ych2qwn9p04088hdvkknwk"))))
180 (build-system gnu-build-system)
181 (supported-systems '("i686-linux" "x86_64-linux"))
183 `(("mescc-tools" ,mescc-tools)
186 `(("guile" ,guile-2.2)
187 ,@(if (string-prefix? "x86_64-linux" (or (%current-target-system)
189 ;; Use cross-compiler rather than #:system "i686-linux" to get
190 ;; MesCC 64 bit .go files installed ready for use with Guile.
191 `(("i686-linux-binutils" ,(cross-binutils triplet))
192 ("i686-linux-gcc" ,(cross-gcc triplet)))
194 ("perl" ,perl))) ;build-aux/gitlog-to-changelog
197 (modify-phases %standard-phases
198 (add-before 'build 'make-git-source-writable
199 (lambda* (#:key outputs #:allow-other-keys)
200 (for-each make-file-writable
201 (find-files "." ".*\\.M1"))))
202 (add-before 'install 'generate-changelog
204 (with-output-to-file "ChangeLog"
207 build-aux/gitlog-to-changelog --srcdir=<git-checkout> > ChangeLog\n")))
209 (delete 'strip)))) ; binutil's strip b0rkes Mescc/M1/hex2 binaries
210 (synopsis "Scheme interpreter and C compiler for full source bootstrapping")
212 "Mes [Maxwell Equations of Software] aims to create full source
213 bootstrapping for GuixSD. It consists of a mutual self-hosting [close to
214 Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in
216 (home-page "https://gitlab.com/janneke/mes")
219 (define-public mes.git
220 (let ((version "0.12")
222 (commit (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ))))
226 (version (string-append version "-" revision "." (string-take commit 7)))
227 (source (local-file %source-dir #:recursive? #t #:select? git-file?)))))
229 ;; Return it here so `guix build/environment/package' can consume it directly.