projects/guix·blob java-team · refs

1150 lines · 47.9 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Cyril Roelandt <[email protected]>
3;;; Copyright © 2013, 2016 Ludovic Courtès <[email protected]>
4;;; Copyright © 2014, 2015 David Thompson <[email protected]>
5;;; Copyright © 2014 Kevin Lemonnier <[email protected]>
6;;; Copyright © 2015 Jeff Mickey <[email protected]>
7;;; Copyright © 2016–2021 Tobias Geerinckx-Rice <[email protected]>
8;;; Copyright © 2016 Stefan Reichör <[email protected]>
9;;; Copyright © 2017, 2018 Ricardo Wurmus <[email protected]>
10;;; Copyright © 2017, 2018 Nikita <[email protected]>
11;;; Copyright © 2017, 2018 Leo Famulari <[email protected]>
12;;; Copyright © 2017, 2021 Arun Isaac <[email protected]>
13;;; Copyright © 2019 Meiyo Peng <[email protected]>
14;;; Copyright © 2019 Timothy Sample <[email protected]>
15;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
16;;; Copyright © 2019, 2020, 2023, 2025 Janneke Nieuwenhuizen <[email protected]>
17;;; Copyright © 2020 Brice Waegeneire <[email protected]>
18;;; Copyright © 2020 Ryan Prior <[email protected]>
19;;; Copyright © 2020, 2022, 2024, 2026 Efraim Flashner <[email protected]>
20;;; Copyright © 2020, 2022 Marius Bakke <[email protected]>
21;;; Copyright © 2021, 2022 Nicolas Goaziou <[email protected]>
22;;; Copyright © 2021, 2022 Felix Gruber <[email protected]>
23;;; Copyright © 2022 Andrew Tropin <[email protected]>
24;;; Copyright © 2023 Zheng Junjie <[email protected]>
25;;; Copyright © 2023 David Pflug <[email protected]>
26;;; Copyright © 2023 Jaeme Sifat <[email protected]>
27;;; Copyright © 2024 Tanguy Le Carrour <[email protected]>
28;;; Copyright © 2024 Vinicius Monego <[email protected]>
29;;; Copyright © 2024 Luís Henriques <[email protected]>
30;;; Copyright © 2024 Giacomo Leidi <[email protected]>
31;;; Copyright © 2026 Untrusem <[email protected]>
32;;; Copyright © 2026 Ashish SHUKLA <[email protected]>
33;;;
34;;; This file is part of GNU Guix.
35;;;
36;;; GNU Guix is free software; you can redistribute it and/or modify it
37;;; under the terms of the GNU General Public License as published by
38;;; the Free Software Foundation; either version 3 of the License, or (at
39;;; your option) any later version.
40;;;
41;;; GNU Guix is distributed in the hope that it will be useful, but
42;;; WITHOUT ANY WARRANTY; without even the implied warranty of
43;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44;;; GNU General Public License for more details.
45;;;
46;;; You should have received a copy of the GNU General Public License
47;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
48
49(define-module (gnu packages shells)
50 #:use-module (gnu packages)
51 #:use-module (gnu packages autotools)
52 #:use-module (gnu packages base)
53 #:use-module (gnu packages bash)
54 #:use-module (gnu packages bison)
55 #:use-module (gnu packages check)
56 #:use-module (gnu packages cmake)
57 #:use-module (gnu packages compression)
58 #:use-module (gnu packages crypto)
59 #:use-module (gnu packages curl)
60 #:use-module (gnu packages documentation)
61 #:use-module (gnu packages gettext)
62 #:use-module (gnu packages groff)
63 #:use-module (gnu packages guile)
64 #:use-module (gnu packages libbsd)
65 #:use-module (gnu packages libedit)
66 #:use-module (gnu packages linux)
67 #:use-module (gnu packages ncurses)
68 #:use-module (gnu packages pcre)
69 #:use-module (gnu packages perl)
70 #:use-module (gnu packages pkg-config)
71 #:use-module (gnu packages python)
72 #:use-module (gnu packages python-build)
73 #:use-module (gnu packages python-check)
74 #:use-module (gnu packages python-web)
75 #:use-module (gnu packages python-xyz)
76 #:use-module (gnu packages readline)
77 #:use-module (gnu packages rust)
78 #:use-module (gnu packages scheme)
79 #:use-module (gnu packages sphinx)
80 #:use-module (gnu packages terminals)
81 #:use-module (gnu packages version-control)
82 #:use-module (gnu packages xdisorg)
83 #:use-module (gnu packages xorg)
84 #:use-module (gnu packages texinfo)
85 #:use-module (gnu packages text-editors)
86 #:use-module (guix build-system cargo)
87 #:use-module (guix build-system cmake)
88 #:use-module (guix build-system gnu)
89 #:use-module (guix build-system meson)
90 #:use-module (guix build-system pyproject)
91 #:use-module (guix build-system trivial)
92 #:use-module (guix download)
93 #:use-module (guix git-download)
94 #:use-module (guix gexp)
95 #:use-module ((guix licenses) #:prefix license:)
96 #:use-module (guix packages)
97 #:use-module (guix utils))
98
99(define-public dash
100 (package
101 (name "dash")
102 (version "0.5.12")
103 (source
104 (origin
105 (method url-fetch)
106 (uri (string-append "http://gondor.apana.org.au/~herbert/dash/files/"
107 "dash-" version ".tar.gz"))
108 (sha256
109 (base32 "12pjm2j0q0q88nvqbcyqjwr8s1c29ilxyq2cdj8k42wbdv24liva"))
110 (modules '((guix build utils)))
111 (snippet
112 '(begin
113 ;; The man page hails from BSD, where (d)ash is the default shell.
114 ;; This isn't the case on Guix or indeed most other GNU systems.
115 (substitute* "src/dash.1"
116 (("the standard command interpreter for the system")
117 "a command interpreter based on the original Bourne shell"))))))
118 (build-system gnu-build-system)
119 (inputs
120 (list libedit))
121 (arguments
122 `(#:configure-flags '("--with-libedit"
123 ,@(if (target-hurd?)
124 '("CPPFLAGS=-DPATH_MAX=4096")
125 '()))))
126 (home-page "http://gondor.apana.org.au/~herbert/dash")
127 (synopsis "POSIX-compliant shell optimised for size")
128 (description
129 "Dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
130as small as possible, often without sacrificing speed. It is faster than the
131GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. Dash is a
132direct descendant of NetBSD's Almquist Shell (@command{ash}).")
133 (license (list license:bsd-3
134 license:gpl2+)) ; mksignames.c
135 (properties '((lint-hidden-cpe-vendors . ("plotly"))))))
136
137(define-public fish
138 (package
139 (name "fish")
140 (version "4.7.1")
141 (source
142 (origin
143 (method url-fetch)
144 (uri (string-append "https://github.com/fish-shell/fish-shell/"
145 "releases/download/" version "/"
146 "fish-" version ".tar.xz"))
147 (sha256
148 (base32 "1pxpvcqxraz6hmk6i5zznylygv72c61a46fsvksy6f33i91mnkbg"))
149 ;; TODO: Unbundle corrosion.
150 (patches (search-patches "corrosion-honor-CARGO_BUILD_TARGET.patch"))))
151 (build-system cmake-build-system)
152 (inputs
153 (cons* fish-foreign-env
154 ncurses
155 pcre2
156 python ;for fish_config and manpage completions
157 (cargo-inputs 'fish)))
158 (native-inputs
159 (append
160 (list gettext-minimal ;localization support
161 pkg-config
162 procps ;for the test suite
163 python-pexpect ;for the test suite
164 ;; python-sphinx ;for documentation TODO: cargo-xtask
165 rust
166 `(,rust "cargo"))
167 (or (and=> (%current-target-system)
168 (compose list make-rust-sysroot))
169 '())))
170 (arguments
171 (list
172 #:out-of-source? #f
173 #:configure-flags
174 #~(list (string-append "-DRust_CARGO_TARGET=" #$(cargo-triplet)))
175 #:imported-modules
176 (append %cargo-build-system-modules
177 %cmake-build-system-modules)
178 #:modules
179 '(((guix build cargo-build-system) #:prefix cargo:)
180 (guix build cmake-build-system)
181 ((guix build gnu-build-system) #:prefix gnu:)
182 (guix build utils))
183 #:phases
184 #~(modify-phases %standard-phases
185 (add-after 'unpack 'use-guix-vendored-dependencies
186 (lambda _
187 (substitute* "Cargo.toml"
188 (("git.*tag.*,")
189 "version = \"*\","))))
190 (add-after 'unpack 'prepare-cargo-build-system
191 (lambda args
192 (for-each
193 (lambda (phase)
194 (format #t "Running cargo phase: ~a~%" phase)
195 (apply (assoc-ref cargo:%standard-phases phase)
196 #:cargo-target #$(cargo-triplet)
197 args))
198 '(prepare-rust-crates
199 unpack-rust-crates
200 configure
201 check-for-pregenerated-files
202 patch-cargo-checksums))))
203 (add-after 'unpack 'set-env
204 (lambda _
205 ;; some tests write to $HOME
206 (setenv "HOME" (getcwd))))
207 (add-after 'unpack 'patch-tests
208 (lambda* (#:key inputs native-inputs #:allow-other-keys)
209 (let* ((coreutils
210 (dirname
211 (dirname
212 (search-input-file
213 (or native-inputs inputs) "bin/pwd"))))
214 (bash
215 (dirname
216 (dirname
217 (search-input-file
218 (or native-inputs inputs) "bin/bash")))))
219 ;; This test sporadically fails in the build container
220 ;; because of leftover zombie processes, which are not
221 ;; reaped automatically:
222;; "Found existing zombie processes. Clean up zombies before running this test."
223 ;; Disabling parallel tests does not reliably prevent it.
224 (delete-file "tests/checks/jobs.fish")
225 ;; These ones need to chdir successfully.
226 (substitute* "tests/checks/vars_as_commands.fish"
227 (("/usr/bin") "/tmp"))
228 (substitute* "tests/checks/cd.fish"
229 (("cd bin") "cd tmp"))
230 ;; shebangless scripts don't work
231 (delete-file "tests/checks/noshebang.fish")
232 ;; This doesn't work
233 (delete-file "tests/checks/__fish_posix_shell.fish")
234 ;; __fish_migrate expects /bin/sh to work
235 (delete-file "tests/checks/__fish_migrate.fish")
236 (substitute* (cons* "src/builtins/test.rs"
237 "src/highlight/file_tester.rs"
238 "src/highlight/highlight.rs"
239 (find-files "tests"))
240 (("/bin/sh" sh) (string-append bash sh))
241 (("/usr/bin/en\"") (string-append coreutils "/bin/en\""))
242 (("/usr/bin/e\"") (string-append coreutils "/bin/e\""))
243 (("\"/bin") "\"/tmp")
244 (("\"/usr") "\"/tmp"))
245 (substitute* "tests/checks/colon-delimited-var.fish"
246 (("/usr/bin:a:.:b") "/tmp/bin:a:.:b"))
247 (substitute* "tests/test_driver.py"
248 (("\"cc\"") "\"gcc\"")))))
249 ;; Source /etc/fish/config.fish from $__fish_sysconf_dir/config.fish.
250 (add-after 'patch-tests 'patch-fish-config
251 (lambda _
252 (let ((port (open-file "etc/config.fish" "a")))
253 (display (string-append
254 "\n\n"
255 "# Patched by Guix.\n"
256 "# Source /etc/fish/config.fish.\n"
257 "if test -f /etc/fish/config.fish\n"
258 " source /etc/fish/config.fish\n"
259 "end\n")
260 port)
261 (close-port port))))
262 ;; Enable completions, functions and configurations in user's and
263 ;; system's guix profiles by adding them to __extra_* variables.
264 (add-before 'build 'patch-fish-extra-paths
265 (lambda _
266 (let ((port (open-file "share/__fish_build_paths.fish.in" "a")))
267 (display
268 (string-append
269 "\n\n"
270 "# Patched by Guix.\n"
271 "# Enable completions, functions and configurations in user's,"
272 " home's and system's guix profiles by adding them to __extra_*"
273 " variables.\n"
274 "set -l __guix_profile_paths ~/.guix-profile ~/.guix-home/profile"
275 " /run/current-system/profile\n"
276 "set __extra_completionsdir"
277 " $__guix_profile_paths\"/etc/fish/completions\""
278 " $__guix_profile_paths\"/share/fish/vendor_completions.d\""
279 " $__extra_completionsdir\n"
280 "set __extra_functionsdir"
281 " $__guix_profile_paths\"/etc/fish/functions\""
282 " $__guix_profile_paths\"/share/fish/vendor_functions.d\""
283 " $__extra_functionsdir\n"
284 "set __extra_confdir"
285 " $__guix_profile_paths\"/etc/fish/conf.d\""
286 " $__guix_profile_paths\"/share/fish/vendor_conf.d\""
287 " $__extra_confdir\n")
288 port)
289 (close-port port))))
290 (replace 'check
291 (lambda* (#:rest args)
292 (apply (assoc-ref gnu:%standard-phases 'check)
293 #:test-target "fish_run_tests" args)))
294 ;; Use fish-foreign-env to source /etc/profile.
295 (add-before 'build 'source-etc-profile
296 (lambda* (#:key inputs #:allow-other-keys)
297 (let ((port (open-file "share/__fish_build_paths.fish.in" "a")))
298 (display
299 (string-append
300 "\n\n"
301 "# Patched by Guix.\n"
302 "# Use fish-foreign-env to source /etc/profile.\n"
303 "if status is-login\n"
304 " set fish_function_path "
305 (dirname
306 (search-input-file inputs "share/fish/functions/fenv.fish"))
307 " $__fish_datadir/functions\n"
308 " [ -f /etc/profile ] && fenv source /etc/profile\n"
309 " set -e fish_function_path\n"
310 "end\n")
311 port)
312 (close-port port)))))))
313 (synopsis "The friendly interactive shell")
314 (description
315 "Fish (friendly interactive shell) is a shell focused on interactive use,
316discoverability, and friendliness. Fish has very user-friendly and powerful
317tab-completion, including descriptions of every completion, completion of
318strings with wildcards, and many completions for specific commands. It also
319has extensive and discoverable help. A special @command{help} command gives
320access to all the fish documentation in your web browser. Other features
321include smart terminal handling based on terminfo, an easy to search history,
322and syntax highlighting.")
323 (home-page "https://fishshell.com/")
324 (license license:gpl2)))
325
326(define-public fish-foreign-env
327 (package
328 (name "fish-foreign-env")
329 (version "0.20230823")
330 (source
331 (origin
332 (method git-fetch)
333 (uri (git-reference
334 (url "https://github.com/oh-my-fish/plugin-foreign-env")
335 (commit "7f0cf099ae1e1e4ab38f46350ed6757d54471de7")))
336 (file-name (git-file-name name version))
337 (sha256
338 (base32 "0d16mdgjdwln41zk44qa5vcilmlia4w15r8z2rc3p49i5ankksg3"))))
339 (build-system trivial-build-system)
340 (arguments
341 '(#:modules ((guix build utils))
342 #:builder
343 (begin
344 (use-modules (guix build utils))
345 (let* ((source (assoc-ref %build-inputs "source"))
346 (out (assoc-ref %outputs "out"))
347 (func-path (string-append out "/share/fish/functions")))
348 (mkdir-p func-path)
349 (copy-recursively (string-append source "/functions")
350 func-path)
351
352 ;; Embed absolute paths.
353 (substitute* `(,(string-append func-path "/fenv.fish")
354 ,(string-append func-path "/fenv.main.fish"))
355 (("bash")
356 (search-input-file %build-inputs "/bin/bash"))
357 (("sed")
358 (search-input-file %build-inputs "/bin/sed"))
359 ((" tr ")
360 (string-append " "
361 (search-input-file %build-inputs "/bin/tr")
362 " ")))))))
363 (inputs
364 (list bash coreutils sed))
365 (home-page "https://github.com/oh-my-fish/plugin-foreign-env")
366 (synopsis "Foreign environment interface for fish shell")
367 (description "@code{fish-foreign-env} wraps bash script execution in a way
368that environment variables that are exported or modified get imported back
369into fish.")
370 (license license:expat)))
371
372(define-public rc
373 (package
374 (name "rc")
375 (version "1.7.4")
376 (source (origin
377 (method git-fetch)
378 (uri (git-reference
379 (url "https://github.com/rakitzis/rc")
380 (commit (string-append "v" version))))
381 (sha256
382 (base32
383 "0vj1h4pcg13vxsiydmmk87dr2sra9h4gwx0c4q6fjsiw4in78rrd"))
384 (file-name (git-file-name name version))))
385 (build-system gnu-build-system)
386 (arguments
387 `(#:configure-flags
388 '("--with-edit=gnu")
389 #:phases
390 (modify-phases %standard-phases
391 (add-before 'bootstrap 'patch-trip.rc
392 (lambda _
393 (substitute* "trip.rc"
394 (("/bin/pwd") (which "pwd"))
395 (("/bin/sh") (which "sh"))
396 (("/bin/rm") (which "rm"))
397 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
398 #t)))))
399 (inputs (list readline perl))
400 (native-inputs (list autoconf automake libtool pkg-config))
401 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
402 (description
403 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
404has a small feature set similar to a traditional Bourne shell.")
405 (home-page "https://github.com/rakitzis/rc")
406 (license license:zlib)))
407
408(define-public es
409 (package
410 (name "es")
411 (version "0.10.0")
412 (source
413 (origin
414 (method git-fetch)
415 (uri (git-reference
416 (url "https://github.com/wryun/es-shell")
417 (commit (string-append "v" version))))
418 (sha256
419 (base32 "11zykg28r018vl9n0sw82jwv3m2yk1r9d25y2mjrvpkxf0dj2va6"))
420 (file-name (git-file-name name version))))
421 (build-system gnu-build-system)
422 (arguments
423 (list
424 #:test-target "test"))
425 (inputs
426 (list readline))
427 (native-inputs
428 (list autoconf-2.72 ;2.69 does not detect that some files are missing
429 automake
430 procps)) ;for tests
431 (synopsis "Extensible shell with higher-order functions")
432 (description
433 "Es is an extensible shell. The language was derived from the Plan 9
434shell, rc, and was influenced by functional programming languages, such as
435Scheme, and the Tcl embeddable programming language. This implementation is
436derived from Byron Rakitzis's public domain implementation of rc, and was
437written by Paul Haahr and Byron Rakitzis.")
438 (home-page "https://wryun.github.io/es-shell/")
439 (license license:public-domain)))
440
441(define-public rush
442 (package
443 (name "rush")
444 (version "2.4")
445 (source (origin
446 (method url-fetch)
447 (uri (string-append "mirror://gnu/rush/rush-"
448 version ".tar.gz"))
449 (sha256
450 (base32
451 "1nqjjbamdn4lcysc2hji3i73jjl1ghivb24h12zh79xnka438vr6"))))
452 (build-system gnu-build-system)
453 (home-page "https://www.gnu.org/software/rush/")
454 (synopsis "Restricted user (login) shell")
455 (description
456 "GNU Rush is a restricted user shell, for systems on which users are to
457be provided with only limited functionality or resources. Administrators set
458user rights via a configuration file which can be used to limit, for example,
459the commands that can be executed, CPU time, or virtual memory usage.")
460 (license license:gpl3+)))
461
462(define-public tcsh
463 (package
464 (name "tcsh")
465 (version "6.24.15")
466 (source (origin
467 (method url-fetch)
468 ;; Old tarballs are moved to old/.
469 (uri (list (string-append "https://astron.com/pub/tcsh/"
470 "tcsh-" version ".tar.gz")
471 (string-append "https://astron.com/pub/tcsh/"
472 "old/tcsh-" version ".tar.gz")))
473 (sha256
474 (base32
475 "1z931m79hd7zp066s57mcifzig3byfg3ak7432jmf3rjvyjb5l6l"))
476 (patches (search-patches "tcsh-fix-autotest.patch"))
477 (patch-flags '("-p0"))))
478 (build-system gnu-build-system)
479 (native-inputs
480 (append (if (target-riscv64?)
481 (list config)
482 '())
483 (list autoconf perl)))
484 (inputs
485 (list libxcrypt ncurses))
486 (arguments
487 (list
488 #:phases
489 #~(modify-phases %standard-phases
490 #$@(if (%current-target-system)
491 #~((add-before 'configure 'set-cross-cc
492 (lambda _
493 (substitute* "configure"
494 (("CC_FOR_GETHOST=\"cc\"")
495 "CC_FOR_GETHOST=\"gcc\"")))))
496 #~())
497 #$@(if (system-hurd?)
498 #~((add-after 'unpack 'skip-tests
499 (lambda _
500 (substitute* "tests/testsuite.at"
501 (("m4_include\\(\\[subst.at\\]\\)" all)
502 (string-append "# " all))))))
503 #~())
504 (add-before 'check 'patch-test-scripts
505 (lambda _
506 ;; Take care of pwd
507 (substitute* '("tests/commands.at" "tests/variables.at")
508 (("/bin/pwd") (which "pwd")))
509 (substitute* "Makefile"
510 ;; Likewise for /usr/bin/env.
511 (("/usr/bin/env") "env")
512 ;; Don't reset the environment (PATH, etc).
513 (("\\$\\(ENVCMD\\) -") "$(ENVCMD)"))
514 ;; This test does not expect the home directory from
515 ;; /etc/passwd to be '/'.
516 (substitute* "tests/subst.at"
517 (("\\$\\(id -un\\)/foo")
518 "$(id -un)//foo"))
519 ;; The .at files create shell scripts without shebangs. Erk.
520 (substitute* "tests/commands.at"
521 (("./output.sh") "/bin/sh output.sh"))
522 (substitute* "tests/syntax.at"
523 (("; other_script.csh") "; /bin/sh other_script.csh"))
524 ;; Now, let's generate the test suite and patch it
525 (invoke "make" "tests/testsuite")
526
527 ;; This file is ISO-8859-1 encoded.
528 (with-fluids ((%default-port-encoding #f))
529 (substitute* "tests/testsuite"
530 (("/bin/sh") (which "sh"))))))
531 (add-after 'install 'post-install
532 (lambda _
533 (with-directory-excursion (string-append #$output "/bin")
534 (symlink "tcsh" "csh")))))))
535 (home-page "https://www.tcsh.org/")
536 (synopsis "Unix shell based on csh")
537 (description
538 "Tcsh is an enhanced, but completely compatible version of the Berkeley
539UNIX C shell (csh). It is a command language interpreter usable both as an
540interactive login shell and a shell script command processor. It includes a
541command-line editor, programmable word completion, spelling correction, a
542history mechanism, job control and a C-like syntax.")
543 (license license:bsd-4)))
544
545(define-public zsh
546 (package
547 (name "zsh")
548 (version "5.9.2")
549 (source (origin
550 (method url-fetch)
551 (uri (list (string-append
552 "https://www.zsh.org/pub/zsh-" version
553 ".tar.xz")
554 (string-append
555 "https://www.zsh.org/pub/old/zsh-" version
556 ".tar.xz")))
557 (sha256
558 (base32
559 "109gil3xz5jmmcj1dv3rqy9gkqi2g3bbq2gc5ic86ixlfi1p7yin"))))
560 (build-system gnu-build-system)
561 (arguments `(#:configure-flags
562 `(,(string-append "CFLAGS=-g -O2"
563 " -Wno-error=implicit-function-declaration"
564 " -Wno-error=implicit-int"
565 " -Wno-error=incompatible-pointer-types"
566 " -Wno-error=int-conversion")
567 "--with-tcsetpgrp"
568 "--enable-pcre"
569 "--enable-maildir-support"
570 ;; share/zsh/site-functions isn't populated
571 "--disable-site-fndir"
572 ,(string-append
573 "--enable-additional-fpath="
574 "/usr/local/share/zsh/site-functions," ; for foreign OS
575 "/run/current-system/profile/share/zsh/site-functions"))
576 #:phases
577 (modify-phases %standard-phases
578 (add-before 'configure 'fix-sh
579 (lambda _
580 ;; Some of the files are ISO-8859-1 encoded.
581 (with-fluids ((%default-port-encoding #f))
582 (substitute*
583 '("configure"
584 "configure.ac"
585 "Src/exec.c"
586 "Src/mkmakemod.sh"
587 "Config/installfns.sh"
588 "Config/defs.mk.in"
589 "Test/E01options.ztst"
590 "Test/A05execution.ztst"
591 "Test/A01grammar.ztst"
592 "Test/A06assign.ztst"
593 "Test/B02typeset.ztst"
594 "Completion/Unix/Command/_init_d"
595 "Util/preconfig")
596 (("/bin/sh") (which "sh"))))))
597 (add-before 'check 'patch-test
598 (lambda _
599 ;; In Zsh, `command -p` searches a predefined set of
600 ;; paths that don't exist in the build environment. See
601 ;; the assignment of 'path' in Src/init.c'
602 (substitute* "Test/A01grammar.ztst"
603 (("command -pv") "command -v")
604 (("command -p") "command ")
605 (("'command' -p") "'command' "))))
606 (add-after 'build 'make-info
607 (lambda _ (invoke "make" "info")))
608 (add-after 'build 'install-info
609 (lambda _ (invoke "make" "install.info"))))))
610 (native-inputs (list autoconf texinfo))
611 (inputs (list ncurses pcre perl))
612 (synopsis "Powerful shell for interactive use and scripting")
613 (description "The Z shell (zsh) is a Unix shell that can be used
614as an interactive login shell and as a powerful command interpreter
615for shell scripting. Zsh can be thought of as an extended Bourne shell
616with a large number of improvements, including some features of bash,
617ksh, and tcsh.")
618 (home-page "https://www.zsh.org/")
619
620 ;; The whole thing is under an MIT/X11-style license, but there's one
621 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
622 (license license:gpl2+)))
623
624(define-public xonsh
625 (package
626 (name "xonsh")
627 (version "0.22.8")
628 (source
629 (origin
630 (method url-fetch)
631 (uri (pypi-uri "xonsh" version))
632 (sha256
633 (base32
634 "1372kg9kp7z7mw0k1f5l93jqyyyc1mmr3hx7557ynm8n5y1ggvay"))
635 (modules '((guix build utils)))
636 (snippet
637 #~(begin
638 (substitute* "pyproject.toml"
639 (("\"xonsh\\.parsers\\.ply\",") ""))
640 ;; Use our properly packaged PLY instead.
641 (substitute* (list "setup.py"
642 "tests/parsers/test_lexer.py"
643 "xonsh/parsers/base.py"
644 "xonsh/parsers/completion_context.py"
645 "xonsh/parsers/lexer.py"
646 "xonsh/parsers/v310.py"
647 "xonsh/xonfig.py")
648 (("from xonsh\\.parsers\\.ply") "from ply")
649 (("from xonsh\\.parsers import ply") "import ply"))
650 (delete-file-recursively "xonsh/parsers/ply")))))
651 (build-system pyproject-build-system)
652 (arguments
653 ;; Some tests are failing for reasons like not accessing parent directory
654 ;; with os.getcwd(), not activating virtual environments, not finding
655 ;; some commands (man, echo), and not running subprocesses.
656 (list #:test-flags
657 #~(list "--ignore=tests/completers/test_pip_completer.py" ;Avoid pip
658 "-k"
659 (string-append
660 "not "
661 (string-join
662 (list "test_aliases_print"
663 "test_argv0"
664 "test_bash_and_is_alias_is_only_functional_alias"
665 "test_bash_completer"
666 "test_bash_completer_empty_prefix"
667 "test_callable_alias_no_bad_file_descriptor"
668 "test_complete_command"
669 "test_complete_dots"
670 "test_dirty_working_directory"
671 "test_equal_sign_arg"
672 "test_loading_correctly"
673 "test_man_completion"
674 "test_on_command_not_found_replacement"
675 "test_parser_show"
676 "test_printfile"
677 "test_printname"
678 "test_ptk_prompt"
679 "test_quote_handling"
680 "test_script"
681 "test_shebang_cr"
682 "test_skipper_command"
683 "test_sourcefile"
684 "test_spec_decorator_alias_output_format"
685 "test_spec_modifier_alias_output_format"
686 "test_trace_in_script"
687 "test_vc_get_branch"
688 "test_xonsh_activator"
689 "test_xonsh_lexer")
690 " and not ")))
691 #:phases
692 #~(modify-phases %standard-phases
693 ;; Some tests run os.mkdir().
694 (add-before 'check 'writable-home
695 (lambda _
696 (setenv "HOME" "/tmp"))))))
697 (native-inputs
698 (list git-minimal/pinned
699 python-pyte
700 python-pytest
701 python-pytest-mock
702 python-pytest-rerunfailures
703 python-pytest-subprocess
704 python-pytest-timeout
705 python-requests
706 python-setuptools))
707 (inputs
708 (list python-distro
709 python-ply
710 python-prompt-toolkit
711 python-pygments
712 python-pyperclip
713 python-setproctitle))
714 (home-page "https://xon.sh/")
715 (synopsis "Python-ish shell")
716 (description
717 "Xonsh is a Python-ish, BASHwards-looking shell language and command
718prompt. The language is a superset of Python 3.4+ with additional shell
719primitives that you are used to from Bash and IPython. It works on all major
720systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
721use of experts and novices alike.")
722 (license license:bsd-2)))
723
724(define-public scsh
725 (let ((commit "4acf6e4ed7b65b46186ef0c9c2a1e10bef8dc052")
726 (revision "0"))
727 (package
728 (name "scsh")
729 (version (git-version "0.7" revision commit))
730 (source
731 (origin
732 (method git-fetch)
733 (uri (git-reference
734 (url "https://github.com/scheme/scsh")
735 (commit commit)))
736 (file-name (git-file-name name version))
737 (sha256
738 (base32
739 "1czrp808v5gs0ci5lmkp3wr3gfkrb3vd5b2iw2hz1bpqgaf6bxpv"))
740 (patches (search-patches "scsh-nonstring-search-path.patch"))))
741 (build-system gnu-build-system)
742 (arguments
743 (list
744 #:test-target "test"
745 #:phases
746 #~(modify-phases %standard-phases
747 (add-before 'configure 'replace-rx
748 (lambda _
749 (let ((rxpath (string-append #$scheme48-rx
750 "/share/scheme48-"
751 #$(package-version scheme48)
752 "/rx")))
753 (delete-file-recursively "rx")
754 (symlink rxpath "rx"))))
755 (add-after 'replace-rx 'patch-source
756 (lambda _
757 (substitute* "Makefile.in"
758 (("SCHEME48VERSION = 1.9.2")
759 (string-append "SCHEME48VERSION = " #$(package-version scheme48))))
760 (with-directory-excursion "c"
761 (substitute* "syscalls.c"
762 (("#include <stdlib.h>" all)
763 (string-append all "\n#include <time.h>")))
764 (substitute* "tty.c"
765 (("#include <termios.h>" all)
766 (string-append all "\n#include <pty.h>")))))))))
767 (inputs
768 (list scheme48 scheme48-rx))
769 (native-inputs
770 (list autoconf automake))
771 (native-search-paths
772 (list (search-path-specification
773 (variable "SCSH_LIB_DIRS")
774 (separator " ")
775 (files '("share/scsh-0.7")))))
776 (home-page "https://github.com/scheme/scsh")
777 (synopsis "Unix shell embedded in Scheme")
778 (description
779 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
780components: a process notation for running programs and setting up pipelines
781and redirections, and a complete syscall library for low-level access to the
782operating system.")
783 (license license:bsd-3))))
784
785(define-public linenoise
786 (let ((commit "e26268de5e56bfaad773786471844578fe9f7f4b")
787 (revision "3"))
788 (package
789 (name "linenoise")
790 (version (string-append "1.0-" revision "." (string-take commit 7)))
791 (source
792 (origin
793 (method git-fetch)
794 (uri (git-reference
795 (url "https://github.com/antirez/linenoise")
796 (commit commit)))
797 (file-name (string-append name "-" version "-checkout"))
798 (sha256
799 (base32
800 "1pwil7pv6zqmy5l0r0hcr5gw25d8vrlh2sc9n5bv8vj3abg64zqs"))))
801 (build-system gnu-build-system)
802 (arguments
803 `(#:tests? #f ; no tests are included
804 #:make-flags
805 (list ,(string-append "CC=" (cc-for-target)))
806 #:phases
807 (modify-phases %standard-phases
808 (delete 'configure)
809 (replace 'install
810 (lambda* (#:key outputs #:allow-other-keys)
811 ;; At the moment there is no 'make install' in upstream.
812 (let* ((out (assoc-ref outputs "out")))
813 (install-file "linenoise.h"
814 (string-append out "/include/linenoise"))
815 (install-file "linenoise.c"
816 (string-append out "/include/linenoise"))
817 #t))))))
818 (home-page "https://github.com/antirez/linenoise")
819 (synopsis "Minimal zero-config readline replacement")
820 (description
821 "Linenoise is a minimal, zero-config, readline replacement.
822Its features include:
823
824@enumerate
825@item Single and multi line editing mode with the usual key bindings
826@item History handling
827@item Completion
828@item Hints (suggestions at the right of the prompt as you type)
829@item A subset of VT100 escapes, ANSI.SYS compatible
830@end enumerate\n")
831 (license license:bsd-2))))
832
833(define-public s-shell
834 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
835 (revision "2"))
836 (package
837 (name "s-shell")
838 (version (git-version "0.0.0" revision commit))
839 (source
840 (origin
841 (method git-fetch)
842 (uri (git-reference
843 (url "https://github.com/rain-1/s")
844 (commit commit)))
845 (file-name (string-append name "-" version "-checkout"))
846 (sha256
847 (base32
848 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
849 (build-system gnu-build-system)
850 (inputs
851 (list linenoise))
852 (arguments
853 `(#:tests? #f
854 #:make-flags (list "CC=gcc"
855 (string-append "PREFIX="
856 (assoc-ref %outputs "out")))
857 #:phases
858 (modify-phases %standard-phases
859 (add-after 'unpack 'install-directory-fix
860 (lambda* (#:key outputs #:allow-other-keys)
861 (let* ((out (assoc-ref outputs "out"))
862 (bin (string-append out "/bin")))
863 (substitute* "Makefile"
864 (("out") bin))
865 #t)))
866 (add-after 'install 'manpage
867 (lambda* (#:key outputs #:allow-other-keys)
868 (install-file "s.1" (string-append (assoc-ref outputs "out")
869 "/share/man/man1"))))
870 (replace 'configure
871 (lambda* (#:key inputs outputs #:allow-other-keys)
872 ;; At this point linenoise is meant to be included,
873 ;; so we have to really copy it into the working directory
874 ;; of s.
875 (let* ((linenoise (assoc-ref inputs "linenoise"))
876 (noisepath (string-append linenoise "/include/linenoise"))
877 (out (assoc-ref outputs "out")))
878 (copy-recursively noisepath "linenoise")
879 (substitute* "s.c"
880 (("/bin/s") (string-append out "/bin/s")))
881 #t))))))
882 (home-page "https://github.com/rain-1/s")
883 (synopsis "Extremely minimal shell with the simplest syntax possible")
884 (description
885 "S is a new shell that aims to be extremely simple. It does not
886implement the POSIX shell standard.
887
888There are no globs or \"splatting\" where a variable $FOO turns into multiple
889command line arguments. One token stays one token forever.
890This is a \"no surprises\" straightforward approach.
891
892There are no redirection operators > in the shell language, they are added as
893extra programs. > is just another unix command, < is essentially cat(1).
894A @code{andglob} program is also provided along with s.")
895 (license license:bsd-3))))
896
897(define-public oksh
898 (package
899 (name "oksh")
900 (version "7.8")
901 (source
902 (origin
903 (method url-fetch)
904 (uri (string-append
905 "https://github.com/ibara/oksh/releases/download/oksh-"
906 version "/oksh-" version ".tar.gz"))
907 (sha256
908 (base32
909 "0l59x9mm6nbixcpz3zf3iplqili2gyw8l382rj89b0iv32hxac1v"))))
910 (build-system gnu-build-system)
911 (arguments
912 `(#:tests? #f ; there are no tests available
913 #:license-file-regexp "LEGAL"))
914 (home-page "https://github.com/ibara/oksh")
915 (synopsis "Portable OpenBSD Korn Shell")
916 (description
917 "Oksh is a portable OpenBSD ksh. Not an official OpenBSD project.
918Unlike other ports of OpenBSD ksh, this port is entirely self-contained
919and aims to be maximally portable across operating systems and C compilers.")
920 (license (list license:public-domain
921 ;; asprintf.c, issetugid.c, reallocarray.c, sh.1,
922 ;; strlcat.c, strlcpy.c, strtonum.c
923 license:isc
924 ;; confstr.c, siglist.c, signame.c, sys-queue.h, unvis.c,
925 ;; vis.c, vis.h
926 license:bsd-3))))
927
928(define-public loksh
929 (package
930 (name "loksh")
931 (version "7.9")
932 (source (origin
933 (method git-fetch)
934 (uri (git-reference
935 (url "https://github.com/dimkr/loksh")
936 (commit version)
937 ;; Include the ‘lolibc’ submodule, a static compatibility library
938 ;; created for and currently used only by loksh.
939 (recursive? #t)))
940 (file-name (git-file-name name version))
941 (sha256
942 (base32
943 "0nwssdxcqs3fypfg884cwcmp21kmwsqrr5rvm1cck1qx5240hyjb"))))
944 (build-system meson-build-system)
945 (inputs (list ncurses))
946 (native-inputs (list pkg-config))
947 (arguments
948 `(#:tests? #f)) ;no tests included
949 (home-page "https://github.com/dimkr/loksh")
950 (synopsis "Korn Shell from OpenBSD")
951 (description
952 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
953interactive POSIX shell targeted at resource-constrained systems.")
954 ;; The file 'LEGAL' says it is the public domain, and the 2
955 ;; exceptions which are listed are not included in this port.
956 (license license:public-domain)))
957
958(define-public mksh
959 (package
960 (name "mksh")
961 (version "59c")
962 (source
963 (origin
964 (method url-fetch)
965 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
966 version ".tgz"))
967 (sha256
968 (base32 "01n5ggw33bw4jv4d3148wlw9n4aj7vdn3ffnc66c9w9pldjidbkp"))))
969 (build-system gnu-build-system)
970 (arguments
971 `(#:tests? #f ; tests require access to /dev/tty
972 #:phases
973 (modify-phases %standard-phases
974 (delete 'configure)
975 (replace 'build
976 (lambda _
977 (setenv "CC" "gcc")
978 (invoke (which "sh") "Build.sh")))
979 (replace 'install
980 (lambda* (#:key outputs #:allow-other-keys)
981 (let* ((out (assoc-ref outputs "out"))
982 (bin (string-append out "/bin"))
983 (man (string-append out "/share/man/man1")))
984 (install-file "mksh" bin)
985 (with-directory-excursion bin
986 (symlink "mksh" "ksh"))
987 (install-file "mksh.1" man)))))))
988 (home-page "https://www.mirbsd.org/mksh.htm")
989 (synopsis "Korn Shell from MirBSD")
990 (description "mksh is an actively developed free implementation of the
991Korn Shell programming language and a successor to the Public Domain Korn
992Shell (pdksh).")
993 (license (list license:miros
994 license:isc)))) ; strlcpy.c
995
996(define-public oils-for-unix
997 (package
998 (name "oils-for-unix")
999 (version "0.37.0")
1000 (source
1001 (origin
1002 (method url-fetch)
1003 (uri (string-append "https://oils.pub/download/oils-for-unix-"
1004 version ".tar.gz"))
1005 (sha256
1006 (base32 "001hfkb6crmmziqvqraxjva0hnzjxn11y8xsskxvqgajl0h1vm7l"))))
1007 (build-system gnu-build-system)
1008 (arguments
1009 (list #:phases
1010 #~(modify-phases %standard-phases
1011 (replace 'configure
1012 (lambda _
1013 (invoke "./configure"
1014 (string-append "--cxx-for-configure=" #$(cc-for-target))
1015 (string-append "--prefix=" #$output)
1016 "--with-readline")))
1017 (replace 'build
1018 (lambda _
1019 (invoke "_build/oils.sh")))
1020 (replace 'install
1021 (lambda _
1022 (setenv "PREFIX" #$output)
1023 (invoke "./install")))
1024 (replace 'check
1025 ;; The tests are not distributed in the tarballs but upstream
1026 ;; recommends running this smoke test.
1027 ;; https://oils.pub/release/latest/doc/INSTALL.html#:~:text=Smoke%20Test
1028 (lambda* (#:key tests? #:allow-other-keys)
1029 (when tests?
1030 (let ((osh "_bin/cxx-opt-sh/osh")
1031 (ysh "_bin/cxx-opt-sh/ysh"))
1032 (invoke/quiet osh "-c" "echo hi")
1033 (invoke/quiet osh "-n" "configure")
1034 (invoke/quiet ysh "-c" "echo hi")
1035 (invoke/quiet ysh "-c"
1036 "json write ({x: 42})"))))))))
1037 (inputs
1038 (list readline))
1039 (home-page "https://oils.pub")
1040 (synopsis "Programming language and Bash-compatible Unix shell")
1041 (description "Oils is a programming language with automatic translation for
1042Bash. It includes OSH, a Unix/POSIX shell that runs unmodified Bash
1043scripts and YSH is a legacy-free shell, with structured data for Python and
1044JavaScript users who avoid shell.")
1045 (license (list license:asl2.0))))
1046
1047;; This is renamed to maintain naming consistency with the Project Guidelines.
1048(define-deprecated-package oils oils-for-unix)
1049
1050(define-public gash
1051 (package
1052 (name "gash")
1053 (version "0.3.1")
1054 (source
1055 ;; Use a copy built from the unofficial 'EBADF-fixes' branch,
1056 ;; <https://codeberg.org/civodul/gash/commit/7c9bf2110cfe85424fba0cd14445d5f0926c3fbd>.
1057 ;; See <https://issues.guix.gnu.org/75658>.
1058 (origin (method url-fetch)
1059 (uri (string-append "mirror://gnu/guix/mirror/gash-"
1060 version ".tar.gz"))
1061 (sha256
1062 (base32
1063 "069wizkfkkifij9n0r6fkwbgcnjyr6xvnjid11ckppx0waixc0s7"))))
1064 (build-system gnu-build-system)
1065 (native-inputs
1066 (list pkg-config))
1067 (inputs
1068 (list guile-3.0))
1069 (home-page "https://savannah.nongnu.org/projects/gash/")
1070 (synopsis "POSIX-compatible shell written in Guile Scheme")
1071 (description "Gash is a POSIX-compatible shell written in Guile
1072Scheme. It provides both the shell interface, as well as a Guile
1073library for parsing shell scripts. Gash is designed to bootstrap Bash
1074as part of the Guix bootstrap process.")
1075 (license license:gpl3+)))
1076
1077(define-public gash-utils
1078 (package
1079 (name "gash-utils")
1080 (version "0.2.0")
1081 (source (origin
1082 (method url-fetch)
1083 (uri (string-append "mirror://savannah/gash/gash-utils-"
1084 version ".tar.gz"))
1085 (sha256
1086 (base32
1087 "18ylb54l9lmaynapbncc1zhbsirhihznrxihhxgqrpqgyjkfbap6"))))
1088 (build-system gnu-build-system)
1089 (arguments
1090 (list
1091 #:phases #~(modify-phases %standard-phases
1092 (add-after 'unpack 'skip-failing-tests
1093 (lambda _
1094 (substitute* "Makefile.am"
1095 (("tests/sort\\.org") ""))
1096 (for-each delete-file '("configure" "Makefile.in")))))))
1097 (native-inputs
1098 (list autoconf automake pkg-config))
1099 (inputs
1100 (list guile-3.0 gash))
1101 (home-page "https://savannah.nongnu.org/projects/gash/")
1102 (synopsis "Core POSIX utilities written in Guile Scheme")
1103 (description "Gash-Utils provides Scheme implementations of many
1104common POSIX utilities (there are about 40 of them, ranging in
1105complexity from @command{false} to @command{awk}). The utilities are
1106designed to be capable of bootstrapping their standard GNU counterparts.
1107Underpinning these utilities are many Scheme interfaces for manipulating
1108files and text.")
1109 (license license:gpl3+)))
1110
1111(define-public yash
1112 (package
1113 (name "yash")
1114 (version "2.61")
1115 (source
1116 (origin
1117 (method url-fetch)
1118 (uri (string-append
1119 "https://github.com/magicant/yash/releases/download/"
1120 (string-append version "/" "yash-" version ".tar.xz")))
1121 (sha256
1122 (base32 "0iyl42lxm3i1z2i6lqgfkrbhgmw7dvpx7911anm97cpq9xprc552"))
1123 (patches (search-patches "yash-disable-standard-path-tests.patch"))))
1124 (build-system gnu-build-system)
1125 (arguments
1126 (list
1127 #:phases
1128 #~(modify-phases %standard-phases
1129 (replace 'configure
1130 (lambda* (#:key target #:allow-other-keys)
1131 (apply invoke "sh" "./configure"
1132 (string-append "--prefix=" #$output)
1133 (if target
1134 (list
1135 (string-append "--host=" target))
1136 '())))))))
1137 (inputs (list ncurses))
1138 (native-inputs (list asciidoc
1139 ed
1140 gettext-minimal
1141 procps))
1142 (home-page "https://magicant.github.io/yash/")
1143 (synopsis "POSIX-compliant command line shell written in C99")
1144 (description
1145 "@acronym{Yash, yet another shell}, is a POSIX-compliant command line
1146shell written in C99. Yash is intended to fully comply with POSIX when
1147invoked as @command{sh}, treating undefined and unspecified behaviour as
1148errors, while also supporting features for daily interactive and
1149scripting use when invoked regularly.")
1150 (license license:gpl2+)))