From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id qFhQJ219CmJNZAAAgWs5BA (envelope-from ) for ; Mon, 14 Feb 2022 17:03:57 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id cOXuH219CmIq3QAAG6o9tA (envelope-from ) for ; Mon, 14 Feb 2022 17:03:57 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 51298442C2 for ; Mon, 14 Feb 2022 17:03:54 +0100 (CET) Received: from localhost ([::1]:55320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJdpQ-00057l-Rd for larch@yhetil.org; Mon, 14 Feb 2022 11:03:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJd82-00038B-PL for guix-patches@gnu.org; Mon, 14 Feb 2022 10:19:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:48400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJd82-0002Tn-E0 for guix-patches@gnu.org; Mon, 14 Feb 2022 10:19:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nJd82-0003Tb-9c for guix-patches@gnu.org; Mon, 14 Feb 2022 10:19:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH 08/11] gnu: Add chez-scheme-for-racket. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 14 Feb 2022 15:19:02 +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: Philip McGrath , 53878@debbugs.gnu.org Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164485193713352 (code B ref 53878); Mon, 14 Feb 2022 15:19:02 +0000 Received: (at 53878) by debbugs.gnu.org; 14 Feb 2022 15:18:57 +0000 Received: from localhost ([127.0.0.1]:42297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJd7w-0003TI-OK for submit@debbugs.gnu.org; Mon, 14 Feb 2022 10:18:57 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:14471) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJd7t-0003T6-2m for 53878@debbugs.gnu.org; Mon, 14 Feb 2022 10:18:55 -0500 Received: from lprikler-laptop.ist.intra (gw.ist.tugraz.at [129.27.202.101]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Jy7Cs4jGkz3xbk; Mon, 14 Feb 2022 16:18:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1644851929; bh=SSI7psRRBrXkSjh0aaXXhnym8YiCr/IEhVV2DamVnx4=; h=Subject:From:To:Date:In-Reply-To:References; b=mQgMXBqWkh8hPC3ijzLg4UsxHC/G125c9B63yYJTuLuJQzJJcMt1ka26LllARcuCO olxUO5S82qnhuCRj68e0aMGsrohrcS+wIFYlrJpAXkzvUJmsKEak2iPk3ihkobl/b4 fo6eaBn2BjMSGFFPzDWOrEcGn+BLPmGrP4Jtai68= Message-ID: From: Liliana Marie Prikler Date: Mon, 14 Feb 2022 16:18:49 +0100 In-Reply-To: <20220213215127.218952-9-philip@philipmcgrath.com> References: <20220213215127.218952-1-philip@philipmcgrath.com> <20220213215127.218952-9-philip@philipmcgrath.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: waObeELIUl4ypBWmcn/8wQ X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644854634; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=SSI7psRRBrXkSjh0aaXXhnym8YiCr/IEhVV2DamVnx4=; b=MFzbGqkoONrK1O1IjmBzy8y02kLajHNXTBENINOREEsvFX/pQDCItqSWfFL6zQPJuGhR5z eaIZ7NNdsseJSDAYckbBpoNrYkk47YzF8VUeZnzcFxUkeDXUo6+XIvf8H/KqRFXy+USZaa udcAICqMnxH6B2wqTzi4giat0rmn2kcNznZjp1VCy3yk9QUp0krmIfFdseGjfetOjr1XWO 10sWv+9te0XRmJrumhCfIjyjlaofaA9kvcQ97MFWT41VXfv9BxFudtCGIUUD/HInqTx0IY BjiA51yyG0+MDNiG3azVeMw13mZLSEyQUb7hG081Cqm5xNyS9NMkKlYZfB56Hg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644854634; a=rsa-sha256; cv=none; b=rERA4oAyAqB0TOlcehIbL37A1mzOdjx+pmELcmb34RqmxrmrG5arQM5/8K3TH9JnRM/+Ey C2zV9qbPj93PEl9rXtG+leUIRTG5O0pYSaBE1kd6qJoc86gRpd0KExUek+HTleqo2wmIw+ +HWMUnhyDP6ozKfipW58ZyBLwslpr2g1ahiuVaMMEEIQtFkmtOfXcu1XYnTRZIxzcW8ykx ZD76e1qrvtPUugA8MIYvq6zL/dmTPJN6BfK24wuNCqIV3nTDvku9rxUOGFYnXsbBs8pgGU jExdQ27cZV7s8o3VUtCWM854A1ddFYdILHEGl+bZ29fsJVk78GjsuND+6rnD8Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=mQgMXBqW; dmarc=fail reason="SPF not aligned (relaxed)" header.from=tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.23 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=mQgMXBqW; dmarc=fail reason="SPF not aligned (relaxed)" header.from=tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 51298442C2 X-Spam-Score: -2.23 X-Migadu-Scanner: scn1.migadu.com X-TUID: JOfjt0tljjGa Hi, Am Sonntag, dem 13.02.2022 um 16:51 -0500 schrieb Philip McGrath: > [...] > * gnu/packages/chez-and-racket-bootstrap.scm (racket-vm-cgc): > (racket-vm-bc): > (racket-vm-cs): > (chez-scheme-for-racket-bootstrap-bootfiles): > (chez-scheme-for-racket): New variables. One patch per package is probably better. > [...] One way of thinking about the > +;; bounary between the Racket VM and Racket programs is that the VM > implements boundary. > +;; the primitives accessed by the 'ffi/unsafe/vm' library. Another > perspective > +;; is that DrRacket's ``Open defining file''/``Jump to definition'' > features > +;; can navigate into Racket programs, including into the > implementation of > +;; 'racket/base', but can not jump into the implementation of the > Racket VM > +;; itself. A third, related perspective is that Racket code is > usually > +;; installed with source files alongside compiled code (though this > is not > +;; mandatory), whereas the Racket VM is installed only in compiled > form. > [...] > +;; output. The function 'racket-vm-for-system' returns the > recomended Racket > +;; VM package for a given system. This is a very long comment. Consider how much of it is actually necessary and how much of it is not (do I really need to know about the capabilities of DrRacket for instance?) > +;; Bootstrapping Racket: > +;; --------------------- > +;; > +;; Here's how bootstrapping Racket works: > +;; > +;;   - Racket BC [CGC] can be built with only a C compiler (except > for > +;;     one caveat discussed below). > +;;   - Racket BC [3M] needs an existing Racket to run "xform", > +;;     which transforms its own C source code to add additional > annotations > +;;     for the precise garbage collector. > +;;   - Racket CS needs (bootfiles for) Racket's fork of Chez Scheme. > +;;     It also needs an existing Racket to compile Racket- > implemented > +;;     parts of the runtime system to R6RS libraries. > +;;   - Chez Scheme also needs bootfiles for itself, but Racket can > simulate > +;;     enough of Chez Scheme to load Racket's fork of the Chez > Scheme compiler > +;;     purely from source into Racket and apply the compiler to > itself, > +;;     producing the needed bootfiles (albeit very slowly). > +;;     Any variant of Racket since version 7.1 can run the > simulation. > +;; > +;; So, we build CGC to build 3M to build bootfiles and CS. This block I'd consider necessary, but again slightly on the verbose end. > +;; (Note: since the CGC variant is basically only for bootstrapping, > we > +;; often use "BC" to mean "3M", consistent with `(banner)` and the > +;; suffixes used on executables when more than one variant co- > exists.) > +;; > +;; One remaining bootstrapping limitation is that Racket's reader, > module > +;; system, and macro expander are implemented in Racket. For Racket > CS, > +;; they are compiled to R6RS libraries as discussed above. This note > from the > +;; README file applies to all such subsystems: > +;; > +;;     The Racket version must be practically the same as the > current Racket > +;;     verson, although it can be the Racket BC implementation > (instead of > +;;     the Racket CS implementation). > +;; > +;;     Unlike Chez Scheme boot files, the files generated in > "schemified" > +;;     are human-readable and -editable Scheme code. That provides a > way > +;;     out of bootstrapping black holes, even without BC. > +;; > +;; However, other Racket subsystems implemented in Racket for Racket > CS > +;; use older C implementations for Racket BC, whereas the reader, > expander, > +;; and module system were completely replaced with the Racket > implementation > +;; > +;; For Racket BC, the compiled "linklet" s-expressions (primitive > modules) > +;; are embeded in C as a static string constant. Eventually, they > are further > +;; compiled by the C-implemented Racket BC bytecode and JIT > compilers. > +;; (On platforms where Racket BC's JIT is not supported, yet another > compiler > +;; instead compiles the linklets to C code, but this is not a > bootstrapping > +;; issue.) > +;; Again, you want to be brief and understandable. What does this mean in practise? Do we have racket bootstrapped yet or is there still some magic hidden within? >  ;; Code: >   >  (define (chez-machine->unthreaded mach) > @@ -189,19 +330,19 @@ (define* (nix-system->chez-machine #:optional > (system (%current-system)) >                  (chez-machine->threaded mach))))))) >   >  ;; > -;; Chez Scheme: > +;; Chez auxiliary G-expressions: >  ;; >   >  (define unbundle-chez-submodules >    #~(begin >        (use-modules (guix build utils)) >        (for-each (lambda (dir) > -                (when (directory-exists? dir) > -                  (delete-file-recursively dir))) > -              '("stex" > -                "nanopass" > -                "lz4" > -                "zlib")))) > +                  (when (directory-exists? dir) > +                    (delete-file-recursively dir))) > +                '("stex" > +                  "nanopass" > +                  "lz4" > +                  "zlib")))) As in one of your previous patches, you're mixing cosmetic changes with non-cosmetic ones. This one could be prevented by correctly indenting it in the patch that introduces it. >  (define unpack-nanopass+stex >    #~(begin > @@ -216,6 +357,234 @@ (define unpack-nanopass+stex >            ;; otherwise, it will try to download submodules >            (display "# to placate ../configure"))))) >   > +;; > +;; Racket VM: > +;; > + > +(define (racket-vm-common-configure-flags) > +  ;; under a lambda extraction to avoid evaluating bash-minimal too > early > +  #~`(,@(cond > +         ((false-if-exception > +           (search-input-file %build-inputs "/bin/libtool")) > +          => (lambda (libtool) > +               (list (string-append "--enable-lt=" libtool)))) > +         (else > +          '())) > +      ,@(cond > +         ((false-if-exception > +           (search-input-file %build-inputs "/opt/racket- > vm/bin/racket")) Did we have /opt/racket... before? We should probably avoid such paths. > +          => (lambda (racket) > +               (list (string-append "--enable-racket=" racket)))) > +         (else > +          '())) > +      ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" > +                      #$(file-append bash-minimal "/bin/sh")) > +      "--disable-strip" > +      "--enable-origtree") For the record, why do you need double quoting here? Would ungexp- splicing extract this too soon? > +(define-public racket-vm-cgc > +  ;; Eventually, it may make sense for some vm packages to not be > hidden, > +  ;; but this one is especially likely to remain hidden. > +  (hidden-package > +   (package > +     (name "racket-vm-cgc") > +     (version "8.4") > +     ;; ^ Remember to also update the version of > +     ;;   chez-scheme-for-racket-bootstrap-bootfiles > +     (source > +      (origin > +        (method git-fetch) > +        (uri (git-reference > +              (url "https://github.com/racket/racket") > +              (commit (string-append "v" version)))) > +        (sha256 > +         (base32 > "1vpl66gdgc8rnldmn8rmb7ar9l057jqjvgpfn29k57i3c5skr8s6")) > +        (file-name (git-file-name "racket" version)) > +        (patches (search-patches "racket-minimal-sh-via-rktio.patch" > +                                 ;; Remove by Racket 8.5: > +                                 "racket-enable-scheme- > backport.patch")) > +        (modules '((guix build utils))) > +        (snippet > +         #~(begin > +             ;; Unbundle Chez submodules. > +             (with-directory-excursion "racket/src/ChezScheme" > +               #$unbundle-chez-submodules) > +             ;; Unbundle libffi. > +             (delete-file-recursively > "racket/src/bc/foreign/libffi"))))) > +     (inputs (list ncurses ;; <- common to all variants (for > #%terminal) > +                   bash-minimal ;; <- common to all variants (for > `system`) > +                   libffi)) ;; <- only for BC variants > +     (native-inputs (list libtool)) ;; <- only for BC variants > +     (outputs '("out" "debug")) > +     (build-system gnu-build-system) > +     (arguments > +      (list > +       #:configure-flags > +       #~(cons "--enable-cgcdefault" > +               #$(racket-vm-common-configure-flags)) > +       ;; Tests are in packages like racket-test-core and > +       ;; main-distribution-test that aren't part of the main > +       ;; distribution. > +       #:tests? #f > +       ;; Upstream recommends #:out-of-source?, and it does > +       ;; help with debugging, but it confuses `install-license- > files`. > +       #:modules '((ice-9 match) > +                   (ice-9 regex) > +                   (guix build gnu-build-system) > +                   (guix build utils)) > +       #:strip-directories #~'("opt/racket-vm/bin" > +                               "opt/racket-vm/lib") > +       #:phases > +       #~(let () > +           (define* ((wrap-racket-vm-outputs phase) . args) > +             (apply > +              phase > +              (let loop ((args args)) > +                (match args > +                  ((#:outputs outputs . args) > +                   `(#:outputs > +                     ,(let loop ((outputs outputs)) > +                        (match outputs > +                          ((("out" . out) . outputs) > +                           `(("out" . ,(string-append out > "/opt/racket-vm/")) > +                             ,@outputs)) > +                          ((other . outputs) > +                           (cons other (loop outputs))))) > +                     ,@args)) > +                  ((arg . args) > +                   (cons arg (loop args))))))) Why? Cheers