From patchwork Sat Feb 19 06:42:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 37346 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 03B7D27BBEA; Sat, 19 Feb 2022 06:54:45 +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 2F95527BBE9 for ; Sat, 19 Feb 2022 06:54:44 +0000 (GMT) Received: from localhost ([::1]:43968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLJdg-0002Ji-0j for patchwork@mira.cbaines.net; Sat, 19 Feb 2022 01:54:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLJTW-00072r-Re for guix-patches@gnu.org; Sat, 19 Feb 2022 01:44:10 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34630) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLJTT-00083I-LP for guix-patches@gnu.org; Sat, 19 Feb 2022 01:44:09 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nLJTT-0004o8-Jk for guix-patches@gnu.org; Sat, 19 Feb 2022 01:44:07 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH v3 11/15] gnu: Add chez-scheme-for-racket. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 19 Feb 2022 06:44:07 +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 Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Attila Lendvai , Philip McGrath , Malte Gerdes , zimoun Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164525304418417 (code B ref 53878); Sat, 19 Feb 2022 06:44:07 +0000 Received: (at 53878) by debbugs.gnu.org; 19 Feb 2022 06:44:04 +0000 Received: from localhost ([127.0.0.1]:56749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJTP-0004mm-8h for submit@debbugs.gnu.org; Sat, 19 Feb 2022 01:44:03 -0500 Received: from mail-qv1-f49.google.com ([209.85.219.49]:40803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJTB-0004l2-HF for 53878@debbugs.gnu.org; Sat, 19 Feb 2022 01:43:50 -0500 Received: by mail-qv1-f49.google.com with SMTP id v10so19200904qvk.7 for <53878@debbugs.gnu.org>; Fri, 18 Feb 2022 22:43:49 -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=3jczH3c6u7DJ3//fjutZXsJPez8NGkdREoswIZMxpW8=; b=gzpMLt0tNY9uAP0yGRmliZq6/o3zyZLXSdZU5v3Lm1lOye+CUvoqfZlbNNWEPlHMaf 4AcKBeHlq6AvwO99h0Oj9HUZBGTb5oLeJv7b1lfYDFJNszCvpcb77IISMqf/3mHhNDoV OGg0wwl2kKzwffQRFZKaaKL06srKUvMNAaIxa6YGaxp/zRh85n0f/l/Vc4iMOZBIhISj CZGERCJq604M9EWCR2gNlBrwoidry7Ky3Le0glB4VYnT14F/7f96KcsQsnaOL0ieBOXJ dMBMEj/SDkXnjVV0MP10yzPmNLUucEL4xZDQuZsRJpfE5YFjYNGoP63G3eq6vO2jdqtB S0zQ== 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=3jczH3c6u7DJ3//fjutZXsJPez8NGkdREoswIZMxpW8=; b=uWd5ptrKMl+ZmgDOSu5FQ7jFcZTSqh4gfaBdQCIIQIlccemQ4lOE2L/YAlPyMz0Ayt 2G1FfH5j6VjxZvf+okYRg7IG4g392e+M9ONgZiEdrfaEGlzks6ZfrqheAc6ULu1glIZy YmefVmO9hhjQxTNQc8sTrUo1KgtpbhP5kIRTuhkjAjthWiuholJs7nF3VGX6/hxRKfBJ GNLQ4LBJQ3PRLY3r4NFxacpJzvRTpsovwj5tAB6ShYq1M79rVYISnNxtmCaxyG/qa38O 2mAsYZBRhVv51s0Ykd6y7qRBYOyOPlkwgEKC9Ddea6huOlCPPFwd8Ky+l8YwGR4+GAV/ dH1Q== X-Gm-Message-State: AOAM53232O41RN6+7KLbLrvwWbLdcrePQ+YjpGAP05FIz2qp/mBekmIo 9wzGeOJGaDBM8v2xR4/3GSfO7D3ZUuDmJsiTleg= X-Google-Smtp-Source: ABdhPJwSyRyZsUvxlgdTuEKaAtwHTmXpV1s+1ulWDoHVeEm511HR5APlb+PsU/KjaXz5jcP+DZq2Hg== X-Received: by 2002:a05:6214:5a3:b0:42c:2c13:759c with SMTP id by3-20020a05621405a300b0042c2c13759cmr8578652qvb.20.1645253023937; Fri, 18 Feb 2022 22:43:43 -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 y9sm17899091qtx.85.2022.02.18.22.43.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Feb 2022 22:43:43 -0800 (PST) From: Philip McGrath Date: Sat, 19 Feb 2022 01:42:24 -0500 Message-Id: <20220219064228.246917-12-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219064228.246917-1-philip@philipmcgrath.com> References: <20220208151316.1897345-1-philip@philipmcgrath.com> <20220219064228.246917-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 ca76e78b1e..6eddc46e66 100644 --- a/gnu/packages/chez-and-racket-bootstrap.scm +++ b/gnu/packages/chez-and-racket-bootstrap.scm @@ -319,11 +319,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) @@ -551,17 +568,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") @@ -691,6 +699,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: ;;