projects/guix·blob java-team · refs

403 lines · 18.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012, 2013, 2014, 2015, 2017, 2018, 2019, 2023 Ludovic Courtès <[email protected]>
3;;; Copyright © 2014, 2016 Mark H Weaver <[email protected]>
4;;; Copyright © 2015, 2017 Leo Famulari <[email protected]>
5;;; Copyright © 2016 Nikita <[email protected]>
6;;; Copyright © 2016, 2025 Efraim Flashner <[email protected]>
7;;; Copyright © 2016 Jan Nieuwenhuizen <[email protected]>
8;;; Copyright © 2017, 2019, 2020, 2021 Marius Bakke <[email protected]>
9;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <[email protected]>
10;;; Copyright © 2020 Michael Rohleder <[email protected]>
11;;; Copyright © 2025 Nigko Yerden <[email protected]>
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28(define-module (gnu packages ncurses)
29 #:use-module (gnu packages)
30 #:use-module (guix licenses)
31 #:use-module (guix gexp)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system perl)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages swig)
40 #:use-module (gnu packages linux)
41 #:use-module (guix utils)
42 #:use-module ((guix memoization) #:select (mlambda))
43 #:use-module (ice-9 match))
44
45(define ncurses-rollup-patch
46 (mlambda (version)
47 (origin
48 (method url-fetch)
49 (uri (match (string-split (version-major+minor+point version) #\.)
50 ((major minor point)
51 (string-append "https://invisible-mirror.net/archives"
52 "/ncurses/" major "." minor "/ncurses-"
53 major "." minor "-" point "-patch.sh.bz2"))))
54 (sha256
55 (base32
56 "1b6522cvi4066bgh9lp93q8lk93zcjjssvnw1512z447xvazy2y6")))))
57
58(define-public ncurses
59 (package
60 (name "ncurses")
61 (version "6.2.20210619")
62 (source (origin
63 (method url-fetch)
64 (uri (string-append "mirror://gnu/ncurses/ncurses-"
65 (version-major+minor version)
66 ".tar.gz"))
67 (sha256
68 (base32
69 "17bcm2z1rdx5gmzj5fb8cp7f28aw5b4g2z4qvvqg3yg0fq66wc1h"))))
70 (build-system gnu-build-system)
71 (outputs '("out"
72 "doc")) ;1 MiB of man pages
73 (arguments
74 (let ((patch-makefile-phase
75 #~(lambda _
76 (for-each patch-makefile-SHELL
77 (find-files "." "Makefile.in"))))
78 (configure-phase
79 ;; The 'configure' script does not understand '--docdir', so we must
80 ;; override that and use '--mandir' instead.
81 #~(lambda* (#:key build target outputs configure-flags
82 #:allow-other-keys)
83 (let ((out (assoc-ref outputs "out"))
84 (doc (assoc-ref outputs "doc")))
85 (apply invoke "./configure"
86 (string-append "SHELL=" (which "sh"))
87 (string-append "--build=" build)
88 (string-append "--prefix=" out)
89 (string-append "--mandir=" doc "/share/man")
90 (if target
91 (cons (string-append "--host=" target)
92 configure-flags)
93 configure-flags)))))
94 (apply-rollup-patch-phase
95 ;; Ncurses distributes "stable" patchsets to be applied on top
96 ;; of the release tarball. These are only available as shell
97 ;; scripts(!) so we decompress and apply them in a phase.
98 ;; See <https://invisible-mirror.net/archives/ncurses/6.1/README>.
99 #~(lambda* (#:key inputs native-inputs #:allow-other-keys)
100 (let ((rollup-patch #$(ncurses-rollup-patch
101 (package-version this-package))))
102 (copy-file rollup-patch
103 (string-append (getcwd) "/rollup-patch.sh.bz2"))
104 (invoke "bzip2" "-d" "rollup-patch.sh.bz2")
105 (invoke "sh" "rollup-patch.sh"))))
106 (remove-shebang-phase
107 #~(lambda _
108 ;; To avoid retaining a reference to the bootstrap Bash via the
109 ;; shebang of the 'ncursesw6-config' script, simply remove that
110 ;; shebang: it'll work just as well without it. Likewise, do not
111 ;; retain a reference to the "doc" output.
112 (substitute* "misc/ncurses-config.in"
113 (("#!@SHELL@")
114 "# No shebang here, use /bin/sh!\n")
115 (("@SHELL@ \\$0")
116 "$0")
117 (("mandir=.*$")
118 "mandir=share/man"))))
119 (post-install-phase
120 #~(lambda* (#:key outputs #:allow-other-keys)
121 (let ((out (assoc-ref outputs "out")))
122 ;; When building a wide-character (Unicode) build, create backward
123 ;; compatibility links from the the "normal" libraries to the
124 ;; wide-character ones (e.g. libncurses.so to libncursesw.so).
125 #$@(if (target-mingw?)
126 '( ;; TODO: create .la files to link to the .dll?
127 (with-directory-excursion (string-append out "/bin")
128 (for-each
129 (lambda (lib)
130 (define lib.dll
131 (string-append "lib" lib ".dll"))
132 (define libw6.dll
133 (string-append "lib" lib "w6.dll"))
134
135 (when (file-exists? libw6.dll)
136 (format #t "creating symlinks for `lib~a'~%" lib)
137 (symlink libw6.dll lib.dll)))
138 '("curses" "ncurses" "form" "panel" "menu"))))
139 #~())
140 (with-directory-excursion (string-append out "/lib")
141 (for-each (lambda (lib)
142 (define libw.a
143 (string-append "lib" lib "w.a"))
144 (define lib.a
145 (string-append "lib" lib ".a"))
146
147 #$@(if (not (target-mingw?))
148 #~((define libw.so.x
149 (string-append "lib" lib "w.so.6"))
150 (define lib.so.x
151 (string-append "lib" lib ".so.6"))
152 (define lib.so
153 (string-append "lib" lib ".so"))
154 (define packagew.pc
155 (string-append lib "w.pc"))
156 (define package.pc
157 (string-append lib ".pc")))
158 #~())
159
160 (when (file-exists? libw.a)
161 (format #t "creating symlinks for `lib~a'~%" lib)
162 (symlink libw.a lib.a)
163 #$@(if (not (target-mingw?))
164 '((symlink libw.so.x lib.so.x)
165 (false-if-exception (delete-file lib.so))
166 (call-with-output-file lib.so
167 (lambda (p)
168 (format p "INPUT (-l~aw)~%" lib)))
169 (with-directory-excursion "pkgconfig"
170 (format #t "creating symlink for `~a'~%"
171 package.pc)
172 (when (file-exists? packagew.pc)
173 (symlink packagew.pc package.pc))))
174 #~())))
175 '("curses" "ncurses" "form" "panel" "menu")))))))
176 (list #:configure-flags
177 #~`("--with-shared" "--without-debug" "--enable-widec"
178
179 "--enable-pc-files"
180 ,(string-append "--with-pkg-config-libdir="
181 #$output "/lib/pkgconfig")
182
183 ;; By default headers land in an `ncursesw' subdir, which is not
184 ;; what users expect.
185 ,(string-append "--includedir=" #$output "/include")
186 "--enable-overwrite" ;really honor --includedir
187
188 ;; Make sure programs like 'tic', 'reset', and 'clear' have a
189 ;; correct RUNPATH.
190 ,(string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
191
192 ;; Starting from ncurses 6.1, "make install" runs "install -s"
193 ;; by default, which doesn't work for cross-compiled binaries
194 ;; because it invokes 'strip' instead of 'TRIPLET-strip'. Work
195 ;; around this.
196 #$@(if (%current-target-system) #~("--disable-stripping") #~())
197
198 ;; Do not assume a default search path in ld, even if it is only to
199 ;; filter it out in ncurses-config. Mainly because otherwise it ends
200 ;; up using the libdir from binutils, which makes little sense and
201 ;; causes an unnecessary runtime dependency.
202 "cf_cv_ld_searchpath=/no-ld-searchpath"
203
204 ;; MinGW: Use term-driver created for the MinGW port.
205 #$@(if (target-mingw?) #~("--enable-term-driver") #~()))
206 #:tests? #f ; no "check" target
207 #:phases #~(modify-phases %standard-phases
208 (add-after 'unpack 'apply-rollup-patch
209 #$apply-rollup-patch-phase)
210 (replace 'configure #$configure-phase)
211 (add-after 'install 'post-install
212 #$post-install-phase)
213 (add-before 'configure 'patch-makefile-SHELL
214 #$patch-makefile-phase)
215 (add-before 'patch-source-shebangs 'remove-unneeded-shebang
216 #$remove-shebang-phase)))))
217 (native-inputs
218 (if (%current-target-system)
219 (list pkg-config this-package) ;for 'tic'
220 (list pkg-config)))
221 (native-search-paths
222 (list (search-path-specification
223 (variable "TERMINFO_DIRS")
224 (files '("share/terminfo")))))
225 (synopsis "Terminal emulation (termcap, terminfo) library")
226 (description
227 "GNU Ncurses is a library which provides capabilities to write text to
228a terminal in a terminal-independent manner. It supports pads and color as
229well as multiple highlights and forms characters. It is typically used to
230implement user interfaces for command-line applications. The accompanying
231ncursesw library provides wide character support.")
232 (license x11)
233 (home-page "https://www.gnu.org/software/ncurses/")))
234
235(define-public ncurses/gpm
236 (package/inherit ncurses
237 (name "ncurses-with-gpm")
238 (arguments
239 (substitute-keyword-arguments arguments
240 ((#:configure-flags cf)
241 #~(cons (string-append "--with-gpm="
242 #$(this-package-input "gpm")
243 "/lib/libgpm.so.2")
244 #$cf))))
245 (inputs (list gpm))))
246
247;; Needed by u-boot 2022.04+
248;; Consider merging into ncurses for next core-updates cycle.
249(define-public ncurses/tinfo
250 (package/inherit ncurses
251 (name "ncurses-with-tinfo")
252 (arguments
253 (substitute-keyword-arguments arguments
254 ((#:configure-flags cf)
255 #~(cons "--with-termlib=tinfo" #$cf))))))
256
257(define-public cdk
258 (package
259 (name "cdk")
260 (version "5.0-20250116")
261 (source (origin
262 (method url-fetch)
263 (uri (string-append
264 "https://invisible-mirror.net/archives/cdk/cdk-"
265 version ".tgz"))
266 (sha256
267 (base32
268 "10ywvbnxwk6sfvlbkzfnbx9whsq9xv227znaiir742ym4h9d800m"))))
269 (build-system gnu-build-system)
270 ;; NOTE: This package does not have automated tests.
271 (arguments
272 (list #:configure-flags #~'("--with-shared" "--enable-rpath")))
273 (inputs
274 (list ncurses))
275 (synopsis "Curses widgets")
276 (description "Curses Development Kit (CDK) is a C library of widgets
277which allow a programmer to quickly create TUI applications. Widgets are
278objects whose appearance and behavior can be customized, e.g. a pulldown
279menu or a file-viewer.")
280 (home-page "https://invisible-island.net/cdk/cdk.html")
281 ;; The license is identified as MIT-X11 (Expat) by the author.
282 (license (non-copyleft "file://share/doc/cdk/COPYING"))))
283
284(define-public dialog
285 (package
286 (name "dialog")
287 (version "1.3-20250116")
288 (source (origin
289 (method url-fetch)
290 (uri (string-append
291 "https://invisible-mirror.net/archives/dialog/dialog-"
292 version ".tgz"))
293 (sha256
294 (base32
295 "1p8n31a2143fw1agh9qshsn925vf9jlj1k2ri453sy3vh8ln6h38"))))
296 (build-system gnu-build-system)
297 (arguments
298 (list #:configure-flags #~'("--with-shared" "--enable-rpath")
299 #:phases #~(modify-phases %standard-phases
300 (add-after 'install 'install-lib
301 (lambda _
302 (invoke "make" "install-lib"))))))
303 (inputs
304 (list ncurses))
305 (synopsis "Curses widgets")
306 (description "Dialog is a script-interpreter and a library which provides
307a set of curses widgets, such as dialog boxes.")
308 (home-page "https://invisible-island.net/dialog/dialog.html")
309 (license lgpl2.1)))
310
311(define-public perl-curses
312 (package
313 (name "perl-curses")
314 (version "1.45")
315 (source
316 (origin
317 (method url-fetch)
318 (uri (string-append "mirror://cpan/authors/id/G/GI/GIRAFFED/"
319 "Curses-" version ".tar.gz"))
320 (sha256
321 (base32
322 "1cmf0mpbsfiymy4znr84rg938mxfn52bnckamq5lmmm22c01w8l4"))))
323 (build-system perl-build-system)
324 (inputs
325 (list ncurses))
326 (arguments
327 `(#:make-maker-flags (list "PANELS" "MENUS")
328 #:phases
329 (modify-phases %standard-phases
330 (add-before
331 'configure 'set-curses-ldflags
332 (lambda* (#:key inputs #:allow-other-keys)
333 (let* ((ncurses (assoc-ref inputs "ncurses"))
334 (include (string-append ncurses "/include"))
335 (lib (string-append ncurses "/lib")))
336 (setenv "CURSES_LIBTYPE" "ncurses")
337 (setenv "CURSES_CFLAGS" (string-append "-I" include))
338 (setenv "CURSES_PANEL_CFLAGS" (string-append "-I" include))
339 (setenv "CURSES_MENU_CFLAGS" (string-append "-I" include))
340 (setenv "CURSES_FORM_CFLAGS" (string-append "-I" include))
341 (setenv "CURSES_LDFLAGS" (string-append "-L" lib " -lncurses"))
342 (setenv "CURSES_PANEL_LDFLAGS" (string-append "-L" lib " -lpanel"))
343 (setenv "CURSES_MENU_LDFLAGS" (string-append "-L" lib " -lmenu"))
344 (setenv "CURSES_FORM_LDFLAGS" (string-append "-L" lib " -lform"))
345 #t))))))
346 (home-page "https://metacpan.org/release/Curses")
347 (synopsis "Terminal screen handling and optimization")
348 (description
349 "@code{Curses} is the interface between Perl and the curses library
350of your system.")
351 (license perl-license)))
352
353(define-public stfl
354 (package
355 (name "stfl")
356 (version "0.24")
357 (source
358 (origin
359 (method url-fetch)
360 ;; The original home page has been taken over by gamblespammers.
361 ;; Luckily, the original is archived and even includes the tarball.
362 (uri (string-append "https://web.archive.org/web/20211113222004/"
363 "http://www.clifford.at/stfl/stfl-"
364 version ".tar.gz"))
365 (sha256
366 (base32 "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl"))))
367 (build-system gnu-build-system)
368 (arguments
369 `(#:tests? #f ; no test target
370 #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out"))
371 (string-append "CC=" ,(cc-for-target)))
372 #:phases
373 (modify-phases %standard-phases
374 (delete 'configure) ; there is no configure script
375 ;; In our ncurses, the headers are in /include.
376 (add-before 'build 'patch-ncursesw
377 (lambda _
378 (substitute* "stfl_internals.h"
379 (("ncursesw/") ""))))
380 (add-after 'install 'install-missing-symlink
381 (lambda* (#:key outputs #:allow-other-keys)
382 (let* ((out (assoc-ref outputs "out"))
383 (lib (string-append out "/lib")))
384 ;; Some programs look for libstfl.so.0.
385 (symlink "libstfl.so" (string-append lib "/libstfl.so.0"))))))))
386 (inputs (list ncurses))
387 (native-inputs (list ncurses swig-4.0))
388 (home-page (string-append "https://web.archive.org/web/20211113222004/"
389 "http://www.clifford.at/stfl/"))
390 (synopsis "Structured terminal forms library")
391 (description "@acronym{STFL, Structured Terminal Forms Language} is a
392language for easily describing @acronym{GUIs, Graphical User Interfaces}.
393@acronym{STFL, Structured Terminal Forms Library} is also the name of this
394library which translates those descriptions into a curses-based widget set for
395text terminals.
396
397STFL descriptions do not contain any concrete layouting information, such as x/y
398coordinates of widgets. Instead, container widgets such as vertical and
399horizontal boxes, as well as tables, are used to group widgets. The actual
400layouting work is done by the STFL library. This allows STFL GUIs to handle
401terminals of different sizes and terminal resize events transparently for the
402application programmer.")
403 (license lgpl3+)))