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