Subject: [bug#57050] [PATCH v2 04/13] gnu: Add Zuo.

From: Liliana Marie Prikler <[email-masked]>
Date: Thu, 11 Aug 2022 13:31:12 +0200

Am Donnerstag, dem 11.08.2022 um 07:08 -0400 schrieb Philip McGrath:
> [...]
>  
>  (define %racket-version "8.5") ; Remember to update chez-scheme-for-
> racket!
> +(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c
Is that publicly visible?
>  (define %racket-commit
>    (string-append "v" %racket-version))
>  (define %racket-origin
> @@ -233,6 +234,69 @@ (define %racket-origin
>           ;; Unbundle libffi.
>           (delete-file-recursively
> "racket/src/bc/foreign/libffi")))))
>  
> +
> +(define-public zuo
> +  (let ((revision #f))
> +    (package
> +      (name "zuo")
> +      (version (string-append %zuo-version
> +                              "-racket"
> +                              "8.6"
> +                              (if revision "-guix" "")
> +                              (or revision "")))
Is this really needed?  If we expect to maintain zuo split from racket,
I'd rather go with https://github.com/racket/zuo and git-version.
> +      (source
> +       (origin
> +         (inherit %racket-origin)
> +         (uri (git-reference
> +               (url "https://github.com/racket/racket")
> +               (commit "v8.6")))
> +         (sha256
> +          (base32
> "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk"))
> +         (patches (append (origin-patches %racket-origin)
> +                          (search-patches "racket-backport-8.6-
> zuo.patch"
> +                                          "racket-zuo-bin-
> sh.patch")))
> +         (file-name (git-file-name "racket" "8.6"))))
> +      (outputs '("out" "debug"))
> +      (build-system gnu-build-system)
> +      (inputs (list bash-minimal))
> +      (native-inputs (list bash-minimal))
> +      (arguments
> +       (list
> +        #:configure-flags
> +        #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH="
> +                            #$(file-append (this-package-input
> "bash-minimal")
> +                                           "/bin/sh"))
As with chez-scheme, I do think using a Racket-agnostic macro name is
helpful here.
> +            #+@(if (%current-target-system)
> +                   (list #~,(string-append
> +                             "CPPFLAGS_FOR_BUILD=-
> DGUIX_RKTIO_BIN_SH="
> +                             #+(file-append
> +                                (this-package-native-input "bash-
> minimal")
> +                                "/bin/sh")))
> +                   '()))
> +        #:out-of-source? #t
> +        #:phases
> +        #~(modify-phases %standard-phases
> +            (add-after 'unpack 'chdir
> +              (lambda args
> +                (chdir "racket/src/zuo"))))))
> +      (home-page "https://github.com/racket/zuo")
> +      ;; ^ This is downstream of https://github.com/racket/racket,
> +      ;; but it's designed to be a friendly landing place
> +      (synopsis "Tiny Racket for build scripts")
> +      (description "You should use Racket to write scripts.
Sorry, but I prefer Guile.

>   But what if you
> +need something much smaller than Racket for some reason—or what if
> you're
> +trying to script a build of Racket itself?  Zuo is a tiny Racket
> with
> +primitives for dealing with files and running processes, and it
> comes with a
> +@command{make}-like embedded DSL.
> +
> +Zuo (作) is a Racket variant in the sense that program files start
> with
> +@code{#lang}, and the module path after @code{#lang} determines the
> parsing
> +and expansion of the file content.  That's how the @command{make}-
> like DSL is
> +defined, and even the base Zuo language is defined by layers of
> @code{#lang}s.
> +One of the early layers implements macros.")
> +      (license (list license:asl2.0 license:expat)))))
Rarely have I read a description this long, yet uninformative.  Let me
shorten that a little: "Zuo is a tiny Racket variant that can be used
to bootstrap Racket.  It comes with primitives for dealing with files
and processes, as well as a @command{make}-like DSL."

Cheers