gnu: dash: Update to 0.5.9.1.
[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 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 ng0 <contact.ng0@cryptolab.net>
10 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages shells)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages algebra)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages documentation)
34 #:use-module (gnu packages libedit)
35 #:use-module (gnu packages ncurses)
36 #:use-module (gnu packages pcre)
37 #:use-module (gnu packages perl)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages readline)
41 #:use-module (gnu packages scheme)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system python)
44 #:use-module (guix download)
45 #:use-module (guix git-download)
46 #:use-module (guix licenses)
47 #:use-module (guix packages))
48
49 (define-public dash
50 (package
51 (name "dash")
52 (version "0.5.9.1")
53 (source
54 (origin
55 ;; The canonical source is offline, so we fetch the source code
56 ;; from the Git repository. See:
57 ;; https://www.mail-archive.com/dash@vger.kernel.org/msg01323.html
58 (method git-fetch)
59 (uri (git-reference
60 (url "https://git.kernel.org/pub/scm/utils/dash/dash.git/")
61 (commit (string-append "v" version))))
62 (file-name (string-append name "-" version "-checkout"))
63 (sha256
64 (base32
65 "0p01vx7rbyf5hyyaff7h8cbhq81bm5fmq1m933484lncl9rafcai"))
66 (modules '((guix build utils)))
67 (snippet
68 '(begin
69 ;; The man page hails from BSD, where (d)ash is the default shell.
70 ;; This isn't the case on Guix or indeed most other GNU systems.
71 (substitute* "src/dash.1"
72 (("the standard command interpreter for the system")
73 "a command interpreter based on the original Bourne shell"))
74 #t))))
75 (build-system gnu-build-system)
76 (native-inputs
77 `(("autoconf" ,autoconf)
78 ("automake" ,automake)))
79 (inputs
80 `(("libedit" ,libedit)))
81 (arguments
82 `(#:phases
83 (modify-phases %standard-phases
84 (add-before 'configure 'bootstrap
85 (lambda _ (zero? (system* "autoreconf" "-vfi")))))
86 #:configure-flags '("--with-libedit")))
87 (home-page "http://gondor.apana.org.au/~herbert/dash")
88 (synopsis "POSIX-compliant shell optimised for size")
89 (description
90 "dash is a POSIX-compliant @command{/bin/sh} implementation that aims to be
91 as small as possible, often without sacrificing speed. It is faster than the
92 GNU Bourne-Again Shell (@command{bash}) at most scripted tasks. dash is a
93 direct descendant of NetBSD's Almquist Shell (@command{ash}).")
94 (license (list bsd-3
95 gpl2+)))) ; mksignames.c
96
97 (define-public fish
98 (package
99 (name "fish")
100 (version "2.5.0")
101 (source (origin
102 (method url-fetch)
103 (uri (string-append "https://fishshell.com/files/"
104 version "/fish-" version ".tar.gz"))
105 (sha256
106 (base32
107 "19djav128nkhjxgfhwhc32i5y9d9c3karbh5yg67kqrdranyvh7q"))
108 (modules '((guix build utils)))
109 ;; Don't try to install /etc/fish/config.fish.
110 (snippet
111 '(substitute* "Makefile.in"
112 ((".*INSTALL.*sysconfdir.*fish.*") "")))))
113 (build-system gnu-build-system)
114 (native-inputs
115 `(("doxygen" ,doxygen)))
116 (inputs
117 `(("bc" ,bc)
118 ("ncurses" ,ncurses)
119 ("pcre2" ,pcre2) ;don't use the bundled PCRE2
120 ("python" ,python-wrapper))) ;for fish_config and manpage completions
121 (arguments
122 '(#:tests? #f ; no check target
123 #:configure-flags '("--sysconfdir=/etc")
124 #:phases
125 (modify-phases %standard-phases
126 ;; Embed absolute paths to store items.
127 (add-after 'unpack 'embed-store-paths
128 (lambda* (#:key inputs outputs #:allow-other-keys)
129 (substitute* '("share/functions/math.fish"
130 "share/functions/seq.fish")
131 (("\\| bc")
132 (string-append "| " (assoc-ref %build-inputs "bc")
133 "/bin/bc")))
134 (substitute* "share/functions/fish_update_completions.fish"
135 (("python") (which "python")))
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 help command gives access to
144 all the fish documentation in your web browser. Other features include smart
145 terminal handling based on terminfo, an easy to search history, and syntax
146 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 "git://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 "http://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 (system* "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.2")
296 (source (origin
297 (method url-fetch)
298 (uri (list (string-append
299 "http://www.zsh.org/pub/zsh-" version
300 ".tar.gz")
301 (string-append
302 "http://www.zsh.org/pub/old/zsh-" version
303 ".tar.gz")))
304 (sha256
305 (base32
306 "0dsr450v8nydvpk8ry276fvbznlrjgddgp7zvhcw4cv69i9lr4ps"))))
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 (native-inputs `(("autoconf" ,autoconf)))
331 (inputs `(("ncurses" ,ncurses)
332 ("pcre" ,pcre)
333 ("perl" ,perl)))
334 (synopsis "Powerful shell for interactive use and scripting")
335 (description "The Z shell (zsh) is a Unix shell that can be used
336 as an interactive login shell and as a powerful command interpreter
337 for shell scripting. Zsh can be thought of as an extended Bourne shell
338 with a large number of improvements, including some features of bash,
339 ksh, and tcsh.")
340 (home-page "http://www.zsh.org/")
341
342 ;; The whole thing is under an MIT/X11-style license, but there's one
343 ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
344 (license gpl2+)))
345
346 (define-public xonsh
347 (package
348 (name "xonsh")
349 (version "0.5.5")
350 (source
351 (origin
352 (method url-fetch)
353 (uri (pypi-uri "xonsh" version))
354 (sha256
355 (base32
356 "1wa5g1gxk4aw8jazp3fqmr7mlkdmnva83x28i9xd3s99lv0qb3dd"))
357 (modules '((guix build utils)))
358 (snippet
359 `(begin
360 ;; Delete bundled ply.
361 (delete-file-recursively "xonsh/ply")
362 (substitute* '("setup.py")
363 (("'xonsh\\.ply\\.ply',") ""))
364 #t))))
365 (build-system python-build-system)
366 (arguments
367 '(;; TODO Try running run the test suite.
368 ;; See 'requirements-tests.txt' in the source distribution for more
369 ;; information.
370 #:tests? #f))
371 (inputs
372 `(("python-ply" ,python-ply)))
373 (home-page "http://xon.sh/")
374 (synopsis "Python-ish shell")
375 (description
376 "Xonsh is a Python-ish, BASHwards-looking shell language and command
377 prompt. The language is a superset of Python 3.4+ with additional shell
378 primitives that you are used to from Bash and IPython. It works on all major
379 systems including Linux, Mac OSX, and Windows. Xonsh is meant for the daily
380 use of experts and novices alike.")
381 (license bsd-2)))
382
383 (define-public scsh
384 (let ((commit "114432435e4eadd54334df6b37fcae505079b49f")
385 (revision "1"))
386 (package
387 (name "scsh")
388 (version (string-append "0.0.0-" revision "." (string-take commit 7)))
389 (source
390 (origin
391 (method git-fetch)
392 (uri (git-reference
393 (url "https://github.com/scheme/scsh")
394 (commit commit)))
395 (file-name (string-append name "-" version "-checkout"))
396 (sha256
397 (base32
398 "1ghk08akiz7hff1pndi8rmgamgcrn2mv9asbss9l79d3c2iaav3q"))))
399 (build-system gnu-build-system)
400 (arguments
401 `(#:test-target "test"
402 #:phases
403 (modify-phases %standard-phases
404 (add-before 'configure 'replace-rx
405 (lambda* (#:key inputs #:allow-other-keys)
406 (let* ((rx (assoc-ref inputs "scheme48-rx"))
407 (rxpath (string-append rx "/share/scheme48-"
408 ,(package-version scheme48)
409 "/rx")))
410 (delete-file-recursively "rx")
411 (symlink rxpath "rx"))
412 #t))
413 (add-before 'configure 'autoreconf
414 (lambda _
415 (zero? (system* "autoreconf")))))))
416 (inputs
417 `(("scheme48" ,scheme48)
418 ("scheme48-rx" ,scheme48-rx)))
419 (native-inputs
420 `(("autoconf" ,autoconf)
421 ("automake" ,automake)))
422 (home-page "https://github.com/scheme/scsh")
423 (synopsis "Unix shell embedded in Scheme")
424 (description
425 "Scsh is a Unix shell embedded in Scheme. Scsh has two main
426 components: a process notation for running programs and setting up pipelines
427 and redirections, and a complete syscall library for low-level access to the
428 operating system.")
429 (license bsd-3))))