gnu: linenoise: Fix cross-compilation.
[jackhill/guix/guix.git] / gnu / packages / shells.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
3 ;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
4 ;;; Copyright © 2014 Kevin Lemonnier <lemonnierk@ulrar.net>
5 ;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
6 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2016 Stefan Reichör <stefan@xsteve.at>
8 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
9 ;;; Copyright © 2017, 2018 Nikita <nikita@n0.is>
10 ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
11 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
12 ;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
13 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
14 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
15 ;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
16 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
17 ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages shells)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages base)
38 #:use-module (gnu packages bash)
39 #:use-module (gnu packages bison)
40 #:use-module (gnu packages documentation)
41 #:use-module (gnu packages groff)
42 #:use-module (gnu packages guile)
43 #:use-module (gnu packages libbsd)
44 #:use-module (gnu packages libedit)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages ncurses)
47 #:use-module (gnu packages pcre)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages readline)
53 #:use-module (gnu packages scheme)
54 #:use-module (guix build-system cmake)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix build-system python)
57 #:use-module (guix build-system trivial)
58 #:use-module (guix download)
59 #:use-module (guix git-download)
60 #:use-module (guix licenses)
61 #:use-module (guix packages)
62 #:use-module (guix utils))
63
64 (define-public dash
65 (package
66 (name "dash")
67 (version "0.5.11")
68 (source
69 (origin
70 (method url-fetch)
71 (uri (string-append "http://gondor.apana.org.au/~herbert/dash/files/"
72 "dash-" version ".tar.gz"))
73 (sha256
74 (base32 "1jwilfsy249d3q7fagg1ga4bgc2bg1fzw63r2nan0m77bznsdnad"))
75 (modules '((guix build utils)))
76 (snippet
77 '(begin
78 ;; The man page hails from BSD, where (d)ash is the default shell.
79 ;; This isn't the case on Guix or indeed most other GNU systems.
80 (substitute* "src/dash.1"
81 (("the standard command interpreter for the system")
82 "a command interpreter based on the original Bourne shell"))
83 #t))))
84 (build-system gnu-build-system)
85 (inputs
86 `(("libedit" ,libedit)))
87 (arguments
88 '(#:configure-flags '("--with-libedit")))
89 (home-page "http://gondor.apana.org.au/~herbert/dash")
90 (synopsis "POSIX-compliant shell optimised for size")
91 (description
92 "dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
93 as small as possible, often without sacrificing speed. It is faster than the
94 GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. dash is a
95 direct descendant of NetBSD's Almquist Shell (@command{ash}).")
96 (license (list bsd-3
97 gpl2+)))) ; mksignames.c
98
99 (define-public fish
100 (package
101 (name "fish")
102 (version "3.1.0")
103 (source
104 (origin
105 (method url-fetch)
106 (uri (string-append "https://github.com/fish-shell/fish-shell/"
107 "releases/download/" version "/"
108 "fish-" version ".tar.gz"))
109 (sha256
110 (base32 "0s2356mlx7fp9kgqgw91lm5ds2i9iq9hq071fbqmcp3875l1xnz5"))))
111 (build-system cmake-build-system)
112 (inputs
113 `(("fish-foreign-env" ,fish-foreign-env)
114 ("ncurses" ,ncurses)
115 ("pcre2" ,pcre2) ; don't use the bundled PCRE2
116 ("python" ,python))) ; for fish_config and manpage completions
117 (native-inputs
118 `(("doxygen" ,doxygen)
119 ; for 'fish --help'
120 ("groff" ,groff)))
121 (arguments
122 '(#:phases
123 (modify-phases %standard-phases
124 (add-after 'unpack 'patch-tests
125 (lambda* (#:key inputs #:allow-other-keys)
126 (let ((coreutils (assoc-ref inputs "coreutils"))
127 (bash (assoc-ref inputs "bash")))
128 ;; These try to open a terminal
129 (delete-file "tests/checks/interactive.fish")
130 (delete-file "tests/checks/login-interactive.fish")
131 ;; These contain absolute path references
132 (substitute* "src/fish_tests.cpp"
133 (("/bin/echo" echo) (string-append coreutils echo))
134 (("/bin/ca" ca) (string-append coreutils ca))
135 (("\"(/bin/c)\"" _ c) (string-append "\"" coreutils c "\""))
136 (("/bin/ls_not_a_path" ls-not-a-path)
137 (string-append coreutils ls-not-a-path))
138 (("/bin/ls" ls) (string-append coreutils ls))
139 (("(/bin/)\"" _ bin) (string-append coreutils bin "\""))
140 (("/bin -" bin) (string-append coreutils bin))
141 (((string-append
142 "do_test\\(is_potential_path\\("
143 "L\"/usr\", wds, vars, PATH_REQUIRE_DIR\\)\\);"))
144 ""))
145 (substitute*
146 (append (find-files "tests" ".*\\.(in|out|err)$")
147 (find-files "tests/checks" ".*\\.fish"))
148 (("/bin/pwd" pwd) (string-append coreutils pwd))
149 (("/bin/echo" echo) (string-append coreutils echo))
150 (("/bin/sh" sh) (string-append bash sh))
151 (("/bin/ls" ls) (string-append coreutils ls)))
152 (substitute* (find-files "tests" ".*\\.(in|out|err)$")
153 (("/usr/bin") (string-append coreutils "/bin")))
154 #t)))
155 ;; Source /etc/fish/config.fish from $__fish_sysconf_dir/config.fish.
156 (add-after 'patch-tests 'patch-fish-config
157 (lambda _
158 (let ((port (open-file "etc/config.fish" "a")))
159 (display (string-append
160 "\n\n"
161 "# Patched by Guix.\n"
162 "# Source /etc/fish/config.fish.\n"
163 "if test -f /etc/fish/config.fish\n"
164 " source /etc/fish/config.fish\n"
165 "end\n")
166 port)
167 (close-port port))
168 #t))
169 ;; Embed absolute paths.
170 (add-before 'install 'embed-absolute-paths
171 (lambda _
172 (substitute* "share/functions/__fish_print_help.fish"
173 (("nroff") (which "nroff")))
174 #t))
175 ;; Enable completions, functions and configurations in user's and
176 ;; system's guix profiles by adding them to __extra_* variables.
177 (add-before 'install 'patch-fish-extra-paths
178 (lambda _
179 (let ((port (open-file "share/__fish_build_paths.fish" "a")))
180 (display
181 (string-append
182 "\n\n"
183 "# Patched by Guix.\n"
184 "# Enable completions, functions and configurations in user's"
185 " and system's guix profiles by adding them to __extra_*"
186 " variables.\n"
187 "set -l __guix_profile_paths ~/.guix-profile"
188 " /run/current-system/profile\n"
189 "set __extra_completionsdir"
190 " $__guix_profile_paths\"/etc/fish/completions\""
191 " $__guix_profile_paths\"/share/fish/vendor_completions.d\""
192 " $__extra_completionsdir\n"
193 "set __extra_functionsdir"
194 " $__guix_profile_paths\"/etc/fish/functions\""
195 " $__guix_profile_paths\"/share/fish/vendor_functions.d\""
196 " $__extra_functionsdir\n"
197 "set __extra_confdir"
198 " $__guix_profile_paths\"/etc/fish/conf.d\""
199 " $__guix_profile_paths\"/share/fish/vendor_conf.d\""
200 " $__extra_confdir\n")
201 port)
202 (close-port port))
203 #t))
204 ;; Use fish-foreign-env to source /etc/profile.
205 (add-before 'install 'source-etc-profile
206 (lambda* (#:key inputs #:allow-other-keys)
207 (let ((port (open-file "share/__fish_build_paths.fish" "a")))
208 (display
209 (string-append
210 "\n\n"
211 "# Patched by Guix.\n"
212 "# Use fish-foreign-env to source /etc/profile.\n"
213 "if status is-login\n"
214 " set fish_function_path "
215 (assoc-ref inputs "fish-foreign-env") "/share/fish/functions"
216 " $__fish_datadir/functions\n"
217 " fenv source /etc/profile\n"
218 " set -e fish_function_path\n"
219 "end\n")
220 port)
221 (close-port port))
222 #t)))))
223 (synopsis "The friendly interactive shell")
224 (description
225 "Fish (friendly interactive shell) is a shell focused on interactive use,
226 discoverability, and friendliness. Fish has very user-friendly and powerful
227 tab-completion, including descriptions of every completion, completion of
228 strings with wildcards, and many completions for specific commands. It also
229 has extensive and discoverable help. A special @command{help} command gives
230 access to all the fish documentation in your web browser. Other features
231 include smart terminal handling based on terminfo, an easy to search history,
232 and syntax highlighting.")
233 (home-page "https://fishshell.com/")
234 (license gpl2)))
235
236 (define-public fish-foreign-env
237 (package
238 (name "fish-foreign-env")
239 (version "0.20190116")
240 (source
241 (origin
242 (method git-fetch)
243 (uri (git-reference
244 (url "https://github.com/oh-my-fish/plugin-foreign-env.git")
245 (commit "dddd9213272a0ab848d474d0cbde12ad034e65bc")))
246 (file-name (git-file-name name version))
247 (sha256
248 (base32 "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"))))
249 (build-system trivial-build-system)
250 (arguments
251 '(#:modules ((guix build utils))
252 #:builder
253 (begin
254 (use-modules (guix build utils))
255 (let* ((source (assoc-ref %build-inputs "source"))
256 (out (assoc-ref %outputs "out"))
257 (func-path (string-append out "/share/fish/functions")))
258 (mkdir-p func-path)
259 (copy-recursively (string-append source "/functions")
260 func-path)
261
262 ;; Embed absolute paths.
263 (substitute* `(,(string-append func-path "/fenv.fish")
264 ,(string-append func-path "/fenv.apply.fish")
265 ,(string-append func-path "/fenv.main.fish"))
266 (("bash")
267 (string-append (assoc-ref %build-inputs "bash") "/bin/bash"))
268 (("sed")
269 (string-append (assoc-ref %build-inputs "sed") "/bin/sed"))
270 ((" tr ")
271 (string-append " " (assoc-ref %build-inputs "coreutils")
272 "/bin/tr ")))))))
273 (inputs
274 `(("bash" ,bash)
275 ("coreutils" ,coreutils)
276 ("sed" ,sed)))
277 (home-page "https://github.com/oh-my-fish/plugin-foreign-env")
278 (synopsis "Foreign environment interface for fish shell")
279 (description "@code{fish-foreign-env} wraps bash script execution in a way
280 that environment variables that are exported or modified get imported back
281 into fish.")
282 (license expat)))
283
284 (define-public rc
285 (package
286 (name "rc")
287 (version "1.7.4")
288 (source (origin
289 (method git-fetch)
290 (uri (git-reference
291 (url "https://github.com/rakitzis/rc.git")
292 (commit (string-append "v" version))))
293 (sha256
294 (base32
295 "0vj1h4pcg13vxsiydmmk87dr2sra9h4gwx0c4q6fjsiw4in78rrd"))
296 (file-name (git-file-name name version))))
297 (build-system gnu-build-system)
298 (arguments
299 `(#:configure-flags
300 '("--with-edit=gnu")
301 #:phases
302 (modify-phases %standard-phases
303 (add-before 'bootstrap 'patch-trip.rc
304 (lambda _
305 (substitute* "trip.rc"
306 (("/bin/pwd") (which "pwd"))
307 (("/bin/sh") (which "sh"))
308 (("/bin/rm") (which "rm"))
309 (("/bin\\)") (string-append (dirname (which "rm")) ")")))
310 #t)))))
311 (inputs `(("readline" ,readline)
312 ("perl" ,perl)))
313 (native-inputs `(("autoconf" ,autoconf)
314 ("automake" ,automake)
315 ("libtool" ,libtool)
316 ("pkg-config" ,pkg-config)))
317 (synopsis "Alternative implementation of the rc shell by Byron Rakitzis")
318 (description
319 "This is a reimplementation by Byron Rakitzis of the Plan 9 shell. It
320 has a small feature set similar to a traditional Bourne shell.")
321 (home-page "https://github.com/rakitzis/rc")
322 (license zlib)))
323
324 (define-public es
325 (package
326 (name "es")
327 (version "0.9.1")
328 (source
329 (origin
330 (method url-fetch)
331 (uri (string-append "https://github.com/wryun/es-shell/releases/"
332 "download/v" version "/es-" version ".tar.gz"))
333 (sha256
334 (base32
335 "1fplzxc6lncz2lv2fyr2ig23rgg5j96rm2bbl1rs28mik771zd5h"))
336 (file-name (string-append name "-" version ".tar.gz"))))
337 (build-system gnu-build-system)
338 (arguments
339 `(#:test-target "test"
340 #:phases
341 (modify-phases %standard-phases
342 (add-before 'configure 're-enter-rootdir
343 ;; The tarball has no folder.
344 (lambda _
345 (chdir ".."))))))
346 (inputs
347 `(("readline" ,readline)))
348 (native-inputs
349 `(("bison" ,bison)))
350 (synopsis "Extensible shell with higher-order functions")
351 (description
352 "Es is an extensible shell. The language was derived from the Plan 9
353 shell, rc, and was influenced by functional programming languages, such as
354 Scheme, and the Tcl embeddable programming language. This implementation is
355 derived from Byron Rakitzis's public domain implementation of rc, and was
356 written by Paul Haahr and Byron Rakitzis.")
357 (home-page "https://wryun.github.io/es-shell/")
358 (license public-domain)))
359
360 (define-public tcsh
361 (package
362 (name "tcsh")
363 (version "6.22.02")
364 (source (origin
365 (method url-fetch)
366 ;; Old tarballs are moved to old/.
367 (uri (list (string-append "ftp://ftp.astron.com/pub/tcsh/"
368 "tcsh-" version ".tar.gz")
369 (string-append "ftp://ftp.astron.com/pub/tcsh/"
370 "old/tcsh-" version ".tar.gz")))
371 (sha256
372 (base32
373 "0nw8prz1n0lmr82wnpyhrzmki630afn7p9cfgr3vl00vr9c72a7d"))
374 (patches (search-patches "tcsh-fix-autotest.patch"))
375 (patch-flags '("-p0"))))
376 (build-system gnu-build-system)
377 (native-inputs
378 `(("autoconf" ,autoconf)
379 ("perl" ,perl)))
380 (inputs
381 `(("ncurses" ,ncurses)))
382 (arguments
383 `(#:phases
384 (modify-phases %standard-phases
385 ,@(if (%current-target-system)
386 '((add-before 'configure 'set-cross-cc
387 (lambda _
388 (substitute* "configure"
389 (("CC_FOR_GETHOST=\"cc\"")
390 "CC_FOR_GETHOST=\"gcc\""))
391 #t)))
392 '())
393 (add-before 'check 'patch-test-scripts
394 (lambda _
395 ;; Take care of pwd
396 (substitute* '("tests/commands.at" "tests/variables.at")
397 (("/bin/pwd") (which "pwd")))
398 ;; The .at files create shell scripts without shebangs. Erk.
399 (substitute* "tests/commands.at"
400 (("./output.sh") "/bin/sh output.sh"))
401 (substitute* "tests/syntax.at"
402 (("; other_script.csh") "; /bin/sh other_script.csh"))
403 ;; Now, let's generate the test suite and patch it
404 (invoke "make" "tests/testsuite")
405
406 ;; This file is ISO-8859-1 encoded.
407 (with-fluids ((%default-port-encoding #f))
408 (substitute* "tests/testsuite"
409 (("/bin/sh") (which "sh"))))
410 #t))
411 (add-after 'install 'post-install
412 (lambda* (#:key inputs outputs #:allow-other-keys)
413 (let* ((out (assoc-ref %outputs "out"))
414 (bin (string-append out "/bin")))
415 (with-directory-excursion bin
416 (symlink "tcsh" "csh"))
417 #t))))))
418 (home-page "https://www.tcsh.org/")
419 (synopsis "Unix shell based on csh")
420 (description
421 "Tcsh is an enhanced, but completely compatible version of the Berkeley
422 UNIX C shell (csh). It is a command language interpreter usable both as an
423 interactive login shell and a shell script command processor. It includes a
424 command-line editor, programmable word completion, spelling correction, a
425 history mechanism, job control and a C-like syntax.")
426 (license bsd-4)))
427
428 (define-public zsh
429 (package
430 (name "zsh")
431 (version "5.8")
432 (source (origin
433 (method url-fetch)
434 (uri (list (string-append
435 "https://www.zsh.org/pub/zsh-" version
436 ".tar.xz")
437 (string-append
438 "https://www.zsh.org/pub/old/zsh-" version
439 ".tar.xz")))
440 (sha256
441 (base32
442 "09yyaadq738zlrnlh1hd3ycj1mv3q5hh4xl1ank70mjnqm6bbi6w"))))
443 (build-system gnu-build-system)
444 (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre"
445 "--enable-maildir-support")
446 #:phases
447 (modify-phases %standard-phases
448 (add-before 'configure 'fix-sh
449 (lambda _
450 ;; Some of the files are ISO-8859-1 encoded.
451 (with-fluids ((%default-port-encoding #f))
452 (substitute*
453 '("configure"
454 "configure.ac"
455 "Src/exec.c"
456 "Src/mkmakemod.sh"
457 "Config/installfns.sh"
458 "Config/defs.mk.in"
459 "Test/E01options.ztst"
460 "Test/A05execution.ztst"
461 "Test/A01grammar.ztst"
462 "Test/A06assign.ztst"
463 "Test/B02typeset.ztst"
464 "Completion/Unix/Command/_init_d"
465 "Util/preconfig")
466 (("/bin/sh") (which "sh"))))))
467 (add-before 'check 'patch-test
468 (lambda _
469 ;; In Zsh, `command -p` searches a predefined set of
470 ;; paths that don't exist in the build environment. See
471 ;; the assignment of 'path' in Src/init.c'
472 (substitute* "Test/A01grammar.ztst"
473 (("command -pv") "command -v")
474 (("command -p") "command ")
475 (("'command' -p") "'command' "))
476 #t)))))
477 (native-inputs `(("autoconf" ,autoconf)))
478 (inputs `(("ncurses" ,ncurses)
479 ("pcre" ,pcre)
480 ("perl" ,perl)))
481 (synopsis "Powerful shell for interactive use and scripting")
482 (description "The Z shell (zsh) is a Unix shell that can be used
483 as an interactive login shell and as a powerful command interpreter
484 for shell scripting. Zsh can be thought of as an extended Bourne shell
485 with a large number of improvements, including some features of bash,
486 ksh, and tcsh.")
487 (home-page "https://www.zsh.org/")
488
489 ;; The whole thing is under an MIT/X11-style license, but there's one
490 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
491 (license gpl2+)))
492
493 (define-public xonsh
494 (package
495 (name "xonsh")
496 (version "0.9.18")
497 (source
498 (origin
499 (method url-fetch)
500 (uri (pypi-uri "xonsh" version))
501 (sha256
502 (base32
503 "1h4rrwzwiwkyi9p49sjn97rl39fqq2r23hchzsw0s3fcwa7m8fkj"))
504 (modules '((guix build utils)))
505 (snippet
506 `(begin
507 ;; Delete bundled PLY.
508 (delete-file-recursively "xonsh/ply")
509 (substitute* "setup.py"
510 (("\"xonsh\\.ply\\.ply\",") ""))
511 ;; Use our properly packaged PLY instead.
512 (substitute* (list "setup.py"
513 "tests/test_lexer.py"
514 "xonsh/__amalgam__.py"
515 "xonsh/lexer.py"
516 "xonsh/parsers/base.py"
517 "xonsh/xonfig.py")
518 (("from xonsh\\.ply\\.(.*) import" _ module)
519 (format #f "from ~a import" module))
520 (("from xonsh\\.ply import") "import"))
521 #t))))
522 (build-system python-build-system)
523 (arguments
524 '(;; TODO Try running run the test suite.
525 ;; See 'requirements-tests.txt' in the source distribution for more
526 ;; information.
527 #:tests? #f))
528 (inputs
529 `(("python-ply" ,python-ply)))
530 (home-page "https://xon.sh/")
531 (synopsis "Python-ish shell")
532 (description
533 "Xonsh is a Python-ish, BASHwards-looking shell language and command
534 prompt. The language is a superset of Python 3.4+ with additional shell
535 primitives that you are used to from Bash and IPython. It works on all major
536 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
537 use of experts and novices alike.")
538 (license bsd-2)))
539
540 (define-public scsh
541 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
542 (revision "1"))
543 (package
544 (name "scsh")
545 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
546 (source
547 (origin
548 (method git-fetch)
549 (uri (git-reference
550 (url "https://github.com/scheme/scsh")
551 (commit commit)))
552 (file-name (string-append name "-" version "-checkout"))
553 (sha256
554 (base32
555 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
556 (build-system gnu-build-system)
557 (arguments
558 `(#:test-target "test"
559 #:phases
560 (modify-phases %standard-phases
561 (add-before 'configure 'replace-rx
562 (lambda* (#:key inputs #:allow-other-keys)
563 (let* ((rx (assoc-ref inputs "scheme48-rx"))
564 (rxpath (string-append rx "/share/scheme48-"
565 ,(package-version scheme48)
566 "/rx")))
567 (delete-file-recursively "rx")
568 (symlink rxpath "rx"))
569 #t)))))
570 (inputs
571 `(("scheme48" ,scheme48)
572 ("scheme48-rx" ,scheme48-rx)))
573 (native-inputs
574 `(("autoconf" ,autoconf)
575 ("automake" ,automake)))
576 (home-page "https://github.com/scheme/scsh")
577 (synopsis "Unix shell embedded in Scheme")
578 (description
579 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
580 components: a process notation for running programs and setting up pipelines
581 and redirections, and a complete syscall library for low-level access to the
582 operating system.")
583 (license bsd-3))))
584
585 (define-public linenoise
586 (let ((commit "2105ce445821381cf1bca87b6d386d4ea88ee20d")
587 (revision "1"))
588 (package
589 (name "linenoise")
590 (version (string-append "1.0-" revision "." (string-take commit 7)))
591 (source
592 (origin
593 (method git-fetch)
594 (uri (git-reference
595 (url "https://github.com/antirez/linenoise")
596 (commit commit)))
597 (file-name (string-append name "-" version "-checkout"))
598 (sha256
599 (base32
600 "1z16qwix8z6a40fskdgxsibkqgdrp4q6ncp4n6hnv4r9iihy2d8r"))))
601 (build-system gnu-build-system)
602 (arguments
603 `(#:tests? #f ; no tests are included
604 #:make-flags
605 (list ,(string-append "CC=" (cc-for-target)))
606 #:phases
607 (modify-phases %standard-phases
608 (delete 'configure)
609 (replace 'install
610 (lambda* (#:key outputs #:allow-other-keys)
611 ;; At the moment there is no 'make install' in upstream.
612 (let* ((out (assoc-ref outputs "out")))
613 (install-file "linenoise.h"
614 (string-append out "/include/linenoise"))
615 (install-file "linenoise.c"
616 (string-append out "/include/linenoise"))
617 #t))))))
618 (home-page "https://github.com/antirez/linenoise")
619 (synopsis "Minimal zero-config readline replacement")
620 (description
621 "Linenoise is a minimal, zero-config, readline replacement.
622 Its features include:
623
624 @enumerate
625 @item Single and multi line editing mode with the usual key bindings
626 @item History handling
627 @item Completion
628 @item Hints (suggestions at the right of the prompt as you type)
629 @item A subset of VT100 escapes, ANSI.SYS compatible
630 @end enumerate\n")
631 (license bsd-2))))
632
633 (define-public s-shell
634 (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
635 (revision "2"))
636 (package
637 (name "s-shell")
638 (version (git-version "0.0.0" revision commit))
639 (source
640 (origin
641 (method git-fetch)
642 (uri (git-reference
643 (url "https://github.com/rain-1/s")
644 (commit commit)))
645 (file-name (string-append name "-" version "-checkout"))
646 (sha256
647 (base32
648 "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
649 (build-system gnu-build-system)
650 (inputs
651 `(("linenoise" ,linenoise)))
652 (arguments
653 `(#:tests? #f
654 #:make-flags (list "CC=gcc"
655 (string-append "PREFIX="
656 (assoc-ref %outputs "out")))
657 #:phases
658 (modify-phases %standard-phases
659 (add-after 'unpack 'install-directory-fix
660 (lambda* (#:key outputs #:allow-other-keys)
661 (let* ((out (assoc-ref outputs "out"))
662 (bin (string-append out "/bin")))
663 (substitute* "Makefile"
664 (("out") bin))
665 #t)))
666 (add-after 'install 'manpage
667 (lambda* (#:key outputs #:allow-other-keys)
668 (install-file "s.1" (string-append (assoc-ref outputs "out")
669 "/share/man/man1"))))
670 (replace 'configure
671 (lambda* (#:key inputs outputs #:allow-other-keys)
672 ;; At this point linenoise is meant to be included,
673 ;; so we have to really copy it into the working directory
674 ;; of s.
675 (let* ((linenoise (assoc-ref inputs "linenoise"))
676 (noisepath (string-append linenoise "/include/linenoise"))
677 (out (assoc-ref outputs "out")))
678 (copy-recursively noisepath "linenoise")
679 (substitute* "s.c"
680 (("/bin/s") (string-append out "/bin/s")))
681 #t))))))
682 (home-page "https://github.com/rain-1/s")
683 (synopsis "Extremely minimal shell with the simplest syntax possible")
684 (description
685 "S is a new shell that aims to be extremely simple.
686 S does not implemnt the POSIX shell standard.
687 There are no globs or \"splatting\" where a variable $FOO turns into multiple
688 command line arguments. One token stays one token forever.
689 This is a \"no surprises\" straightforward approach.
690
691 There are no redirection operators > in the shell language, they are added as
692 extra programs. > is just another unix command, < is essentially cat(1).
693 A @code{andglob} program is also provided along with s.")
694 (license bsd-3))))
695
696 (define-public oksh
697 (package
698 (name "oksh")
699 (version "0.5.9")
700 (source
701 (origin
702 (method url-fetch)
703 (uri (string-append "https://connochaetos.org/oksh/oksh-"
704 version ".tar.gz"))
705 (sha256
706 (base32
707 "0ln9yf6pxngsviqszv8klnnvn8vcpplvj1njdn8xr2y8frkbw8r3"))))
708 (build-system gnu-build-system)
709 (arguments
710 `(; The test files are not part of the distributed tarball.
711 #:tests? #f))
712 (home-page "https://connochaetos.org/oksh")
713 (synopsis "Port of OpenBSD Korn Shell")
714 (description
715 "Oksh is a port of the OpenBSD Korn Shell.
716 The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
717 (license gpl3+)))
718
719 (define-public loksh
720 (package
721 (name "loksh")
722 (version "6.6")
723 (source
724 (origin
725 (method git-fetch)
726 (uri (git-reference
727 (url "https://github.com/dimkr/loksh.git")
728 (commit version)))
729 (file-name (git-file-name name version))
730 (sha256
731 (base32 "1a8s64n97ikvvi7ckirxnnjvcmhr3dd4rnqm2ivapyzb0wp42jk7"))))
732 (build-system gnu-build-system)
733 (inputs
734 `(("libbsd" ,libbsd)
735 ("ncurses" ,ncurses)))
736 (native-inputs
737 `(("pkg-config" ,pkg-config)))
738 (arguments
739 `(#:tests? #f ; no tests included
740 #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
741 (string-append "PREFIX="
742 (assoc-ref %outputs "out")))
743 #:phases
744 (modify-phases %standard-phases
745 (delete 'configure)))) ; no configure script
746 (home-page "https://github.com/dimkr/loksh")
747 (synopsis "Korn Shell from OpenBSD")
748 (description
749 "loksh is a Linux port of OpenBSD's @command{ksh}. It is a small,
750 interactive POSIX shell targeted at resource-constrained systems.")
751 ;; The file 'LEGAL' says it is the public domain, and the 2
752 ;; exceptions which are listed are not included in this port.
753 (license public-domain)))
754
755 (define-public mksh
756 (package
757 (name "mksh")
758 (version "58")
759 (source
760 (origin
761 (method url-fetch)
762 (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
763 version ".tgz"))
764 (sha256
765 (base32 "1337zjvzh14yncg9igdry904a3ns52l8rnm1kcq262w7f5xyp2v0"))))
766 (build-system gnu-build-system)
767 (arguments
768 `(#:tests? #f ; tests require access to /dev/tty
769 #:phases
770 (modify-phases %standard-phases
771 (delete 'configure)
772 (replace 'build
773 (lambda _
774 (setenv "CC" "gcc")
775 (invoke (which "sh") "Build.sh")))
776 (replace 'install
777 (lambda* (#:key outputs #:allow-other-keys)
778 (let* ((out (assoc-ref outputs "out"))
779 (bin (string-append out "/bin"))
780 (man (string-append out "/share/man/man1")))
781 (install-file "mksh" bin)
782 (with-directory-excursion bin
783 (symlink "mksh" "ksh"))
784 (install-file "mksh.1" man)
785 #t))))))
786 (home-page "https://www.mirbsd.org/mksh.htm")
787 (synopsis "Korn Shell from MirBSD")
788 (description "mksh is an actively developed free implementation of the
789 Korn Shell programming language and a successor to the Public Domain Korn
790 Shell (pdksh).")
791 (license (list miros
792 isc)))) ; strlcpy.c
793
794 (define-public oil
795 (package
796 (name "oil")
797 ;; https://www.oilshell.org/blog/2020/04/release-0.8.pre4.html#comment-on-version-numbering
798 (version "0.8.pre5")
799 (source
800 (origin
801 (method url-fetch)
802 (uri (string-append "https://www.oilshell.org/download/oil-"
803 version ".tar.gz"))
804 (sha256
805 (base32 "02llxx10izxpv1y32qn8k6r0y7al01rzxjirc8h6x8nd9kiaqknl"))))
806 (build-system gnu-build-system)
807 (arguments
808 `(#:strip-binaries? #f ; strip breaks the binary
809 #:phases
810 (modify-phases %standard-phases
811 (replace 'configure
812 (lambda* (#:key outputs #:allow-other-keys)
813 (let ((out (assoc-ref outputs "out")))
814 (setenv "CC" "gcc")
815 (substitute* "configure"
816 ((" cc ") " $CC "))
817 (invoke "./configure" (string-append "--prefix=" out)
818 "--with-readline"))))
819 (replace 'check
820 ;; The tests are not distributed in the tarballs but upstream
821 ;; recommends running this smoke test.
822 ;; https://github.com/oilshell/oil/blob/release/0.8.pre5/INSTALL.txt#L38-L48
823 (lambda _
824 (let* ((oil "_bin/oil.ovm"))
825 (invoke/quiet oil "osh" "-c" "echo hi")
826 (invoke/quiet oil "osh" "-n" "configure")))))))
827 (inputs
828 `(("readline" ,readline)))
829 (home-page "https://www.oilshell.org")
830 (synopsis "Programming language and Bash-compatible Unix shell")
831 (description "Oil is a programming language with automatic translation for
832 Bash. It includes osh, a Unix/POSIX shell that runs unmodified Bash
833 scripts.")
834 (license (list psfl ; tarball includes python2.7
835 asl2.0))))
836
837 (define-public oil-shell
838 (deprecated-package "oil-shell" oil))
839
840 (define-public gash
841 (package
842 (name "gash")
843 (version "0.2.0")
844 (source
845 (origin (method url-fetch)
846 (uri (string-append "mirror://savannah/gash/gash-"
847 version ".tar.gz"))
848 (sha256
849 (base32
850 "13m0yz5h9nj3x40mr6wr5xcpq1lscndfwcicw3skrz801025hhgf"))
851 (modules '((guix build utils)))))
852 (build-system gnu-build-system)
853 (native-inputs
854 `(("pkg-config" ,pkg-config)))
855 (inputs
856 `(("guile" ,guile-2.2)))
857 (arguments
858 '(#:make-flags '("XFAIL_TESTS=tests/redirects.org")))
859 (home-page "https://savannah.nongnu.org/projects/gash/")
860 (synopsis "POSIX-compatible shell written in Guile Scheme")
861 (description "Gash is a POSIX-compatible shell written in Guile
862 Scheme. It provides both the shell interface, as well as a Guile
863 library for parsing shell scripts. Gash is designed to bootstrap Bash
864 as part of the Guix bootstrap process.")
865 (license gpl3+)))
866
867 (define-public gash-utils
868 (package
869 (name "gash-utils")
870 (version "0.1.0")
871 (source (origin
872 (method url-fetch)
873 (uri (string-append "mirror://savannah/gash/gash-utils-"
874 version ".tar.gz"))
875 (sha256
876 (base32
877 "0ib2p52qmbac5n0s5bys4fiwim461ps546976l1n7pwbs0avh7fk"))))
878 (build-system gnu-build-system)
879 (native-inputs
880 `(("pkg-config" ,pkg-config)))
881 (inputs
882 `(("guile" ,guile-2.2)
883 ("gash" ,gash)))
884 (home-page "https://savannah.nongnu.org/projects/gash/")
885 (synopsis "Core POSIX utilities written in Guile Scheme")
886 (description "Gash-Utils provides Scheme implementations of many
887 common POSIX utilities (there are about 40 of them, ranging in
888 complexity from @command{false} to @command{awk}). The utilities are
889 designed to be capable of bootstrapping their standard GNU counterparts.
890 Underpinning these utilities are many Scheme interfaces for manipulating
891 files and text.")
892 (license gpl3+)))
893