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