gnu: libdrm: Switch to meson-build-system.
[jackhill/guix/guix.git] / gnu / packages / shells.scm
index 1f07699..4c832c0 100644 (file)
@@ -3,12 +3,13 @@
 ;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2014 Kevin Lemonnier <lemonnierk@ulrar.net>
 ;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
-;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2016, 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2016 Stefan Reichör <stefan@xsteve.at>
-;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2017 ng0 <ng0@n0.is>
-;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017, 2018 Nils Gillmann <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>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,9 +28,9 @@
 
 (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 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)
@@ -52,7 +55,7 @@
 (define-public dash
   (package
     (name "dash")
-    (version "0.5.9.1")
+    (version "0.5.10.2")
     (source
      (origin
        (method url-fetch)
@@ -60,7 +63,7 @@
                            "dash-" version ".tar.gz"))
        (sha256
         (base32
-         "0ng695mq5ngg43h7ljhxvbjm46ym3nayj6ssn47d2gm9fbm5pkay"))
+         "0wb0bwmqc661hylqcfdp7l7x12myw3vpqk513ncyqrjwvhckjriw"))
        (modules '((guix build utils)))
        (snippet
         '(begin
@@ -88,50 +91,105 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
 (define-public fish
   (package
     (name "fish")
-    (version "2.7.0")
-    (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
-                "1jvvm27hp46w0cia14lfz6161dkz8b935j1m7j38i7rgx75bfxis"))
-              (modules '((guix build utils)))
-              ;; Don't try to install /etc/fish/config.fish.
-              (snippet
-               '(substitute* "Makefile.in"
-                  ((".*INSTALL.*sysconfdir.*fish.*") "")))))
+    (version "3.0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/fish-shell/fish-shell/"
+                           "releases/download/" version "/"
+                           name "-" 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
@@ -139,38 +197,60 @@ direct descendant of NetBSD's Almquist Shell (@command{ash}).")
 discoverability, and friendliness.  Fish has very user-friendly and powerful
 tab-completion, including descriptions of every completion, completion of
 strings with wildcards, and many completions for specific commands.  It also
-has extensive and discoverable help.  A special help command gives access to
-all the fish documentation in your web browser.  Other features include smart
-terminal handling based on terminfo, an easy to search history, and syntax
-highlighting.")
+has extensive and discoverable help.  A special @command{help} command gives
+access to all the fish documentation in your web browser.  Other features
+include smart terminal handling based on terminfo, an easy to search history,
+and syntax highlighting.")
     (home-page "https://fishshell.com/")
     (license gpl2)))
 
