gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / ada.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
3 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages ada)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix build-system gnu)
23 #:use-module (guix build-system python)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages base)
29 #:use-module (gnu packages check)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages python)
32 #:use-module (gnu packages python-xyz)
33 #:use-module (ice-9 match))
34
35 (define-public ada/ed
36 (package
37 (name "ada-ed")
38 (version "1.11.2")
39 (source
40 (origin
41 (method git-fetch)
42 (uri (git-reference
43 ;; The HOME-PAGE sources, mirrored by one of the original authors.
44 (url "https://github.com/daveshields/AdaEd")
45 (commit "57daecfb7ccadfd9aaf13b4d54f51065affbe599")))
46 (sha256
47 (base32 "1k97a8nqsvbsadizrmhhypcx758sxqkai8wq3ckk853qxvzaasd8"))
48 (file-name (git-file-name name version))))
49 (build-system gnu-build-system)
50 (supported-systems (list "i686-linux" "x86_64-linux"
51 "armhf-linux" "aarch64-linux"))
52 (outputs (list "out" "debug"))
53 (arguments
54 `(#:system
55 ,@(match (%current-system)
56 ;; This package predates 64-bit PCs: a ‘64-bit’ adaexec segfaults.
57 ;; Force a 32-bit build targeting a similar architecture.
58 ((or "armhf-linux" "aarch64-linux")
59 `("armhf-linux"))
60 (_
61 `("i686-linux")))
62 #:make-flags
63 (let ((out (assoc-ref %outputs "out")))
64 (list (string-append
65 "CFLAGS=-g" ; compile with :debug symbols
66 " -DOP_SYS='\"GNU\"'" ; sic; quoting gets mangled somewhere
67 " -DSYSTEM_V" ; closest to modern GNU
68 " -DWORDSIZE32"
69 " -DALIGN4") ; suffices on both x86 and ARM
70 "LFLAGS=" ; don't link against -lg
71 (string-append "BINDIR=" out "/bin")
72 (string-append "LIBDIR=" out "/lib")
73 (string-append "MANDIR=" out "/share/man")))
74 #:modules ((guix build gnu-build-system)
75 (guix build utils)
76 (srfi srfi-26))
77 #:phases
78 (modify-phases %standard-phases
79 (add-after 'unpack 'patch-sources
80 (lambda _
81 ;; Rename the custom (and incompatible) getline() implementation.
82 (substitute* "adalex.c"
83 (("getline") "adaed_getline"))
84 ;; Work around ‘error: initializer element is not constant’ by not
85 ;; initialising MSGFILE.
86 (substitute* "vars.ch"
87 (("INIT\\(stdout\\)") ""))
88 #t))
89 (delete 'configure) ; no configure script
90 (add-before 'build 'find-build-scripts
91 (lambda _
92 (setenv "PATH" (string-append ".:" (getenv "PATH")))
93 #t))
94 (add-after 'build 'build-predef
95 (lambda* (#:key make-flags #:allow-other-keys)
96 ;; These aren't otherwise compiled until the ‘install’ phase.
97 (apply invoke "make" "predef" make-flags)
98 #t))
99 (delete 'check) ; no test suite; run our own below
100 (add-before 'install 'create-output-directories
101 (lambda* (#:key outputs #:allow-other-keys)
102 (let ((out (assoc-ref outputs "out")))
103 (mkdir-p (string-append out "/share/man/manl"))
104 #t)))
105 (add-after 'install 'check
106 ;; Run most of the included demos as our own ‘test suite’.
107 (lambda* (#:key outputs tests? #:allow-other-keys)
108 (let ((out (assoc-ref outputs "out")))
109 (when tests?
110 (setenv "ADAED" (string-append out "/lib"))
111 (setenv "PATH" (string-append out "/bin:" (getenv "PATH")))
112 (with-directory-excursion "demos" ; won't run outside of it
113 (for-each
114 delete-file
115 '("runc" ; ‘invalid data. Please make it a positive no.’
116 "rund" ; deadlocks by design
117 "rune" ; ‘dining2.ada: No such file or directory’
118 "rung")) ; ‘mathlib cannot be used as a library’ (!)
119 (for-each (lambda (script)
120 (format #t "\n=== Invoking ~a ===\n" script)
121 (invoke script))
122 (find-files "." "^run")))))))
123 (add-after 'install 'clean-up-output
124 (lambda* (#:key outputs #:allow-other-keys)
125 (let ((out (assoc-ref outputs "out")))
126 (with-directory-excursion out
127 ;; These needn't be executable.
128 (for-each (cut chmod <> #o644)
129 (append (find-files "lib" "\\....$")
130 (find-files "share" ".")))
131 #t)))))))
132 (native-inputs
133 `(("sed" ,sed)))
134 (home-page (string-append "https://web.archive.org/web/20140902150609/"
135 "http://www2.informatik.uni-stuttgart.de/iste/ps/"
136 "ada-software/html/dos_ada.html"))
137 (synopsis "Ada 83 interpreter")
138 (description "Ada/Ed is a translator-interpreter for Ada 83. It's intended
139 primarily as a teaching tool and lacks the capacity, performance, and robustness
140 of other contemporary or modern-day Ada compilers.
141
142 Ada/Ed was the first Ada compiler to pass the @acronym{ACVC, Ada Compiler
143 Validation Suite} version 1.7 but fails many newer tests and is not a validated
144 Ada system. Being an interpreter, it does not implement most representation
145 clauses, and thus does not support systems programming close to the machine
146 level.")
147 (license license:gpl2+)))
148
149 (define-public python2-langkit
150 (let ((commit "fe0bc8bf60dbd2937759810df76ac420d99fc15f")
151 (revision "0"))
152 (package
153 (name "python2-langkit")
154 (version (git-version "0.0.0" revision commit))
155 (source (origin
156 (method git-fetch)
157 (uri (git-reference
158 (url "https://github.com/AdaCore/langkit")
159 (commit commit)))
160 (sha256
161 (base32
162 "1abqgw2p8pb1pm54my5kkbbixfhc6l0bwajdv1xlzyrh31xki3wx"))
163 (file-name (string-append name "-" version "-checkout"))))
164 (build-system python-build-system)
165 (propagated-inputs
166 `(("python2-docutils" ,python2-docutils)
167 ("python2-enum34" ,python2-enum34)
168 ("python2-funcy" ,python2-funcy)
169 ("python2-mako" ,python2-mako)))
170 (arguments
171 `(#:python ,python-2
172 #:tests? #f)) ; Tests would requite gprbuild (Ada).
173 (synopsis "Semantic analysis tool generator in Python")
174 (description "@code{Langkit} is a tool whose purpose is to make it easy
175 to create syntactic and semantic analysis engines. Write a language
176 specification in our Python DSL and Langkit will generate for you an
177 Ada library with bindings for the C and Python programming languages.")
178 (home-page "https://github.com/AdaCore/langkit/")
179 (license license:gpl3+)))) ; and gcc runtime library exception
180
181 (define-public python2-libadalang
182 (let ((commit "9b205e9bacdd50a68117727332e16fbef5f6ac49")
183 (revision "0"))
184 (package
185 (name "python2-libadalang")
186 (version (git-version "0.0.0" revision commit))
187 (source (origin
188 (method git-fetch)
189 (uri (git-reference
190 (url "https://github.com/AdaCore/libadalang")
191 (commit commit)))
192 (sha256
193 (base32
194 "06hsnzj2syqpq2yhg1bb0zil7ydbyqkdmkjbf8j9b5sdgkyh5xrp"))
195 (file-name (string-append name "-" version "-checkout"))))
196 (build-system python-build-system)
197 (native-inputs
198 `(("python2-langkit" ,python2-langkit)
199 ("python2-quex" ,python2-quex-0.67.3)))
200 (arguments
201 `(#:python ,python-2
202 #:phases
203 (modify-phases %standard-phases
204 (replace 'build
205 (lambda _
206 (invoke "python2" "ada/manage.py" "generate")
207 (invoke "python2" "ada/manage.py" "build")))
208 (replace 'check
209 (lambda _
210 (invoke "python2" "ada/manage.py" "test")))
211 (replace 'install
212 (lambda* (#:key outputs #:allow-other-keys)
213 (let* ((out (assoc-ref outputs "out")))
214 (invoke "python2" "ada/manage.py" "install" out)))))))
215 (synopsis "Semantic Analysis for Ada in Python")
216 (description "@code{libadalang} provides a high-performance semantic
217 engine for the Ada programming language.")
218 (home-page "https://github.com/AdaCore/libadalang")
219 (license license:gpl3)))) ; and gcc runtime gcc lib exception