projects/guix·blob javascript-team · refs

145 lines · 6.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Danny Milosavljevic <[email protected]>
3;;; Copyright © 2020 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2021 Efraim Flashner <[email protected]>
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 ada)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix build-system gnu)
24 #:use-module (guix packages)
25 #:use-module (guix git-download)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages base)
28 #:use-module (ice-9 match))
29
30(define-public ada/ed
31 (package
32 (name "ada-ed")
33 (version "1.11.2")
34 (source
35 (origin
36 (method git-fetch)
37 (uri (git-reference
38 ;; The HOME-PAGE sources, mirrored by one of the original authors.
39 (url "https://github.com/daveshields/AdaEd")
40 (commit "57daecfb7ccadfd9aaf13b4d54f51065affbe599")))
41 (sha256
42 (base32 "1k97a8nqsvbsadizrmhhypcx758sxqkai8wq3ckk853qxvzaasd8"))
43 (file-name (git-file-name name version))))
44 (build-system gnu-build-system)
45 (supported-systems (list "i686-linux" "x86_64-linux"
46 "armhf-linux" "aarch64-linux"
47 "powerpc-linux"))
48 (outputs (list "out" "debug"))
49 (arguments
50 `(#:system
51 ,@(match (%current-system)
52 ;; This package predates 64-bit PCs: a ‘64-bit’ adaexec segfaults.
53 ;; Force a 32-bit build targeting a similar architecture.
54 ("aarch64-linux"
55 `("armhf-linux"))
56 ("x86_64-linux"
57 `("i686-linux"))
58 (_
59 (list (%current-system))))
60 #:make-flags
61 (let ((out (assoc-ref %outputs "out")))
62 (list (string-append
63 "CFLAGS=-g" ; compile with :debug symbols
64 " -DOP_SYS='\"GNU\"'" ; sic; quoting gets mangled somewhere
65 " -DSYSTEM_V" ; closest to modern GNU
66 " -DWORDSIZE32"
67 " -DALIGN4") ; suffices on both x86 and ARM
68 "LFLAGS=" ; don't link against -lg
69 (string-append "BINDIR=" out "/bin")
70 (string-append "LIBDIR=" out "/lib")
71 (string-append "MANDIR=" out "/share/man")))
72 #:modules ((guix build gnu-build-system)
73 (guix build utils)
74 (srfi srfi-26))
75 #:phases
76 (modify-phases %standard-phases
77 (add-after 'unpack 'patch-sources
78 (lambda _
79 ;; Rename the custom (and incompatible) getline() implementation.
80 (substitute* "adalex.c"
81 (("getline") "adaed_getline"))
82 ;; Work around ‘error: initializer element is not constant’ by not
83 ;; initialising MSGFILE.
84 (substitute* "vars.ch"
85 (("INIT\\(stdout\\)") ""))
86 #t))
87 (delete 'configure) ; no configure script
88 (add-before 'build 'find-build-scripts
89 (lambda _
90 (setenv "PATH" (string-append ".:" (getenv "PATH")))
91 #t))
92 (add-after 'build 'build-predef
93 (lambda* (#:key make-flags #:allow-other-keys)
94 ;; These aren't otherwise compiled until the ‘install’ phase.
95 (apply invoke "make" "predef" make-flags)
96 #t))
97 (delete 'check) ; no test suite; run our own below
98 (add-before 'install 'create-output-directories
99 (lambda* (#:key outputs #:allow-other-keys)
100 (let ((out (assoc-ref outputs "out")))
101 (mkdir-p (string-append out "/share/man/manl"))
102 #t)))
103 (add-after 'install 'check
104 ;; Run most of the included demos as our own ‘test suite’.
105 (lambda* (#:key outputs tests? #:allow-other-keys)
106 (let ((out (assoc-ref outputs "out")))
107 (when tests?
108 (setenv "ADAED" (string-append out "/lib"))
109 (setenv "PATH" (string-append out "/bin:" (getenv "PATH")))
110 (with-directory-excursion "demos" ; won't run outside of it
111 (for-each
112 delete-file
113 '("runc" ; ‘invalid data. Please make it a positive no.’
114 "rund" ; deadlocks by design
115 "rune" ; ‘dining2.ada: No such file or directory’
116 "rung")) ; ‘mathlib cannot be used as a library’ (!)
117 (for-each (lambda (script)
118 (format #t "\n=== Invoking ~a ===\n" script)
119 (invoke script))
120 (find-files "." "^run")))))))
121 (add-after 'install 'clean-up-output
122 (lambda* (#:key outputs #:allow-other-keys)
123 (let ((out (assoc-ref outputs "out")))
124 (with-directory-excursion out
125 ;; These needn't be executable.
126 (for-each (cut chmod <> #o644)
127 (append (find-files "lib" "\\....$")
128 (find-files "share" ".")))
129 #t)))))))
130 (native-inputs
131 (list sed))
132 (home-page (string-append "https://web.archive.org/web/20140902150609/"
133 "http://www2.informatik.uni-stuttgart.de/iste/ps/"
134 "ada-software/html/dos_ada.html"))
135 (synopsis "Ada 83 interpreter")
136 (description "Ada/Ed is a translator-interpreter for Ada 83. It's intended
137primarily as a teaching tool and lacks the capacity, performance, and robustness
138of other contemporary or modern-day Ada compilers.
139
140Ada/Ed was the first Ada compiler to pass the @acronym{ACVC, Ada Compiler
141Validation Suite} version 1.7 but fails many newer tests and is not a validated
142Ada system. Being an interpreter, it does not implement most representation
143clauses, and thus does not support systems programming close to the machine
144level.")
145 (license license:gpl2+)))