guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#53878] [PATCH v2 08/15] gnu: chez-scheme: Explicitly package bootst


From: Philip McGrath
Subject: [bug#53878] [PATCH v2 08/15] gnu: chez-scheme: Explicitly package bootstrap bootfiles.
Date: Thu, 17 Feb 2022 15:50:41 -0500

This might seem a bit silly in isolation, but it makes the structure of
the upstream Chez Scheme package the same as for the Racket variant, it
sets things up for (one day, hopefully) actually being able to bootstrap
the upstream Chez Scheme bootfiles, and it may be useful for
cross-compilation and adding support for architectures without pre-built
bootfiles from upstream.

* gnu/packages/chez-and-racket-bootstrap.scm
(chez-scheme-bootstrap-bootfiles): New variable.
(chez-scheme)[native-inputs]: Add it.
[arguments]<#:phases>: Add 'unpack-bootfiles'.
---
 gnu/packages/chez-and-racket-bootstrap.scm | 51 +++++++++++++++++++++-
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/chez-and-racket-bootstrap.scm 
b/gnu/packages/chez-and-racket-bootstrap.scm
index d66955d50d..366815634d 100644
--- a/gnu/packages/chez-and-racket-bootstrap.scm
+++ b/gnu/packages/chez-and-racket-bootstrap.scm
@@ -187,7 +187,7 @@ (define-public chez-scheme
               (sha256
                (base32
                 "07s433hn1z2slfc026sidrpzxv3a8narcd40qqr1xrpb9012xdky"))
-              (file-name (git-file-name name version))
+              (file-name (git-file-name "chez-scheme" version))
               (snippet #~(begin
                            (use-modules (guix build utils))
                            (for-each (lambda (dir)
@@ -207,7 +207,9 @@ (define-public chez-scheme
       ;; 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-inputs (list chez-scheme-bootstrap-bootfiles
+                         chez-nanopass-bootstrap
+                         stex-bootstrap))
     (native-search-paths
      (list (search-path-specification
             (variable "CHEZSCHEMELIBDIRS")
@@ -237,6 +239,14 @@ (define-public chez-scheme
                 (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 (or native-inputs 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`.
@@ -321,6 +331,43 @@ (define* (stex-make #:optional (suffix ""))
 and 32-bit PowerPC architectures.")
     (license 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
+     ;; Upstream only distributes pre-built bootfiles for
+     ;; arm32le and t?(i3|a6)(le|nt|osx)
+     (filter (lambda (system)
+               (let ((machine (and=> (nix-system->chez-machine system)
+                                     chez-machine->nonthreaded)))
+                 (or (equal? "arm32le" machine)
+                     (and machine
+                          (member (substring machine 0 2) '("i3" "a6"))
+                          (or-map (cut string-suffix? <> machine)
+                                  '("le" "nt" "osx"))))))
+             %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 upsream
+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:
 ;;
-- 
2.32.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]