projects/guix·blob java-team · refs

176 lines · 7.3 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Nikita Karetnikov <[email protected]>
3;;; Copyright © 2014, 2015 Mark H Weaver <[email protected]>
4;;; Copyright © 2017, 2019 Efraim Flashner <[email protected]>
5;;; Copyright © 2022 Paul A. Patience <[email protected]>
6;;; Copyright © 2023 B. Wilson <[email protected]>
7;;; Copyright © 2025 Lee Thompson <[email protected]>
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages apl)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix svn-download)
29 #:use-module (guix gexp)
30 #:use-module (guix packages)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system trivial)
33 #:use-module (gnu packages algebra)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bash)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages gtk)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages java)
41 #:use-module (gnu packages maths)
42 #:use-module (gnu packages pcre)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages readline)
45 #:use-module (gnu packages sqlite)
46 #:use-module (gnu packages xorg))
47
48(define-public apl
49 (let ((revision 1977))
50 (package
51 (name "apl")
52 (version (string-append "2.0.1-r" (number->string revision)))
53 (source
54 (origin
55 (method svn-fetch)
56 (uri (svn-reference
57 (url "svn://svn.savannah.gnu.org/apl/trunk")
58 (revision revision)))
59 (file-name (git-file-name name version))
60 (sha256
61 (base32 "1llm1hqpfd71jrhd4pizhmvvca5wr18v8zqfajwmvjjxcmzfkvv1"))))
62 (build-system gnu-build-system)
63 (home-page "https://www.gnu.org/software/apl/")
64 (native-inputs (list gettext-minimal which pkg-config))
65 (inputs
66 (list gettext-minimal
67 libxcb
68 fftw
69 openblas
70 gsl
71 libpng
72 gtk+
73 pcre2
74 readline
75 sqlite))
76 (arguments
77 (list #:configure-flags #~(list (string-append
78 "--with-sqlite3="
79 #$(this-package-input "sqlite")))
80 #:phases
81 #~(modify-phases %standard-phases
82 (add-before 'configure 'fix-configure
83 (lambda _
84 (substitute* "configure"
85 ;; Manually set the SVN revision, since the directory
86 ;; is unversioned and we know it anyway.
87 (("\\$apl_ARCHIVE_SVNINFO")
88 #$(number->string revision))))))))
89 (synopsis "APL interpreter")
90 (description
91 "GNU APL is a free interpreter for the programming language APL. It is
92an implementation of the ISO standard 13751.")
93 (license license:gpl3+))))
94
95(define-public dzaima-apl
96 (package
97 (name "dzaima-apl")
98 (version "0.2.0")
99 (source
100 (origin
101 (method git-fetch)
102 (uri (git-reference
103 (url "https://github.com/dzaima/APL.git")
104 (commit (string-append "v" version))))
105 (sha256
106 (base32 "1hnrq0mlff6b9c9129afphcnmzd05wdyyfs905n421diyd5xa0il"))
107 (file-name (git-file-name name version))))
108 (build-system gnu-build-system)
109 (inputs (list bash-minimal openjdk18))
110 (native-inputs (list `(,openjdk18 "jdk") zip))
111 (arguments
112 (list
113 #:imported-modules `(,@%default-gnu-imported-modules
114 (guix build ant-build-system))
115 #:modules `((guix build gnu-build-system)
116 ((guix build ant-build-system) #:prefix ant:)
117 (guix build utils)
118 (ice-9 ftw)
119 (ice-9 regex)
120 (srfi srfi-26))
121 #:phases
122 `(modify-phases %standard-phases
123 (delete 'configure)
124 (replace 'build
125 (lambda* (#:key inputs #:allow-other-keys)
126 (let* ((javac (search-input-file inputs "/bin/javac"))
127 (jar (search-input-file inputs "/bin/jar")))
128 (mkdir-p "src/build")
129 (apply invoke javac "-encoding" "UTF-8" "-d" "src/build"
130 (let ((files '()))
131 (ftw "src/APL/"
132 (lambda (filename statinfo flags)
133 (if (string-match ".*\\.java" filename)
134 (set! files (cons filename files)))
135 #t))
136 files))
137 (with-directory-excursion "src/build"
138 (invoke jar "--create" "--verbose"
139 "--file=dzaima-apl.jar"
140 "--main-class=APL.Main"
141 "APL")))))
142 (delete 'check) ;; Upstream implements no tests
143 (replace 'install
144 (lambda* (#:key inputs outputs #:allow-other-keys)
145 (let* ((out (assoc-ref outputs "out"))
146 (bin (string-append out "/bin"))
147 (share (string-append out "/share/java"))
148 (wrapper (string-append bin "/dzaima-apl")))
149 (mkdir-p share)
150 (mkdir-p bin)
151 (install-file "src/build/dzaima-apl.jar" share)
152 (with-output-to-file wrapper
153 (lambda _
154 (display (string-append
155 "#!" (search-input-file inputs "/bin/sh") "\n"
156 (search-input-file inputs "/bin/java")
157 " -jar " share "/dzaima-apl.jar \"$@\""))))
158 (chmod wrapper #o555))))
159 (add-after 'install 'reorder-jar-content
160 (lambda* (#:key outputs #:allow-other-keys)
161 (apply (assoc-ref ant:%standard-phases 'reorder-jar-content)
162 #:outputs (list outputs))))
163 (add-after 'reorder-jar-content 'generate-jar-indices
164 (lambda* (#:key outputs #:allow-other-keys)
165 (apply (assoc-ref ant:%standard-phases 'generate-jar-indices)
166 #:outputs (list outputs))))
167 (add-after 'generate-jar-indices 'reorder-jar-content
168 (lambda* (#:key outputs #:allow-other-keys)
169 (apply (assoc-ref ant:%standard-phases 'reorder-jar-content)
170 #:outputs (list outputs)))))))
171 (home-page "https://github.com/dzaima/APL")
172 (synopsis "Implementation of the APL programming language in Java")
173 (description
174 "This package provides an implementation of APL in Java, extended from
175Dyalog APL.")
176 (license license:expat)))