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