Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / shells.scm
index 38eeaa7..4ab8329 100644 (file)
@@ -3,12 +3,17 @@
 ;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2014 Kevin Lemonnier <lemonnierk@ulrar.net>
 ;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
-;;; Copyright © 2016, 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2016 Stefan Reichör <stefan@xsteve.at>
 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2017, 2018 Nils Gillmann <ng0@n0.is>
+;;; Copyright © 2017, 2018 ng0 <ng0@n0.is>
 ;;; Copyright © 2017, 2018 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
+;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
 
 (define-module (gnu packages shells)
   #:use-module (gnu packages)
-  #:use-module (gnu packages algebra)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages groff)
+  #:use-module (gnu packages guile)
   #:use-module (gnu packages libbsd)
   #:use-module (gnu packages libedit)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages scheme)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system trivial)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix licenses)
@@ -88,51 +96,105 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
 (define-public fish
   (package
     (name "fish")
-    (version "2.7.1")
-    (source (origin
-              (method url-fetch)
-              (uri
-               (list
-                (string-append "https://fishshell.com/files/"
-                               version "/fish-" version ".tar.gz")
-                (string-append "https://github.com/fish-shell/fish-shell/"
-                               "releases/download/" version "/"
-                               name "-" version ".tar.gz")))
-              (sha256
-               (base32
-                "0nhc3yc5lnnan7zmxqqxm07rdpwjww5ijy45ll2njdc6fnfb2az4"))
-              (modules '((guix build utils)))
-              ;; Don't try to install /etc/fish/config.fish.
-              (snippet '(begin
-                          (substitute* "Makefile.in"
-                            ((".*INSTALL.*sysconfdir.*fish.*") ""))
-                          #t))))
+    (version "3.0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/fish-shell/fish-shell/"
+                           "releases/download/" version "/"
+                           "fish-" version ".tar.gz"))
+       (sha256
+        (base32 "03j3jl9jzlnhq4p86zj8wqsh5sx45j1d1fvfa80ks1cfdg68qwhl"))))
     (build-system gnu-build-system)
-    (native-inputs
-     `(("doxygen" ,doxygen)))
     (inputs
-     `(("bc" ,bc)
+     `(("fish-foreign-env" ,fish-foreign-env)
+       ("groff" ,groff)                 ; for 'fish --help'
        ("ncurses" ,ncurses)
-       ("groff" ,groff)               ;for 'fish --help'
-       ("pcre2" ,pcre2)               ;don't use the bundled PCRE2
-       ("python" ,python-wrapper)))   ;for fish_config and manpage completions
+       ("pcre2" ,pcre2)      ; don't use the bundled PCRE2
+       ("python" ,python)))  ; for fish_config and manpage completions
+    (native-inputs
+     `(("doxygen" ,doxygen)))
     (arguments
-     '(#:tests? #f ; no check target
-       #:configure-flags '("--sysconfdir=/etc")
+     '(#:tests? #f                      ; no check target
        #:phases
        (modify-phases %standard-phases
-         ;; Embed absolute paths to store items.
-         (add-after 'unpack 'embed-store-paths
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (substitute* '("share/functions/math.fish"
-                            "share/functions/seq.fish")
-               (("\\| bc")
-                (string-append "| " (assoc-ref %build-inputs "bc")
-                               "/bin/bc")))
-             (substitute* "share/functions/fish_update_completions.fish"
-               (("python") (which "python")))
+         (add-after 'unpack 'patch-source
+           (lambda _
+             (substitute* '("build_tools/build_commands_hdr.sh"
+                            "build_tools/build_user_doc.sh")
+               (("/usr/bin/env") "env"))
+             #t))
+         ;; Embed absolute paths.
+         (add-before 'install 'embed-absolute-paths
+           (lambda _
+             (substitute* '("share/functions/__fish_config_interactive.fish"
+                            "share/functions/fish_config.fish"
+                            "share/functions/fish_update_completions.fish")
+               (("python3") (which "python3")))
              (substitute* "share/functions/__fish_print_help.fish"
                (("nroff") (which "nroff")))
+             #t))
+         ;; Source /etc/fish/config.fish from $__fish_sysconf_dir/config.fish.
+         (add-before 'install 'patch-fish-config
+           (lambda _
+             (let ((port (open-file "etc/config.fish" "a")))
+               (display (string-append
+                         "\n\n"
+                         "# Patched by Guix.\n"
+                         "# Source /etc/fish/config.fish.\n"
+                         "if test -f /etc/fish/config.fish\n"
+                         "    source /etc/fish/config.fish\n"
+                         "end\n")
+                        port)
+               (close-port port))
+             #t))
+         ;; Enable completions, functions and configurations in user's and
+         ;; system's guix profiles by adding them to __extra_* variables.
+         (add-before 'install 'patch-fish-extra-paths
+           (lambda _
+             (let ((port (open-file "share/__fish_build_paths.fish" "a")))
+               (display
+                (string-append
+                 "\n\n"
+                 "# Patched by Guix.\n"
+                 "# Enable completions, functions and configurations in user's"
+                 " and system's guix profiles by adding them to __extra_*"
+                 " variables.\n"
+                 "set -l __guix_profile_paths ~/.guix-profile"
+                 " /run/current-system/profile\n"
+                 "set __extra_completionsdir"
+                 " $__guix_profile_paths\"/etc/fish/completions\""
+                 " $__guix_profile_paths\"/share/fish/vendor_completions.d\""
+                 " $__extra_completionsdir\n"
+                 "set __extra_functionsdir"
+                 " $__guix_profile_paths\"/etc/fish/functions\""
+                 " $__guix_profile_paths\"/share/fish/vendor_functions.d\""
+                 " $__extra_functionsdir\n"
+                 "set __extra_confdir"
+                 " $__guix_profile_paths\"/etc/fish/conf.d\""
+                 " $__guix_profile_paths\"/share/fish/vendor_conf.d\""
+                 " $__extra_confdir\n")
+                port)
+               (close-port port))
+             #t))
+         ;; Use fish-foreign-env to source /etc/profile.
+         (add-before 'install 'source-etc-profile
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((port (open-file "share/__fish_build_paths.fish" "a")))
+               (display
+                (string-append
+                 "\n\n"
+                 "# Patched by Guix.\n"
+                 "# Use fish-foreign-env to source /etc/profile.\n"
+                 "if status is-login\n"
+                 "    set fish_function_path "
+                 (assoc-ref inputs "fish-foreign-env") "/share/fish/functions"
+                 " $__fish_datadir/functions\n"
+                 "    fenv source /etc/profile\n"
+                 "    set -e fish_function_path\n"
+                 "end\n")
+                port)
+               (close-port port))
              #t)))))
     (synopsis "The friendly interactive shell")
     (description
@@ -147,6 +209,54 @@ and syntax highlighting.")
     (home-page "https://fishshell.com/")
     (license gpl2)))
 
+(define-public fish-foreign-env
+  (package
+    (name "fish-foreign-env")
+    (version "0.20190116")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/oh-my-fish/plugin-foreign-env.git")
+             (commit "dddd9213272a0ab848d474d0cbde12ad034e65bc")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"))))
+    (build-system trivial-build-system)
+    (arguments
+     '(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (let* ((source (assoc-ref %build-inputs "source"))
+                (out (assoc-ref %outputs "out"))
+                (func-path (string-append out "/share/fish/functions")))
+           (mkdir-p func-path)
+           (copy-recursively (string-append source "/functions")
+                             func-path)
+
+           ;; Embed absolute paths.
+           (substitute* `(,(string-append func-path "/fenv.fish")
+                          ,(string-append func-path "/fenv.apply.fish")
+                          ,(string-append func-path "/fenv.main.fish"))
+             (("bash")
+              (string-append (assoc-ref %build-inputs "bash") "/bin/bash"))
+             (("sed")
+              (string-append (assoc-ref %build-inputs "sed") "/bin/sed"))
+             ((" tr ")
+              (string-append " " (assoc-ref %build-inputs "coreutils")
+                             "/bin/tr ")))))))
+    (inputs
+     `(("bash" ,bash)
+       ("coreutils" ,coreutils)
+       ("sed" ,sed)))
+    (home-page "https://github.com/oh-my-fish/plugin-foreign-env")
+    (synopsis "Foreign environment interface for fish shell")
+    (description "@code{fish-foreign-env} wraps bash script execution in a way
+that environment variables that are exported or modified get imported back
+into fish.")
+    (license expat)))
+
 (define-public rc
   (package
     (name "rc")
@@ -226,7 +336,7 @@ written by Paul Haahr and Byron Rakitzis.")
 (define-public tcsh
   (package
     (name "tcsh")
-    (version "6.20.00")
+    (version "6.22.02")
     (source (origin
               (method url-fetch)
               ;; Old tarballs are moved to old/.
@@ -236,9 +346,8 @@ written by Paul Haahr and Byron Rakitzis.")
                                         "old/tcsh-" version ".tar.gz")))
               (sha256
                (base32
-                "17ggxkkn5skl0v1x0j6hbv5l0sgnidfzwv16992sqkdm983fg7dq"))
-              (patches (search-patches "tcsh-fix-autotest.patch"
-                                       "tcsh-fix-out-of-bounds-read.patch"))
+                "0nw8prz1n0lmr82wnpyhrzmki630afn7p9cfgr3vl00vr9c72a7d"))
+              (patches (search-patches "tcsh-fix-autotest.patch"))
               (patch-flags '("-p0"))))
     (build-system gnu-build-system)
     (native-inputs
@@ -249,6 +358,14 @@ written by Paul Haahr and Byron Rakitzis.")
     (arguments
      `(#:phases
         (modify-phases %standard-phases
+          ,@(if (%current-target-system)
+                '((add-before 'configure 'set-cross-cc
+                     (lambda _
+                       (substitute* "configure"
+                         (("CC_FOR_GETHOST=\"cc\"")
+                          "CC_FOR_GETHOST=\"gcc\""))
+                       #t)))
+                '())
           (add-before 'check 'patch-test-scripts
             (lambda _
               ;; Take care of pwd
@@ -274,7 +391,7 @@ written by Paul Haahr and Byron Rakitzis.")
                 (with-directory-excursion bin
                   (symlink "tcsh" "csh"))
                 #t))))))
-    (home-page "http://www.tcsh.org/")
+    (home-page "https://www.tcsh.org/")
     (synopsis "Unix shell based on csh")
     (description
      "Tcsh is an enhanced, but completely compatible version of the Berkeley
@@ -287,7 +404,7 @@ history mechanism, job control and a C-like syntax.")
 (define-public zsh
   (package
     (name "zsh")
-    (version "5.6.2")
+    (version "5.8")
     (source (origin
               (method url-fetch)
               (uri (list (string-append
@@ -298,9 +415,10 @@ history mechanism, job control and a C-like syntax.")
                            ".tar.xz")))
               (sha256
                (base32
-                "17iffliqcj4hv91g0bd2sxsyfcz51mfyh97sp2iyrs2p0mndc2x5"))))
+                "09yyaadq738zlrnlh1hd3ycj1mv3q5hh4xl1ank70mjnqm6bbi6w"))))
     (build-system gnu-build-system)
-    (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
+    (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre"
+                                     "--enable-maildir-support")
                  #:phases
                  (modify-phases %standard-phases
                    (add-before 'configure 'fix-sh
@@ -375,7 +493,7 @@ ksh, and tcsh.")
        #:tests? #f))
     (inputs
      `(("python-ply" ,python-ply)))
-    (home-page "http://xon.sh/")
+    (home-page "https://xon.sh/")
     (synopsis "Python-ish shell")
     (description
      "Xonsh is a Python-ish, BASHwards-looking shell language and command
@@ -566,7 +684,7 @@ The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
 (define-public loksh
   (package
     (name "loksh")
-    (version "6.4")
+    (version "6.6")
     (source
      (origin
        (method git-fetch)
@@ -575,7 +693,7 @@ The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "1d92cf5iadj1vwg0wwksaq1691zaxjrd2y4qygj4sdd25zsahj6p"))))
+        (base32 "1a8s64n97ikvvi7ckirxnnjvcmhr3dd4rnqm2ivapyzb0wp42jk7"))))
     (build-system gnu-build-system)
     (inputs
      `(("libbsd" ,libbsd)
@@ -602,18 +720,17 @@ interactive POSIX shell targeted at resource-constrained systems.")
 (define-public mksh
   (package
     (name "mksh")
-    (version "56")
+    (version "57")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R"
                            version ".tgz"))
        (sha256
-        (base32
-         "1x4zjj9259ijpf8jw0nyh1fnr1pbm5fwvylclpvcrlb45xrglf5d"))))
+        (base32 "0xdykm1z710wriwd6nc8s8lwk2dwjl63dq96xxaawlid31a1241x"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:tests? #f ; tests require access to /dev/tty
+     `(#:tests? #f                      ; tests require access to /dev/tty
        #:phases
        (modify-phases %standard-phases
          (delete 'configure)
@@ -637,19 +754,19 @@ interactive POSIX shell targeted at resource-constrained systems.")
 Korn Shell programming language and a successor to the Public Domain Korn
 Shell (pdksh).")
     (license (list miros
-                   isc)))) ; strlcpy.c
+                   isc))))              ; strlcpy.c
 
 (define-public oil-shell
   (package
     (name "oil-shell")
-    (version "0.5.0")
+    (version "0.7.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.oilshell.org/download/oil-"
                                   version ".tar.xz"))
               (sha256
                (base32
-                "03zc7rhhpl0cybng2i3c33pky1knsnyvn526bn91hg6w4znvn66w"))))
+                "12c9s462879adb6mwd3fqafk0dnqsm16s18rhym6cmzfzy8v8zm3"))))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f ; the tests are not distributed in the tarballs
@@ -684,3 +801,58 @@ is commonly written.")
     (home-page "https://www.oilshell.org/")
     (license (list psfl ; The Oil sources include a patched Python 2 source tree
                    asl2.0))))
+
+(define-public gash
+  (package
+    (name "gash")
+    (version "0.2.0")
+    (source
+     (origin (method url-fetch)
+             (uri (string-append "mirror://savannah/gash/gash-"
+                                 version ".tar.gz"))
+             (sha256
+              (base32
+               "13m0yz5h9nj3x40mr6wr5xcpq1lscndfwcicw3skrz801025hhgf"))
+             (modules '((guix build utils)))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("guile" ,guile-2.2)))
+    (arguments
+     '(#:make-flags '("XFAIL_TESTS=tests/redirects.org")))
+    (home-page "https://savannah.nongnu.org/projects/gash/")
+    (synopsis "POSIX-compatible shell written in Guile Scheme")
+    (description "Gash is a POSIX-compatible shell written in Guile
+Scheme.  It provides both the shell interface, as well as a Guile
+library for parsing shell scripts.  Gash is designed to bootstrap Bash
+as part of the Guix bootstrap process.")
+    (license gpl3+)))
+
+(define-public gash-utils
+  (package
+    (name "gash-utils")
+    (version "0.1.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://savannah/gash/gash-utils-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0ib2p52qmbac5n0s5bys4fiwim461ps546976l1n7pwbs0avh7fk"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("guile" ,guile-2.2)
+       ("gash" ,gash)))
+    (home-page "https://savannah.nongnu.org/projects/gash/")
+    (synopsis "Core POSIX utilities written in Guile Scheme")
+    (description "Gash-Utils provides Scheme implementations of many
+common POSIX utilities (there are about 40 of them, ranging in
+complexity from @command{false} to @command{awk}).  The utilities are
+designed to be capable of bootstrapping their standard GNU counterparts.
+Underpinning these utilities are many Scheme interfaces for manipulating
+files and text.")
+    (license gpl3+)))
+