-(define-public fish-guix
+(define-public fish-foreign-env
   (package
-    (name "fish-guix")
-    (version "0.1.2.1")
+    (name "fish-foreign-env")
+    (version "0.20190116")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://d.n0.is/releases/fish-guix/"
-                           name "-" version ".tar.xz"))
+       (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
-         "0k71hcn7nr523w74jw2i68x52s9hv6vmasnvnn7yr3xxvzn4kqgf"))))
-    (build-system gnu-build-system)
+        (base32 "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs"))))
+    (build-system trivial-build-system)
     (arguments
-     `(#:tests? #f ; No checks.
-       #:make-flags (list
-                     (string-append "PREFIX=" %output))
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)))) ; No configure script.
-    (home-page "https://n0.is/s/fish-guix/")
-    (synopsis "Fish completions for Guix")
-    (description
-     "Fish-guix provides completions for Guix for users of the fish shell.")
-    (license bsd-3)))
+     '(#: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
@@ -180,23 +260,18 @@ highlighting.")
               (method git-fetch)
               (uri (git-reference
                     (url "https://github.com/rakitzis/rc.git")
-                    ;; commit name 'release: rc-1.7.4'
-                    (commit "c884da53a7c885d46ace2b92de78946855b18e92")))
+                    (commit (string-append "v" version))))
               (sha256
                (base32
-                "00mgzvrrh9w96xa85g4gjbsvq02f08k4jwjcdnxq7kyh5xgiw95l"))
-              (file-name (string-append name "-" version "-checkout"))))
+                "0vj1h4pcg13vxsiydmmk87dr2sra9h4gwx0c4q6fjsiw4in78rrd"))
+              (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (arguments
      `(#:configure-flags
        '("--with-edit=gnu")
        #:phases
        (modify-phases %standard-phases
-         (add-after
-          'unpack 'autoreconf
-          (lambda _ (zero? (system* "autoreconf" "-vfi"))))
-         (add-before
-          'autoreconf 'patch-trip.rc
+         (add-before 'bootstrap 'patch-trip.rc
           (lambda _
             (substitute* "trip.rc"
               (("/bin/pwd") (which "pwd"))
@@ -290,7 +365,7 @@ written by Paul Haahr and Byron Rakitzis.")
               (substitute* "tests/syntax.at"
                 (("; other_script.csh") "; /bin/sh other_script.csh"))
               ;; Now, let's generate the test suite and patch it
-              (system* "make" "tests/testsuite")
+              (invoke "make" "tests/testsuite")
 
               ;; This file is ISO-8859-1 encoded.
               (with-fluids ((%default-port-encoding #f))
@@ -317,18 +392,18 @@ history mechanism, job control and a C-like syntax.")
 (define-public zsh
   (package
     (name "zsh")
-    (version "5.4.2")
+    (version "5.6.2")
     (source (origin
               (method url-fetch)
               (uri (list (string-append
-                           "http://www.zsh.org/pub/zsh-" version
-                           ".tar.gz")
+                           "https://www.zsh.org/pub/zsh-" version
+                           ".tar.xz")
                          (string-append
-                           "http://www.zsh.org/pub/old/zsh-" version
-                           ".tar.gz")))
+                           "https://www.zsh.org/pub/old/zsh-" version
+                           ".tar.xz")))
               (sha256
                (base32
-                "1jdcfinzmki2w963msvsanv29vqqfmdfm4rncwpw0r3zqnrcsywm"))))
+                "17iffliqcj4hv91g0bd2sxsyfcz51mfyh97sp2iyrs2p0mndc2x5"))))
     (build-system gnu-build-system)
     (arguments `(#:configure-flags '("--with-tcsetpgrp" "--enable-pcre")
                  #:phases
@@ -372,7 +447,7 @@ as an interactive login shell and as a powerful command interpreter
 for shell scripting.  Zsh can be thought of as an extended Bourne shell
 with a large number of improvements, including some features of bash,
 ksh, and tcsh.")
-    (home-page "http://www.zsh.org/")
+    (home-page "https://www.zsh.org/")
 
     ;; The whole thing is under an MIT/X11-style license, but there's one
     ;; command, 'Completion/Unix/Command/_darcs', which is under GPLv2+.
@@ -381,14 +456,14 @@ ksh, and tcsh.")
 (define-public xonsh
   (package
     (name "xonsh")
-    (version "0.5.12")
+    (version "0.6.2")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "xonsh" version))
         (sha256
           (base32
-            "1yz595hx5bni524m73cx8a08vcr6vfksfci14nx2ylz53igzva2c"))
+            "0c2bbmdg0n10q54vq9k1z5n53l0mh1hb1q5xprfhilvrbr6hlcwr"))
         (modules '((guix build utils)))
         (snippet
          `(begin
@@ -444,10 +519,7 @@ use of experts and novices alike.")
                                              "/rx")))
                  (delete-file-recursively "rx")
                  (symlink rxpath "rx"))
-               #t))
-           (add-after 'unpack 'autoreconf
-             (lambda _
-               (zero? (system* "autoreconf")))))))
+               #t)))))
       (inputs
        `(("scheme48" ,scheme48)
          ("scheme48-rx" ,scheme48-rx)))
@@ -511,11 +583,11 @@ Its features include:
       (license bsd-2))))
 
 (define-public s-shell
-  (let ((commit "6604341edb3a775ff94415762af3ee9bd86bfb3c")
-        (revision "1"))
+  (let ((commit "da2e5c20c0c5f477ec3426dc2584889a789b1659")
+        (revision "2"))
     (package
       (name "s-shell")
-      (version (string-append "0.0.0-" revision "." (string-take commit 7)))
+      (version (git-version "0.0.0" revision commit))
       (source
        (origin
          (method git-fetch)
@@ -525,13 +597,15 @@ Its features include:
          (file-name (string-append name "-" version "-checkout"))
          (sha256
           (base32
-           "1075cml6dl15d770j3m12yz90cjacsdslbv3gank1nxd76vmpdcr"))))
+           "0qiny71ww5nhzy4mnc8652hn0mlxyb67h333gbdxp4j4qxsi13q4"))))
       (build-system gnu-build-system)
       (inputs
        `(("linenoise" ,linenoise)))
       (arguments
        `(#:tests? #f
-         #:make-flags (list "CC=gcc")
+         #:make-flags (list "CC=gcc"
+                            (string-append "PREFIX="
+                                           (assoc-ref %outputs "out")))
          #:phases
          (modify-phases %standard-phases
            (add-after 'unpack 'install-directory-fix
@@ -597,30 +671,30 @@ The OpenBSD Korn Shell is a cleaned up and enhanced ksh.")
 (define-public loksh
   (package
     (name "loksh")
-    (version "6.1")
+    (version "6.4")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://github.com/dimkr/loksh/archive/"
-                           version ".tar.gz"))
-       (file-name (string-append name "-" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/dimkr/loksh.git")
+             (commit version)))
+       (file-name (git-file-name name version))
        (sha256
-        (base32
-         "1wg7ds56yr8fgg1m149bi53bvrwccwiashmwknggza1sqgj9m2lq"))))
+        (base32 "1d92cf5iadj1vwg0wwksaq1691zaxjrd2y4qygj4sdd25zsahj6p"))))
     (build-system gnu-build-system)
     (inputs
-     `(("libbsd" ,libbsd)))
+     `(("libbsd" ,libbsd)
+       ("ncurses" ,ncurses)))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (arguments
-     `(#:tests? #f ;No tests included
+     `(#:tests? #f                      ; no tests included
        #:make-flags (list "CC=gcc" "HAVE_LIBBSD=1"
-                          (string-append "DESTDIR="
-                                         (assoc-ref %outputs "out"))
-                          "PREFIX=")
+                          (string-append "PREFIX="
+                                         (assoc-ref %outputs "out")))
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)))) ;No configure script
+         (delete 'configure))))         ; no configure script
     (home-page "https://github.com/dimkr/loksh")
     (synopsis "Korn Shell from OpenBSD")
     (description
@@ -651,7 +725,7 @@ interactive POSIX shell targeted at resource-constrained systems.")
          (replace 'build
            (lambda _
              (setenv "CC" "gcc")
-             (zero? (system* (which "sh") "Build.sh"))))
+             (invoke (which "sh") "Build.sh")))
          (replace 'install
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -660,7 +734,8 @@ interactive POSIX shell targeted at resource-constrained systems.")
                (install-file "mksh" bin)
                (with-directory-excursion bin
                  (symlink "mksh" "ksh"))
-               (install-file "mksh.1" man)))))))
+               (install-file "mksh.1" man)
+               #t))))))
     (home-page "https://www.mirbsd.org/mksh.htm")
     (synopsis "Korn Shell from MirBSD")
     (description "mksh is an actively developed free implementation of the
@@ -668,3 +743,49 @@ Korn Shell programming language and a successor to the Public Domain Korn
 Shell (pdksh).")
     (license (list miros
                    isc)))) ; strlcpy.c
+
+(define-public oil-shell
+  (package
+    (name "oil-shell")
+    (version "0.5.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.oilshell.org/download/oil-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "03zc7rhhpl0cybng2i3c33pky1knsnyvn526bn91hg6w4znvn66w"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:tests? #f ; the tests are not distributed in the tarballs
+       #:strip-binaries? #f ; the binaries cannot be stripped
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-compiler-invocation
+           (lambda _
+             (substitute* "configure"
+               ((" cc ") " gcc "))
+             #t))
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (setenv "CC" "gcc")
+               ;; The configure script doesn't recognize CONFIG_SHELL.
+               (setenv "CONFIG_SHELL" (which "sh"))
+               (invoke "./configure" (string-append "--prefix=" out)
+                       "--with-readline"))))
+         (add-before 'install 'make-destination
+           (lambda _
+             ;; The build scripts don't create the destination directory.
+             (mkdir-p (string-append (assoc-ref %outputs "out") "/bin")))))))
+    (inputs
+     `(("readline" ,readline)))
+    (synopsis "Bash-compatible Unix shell")
+    (description "Oil is a Unix / POSIX shell, compatible with Bash.  It
+implements the Oil language, which is a new shell language to which Bash can be
+automatically translated.  The Oil language is a superset of Bash.  It also
+implements the OSH language, a statically-parseable language based on Bash as it
+is commonly written.")
+    (home-page "https://www.oilshell.org/")
+    (license (list psfl ; The Oil sources include a patched Python 2 source tree
+                   asl2.0))))