[bug#70065,v2,3/8] gnu: chez-scheme: Reorganize package definitions.
Commit Message
A future commit will change 'chez-scheme' to inherit from
'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be
defined before 'chez-scheme'. In an attempt to produce better diffs,
this commit re-orders the definitions while keeping their contents
exactly the same.
* gnu/packages/chez.scm (chez-scheme): Move below
'chez-scheme-for-racket'.
(chez-scheme-bootstrap-bootfiles): Move below
'chez-scheme-for-racket-bootstrap-bootfiles'.
Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e
---
gnu/packages/chez.scm | 426 +++++++++++++++++++++---------------------
1 file changed, 213 insertions(+), 213 deletions(-)
Comments
Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
> A future commit will change 'chez-scheme' to inherit from
> 'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be
> defined before 'chez-scheme'. In an attempt to produce better diffs,
> this commit re-orders the definitions while keeping their contents
> exactly the same.
>
> * gnu/packages/chez.scm (chez-scheme): Move below
> 'chez-scheme-for-racket'.
> (chez-scheme-bootstrap-bootfiles): Move below
> 'chez-scheme-for-racket-bootstrap-bootfiles'.
>
> Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e
> ---
I don't understand this direction. Why have chez-scheme inherit from
chez-scheme-for-racket? Even if Racket itself pins a particular
version instead of an upstream release (which, let's face it, would be
the wiser option here), or requires a special build (again, why?) I
think keeping the inheritance in the other direction makes ontological
sense moreso than whatever we're starting here.
Cheers
Hi Liliana,
On 4/1/24 11:40, Liliana Marie Prikler wrote:
> Am Montag, dem 01.04.2024 um 02:51 -0400 schrieb Philip McGrath:
>> A future commit will change 'chez-scheme' to inherit from
>> 'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be
>> defined before 'chez-scheme'. In an attempt to produce better diffs,
>> this commit re-orders the definitions while keeping their contents
>> exactly the same.
>>
>> * gnu/packages/chez.scm (chez-scheme): Move below
>> 'chez-scheme-for-racket'.
>> (chez-scheme-bootstrap-bootfiles): Move below
>> 'chez-scheme-for-racket-bootstrap-bootfiles'.
>>
>> Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e
>> ---
> I don't understand this direction. Why have chez-scheme inherit from
> chez-scheme-for-racket? Even if Racket itself pins a particular
> version instead of an upstream release (which, let's face it, would be
> the wiser option here), or requires a special build (again, why?) I
> think keeping the inheritance in the other direction makes ontological
> sense moreso than whatever we're starting here.
>
> Cheers
We will be using chez-scheme-for-racket to bootstrap chez-scheme. (For
more rationale, see the comments added to chez.scm in [v2 8/8].) While
it is possible to have package inheritance go in the opposite direction
as bootstrapping, my experience before
daa91a49b2914343afdfcdbea9a22c9d062ba185 was that it was very confusing
and often triggered unnecessary rebuilds. In this case, it avoids
potentially rebuilding the entire Racket world when there's a Chez
Scheme release. (Bootstrapping chez-scheme really does depend on at
least racket-vm-bc, so we can't avoid rebuilding the Chez Scheme world
when there's a Racket release.)
Matthew Flatt wrote in <https://racket.discourse.group/t/2739/3>:
> I imagine that Racket's copy of Chez Scheme will be more
> conventionally vendored and aligned with Chez Scheme releases one day,
> but I don't think we're ready to move to that mode in the near future.
I wasn't involved in his efforts together with the other Chez Scheme
maintainers to merge Racket's changes and to keep development in sync
going forward, but offhand I can think of both social and technical
reasons that the approach they've chosen for now makes sense to me.
Thanks,
Philip
@@ -282,191 +282,6 @@ (define unpack-nanopass
"lib/chez-scheme/nanopass.ss"))
"nanopass"))))
-(define-public chez-scheme
- (package
- (name "chez-scheme")
- ;; The version should match `(scheme-version-number)`.
- ;; See s/cmacros.ss c. line 360.
- (version "9.5.8")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/cisco/ChezScheme")
- (commit (string-append "v" version))))
- (sha256
- (base32
- "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
- (file-name (git-file-name name version))
- (patches (search-patches "chez-scheme-bin-sh.patch"))
- (snippet #~(begin
- (use-modules (guix build utils))
- ;; TODO: consider putting this in a (guix ...) or
- ;; (guix build ...) module so it can be shared
- ;; with the Racket origin without cyclic issues.
- (for-each (lambda (dir)
- (when (directory-exists? dir)
- (delete-file-recursively dir)))
- '("stex"
- "nanopass"
- "lz4"
- "zlib"))))))
- (build-system gnu-build-system)
- (inputs
- (list
- chez-scheme-bootstrap-bootfiles
- `(,util-linux "lib") ;<-- libuuid
- zlib
- lz4
- ncurses ;<-- for expeditor
- ;; for X11 clipboard support in expeditor:
- ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
- libx11))
- (native-inputs (list chez-nanopass-bootstrap
- stex-bootstrap))
- (native-search-paths
- (list (search-path-specification
- (variable "CHEZSCHEMELIBDIRS")
- (files '("lib/chez-scheme")))))
- (outputs '("out" "doc"))
- (arguments
- (list
- #:modules
- '((guix build gnu-build-system)
- (guix build utils)
- (ice-9 ftw)
- (ice-9 match))
- #:test-target "test"
- #:configure-flags
- #~`(,(string-append "--installprefix=" #$output)
- #$@(if (and=> (chez-upstream-features-for-system)
- (cut memq 'threads <>))
- #~("--threads")
- #~())
- "ZLIB=-lz"
- "LZ4=-llz4"
- "--libkernel"
- ;; Guix will do 'compress-man-pages',
- ;; and letting Chez try causes an error
- "--nogzip-man-pages")
- #:phases
- #~(modify-phases %standard-phases
- (add-after 'unpack 'unpack-nanopass+stex
- (lambda args
- (begin
- (copy-recursively
- (dirname (search-input-file %build-inputs
- "lib/chez-scheme/nanopass.ss"))
- "nanopass"
- #:keep-mtime? #t)
- (mkdir-p "stex")
- (with-output-to-file "stex/Mf-stex"
- (lambda ()
- ;; otherwise, it will try to download submodules
- (display "# to placate ../configure"))))))
- (add-after 'unpack-nanopass+stex 'unpack-bootfiles
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (when (directory-exists? "boot")
- (delete-file-recursively "boot"))
- (copy-recursively
- (search-input-directory inputs
- "lib/chez-scheme-bootfiles")
- "boot")))
- ;; NOTE: The custom Chez 'configure' script doesn't allow
- ;; unrecognized flags, such as those automatically added
- ;; by `gnu-build-system`. This replacement phase uses only
- ;; the explicitly provided `#:configure-flags`.
- (replace 'configure
- (lambda* (#:key inputs (configure-flags '()) out-of-source?
- #:allow-other-keys)
- (let* ((abs-srcdir (getcwd))
- (srcdir (if out-of-source?
- (string-append "../" (basename abs-srcdir))
- ".")))
- (format #t "source directory: ~s (relative from build: ~s)~%"
- abs-srcdir srcdir)
- (if out-of-source?
- (begin
- (mkdir "../build")
- (chdir "../build")))
- (format #t "build directory: ~s~%" (getcwd))
- (format #t "configure flags: ~s~%" configure-flags)
- (apply invoke
- (string-append srcdir "/configure")
- configure-flags))))
- (add-after 'configure 'configure-environment-variables
- (lambda args
- ;; Some makefiles (for tests) don't seem to propagate CC
- ;; properly, so we take it out of their hands:
- (setenv "CC" #$(cc-for-target))
- ;; Likewise, some tests have needed HOME to be set:
- (setenv "HOME" "/tmp")))
- ;; 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)
- (let* ((scheme (search-input-file outputs "/bin/scheme"))
- (bin-dir (dirname scheme)))
- (symlink scheme
- (string-append bin-dir "/chez-scheme"))
- (match (find-files (string-append bin-dir "/../lib")
- "scheme.boot")
- ((scheme.boot)
- (symlink scheme.boot
- (string-append (dirname scheme.boot)
- "/chez-scheme.boot")))))))
- ;; Building the documentation requires stex and a running scheme.
- (add-after 'install-symlink 'install-docs
- (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
- (let* ((doc-prefix (or (assoc-ref outputs "doc")
- (assoc-ref outputs "out")))
- (chez+version (strip-store-file-name #$output))
- (scheme (search-input-file outputs "/bin/scheme"))
- (stexlib (search-input-directory (or native-inputs
- inputs)
- "/lib/stex"))
- (doc-dir (string-append doc-prefix
- "/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")))))
- (add-after 'install-docs 'link-doc-pdfs
- ;; otherwise, it's hard to notice them in a forest of HTML files
- (lambda* (#:key outputs #:allow-other-keys)
- (with-directory-excursion
- (string-append (or (assoc-ref outputs "doc")
- (assoc-ref outputs "out"))
- "/share/doc/"
- (strip-store-file-name #$output))
- (symlink "release_notes/release_notes.pdf"
- "release_notes.pdf")
- (match (find-files "csug"
- "csug.*\\.pdf$" ;; embeded version number
- #:fail-on-error? #t)
- ((pth)
- (symlink pth
- "csug.pdf")))))))))
- (supported-systems
- (delete
- "armhf-linux" ;; XXX reportedly broken, needs checking
- (filter chez-upstream-features-for-system
- %supported-systems)))
- (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
-Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
-generates native code for each target processor, with support for x86, x86_64,
-and 32-bit PowerPC architectures.")
- (license asl2.0)))
-
(define chez-configure
;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
;; as those automatically added by `gnu-build-system`. This replacement
@@ -689,39 +504,194 @@ (define-public chez-scheme-for-racket
version of Chez Scheme.")
(license asl2.0)))
-;;
-;; Bootfiles:
-;;
-
-(define-public chez-scheme-bootstrap-bootfiles
+(define-public chez-scheme
(package
- (inherit chez-scheme)
- (name "chez-scheme-bootstrap-bootfiles")
- (inputs '())
- (native-inputs '())
- (outputs '("out"))
- (build-system copy-build-system)
- ;; TODO: cross compilation
+ (name "chez-scheme")
+ ;; The version should match `(scheme-version-number)`.
+ ;; See s/cmacros.ss c. line 360.
+ (version "9.5.8")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cisco/ChezScheme")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32
+ "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
+ (file-name (git-file-name name version))
+ (patches (search-patches "chez-scheme-bin-sh.patch"))
+ (snippet #~(begin
+ (use-modules (guix build utils))
+ ;; TODO: consider putting this in a (guix ...) or
+ ;; (guix build ...) module so it can be shared
+ ;; with the Racket origin without cyclic issues.
+ (for-each (lambda (dir)
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib"))))))
+ (build-system gnu-build-system)
+ (inputs
+ (list
+ chez-scheme-bootstrap-bootfiles
+ `(,util-linux "lib") ;<-- libuuid
+ zlib
+ lz4
+ ncurses ;<-- for expeditor
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ libx11))
+ (native-inputs (list chez-nanopass-bootstrap
+ stex-bootstrap))
+ (native-search-paths
+ (list (search-path-specification
+ (variable "CHEZSCHEMELIBDIRS")
+ (files '("lib/chez-scheme")))))
+ (outputs '("out" "doc"))
(arguments
- (list #:install-plan
- #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+ (list
+ #:modules
+ '((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 ftw)
+ (ice-9 match))
+ #:test-target "test"
+ #:configure-flags
+ #~`(,(string-append "--installprefix=" #$output)
+ #$@(if (and=> (chez-upstream-features-for-system)
+ (cut memq 'threads <>))
+ #~("--threads")
+ #~())
+ "ZLIB=-lz"
+ "LZ4=-llz4"
+ "--libkernel"
+ ;; Guix will do 'compress-man-pages',
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda args
+ (begin
+ (copy-recursively
+ (dirname (search-input-file %build-inputs
+ "lib/chez-scheme/nanopass.ss"))
+ "nanopass"
+ #:keep-mtime? #t)
+ (mkdir-p "stex")
+ (with-output-to-file "stex/Mf-stex"
+ (lambda ()
+ ;; otherwise, it will try to download submodules
+ (display "# to placate ../configure"))))))
+ (add-after 'unpack-nanopass+stex 'unpack-bootfiles
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (when (directory-exists? "boot")
+ (delete-file-recursively "boot"))
+ (copy-recursively
+ (search-input-directory inputs
+ "lib/chez-scheme-bootfiles")
+ "boot")))
+ ;; NOTE: The custom Chez 'configure' script doesn't allow
+ ;; unrecognized flags, such as those automatically added
+ ;; by `gnu-build-system`. This replacement phase uses only
+ ;; the explicitly provided `#:configure-flags`.
+ (replace 'configure
+ (lambda* (#:key inputs (configure-flags '()) out-of-source?
+ #:allow-other-keys)
+ (let* ((abs-srcdir (getcwd))
+ (srcdir (if out-of-source?
+ (string-append "../" (basename abs-srcdir))
+ ".")))
+ (format #t "source directory: ~s (relative from build: ~s)~%"
+ abs-srcdir srcdir)
+ (if out-of-source?
+ (begin
+ (mkdir "../build")
+ (chdir "../build")))
+ (format #t "build directory: ~s~%" (getcwd))
+ (format #t "configure flags: ~s~%" configure-flags)
+ (apply invoke
+ (string-append srcdir "/configure")
+ configure-flags))))
+ (add-after 'configure 'configure-environment-variables
+ (lambda args
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" #$(cc-for-target))
+ ;; Likewise, some tests have needed HOME to be set:
+ (setenv "HOME" "/tmp")))
+ ;; 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)
+ (let* ((scheme (search-input-file outputs "/bin/scheme"))
+ (bin-dir (dirname scheme)))
+ (symlink scheme
+ (string-append bin-dir "/chez-scheme"))
+ (match (find-files (string-append bin-dir "/../lib")
+ "scheme.boot")
+ ((scheme.boot)
+ (symlink scheme.boot
+ (string-append (dirname scheme.boot)
+ "/chez-scheme.boot")))))))
+ ;; Building the documentation requires stex and a running scheme.
+ (add-after 'install-symlink 'install-docs
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((doc-prefix (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out")))
+ (chez+version (strip-store-file-name #$output))
+ (scheme (search-input-file outputs "/bin/scheme"))
+ (stexlib (search-input-directory (or native-inputs
+ inputs)
+ "/lib/stex"))
+ (doc-dir (string-append doc-prefix
+ "/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")))))
+ (add-after 'install-docs 'link-doc-pdfs
+ ;; otherwise, it's hard to notice them in a forest of HTML files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (with-directory-excursion
+ (string-append (or (assoc-ref outputs "doc")
+ (assoc-ref outputs "out"))
+ "/share/doc/"
+ (strip-store-file-name #$output))
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (match (find-files "csug"
+ "csug.*\\.pdf$" ;; embeded version number
+ #:fail-on-error? #t)
+ ((pth)
+ (symlink pth
+ "csug.pdf")))))))))
(supported-systems
- (filter (lambda (system)
- (and=> (chez-upstream-features-for-system system)
- (cut memq 'bootstrap-bootfiles <>)))
- %supported-systems))
- (synopsis "Chez Scheme bootfiles (binary seed)")
+ (delete
+ "armhf-linux" ;; XXX reportedly broken, needs checking
+ (filter chez-upstream-features-for-system
+ %supported-systems)))
+ (home-page "https://cisco.github.io/ChezScheme/")
+ (synopsis "R6RS Scheme compiler and run-time")
(description
- "Chez Scheme is a self-hosting compiler: building it requires
-``bootfiles'' containing the Scheme-implemented portions compiled for the
-current platform. (Chez can then cross-compile bootfiles for all other
-supported platforms.)
+ "Chez Scheme is a compiler and run-time system for the language of the
+Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
+generates native code for each target processor, with support for x86, x86_64,
+and 32-bit PowerPC architectures.")
+ (license asl2.0)))
-This package provides bootstrap bootfiles for upstream Chez Scheme.
-Currently, it simply packages the binaries checked in to the upstream
-repository. Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
-work with upstream Chez Scheme so that we can bootstrap these files from
-source.")))
+;;
+;; Bootfiles:
+;;
(define-public chez-scheme-for-racket-bootstrap-bootfiles
(package
@@ -803,6 +773,36 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
7.1 and later, including the Racket BC variant.")
(license asl2.0)))
+(define-public chez-scheme-bootstrap-bootfiles
+ (package
+ (inherit chez-scheme)
+ (name "chez-scheme-bootstrap-bootfiles")
+ (inputs '())
+ (native-inputs '())
+ (outputs '("out"))
+ (build-system copy-build-system)
+ ;; TODO: cross compilation
+ (arguments
+ (list #:install-plan
+ #~`(("boot/" "lib/chez-scheme-bootfiles"))))
+ (supported-systems
+ (filter (lambda (system)
+ (and=> (chez-upstream-features-for-system system)
+ (cut memq 'bootstrap-bootfiles <>)))
+ %supported-systems))
+ (synopsis "Chez Scheme bootfiles (binary seed)")
+ (description
+ "Chez Scheme is a self-hosting compiler: building it requires
+``bootfiles'' containing the Scheme-implemented portions compiled for the
+current platform. (Chez can then cross-compile bootfiles for all other
+supported platforms.)
+
+This package provides bootstrap bootfiles for upstream Chez Scheme.
+Currently, it simply packages the binaries checked in to the upstream
+repository. Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
+work with upstream Chez Scheme so that we can bootstrap these files from
+source.")))
+
;;
;; Chez's bootstrap dependencies:
;;