gnu: libretro-lowresnx: Update to 1.2.
[jackhill/guix/guix.git] / gnu / packages / chez.scm
index 929e50e..1cd2cde 100644 (file)
@@ -1,7 +1,10 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
+  #:use-module (guix gexp)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages ghostscript)
+  #:use-module (gnu packages linux)
   #:use-module (gnu packages netpbm)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages compression)
   #:use-module (srfi srfi-1))
 
 (define nanopass
-  (let ((version "1.9"))
+  (let ((version "1.9.2"))
     (origin
-      (method url-fetch)
-      (uri (string-append
-            "https://github.com/nanopass/nanopass-framework-scheme/archive"
-            "/v" version ".tar.gz"))
-      (sha256 (base32 "11pwyy4jiwhcl2am3a4ciczacjbjkyvdizqzdglb3l1hj2gj6nv2"))
-      (file-name (string-append "nanopass-" version ".tar.gz")))))
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/nanopass/nanopass-framework-scheme")
+            (commit (string-append "v" version))))
+      (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
+      (file-name (git-file-name "nanopass" version)))))
 
 (define stex
-  (let ((version "1.2.1"))
+  ;; This commit includes a fix, which we would otherwise want to use as
+  ;; patch.  Let's revert to tagged releases as soon as one becomes available.
+  (let* ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5")
+         (version "1.2.2")
+         (version (git-version version "1" commit)))
     (origin
-      (method url-fetch)
-      (uri (string-append
-            "https://github.com/dybvig/stex/archive"
-            "/v" version ".tar.gz"))
-      (sha256 (base32 "03pl3f668h24dn51vccr1sj5lsba9zq3j37bnxjvdadcdaj4qy5z"))
-      (file-name (string-append "stex-" version ".tar.gz")))))
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/dybvig/stex")
+            (commit commit)))
+      (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
+      (file-name (git-file-name "stex" version)))))
 
 (define-public chez-scheme
   (package
     (name "chez-scheme")
-    (version "9.5")
+    (version "9.5.4")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append "https://github.com/cisco/ChezScheme/archive/"
-                           "v" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/cisco/ChezScheme")
+             (commit (string-append "v" version))))
        (sha256
-        (base32 "135991hspq0grf26pvl2lkwhp92yz204h6rgiwyym0x6v0xzknd1"))
-       (file-name (string-append "chez-scheme-" version ".tar.gz"))
-       (modules '((guix build utils)))
+        (base32 "0prgn2z9l888j93ydxaf04ph424g0fi3a8w7f8m0b2r7fr1v7388"))
+       (file-name (git-file-name name version))
+       (patches
+        (search-patches
+         ;; backported from upstream: remove on next release
+         "chez-scheme-build-util-paths-backport.patch"))
        (snippet
-        ;; Fix compilation with glibc >= 2.26, which removed xlocale.h.
-        '(begin
-           (substitute* "c/expeditor.c"
-             (("xlocale\\.h") "locale.h"))
-           #t))))
+        ;; remove bundled libraries
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              (for-each (lambda (dir)
+                          (when (directory-exists? dir)
+                            (delete-file-recursively dir)))
+                        '("stex"
+                          "nanopass"
+                          "lz4"
+                          "zlib")))))))
     (build-system gnu-build-system)
     (inputs
-     `(("ncurses" ,ncurses)
-       ("libx11" ,libx11)
-       ("xorg-rgb" ,xorg-rgb)
-       ("nanopass" ,nanopass)
+     `(("libuuid" ,util-linux "lib")
        ("zlib" ,zlib)
        ("zlib:static" ,zlib "static")
-       ("stex" ,stex)))
+       ("lz4" ,lz4)
+       ("lz4:static" ,lz4 "static")
+       ;; for expeditor:
+       ("ncurses" ,ncurses)
+       ;; for X11 clipboard support in expeditor:
+       ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+       ("libx11" ,libx11)))
     (native-inputs
-     `(("texlive" ,texlive)
+     `(("nanopass" ,nanopass) ; source only
+       ;; for docs
+       ("stex" ,stex)
+       ("xorg-rgb" ,xorg-rgb)
+       ("texlive" ,(texlive-union (list texlive-latex-oberdiek
+                                        texlive-generic-epsf)))
        ("ghostscript" ,ghostscript)
        ("netpbm" ,netpbm)))
     (native-search-paths
             (files (list (string-append "lib/csv" version "-site"))))))
     (outputs '("out" "doc"))
     (arguments
-     `(#:modules ((guix build gnu-build-system)
-                  (guix build utils)
-                  (ice-9 match))
+     `(#:modules
+       ((guix build gnu-build-system)
+        (guix build utils)
+        (ice-9 ftw)
+        (ice-9 match))
        #:test-target "test"
        #:configure-flags
-       (list ,(match (or (%current-target-system) (%current-system))
-                ("x86_64-linux" '(list "--machine=ta6le"))
-                ("i686-linux" '(list "--machine=ti3le"))
-                ;; Let autodetection have its attempt on other architectures.
-                (_
-                 '())))
+       '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
        #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'patch-processor-detection
-           (lambda _ (substitute* "configure"
-                       (("uname -a") "uname -m"))
-                   #t))
-         (add-after 'unpack 'patch-broken-documentation
-           (lambda _
-             ;; Work around an oversight in the 9.5 release tarball that causes
-             ;; building the documentation to fail. This should be fixed in the
-             ;; next one; see <https://github.com/cisco/ChezScheme/issues/209>.
-             (substitute* "csug/copyright.stex"
-               (("\\\\INSERTREVISIONMONTHSPACEYEAR" )
-                "October 2017"))))     ; tarball release date
-         ;; Adapt the custom 'configure' script.
+         ;; put these where configure expects them to be
+         (add-after 'unpack 'unpack-nanopass+stex
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
+             (for-each (lambda (dep)
+                         (define src
+                           (assoc-ref (or native-inputs inputs) dep))
+                         (copy-recursively src dep
+                                           #:keep-mtime? #t))
+                       '("nanopass" "stex"))
+               #t))
+         ;; NOTE: the custom Chez 'configure' script doesn't allow
+         ;; unrecognized flags, such as those automatically added
+         ;; by `gnu-build-system`.
          (replace 'configure
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (nanopass (assoc-ref inputs "nanopass"))
-                   (stex (assoc-ref inputs "stex"))
-                   (zlib (assoc-ref inputs "zlib"))
-                   (zlib-static (assoc-ref inputs "zlib:static"))
-                   (unpack (assoc-ref %standard-phases 'unpack))
-                   (patch-source-shebangs
-                    (assoc-ref %standard-phases 'patch-source-shebangs)))
-               (map (match-lambda
-                      ((src orig-name new-name)
-                       (with-directory-excursion "."
-                         (apply unpack (list #:source src))
-                         (apply patch-source-shebangs (list #:source src)))
-                       (delete-file-recursively new-name)
-                       (system* "mv" orig-name new-name)))
-                    `((,nanopass "nanopass-framework-scheme-1.9" "nanopass")
-                      (,stex "stex-1.2.1" "stex")))
-               ;; The Makefile wants to download and compile "zlib".  We patch
-               ;; it to use the one from our 'zlib' package.
-               (substitute* "configure"
-                 (("rmdir zlib .*$") "echo \"using system zlib\"\n"))
-               (substitute* (find-files "./c" "Mf-[a-zA-Z0-9.]+")
-                 (("\\$\\{Kernel\\}: \\$\\{kernelobj\\} \\.\\./zlib/libz\\.a")
-                  "${Kernel}: ${kernelobj}")
-                 (("ld ([-a-zA-Z0-9_${} ]+) \\.\\./zlib/libz\\.a" all args)
-                  (string-append "ld " args " " zlib-static "/lib/libz.a"))
-                 (("\\(cd \\.\\./zlib; ([-a-zA-Z0-9=./ ]+))")
-                  (which "true")))
-               (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"
-                                    ;;"|[a-zA-Z0-9.]+\\.ms" ; guile can't read
-                                    ")"))
-                 (("/bin/rm") (which "rm"))
-                 (("/bin/ln") (which "ln"))
-                 (("/bin/cp") (which "cp")))
-               (substitute* "makefiles/installsh"
-                 (("/bin/true") (which "true")))
-               (substitute* "stex/Makefile"
-                 (("PREFIX=/usr") (string-append "PREFIX=" out)))
-               (zero? (system* "./configure" "--threads"
-                               (string-append "--installprefix=" out))))))
-         ;; Installation of the documentation requires a running "chez".
-         (add-after 'install 'install-doc
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((bin (string-append (assoc-ref outputs "out") "/bin"))
-                   (doc (string-append (assoc-ref outputs "doc")
-                                       "/share/doc/" ,name "-" ,version)))
-               (setenv "HOME" (getcwd))
-               (setenv "PATH" (string-append (getenv "PATH") ":" bin))
-               (with-directory-excursion "stex"
-                 (system* "make" (string-append "BIN=" bin)))
-               (system* "make" "docs")
-               (with-directory-excursion "csug"
-                 (substitute* "Makefile"
-                   (("/tmp/csug9") doc))
-                 (system* "make" "install")
-                 (install-file "csug.pdf" doc))
-               (with-directory-excursion "release_notes"
-                 (install-file "release_notes.pdf" doc))
+           (lambda* (#:key inputs outputs
+                           (configure-flags '())
+                           #:allow-other-keys)
+             (let* ((zlib-static (assoc-ref inputs "zlib:static"))
+                    (lz4-static (assoc-ref inputs "lz4:static"))
+                    (out (assoc-ref outputs "out"))
+                    ;; add flags which are always required:
+                    (flags (cons*
+                            (string-append "--installprefix=" out)
+                            (string-append "ZLIB=" zlib-static "/lib/libz.a")
+                            (string-append "LZ4=" lz4-static "/lib/liblz4.a")
+                            ;; Guix will do compress man pages,
+                            ;; and letting Chez try causes an error
+                            "--nogzip-man-pages"
+                            configure-flags)))
+               (format #t "configure flags: ~s~%" flags)
+               ;; Some makefiles (for tests) don't seem to propagate CC
+               ;; properly, so we take it out of their hands:
+               (setenv "CC" ,(cc-for-target))
+               (apply invoke
+                      "./configure"
+                      flags)
                #t)))
-         ;; The binary file name is called "scheme" as the one from MIT/GNU
+         ;; The binary file name is called "scheme" as is the one from MIT/GNU
          ;; Scheme.  We add a symlink to use in case both are installed.
          (add-after 'install 'install-symlink
            (lambda* (#:key outputs #:allow-other-keys)
                                                    "/" name ".boot")))
                     (find-files lib "scheme.boot"))
                #t)))
-         (add-before 'reset-gzip-timestamps 'make-manpages-writable
-           (lambda* (#:key outputs #:allow-other-keys)
-             (map (lambda (file)
-                    (make-file-writable file))
-                  (find-files (string-append (assoc-ref outputs "out")
-                                             "/share/man")
-                              ".*\\.gz$"))
-             #t)))))
-    ;; According to the documentation MIPS is not supported.
-    ;; Cross-compiling for the Raspberry Pi is supported, but not native ARM.
+         ;; Building explicitly lets us avoid using substitute*
+         ;; to re-write makefiles.
+         (add-after 'install-symlink 'prepare-stex
+           (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+             (let* ((stex+version
+                     (strip-store-file-name
+                      (assoc-ref (or native-inputs inputs) "stex")))
+                    ;; Eventually we want to install stex as a real
+                    ;; package so it's reusable. For now:
+                    (stex-output "/tmp")
+                    (doc-dir (string-append stex-output
+                                            "/share/doc/"
+                                            stex+version)))
+               (with-directory-excursion "stex"
+                 (invoke "make"
+                         "install"
+                         (string-append "LIB="
+                                        stex-output
+                                        "/lib/"
+                                        stex+version)
+                         (string-append "Scheme="
+                                        (assoc-ref outputs "out")
+                                        "/bin/scheme"))
+                 (for-each (lambda (pth)
+                             (install-file pth doc-dir))
+                           '("ReadMe" ; includes the license
+                             "doc/stex.html"
+                             "doc/stex.css"
+                             "doc/stex.pdf"))
+                 #t))))
+         ;; Building the documentation requires stex and a running scheme.
+         ;; FIXME: this is probably wrong for cross-compilation
+         (add-after 'prepare-stex 'install-doc
+           (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+             (let* ((chez+version (strip-store-file-name
+                                   (assoc-ref outputs "out")))
+                    (stex+version
+                     (strip-store-file-name
+                      (assoc-ref (or native-inputs inputs) "stex")))
+                    (scheme (string-append (assoc-ref outputs "out")
+                                           "/bin/scheme"))
+                    ;; see note on stex-output in phase build-stex, above:
+                    (stexlib (string-append "/tmp"
+                                            "/lib/"
+                                            stex+version))
+                    (doc-dir (string-append (assoc-ref outputs "doc")
+                                            "/share/doc/"
+                                            chez+version)))
+               (define* (stex-make #:optional (suffix ""))
+                 (invoke "make"
+                         "install"
+                         (string-append "Scheme=" scheme)
+                         (string-append "STEXLIB=" stexlib)
+                         (string-append "installdir=" doc-dir suffix)))
+               (with-directory-excursion "csug"
+                 (stex-make "/csug"))
+               (with-directory-excursion "release_notes"
+                 (stex-make "/release_notes"))
+               (with-directory-excursion doc-dir
+                 (symlink "release_notes/release_notes.pdf"
+                          "release_notes.pdf")
+                 (symlink "csug/csug9_5.pdf"
+                          "csug.pdf"))
+               #t))))))
+    ;; Chez Scheme does not have a  MIPS backend.
+    ;; FIXME: Debian backports patches to get armhf working.
+    ;; We should too. It is the Chez machine type arm32le
+    ;; (no threaded version upstream yet, though there is in
+    ;; Racket's fork), more specifically (per the release notes) ARMv6.
     (supported-systems (fold delete %supported-systems
                              '("mips64el-linux" "armhf-linux")))
-    (home-page "http://www.scheme.com")
+    (home-page "https://cisco.github.io/ChezScheme/")
     (synopsis "R6RS Scheme compiler and run-time")
     (description
      "Chez Scheme is a compiler and run-time system for the language of the
@@ -236,19 +272,21 @@ and 32-bit PowerPC architectures.")
     (version "1.0")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append
-             "https://github.com/fedeinthemix/chez-srfi/archive"
-             "/v" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/fedeinthemix/chez-srfi")
+             (commit (string-append "v" version))))
        (sha256
-        (base32 "17i4wly7bcr5kb5hf04ljpbvv4r5hsr9xsmw650fj43z9jr303gs"))
-       (file-name (string-append name "-" version ".tar.gz"))))
+        (base32 "1vgn984mj2q4w6r2q66h7qklp2hrh85wwh4k9yisga5fi0ps7myf"))
+       (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (native-inputs
      `(("chez-scheme" ,chez-scheme)))
     (arguments
      `(#:make-flags (let ((out (assoc-ref %outputs "out")))
-                      (list (string-append "PREFIX=" out)))
+                      (list (string-append "PREFIX=" out)
+                            "CHEZ=chez-scheme --libdirs ./"
+                            (string-append "chezversion=" ,(package-version chez-scheme))))
        #:test-target "test"
        #:phases (modify-phases %standard-phases
                   (delete 'configure))))
@@ -263,22 +301,29 @@ and 32-bit PowerPC architectures.")
         (revision "1"))
     (package
       (name "chez-web")
-      ;; release 2.0 is different and doesn't work.
-      (version (string-append "2.0-" revision "."
-                              (string-take commit 7)))
+      ;; Release 2.0 is different and doesn't work.
+      (version (git-version "2.0" revision commit))
       (source
        (origin
          (method git-fetch)
          (uri (git-reference
-               (url "https://github.com/arcfide/ChezWEB.git")
+               (url "https://github.com/arcfide/ChezWEB")
                (commit commit)))
-         (file-name (string-append name "-" version "-checkout"))
+         (file-name (git-file-name name version))
          (sha256
           (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
       (build-system gnu-build-system)
       (native-inputs
        `(("chez-scheme" ,chez-scheme)
-         ("texlive" ,texlive)))
+         ("ghostscript" ,ghostscript)
+         ("texlive" ,(texlive-union (list texlive-latex-oberdiek
+                                          texlive-generic-epsf
+                                          texlive-metapost
+                                          texlive-fonts-charter
+                                          texlive-generic-pdftex
+                                          texlive-context-base
+                                          texlive-fonts-cm
+                                          texlive-tex-plain)))))
       (arguments
        `(#:make-flags (list (string-append "PREFIX=" %output)
                             (string-append "DOCDIR=" %output "/share/doc/"
@@ -288,6 +333,15 @@ and 32-bit PowerPC architectures.")
                       #:tests? #f        ; no tests
                       #:phases
                       (modify-phases %standard-phases
+                        (add-before 'build 'set-HOME
+                          (lambda _
+                            ;; FIXME: texlive-union does not find the built
+                            ;; metafonts, so it tries to generate them in HOME.
+                            (setenv "HOME" "/tmp")
+                            #t))
+                        ;; This package has a custom "bootstrap" script that
+                        ;; is meant to be run from the Makefile.
+                        (delete 'bootstrap)
                         (replace 'configure
                           (lambda* _
                             (copy-file "config.mk.template" "config.mk")
@@ -300,7 +354,8 @@ and 32-bit PowerPC architectures.")
                               (("\\./chezweave" all)
                                (string-append "chez-scheme --program " all)))
                             (substitute* "installit"
-                              (("-g \\$GROUP -o \\$OWNER") "")))))))
+                              (("-g \\$GROUP -o \\$OWNER") ""))
+                            #t)))))
       (home-page "https://github.com/arcfide/ChezWEB")
       (synopsis "Hygienic Literate Programming for Chez Scheme")
       (description "ChezWEB is a system for doing Knuthian style WEB
@@ -312,22 +367,21 @@ programming in Scheme.")
         (revision "1"))
     (package
       (name "chez-sockets")
-      (version (string-append "0.0-" revision "."
-                              (string-take commit 7)))
+      (version (git-version "0.0.0" revision commit))
       (source
        (origin
          (method git-fetch)
          (uri (git-reference
-               (url "https://github.com/arcfide/chez-sockets.git")
+               (url "https://github.com/arcfide/chez-sockets")
                (commit commit)))
-         (file-name (string-append name "-" version "-checkout"))
+         (file-name (git-file-name name version))
          (sha256
           (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
       (build-system gnu-build-system)
       (native-inputs
        `(("chez-scheme" ,chez-scheme)
          ("chez-web" ,chez-web)
-         ("texlive" ,texlive)))
+         ("texlive" ,(texlive-union (list texlive-generic-pdftex)))))
       (arguments
        `(#:tests? #f              ; no tests
          #:phases
@@ -343,11 +397,16 @@ programming in Scheme.")
                     (string-append var chez-h)))
                  #t)))
            (add-before 'build 'tangle
-             (lambda _
+             (lambda* (#:key inputs #:allow-other-keys)
+               (setenv "TEXINPUTS"
+                       (string-append
+                        (getcwd) ":"
+                        (assoc-ref inputs "chez-web") "/share/texmf-local/tex/generic:"
+                        ":"))
                ;; just using "make" tries to build the .c files before
                ;; they are created.
-               (and (zero? (system* "make" "sockets"))
-                    (zero? (system* "make")))))
+               (and (invoke "make" "sockets")
+                    (invoke "make"))))
            (replace 'build
              (lambda* (#:key outputs inputs #:allow-other-keys)
                (let* ((out (assoc-ref outputs "out"))
@@ -401,9 +460,13 @@ Chez Scheme.")
 ;; files.
 (define (chez-make-flags name version)
   `(let ((out (assoc-ref %outputs "out")))
-     (list (string-append "PREFIX=" out)
-           (string-append "DOCDIR=" out "/share/doc/"
-                          ,name "-" ,version))))
+     (list
+      ;; Set 'chezversion' so that libraries are installed in
+      ;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
+      (string-append "chezversion=" ,(package-version chez-scheme))
+      (string-append "PREFIX=" out)
+      (string-append "DOCDIR=" out "/share/doc/"
+                     ,name "-" ,version))))
 
 (define-public chez-matchable
   (package
@@ -412,11 +475,13 @@ Chez Scheme.")
     (home-page "https://github.com/fedeinthemix/chez-matchable")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append home-page "/archive" "/v" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url home-page)
+             (commit (string-append "v" version))))
        (sha256
-        (base32 "0cl4vc6487pikjq159pj4n5ghyaax31nywb5n4yn1682h3ir1hs0"))
-       (file-name (string-append name "-" version ".tar.gz"))))
+        (base32 "02qn7x348p23z1x5lwhkyj7i8z6mgwpzpnwr8dyina0yzsdkr71s"))
+       (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (inputs
      `(("chez-srfi" ,chez-srfi))) ; for tests
@@ -439,13 +504,13 @@ Chez Scheme.")
     (version "0.9.4")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append
-             "https://github.com/fedeinthemix/chez-irregex/archive"
-             "/v" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/fedeinthemix/chez-irregex")
+             (commit (string-append "v" version))))
        (sha256
-        (base32 "0ywy5syaw549a58viz68dmgnv756ic705rcnlqxgjq27lnaim53b"))
-       (file-name (string-append name "-" version ".tar.gz"))))
+        (base32 "0jh6piylw545j81llay9wfivgpv6lcnwd81gm4w17lkasslir50q"))
+       (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (inputs
      `(("chez-matchable" ,chez-matchable))) ; for tests
@@ -491,10 +556,10 @@ syntax, with various aliases for commonly used patterns.")
          (replace 'configure ,chez-configure)
          (replace 'build
            (lambda* (#:key (make-flags '()) #:allow-other-keys)
-             (zero? (apply system* "make" "chez-build" make-flags))))
+             (apply invoke "make" "chez-build" make-flags)))
          (replace 'install
            (lambda* (#:key (make-flags '()) #:allow-other-keys)
-             (zero? (apply system* "make" "chez-install" make-flags)))))))
+             (apply invoke "make" "chez-install" make-flags))))))
     (home-page "http://synthcode.com/scheme/fmt")
     (synopsis "Combinator formatting library for Chez Scheme")
     (description "This package provides a library of procedures for
@@ -511,14 +576,16 @@ strings.")
     (home-page "https://github.com/fedeinthemix/chez-mit")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append home-page "/archive/v" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url home-page)
+             (commit (string-append "v" version))))
        (sha256
-        (base32 "1p11q061znwxzxrxg3vw4dbsnpv1dav12hjhnkrjnzyyjvvdm2kn"))
-       (file-name (string-append name "-" version ".tar.gz"))))
+        (base32 "0c7i3b6i90xk96nmxn1pc9272a4yal4v40dm1a4ybdi87x53zkk0"))
+       (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (inputs
-     `(("chez-srfi" ,chez-srfi))) ; for tests
+     `(("chez-srfi" ,chez-srfi)))       ; for tests
     (native-inputs
      `(("chez-scheme" ,chez-scheme)))
     (arguments
@@ -529,7 +596,7 @@ strings.")
     (synopsis "MIT/GNU Scheme compatibility library for Chez Scheme")
     (description "This package provides a set of MIT/GNU Scheme compatibility
 libraries for Chez Scheme.  The main goal was to provide the functionality
-required to port the program 'Scmutils' to Chez Scheme.")
+required to port the program @code{Scmutils} to Chez Scheme.")
     (license gpl3+)))
 
 (define-public chez-scmutils
@@ -539,14 +606,16 @@ required to port the program 'Scmutils' to Chez Scheme.")
     (home-page "https://github.com/fedeinthemix/chez-scmutils")
     (source
      (origin
-       (method url-fetch)
-       (uri (string-append home-page "/archive/v" version ".tar.gz"))
+       (method git-fetch)
+       (uri (git-reference
+             (url home-page)
+             (commit (string-append "v" version))))
        (sha256
-        (base32 "1a5j61pggaiwl1gl6m038rcy5n8r2sj5nyjmz86jydx97mm5i8hj"))
-       (file-name (string-append name "-" version ".tar.gz"))))
+        (base32 "0lb05wlf8qpgg8y0gdsyaxg1nbfx1qbaqdjvygrp64ndn8fnhq7l"))
+       (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (inputs
-     `(("chez-srfi" ,chez-srfi)))      ; for tests
+     `(("chez-srfi" ,chez-srfi)))       ; for tests
     (native-inputs
      `(("chez-scheme" ,chez-scheme)))
     (propagated-inputs
@@ -554,7 +623,7 @@ required to port the program 'Scmutils' to Chez Scheme.")
        ("chez-srfi" ,chez-srfi)))
     (arguments
      `(#:make-flags ,(chez-make-flags name version)
-       #:tests? #f ; no test suite
+       #:tests? #f                      ; no test suite
        #:phases
        (modify-phases %standard-phases
          (replace 'configure ,chez-configure)
@@ -566,7 +635,7 @@ required to port the program 'Scmutils' to Chez Scheme.")
          (delete 'build)
          (add-after 'install 'install-src
            (lambda* (#:key (make-flags '()) #:allow-other-keys)
-             (zero? (apply system* "make" "install-src" make-flags))))
+             (apply invoke "make" "install-src" make-flags)))
          (add-after 'install-src 'absolute-path-in-scm-files
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
@@ -586,12 +655,13 @@ required to port the program 'Scmutils' to Chez Scheme.")
              (let* ((out (assoc-ref outputs "out"))
                     (mk-file (car (find-files out "Makefile"))))
                (with-directory-excursion (dirname mk-file)
-                 (zero? (apply system* "make" "build" make-flags))))))
+                 (apply invoke "make" "build" make-flags)))))
          (add-after 'build 'clean-up
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out")))
                (for-each delete-file
-                         (find-files out "Makefile|compile-all\\.ss"))))))))
+                         (find-files out "Makefile|compile-all\\.ss"))
+               #t))))))
     (synopsis "Port of MIT/GNU Scheme Scmutils to Chez Scheme")
     (description "This package provides a port of the MIT/GNU Scheme
 Scmutils program to Chez Scheme.  The port consists of a set of