gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / scheme.scm
index 5fef20c..b5d526b 100644 (file)
@@ -3,14 +3,18 @@
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
 ;;; Copyright © 2015, 2016 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
-;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
-;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
+;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Gabriel Hondet <gabrielhondet@gmail.com>
+;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
+;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Edouard Klein <edk@beaver-labs.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,8 +34,8 @@
 (define-module (gnu packages scheme)
   #:use-module (gnu packages)
   #:use-module ((guix licenses)
-                #:select (gpl2+ lgpl2.0+ lgpl2.1+ lgpl3+ asl2.0 bsd-3
-                          cc-by-sa4.0 non-copyleft))
+                #:select (gpl2+ lgpl2.0+ lgpl2.1 lgpl2.1+ lgpl3+ asl2.0 bsd-3
+                          cc-by-sa4.0 non-copyleft expat))
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -40,6 +44,7 @@
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages bdw-gc)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages libevent)
@@ -69,6 +74,7 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages libedit)
+  #:use-module (gnu packages linux)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match))
 
@@ -368,47 +374,6 @@ applications in many fields such as multimedia (web galleries, music players,
 mashups, office (web agendas, mail clients, ...), etc.")
     (license gpl2+)))
 
-(define-public chicken
-  (package
-    (name "chicken")
-    (version "5.0.0")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append "https://code.call-cc.org/releases/"
-                                  version "/chicken-" version ".tar.gz"))
-              (sha256
-               (base32
-                "15b5yrzfa8aimzba79x7v6y282f898rxqxfxrr446sjx9jwlpfd8"))))
-    (build-system gnu-build-system)
-    (arguments
-     `(#:modules ((guix build gnu-build-system)
-                  (guix build utils)
-                  (srfi srfi-1))
-
-       ;; No `configure' script; run "make check" after "make install" as
-       ;; prescribed by README.
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure)
-         (delete 'check)
-         (add-after 'install 'check
-           (assoc-ref %standard-phases 'check)))
-
-       #:make-flags (let ((out (assoc-ref %outputs "out")))
-                      (list "PLATFORM=linux"
-                            (string-append "PREFIX=" out)
-                            (string-append "VARDIR=" out "/var/lib")))
-
-       ;; Parallel builds are not supported, as noted in README.
-       #:parallel-build? #f))
-    (home-page "http://www.call-cc.org/")
-    (synopsis "R5RS Scheme implementation that compiles native code via C")
-    (description
-     "CHICKEN is a compiler for the Scheme programming language.  CHICKEN
-produces portable and efficient C, supports almost all of the R5RS Scheme
-language standard, and includes many enhancements and extensions.")
-    (license bsd-3)))
-
 (define-public scheme48
   (package
     (name "scheme48")
@@ -435,98 +400,133 @@ implementation techniques and as an expository tool.")
 (define-public racket
   (package
     (name "racket")
-    (version "7.3")
+    (version "8.0")            ; note: remember to also update racket-minimal!
     (source (origin
               (method url-fetch)
-              (uri (list (string-append "http://mirror.racket-lang.org/installers/"
-                                        version "/racket-" version "-src.tgz")
+              (uri (list (string-append "https://mirror.racket-lang.org/installers/"
+                                        version "/racket-src.tgz")
+                         ;; this mirror seems to have broken HTTPS:
                          (string-append
                           "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
-                          version "/racket-" version "-src.tgz")))
+                          version "/racket-src.tgz")))
               (sha256
                (base32
-                "0h6072njhb87rkz4arijvahxgjzn8r14s4wns0ijvxm89bg136yl"))
+                "047wpjblfzmf1msz7snrp2c2h0zxyzlmbsqr9bwsyvz3frcg0888"))
               (patches (search-patches
+                        "racket-sh-via-rktio.patch"
+                        ;; TODO: If we're no longer patching Racket source
+                        ;; files with store paths, we may also fix the
+                        ;; issue that necessitated the following patch:
                         "racket-store-checksum-override.patch"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:phases
+     `(#:configure-flags
+       `(,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH="
+                         (assoc-ref %build-inputs "sh")
+                         "/bin/sh")
+         "--enable-libz"
+         "--enable-liblz4")
+       #:modules
+       ((guix build gnu-build-system)
+        (guix build utils)
+        (srfi srfi-1))
+       #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'pre-configure
+         (add-after 'unpack 'patch-chez-configure
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (substitute* "src/cs/c/Makefile.in"
+               (("/bin/sh") (which "sh")))
+             ;; TODO: Racket CS uses a fork of Chez Scheme.
+             ;; Most of this is copy-pasted from the "chez.scm",
+             ;; but maybe there's a way to reuse more directly.
+             (with-directory-excursion "src/ChezScheme"
+               (substitute* (find-files "mats" "Mf-.*")
+                 (("^[[:space:]]+(cc ) *") "\tgcc "))
+               (substitute*
+                   (find-files "." (string-append
+                                    "("
+                                    "Mf-[a-zA-Z0-9.]+"
+                                    "|Makefile[a-zA-Z0-9.]*"
+                                    "|checkin"
+                                    "|stex\\.stex"
+                                    "|newrelease"
+                                    "|workarea"
+                                    "|unix\\.ms"
+                                    "|^6\\.ms"
+                                    ;;"|[a-zA-Z0-9.]+\\.ms" ; guile can't read
+                                    ")"))
+                 (("/bin/rm") (which "rm"))
+                 (("/bin/ln") (which "ln"))
+                 (("/bin/cp") (which "cp"))
+                 (("/bin/echo") (which "echo")))
+               (substitute* "makefiles/installsh"
+                 (("/bin/true") (which "true"))))
+             #t))
+         (add-before 'configure 'pre-configure-minimal
            (lambda* (#:key inputs #:allow-other-keys)
-             ;; Patch dynamically loaded libraries with their absolute paths.
-             (let* ((library-path   (search-path-as-string->list
-                                     (getenv "LIBRARY_PATH")))
-                    (find-so        (lambda (soname)
-                                      (search-path
-                                       library-path
-                                       (format #f "~a.so" soname))))
-                    (patch-ffi-libs (lambda (file libs)
-                                      (for-each
-                                       (lambda (lib)
-                                         (substitute* file
-                                           (((format #f "\"~a\"" lib))
-                                            (format #f "\"~a\"" (find-so lib)))))
-                                       libs))))
-               (substitute* "collects/db/private/sqlite3/ffi.rkt"
-                 (("ffi-lib sqlite-so")
-                  (format #f "ffi-lib \"~a\"" (find-so "libsqlite3"))))
-               (substitute* "collects/openssl/libssl.rkt"
-                 (("ffi-lib libssl-so")
-                  (format #f "ffi-lib \"~a\"" (find-so "libssl"))))
-               (substitute* "collects/openssl/libcrypto.rkt"
-                 (("ffi-lib libcrypto-so")
-                  (format #f "ffi-lib \"~a\"" (find-so "libcrypto"))))
-               (substitute* "share/pkgs/math-lib/math/private/bigfloat/gmp.rkt"
-                 (("ffi-lib libgmp-so")
-                  (format #f "ffi-lib \"~a\"" (find-so "libgmp"))))
-               (substitute* "share/pkgs/math-lib/math/private/bigfloat/mpfr.rkt"
-                 (("ffi-lib libmpfr-so")
-                  (format #f "ffi-lib \"~a\"" (find-so "libmpfr"))))
-               (substitute* "share/pkgs/readline-lib/readline/rktrl.rkt"
-                 (("\\(getenv \"PLT_READLINE_LIB\"\\)")
-                  (format #f "\"~a\"" (find-so "libedit"))))
-               (for-each
-                (lambda (x) (apply patch-ffi-libs x))
-                '(("share/pkgs/draw-lib/racket/draw/unsafe/cairo-lib.rkt"
-                   ("libfontconfig" "libcairo"))
-                  ("share/pkgs/draw-lib/racket/draw/unsafe/glib.rkt"
-                   ("libglib-2.0" "libgmodule-2.0" "libgobject-2.0"))
-                  ("share/pkgs/draw-lib/racket/draw/unsafe/jpeg.rkt"
-                   ("libjpeg"))
-                  ("share/pkgs/draw-lib/racket/draw/unsafe/pango.rkt"
-                   ("libpango-1.0" "libpangocairo-1.0"))
-                  ("share/pkgs/draw-lib/racket/draw/unsafe/png.rkt"
-                   ("libpng"))
-                  ("share/pkgs/db-lib/db/private/odbc/ffi.rkt"
-                   ("libodbc"))
-                  ("share/pkgs/gui-lib/mred/private/wx/gtk/x11.rkt"
-                   ("libX11"))
-                  ("share/pkgs/gui-lib/mred/private/wx/gtk/gsettings.rkt"
-                   ("libgio-2.0"))
-                  ("share/pkgs/gui-lib/mred/private/wx/gtk/gtk3.rkt"
-                   ("libgdk-3" "libgtk-3"))
-                  ("share/pkgs/gui-lib/mred/private/wx/gtk/unique.rkt"
-                   ("libunique-1.0"))
-                  ("share/pkgs/gui-lib/mred/private/wx/gtk/utils.rkt"
-                   ("libgdk-x11-2.0" "libgdk_pixbuf-2.0" "libgtk-x11-2.0"))
-                  ("share/pkgs/gui-lib/mred/private/wx/gtk/gl-context.rkt"
-                   ("libGL"))
-                  ("share/pkgs/sgl/gl.rkt"
-                   ("libGL" "libGLU")))))
              (chdir "src")
              #t))
-         (add-after 'unpack 'patch-/bin/sh
-           (lambda _
-             (substitute* "collects/racket/system.rkt"
-               (("/bin/sh") (which "sh")))
+         (add-after 'build 'patch-config.rktd-lib-search-dirs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; We do this between the `build` and `install` phases
+             ;; so that we have racket to read and write the hash table,
+             ;; but it comes before `raco setup`, when foreign libraries
+             ;; are needed to build the documentation.
+             (define out (assoc-ref outputs "out"))
+             (apply invoke
+                    "./cs/c/racketcs"
+                    "-e"
+                    ,(format #f
+                             "~s"
+                             '(let* ((args
+                                      (vector->list
+                                       (current-command-line-arguments)))
+                                     (file (car args))
+                                     (extra-lib-search-dirs (cdr args)))
+                                (write-to-file
+                                 (hash-update
+                                  (file->value file)
+                                  'lib-search-dirs
+                                  (lambda (dirs)
+                                    (append dirs extra-lib-search-dirs))
+                                  null)
+                                 #:exists 'truncate/replace
+                                 file)))
+                    "--"
+                    "../etc/config.rktd"
+                    (filter-map (lambda (lib)
+                                  (cond
+                                   ((assoc-ref inputs lib)
+                                    => (lambda (pth)
+                                         (string-append pth "/lib")))
+                                   (else
+                                    #f)))
+                                '("cairo"
+                                  "fontconfig"
+                                  "glib"
+                                  "glu"
+                                  "gmp"
+                                  "gtk+"
+                                  "libjpeg"
+                                  "libpng"
+                                  "libx11"
+                                  "mesa"
+                                  "mpfr"
+                                  "openssl"
+                                  "pango"
+                                  "sqlite"
+                                  "unixodbc"
+                                  "libedit")))
              #t)))
-       #:tests? #f                      ; XXX: how to run them?
-       ))
+       ;; XXX: how to run them?
+       #:tests? #f))
     (inputs
-     `(("libffi" ,libffi)
-       ;; Hardcode dynamically loaded libraries for better functionality.
-       ;; sqlite and libraries for `racket/draw' are needed to build the doc.
+     `(;; sqlite and libraries for `racket/draw' are needed to build the doc.
+       ("sh" ,bash-minimal)
+       ("zlib" ,zlib)
+       ("zlib:static" ,zlib "static")
+       ("lz4" ,lz4)
+       ("lz4:static" ,lz4 "static")
        ("cairo" ,cairo)
        ("fontconfig" ,fontconfig)
        ("glib" ,glib)
@@ -543,14 +543,53 @@ implementation techniques and as an expository tool.")
        ("sqlite" ,sqlite)
        ("unixodbc" ,unixodbc)
        ("libedit" ,libedit)))
-    (home-page "http://racket-lang.org")
+    (home-page "https://racket-lang.org")
     (synopsis "Implementation of Scheme and related languages")
     (description
-     "Racket is an implementation of the Scheme programming language (R5RS and
-R6RS) and related languages, such as Typed Racket.  It features a compiler and
-a virtual machine with just-in-time native compilation, as well as a large set
-of libraries.")
-    (license lgpl2.0+)))
+     "Racket is a general-purpose programming language in the Scheme family,
+with a large set of libraries and a compiler based on Chez Scheme.  Racket is
+also a platform for language-oriented programming, from small domain-specific
+languages to complete language implementations.
+
+The main Racket distribution comes with many bundled packages, including
+the DrRacket IDE, libraries for GUI and web programming, and implementations
+of languages such as Typed Racket, R5RS and R6RS Scheme, and Datalog.")
+    ;; https://download.racket-lang.org/license.html
+    (license (list lgpl3+ asl2.0 expat))))
+
+(define-public racket-minimal
+  (package
+    (inherit racket)
+    (name "racket-minimal")
+    (version (package-version racket))
+    (source
+     (origin
+       (inherit (package-source racket))
+       (uri (list (string-append "https://mirror.racket-lang.org/installers/"
+                                 version "/racket-minimal-src.tgz")
+                  ;; this mirror seems to have broken HTTPS:
+                  (string-append
+                   "http://mirror.informatik.uni-tuebingen.de/mirror/racket/"
+                   version "/racket-minimal-src.tgz")))
+       (sha256 "0mwyffw4gcci8wmzxa3j28h03h0gsz55aard8qrk3lri8r2xyg21")))
+    (synopsis "Racket without bundled packages such as Dr. Racket")
+    (inputs
+     `(("openssl" ,openssl)
+       ("sqlite" ,sqlite)
+       ("sh" ,bash-minimal)
+       ("zlib" ,zlib)
+       ("zlib:static" ,zlib "static")
+       ("lz4" ,lz4)
+       ("lz4:static" ,lz4 "static")))
+    (description
+     "Racket is a general-purpose programming language in the Scheme family,
+with a large set of libraries and a compiler based on Chez Scheme.  Racket is
+also a platform for language-oriented programming, from small domain-specific
+languages to complete language implementations.
+
+The ``minimal Racket'' distribution includes just enough of Racket for you to
+use @command{raco pkg} to install more.  Bundled packages, such as the
+Dr. Racket IDE, are not included.")))
 
 (define-public gambit-c
   (package
@@ -588,7 +627,7 @@ mixed.")
 (define-public chibi-scheme
   (package
     (name "chibi-scheme")
-    (version "0.8")
+    (version "0.9")
     (home-page "https://github.com/ashinn/chibi-scheme")
     (source
      (origin
@@ -597,7 +636,7 @@ mixed.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "0269d5fhaz7nqjb41vh7yz63mp5s4z08fn4sspwc06z32xksigw9"))))
+         "1lnap41gl9vg82h557f4rlr69jgmd2gh0iqs6cxm77d39kv1scb8"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases (modify-phases %standard-phases
@@ -735,7 +774,7 @@ regular-expression notation.")
                                            (assoc-ref outputs "out"))))))))
     (native-inputs `(("unzip" ,unzip)
                      ("texinfo" ,texinfo)))
-    (home-page "http://people.csail.mit.edu/jaffer/SLIB.html")
+    (home-page "https://people.csail.mit.edu/jaffer/SLIB.html")
     (synopsis "Compatibility and utility library for Scheme")
     (description "SLIB is a portable Scheme library providing compatibility and
 utility functions for all standard Scheme implementations.")
@@ -746,7 +785,7 @@ utility functions for all standard Scheme implementations.")
 (define-public scm
   (package
     (name "scm")
-    (version "5f2")
+    (version "5f3")
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -754,7 +793,7 @@ utility functions for all standard Scheme implementations.")
                     version ".zip"))
               (sha256
                (base32
-                "050ijb51jm1cij9g3r89zl9rawsrikhbb5y8zb7lspb7bsxq5w99"))))
+                "1jxxlhmgal26mpcl97kz37djkn97rfy9h5pvw0hah6f3f6w49j97"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
@@ -792,7 +831,7 @@ utility functions for all standard Scheme implementations.")
     (inputs `(("slib" ,slib)))
     (native-inputs `(("unzip" ,unzip)
                      ("texinfo" ,texinfo)))
-    (home-page "http://people.csail.mit.edu/jaffer/SCM")
+    (home-page "https://people.csail.mit.edu/jaffer/SCM")
     (synopsis "Scheme implementation conforming to R5RS and IEEE P1178")
     (description "GNU SCM is an implementation of Scheme.  This
 implementation includes Hobbit, a Scheme-to-C compiler, which can
@@ -803,14 +842,14 @@ linked with a SCM executable.")
 (define-public tinyscheme
   (package
     (name "tinyscheme")
-    (version "1.41")
+    (version "1.42")
     (source (origin
               (method url-fetch)
               (uri (string-append "mirror://sourceforge/" name "/" name "/"
                                   name "-" version "/" name "-" version ".zip"))
               (sha256
                (base32
-                "0yqma4jrjgj95f3hf30h542x97n8ah234n19yklbqq0phfsa08wf"))))
+                "0rik3qnxqd8wjlazx8rw996pfzkjjg60v6hcbpcqzi7rgml8q4n8"))))
     (build-system gnu-build-system)
     (native-inputs
      `(("unzip" ,unzip)))
@@ -881,7 +920,7 @@ small program, it is easy to comprehend, get to grips with, and use.")
                 ;; <ftp.ecn.purdue.edu/qobi/stalin-0.11-amd64-patches.tgz>
                 (method git-fetch)
                 (uri (git-reference
-                      (url "https://github.com/barak/stalin.git")
+                      (url "https://github.com/barak/stalin")
                       (commit commit)))
                 (file-name (string-append name "-" version "-checkout"))
                 (sha256
@@ -953,7 +992,7 @@ generation.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                      (url "https://github.com/JeffBezanson/femtolisp.git")
+                      (url "https://github.com/JeffBezanson/femtolisp")
                       (commit commit)))
                 (file-name (string-append name "-" version "-checkout"))
                 (sha256
@@ -998,8 +1037,8 @@ The core is 12 builtin special forms and 33 builtin functions.")
 (define-public gauche
   (package
     (name "gauche")
-    (version "0.9.9")
-    (home-page "http://practical-scheme.net/gauche/index.html")
+    (version "0.9.10")
+    (home-page "https://practical-scheme.net/gauche/index.html")
     (source
      (origin
        (method url-fetch)
@@ -1007,7 +1046,7 @@ The core is 12 builtin special forms and 33 builtin functions.")
              "mirror://sourceforge/gauche/Gauche/Gauche-"
              version ".tgz"))
        (sha256
-        (base32 "1yzpszhw52vkpr65r5d4khf3489mnnvnw58dd2wsvvx7499k5aac"))
+        (base32 "0ci57ak5cp3lkmfy3nh50hifh8nbg58hh6r18asq0rn5mqfxyf8g"))
        (modules '((guix build utils)))
        (snippet '(begin
                    ;; Remove libatomic-ops.
@@ -1016,24 +1055,26 @@ The core is 12 builtin special forms and 33 builtin functions.")
     (build-system gnu-build-system)
     (inputs
      `(("libatomic-ops" ,libatomic-ops)
+       ("slib" ,slib)
        ("zlib" ,zlib)))
     (native-inputs
      `(("texinfo" ,texinfo)
        ("openssl" ,openssl)            ; needed for tests
        ("pkg-config" ,pkg-config)))    ; needed to find external libatomic-ops
     (arguments
-     `(#:phases
+     `(#:configure-flags
+       (list (string-append "--with-slib="
+                            (assoc-ref %build-inputs "slib")
+                            "/lib/slib"))
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-/bin/sh
            ;; Needed only for tests.
            (lambda _
-             (substitute* '("configure"
-                            "test/www.scm"
+             (substitute* '("test/www.scm"
                             "ext/tls/test.scm"
-                            "gc/configure"
-                            "lib/gauche/configure.scm"
                             "lib/gauche/package/util.scm"
-                            "lib/gauche/process.scm")
+                            "libsrc/gauche/process.scm")
                (("/bin/sh") (which "sh")))
              #t))
          (add-after 'build 'build-doc
@@ -1041,18 +1082,11 @@ The core is 12 builtin special forms and 33 builtin functions.")
              (with-directory-excursion "doc"
                (invoke "make" "info"))
              #t))
-         (add-before 'check 'patch-normalize-test
-           ;; Neutralize sys-normalize-pathname test as it relies on
-           ;; the home directory; (setenv "HOME" xx) isn't enough).
-           (lambda _
-             (substitute* "test/system.scm"
-               (("~/abc") "//abc"))
-             #t))
          (add-before 'check 'patch-network-tests
            ;; Remove net checks.
            (lambda _
-             (substitute* "ext/Makefile"
-               (("binary net termios") "binary termios"))
+             (delete-file "ext/net/test.scm")
+             (invoke "touch" "ext/net/test.scm")
              #t))
          (add-after 'install 'install-docs
            (lambda _
@@ -1067,3 +1101,107 @@ multilingual support are some of the goals.  Gauche comes with a package
 manager/installer @code{gauche-package} which can download, compile, install
 and list gauche extension packages.")
     (license bsd-3)))
+
+(define-public gerbil
+  (package
+    (name "gerbil")
+    (version "0.16")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vyzo/gerbil")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0vng0kxpnwsg8jbjdpyn4sdww36jz7zfpfbzayg9sdpz6bjxjy0f"))))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'bootstrap)
+         (add-before 'configure 'chdir
+           (lambda _
+             (chdir "src")
+             #t))
+         (replace 'configure
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (invoke "chmod" "755" "-R" ".")
+             ;; Otherwise fails when editing an r--r--r-- file.
+             (invoke "gsi-script" "configure"
+                     "--prefix" (assoc-ref outputs "out")
+                     "--with-gambit" (assoc-ref inputs "gambit-c"))))
+         (add-before 'patch-generated-file-shebangs 'fix-gxi-shebangs
+           (lambda _
+             ;; Some .ss files refer to gxi using /usr/bin/env gxi
+             ;; and 'patch-generated-file-shebangs can't fix that
+             ;; because gxi has not been compiled yet.
+             ;; We know where gxi is going to end up so we
+             ;; Doctor Who our fix here before the problem
+             ;; happens towards the end of the build.sh script.
+             (let ((abs-srcdir (getcwd)))
+               (for-each
+                (lambda (f)
+                   (substitute* f
+                     (("#!/usr/bin/env gxi")
+                      (string-append "#!" abs-srcdir "/../bin/gxi"))))
+                 '("./gerbil/gxc"
+                   "./lang/build.ss"
+                   "./misc/http-perf/build.ss"
+                   "./misc/rpc-perf/build.ss"
+                   "./misc/scripts/docsnarf.ss"
+                   "./misc/scripts/docstub.ss"
+                   "./misc/scripts/docsyms.ss"
+                   "./r7rs-large/build.ss"
+                   "./release.ss"
+                   "./std/build.ss"
+                   "./std/run-tests.ss"
+                   "./std/web/fastcgi-test.ss"
+                   "./std/web/rack-test.ss"
+                   "./tools/build.ss"
+                   "./tutorial/httpd/build.ss"
+                   "./tutorial/kvstore/build.ss"
+                   "./tutorial/lang/build.ss"
+                   "./tutorial/proxy/build-static.ss"
+                   "./tutorial/proxy/build.ss")))
+             #t))
+         (replace
+          'build
+          (lambda*
+           (#:key inputs #:allow-other-keys)
+           (setenv "HOME" (getcwd))
+             (invoke
+              ;; The build script needs a tty or it'll crash on an ioctl
+              ;; trying to find the width of the terminal it's running on.
+              ;; Calling in script prevents that.
+              "script"
+              "-qefc"
+              "./build.sh")))
+         (delete 'check)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (lib (string-append out "/lib")))
+               (mkdir-p bin)
+               (mkdir-p lib)
+               (copy-recursively "../bin" bin)
+               (copy-recursively "../lib" lib)))))))
+    (native-inputs
+     `(("coreutils" ,coreutils)
+       ("util-linux" ,util-linux)))
+    (propagated-inputs
+     `(("gambit-c" ,gambit-c)
+       ("zlib" ,zlib)
+       ("openssl" ,openssl)
+       ("sqlite" ,sqlite)))
+    (build-system gnu-build-system)
+    (synopsis "Meta-dialect of Scheme with post-modern features")
+    (description "Gerbil is an opinionated dialect of Scheme designed for Systems
+Programming, with a state of the art macro and module system on top of the Gambit
+runtime.  The macro system is based on quote-syntax, and provides the full meta-syntactic
+tower with a native implementation of syntax-case.  It also provides a full-blown module
+system, similar to PLT Scheme's (sorry, Racket) modules.  The main difference from Racket
+is that Gerbil modules are single instantiation, supporting high performance ahead of
+time compilation and compiled macros.")
+    (home-page "https://cons.io")
+    (license `(,lgpl2.1 ,asl2.0))))