From patchwork Sun Feb 20 06:06:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 37370 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 93FA627BBF0; Sun, 20 Feb 2022 06:08:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 79A8727BBEE for ; Sun, 20 Feb 2022 06:08:34 +0000 (GMT) Received: from localhost ([::1]:59788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLfOb-0006Uw-KR for patchwork@mira.cbaines.net; Sun, 20 Feb 2022 01:08:33 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50052) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLfOA-000639-Fu for guix-patches@gnu.org; Sun, 20 Feb 2022 01:08:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:37088) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLfO7-00048w-FM for guix-patches@gnu.org; Sun, 20 Feb 2022 01:08:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nLfO7-0005XL-Bk; Sun, 20 Feb 2022 01:08:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH v4 11/15] gnu: Add chez-scheme-for-racket. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: philip@philipmcgrath.com, guix-patches@gnu.org Resent-Date: Sun, 20 Feb 2022 06:08:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53878 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53878@debbugs.gnu.org, Liliana Marie Prikler , Ludovic =?utf-8?q?Co?= =?utf-8?q?urt=C3=A8s?= Cc: Attila Lendvai , Malte Gerdes , raingloom , zimoun , Philip McGrath X-Debbugs-Original-Xcc: Philip McGrath Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164533723721071 (code B ref 53878); Sun, 20 Feb 2022 06:08:03 +0000 Received: (at 53878) by debbugs.gnu.org; 20 Feb 2022 06:07:17 +0000 Received: from localhost ([127.0.0.1]:59203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLfNM-0005Tg-BQ for submit@debbugs.gnu.org; Sun, 20 Feb 2022 01:07:16 -0500 Received: from mail-qv1-f47.google.com ([209.85.219.47]:42734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLfNB-0005Ma-1s for 53878@debbugs.gnu.org; Sun, 20 Feb 2022 01:07:05 -0500 Received: by mail-qv1-f47.google.com with SMTP id e22so23827639qvf.9 for <53878@debbugs.gnu.org>; Sat, 19 Feb 2022 22:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5PMC+szkO1rOVGCQARJBH0mRv7wpQ+x6PhOjZiSrMvI=; b=iBlM+i0f26pH/sin6RwAmsz56Ojx28Ui/Woue157VrdLa3Ui6f1Gzk52rd0voy4zCb 3Q9x1r+7DKeUgaovet/ktpAuJnaDfFwPnuFdc9Wseut8sf/9jFgRCE+1ifqoOjqScX1R YU5BM28fZ/pbGD5XDz1w6MA//HLqZ1JacJI/tcK/M1oiCJoQTGlFyJdkXBmRPfVQ9DL0 gGzULsHYZqSPSU98oBxOqJt3R/6+phto4s9NXBW7mlsuqmdIYzZLO509bxUMOtgyE9Gf mlVUzdELBClMQbDkNbxSnN7IwMaTIzZlWUp0nZqcoLdTYePIgovdJijPY5IlSxOknqh1 7EOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5PMC+szkO1rOVGCQARJBH0mRv7wpQ+x6PhOjZiSrMvI=; b=MsmoTmXEpIQRLsWgKdPUxfNU4O/EUMl9fJ5sVXKRQjNJvj0SXHaFvZNxF5bKF4pP0R 4lTyAPT3i1Gm4DkSmhpQJYcppBFOfnWFnbkDILwlP8OSTGgDdVTqvlSz4x5BAQeaIRWz 4SS6j66V2zh2QvwUqwwLmfo5rmbMTigemmcGVFiIhihDTg8mcNs8TizxoeHhkO/Y0Aw5 /dsOzIFnisMeGeGOW1F6AmzVQ+rq7lOpAiO/35U2ZZPola3QbYUbwmQztlY3Mcw5Xn/8 gbT8vBIJ7YbLDDEfcyGInhkIjmqRdJqC6TghwvvZGWbbUO58ZHSULcTSnH1P4LVDPp7d IZug== X-Gm-Message-State: AOAM5320bB4n3cvLTwtowHFzLklztl4V/QaseOtT8R8oDBZrQK5fmjJH 4eI/hatK4fUomHLh4uDWKSmEHpxN5sL7jgTY+FU= X-Google-Smtp-Source: ABdhPJxwzyncrofZqnFX33PR9pvKvqJf8lD8/YD2QPxlgYEX8gbV/loSqqxGa4ssPLCwM+YtruE1tw== X-Received: by 2002:ac8:5850:0:b0:2dd:9260:c4f9 with SMTP id h16-20020ac85850000000b002dd9260c4f9mr10657527qth.446.1645337219613; Sat, 19 Feb 2022 22:06:59 -0800 (PST) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id c7sm9000089qtp.61.2022.02.19.22.06.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Feb 2022 22:06:59 -0800 (PST) From: Philip McGrath Date: Sun, 20 Feb 2022 01:06:06 -0500 Message-Id: <20220220060610.178131-12-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220220060610.178131-1-philip@philipmcgrath.com> References: <20220208151316.1897345-1-philip@philipmcgrath.com> <20220220060610.178131-1-philip@philipmcgrath.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches The Racket variant of Chez Scheme can be used to support platforms that are not yet supported by upstream Chez Scheme. * gnu/packages/chez-and-racket-bootstrap.scm (unpack-nanopass+stex): (chez-scheme-for-racket): (chez-scheme-for-racket-bootstrap-bootfiles): New variables. (chez-scheme)[arguments]<#:phases>: Adapt 'unpack-nanopass+stex' phase to use the eponymous new variable. --- gnu/packages/chez-and-racket-bootstrap.scm | 132 +++++++++++++++++++-- 1 file changed, 121 insertions(+), 11 deletions(-) diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm index 2f649fe67f..25f1ff52f8 100644 --- a/gnu/packages/chez-and-racket-bootstrap.scm +++ b/gnu/packages/chez-and-racket-bootstrap.scm @@ -317,11 +317,28 @@ (define unbundle-chez-submodules "lz4" "zlib")))) +(define unpack-nanopass+stex + #~(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"))))) + ;; ;; Racket VM: ;; (define %racket-version "8.4") +(define %chez-scheme-for-racket-version "9.5.7.3") +;; The version should match `(scheme-fork-version-number)`. +;; See racket/src/ChezScheme/s/cmacros.ss c. line 360. +;; It will always be different than the upstream version! (define %racket-origin (origin (method git-fetch) @@ -549,17 +566,8 @@ (define-public chez-scheme #:phases #~(modify-phases %standard-phases (add-after 'unpack 'unpack-nanopass+stex - (lambda* (#:key native-inputs inputs #:allow-other-keys) - (copy-recursively - (dirname (search-input-file (or native-inputs 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"))))) + (lambda args + #$unpack-nanopass+stex)) (add-after 'unpack-nanopass+stex 'unpack-bootfiles (lambda* (#:key native-inputs inputs #:allow-other-keys) (when (directory-exists? "boot") @@ -689,6 +697,108 @@ (define-public chez-scheme-bootstrap-bootfiles work with upstream Chez Scheme so that we can bootstrap these files from source."))) +(define-public chez-scheme-for-racket + (package + (inherit chez-scheme) + (name "chez-scheme-for-racket") + (version %chez-scheme-for-racket-version) + (source %racket-origin) + (inputs + (modify-inputs (package-inputs chez-scheme) + (delete "libx11" "util-linux:lib"))) + (native-inputs + (modify-inputs (package-native-inputs chez-scheme) + (replace "chez-scheme-bootstrap-bootfiles" + chez-scheme-for-racket-bootstrap-bootfiles))) + (arguments + (substitute-keyword-arguments (package-arguments chez-scheme) + ((#:configure-flags cfg-flags #~'()) + #~(cons "--disable-x11" #$cfg-flags)) + ((#:phases those-phases #~%standard-phases) + #~(modify-phases #$those-phases + (add-after 'unpack 'chdir + (lambda args + (chdir "racket/src/ChezScheme"))))))) + (supported-systems (filter nix-system->chez-machine + %supported-systems)) + (home-page "https://github.com/racket/ChezScheme") + ;; ^ This is downstream of https://github.com/racket/racket, + ;; but it's designed to be a friendly landing place for people + ;; who want a ChezScheme-shaped repositroy. + (synopsis "Variant of Chez Scheme extended for Racket") + (description "This variant of Chez Scheme is extended to support the +implementation of Racket. It may be useful on platforms that are not yet +supported by upstream Chez Scheme. + +Main additions to Chez Scheme in the Racket variant: +@itemize @bullet +@item +AArch64 support +@item +Portable bytes (@code{pb}) support, which is mainly useful for bootstrapping +a build on any supported platform +@item +Unboxed floating-point arithmetic and flvectors +@item +Type reconstruction during optimization (especially for safe code) +@item +Continuation attachments +@item +Parallel garbage collection, in-place garbage collection for old-generation +objects (instead of always copying), and reachability-based memory +accounting +@item +Ordered finalization, immobile (but collectable) objects, weak/ephemeron +generic hash tables, and reference bytevectors +@item +Faster multiplication and division for large exact numbers +@end itemize") + (license license:asl2.0))) + +(define-public chez-scheme-for-racket-bootstrap-bootfiles + (package + (inherit chez-scheme-bootstrap-bootfiles) + (name "chez-scheme-for-racket-bootstrap-bootfiles") + (version (package-version chez-scheme-for-racket)) + (source (package-source chez-scheme-for-racket)) + (native-inputs (list chez-nanopass-bootstrap racket-vm-bc)) + (arguments + (substitute-keyword-arguments + (package-arguments chez-scheme-bootstrap-bootfiles) + ((#:phases those-phases #~%standard-phases) + #~(modify-phases #$those-phases + (add-after 'unpack 'chdir + (lambda args + (chdir "racket/src/ChezScheme"))) + (add-after 'chdir 'unpack-nanopass+stex + (lambda args + #$unpack-nanopass+stex)) + (add-before 'install 'build + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (invoke (search-input-file (or native-inputs inputs) + "/opt/racket-vm/bin/racket") + "rktboot/main.rkt"))))))) + (home-page "https://github.com/racket/ChezScheme") + ;; ^ This is downstream of https://github.com/racket/racket, + ;; but it's designed to be a friendly landing place for people + ;; who want a ChezScheme-shaped repositroy. + (synopsis "Chez Scheme bootfiles bootstrapped by Racket") + (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.) + +The Racket package @code{cs-bootstrap} (part of the main Racket Git +repository) implements enough of a Chez Scheme simulation to load the Chez +Scheme compiler purely from source into Racket and apply the compiler to +itself, thus bootstrapping Chez Scheme. Bootstrapping takes about 10 times as +long as using an existing Chez Scheme, but @code{cs-bootstrap} supports Racket +7.1 and later, including the Racket BC variant. + +Note that the generated bootfiles are specific to Racket's fork of Chez +Scheme, and @code{cs-bootstrap} does not currently support building upstream +Chez Scheme."))) + ;; ;; Chez's bootstrap dependencies: ;;