From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EPxzGzxAB2N8CwEAbAwnHQ (envelope-from ) for ; Thu, 25 Aug 2022 11:26:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UDlvGzxAB2OruQAA9RJhRA (envelope-from ) for ; Thu, 25 Aug 2022 11:26:20 +0200 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 184B51E493 for ; Thu, 25 Aug 2022 11:26:19 +0200 (CEST) Received: from localhost ([::1]:48808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oR97x-0005vh-Vo for larch@yhetil.org; Thu, 25 Aug 2022 05:26:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oR96k-0005Aa-7h for guix-patches@gnu.org; Thu, 25 Aug 2022 05:25:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59243) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oR96j-0007oF-Tk for guix-patches@gnu.org; Thu, 25 Aug 2022 05:25:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oR96j-0003Ot-PW for guix-patches@gnu.org; Thu, 25 Aug 2022 05:25:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH v3 12/14] gnu: chez-scheme-for-racket: Suport all systems. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Aug 2022 09:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57050 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Philip McGrath , 57050@debbugs.gnu.org Cc: Liliana Marie Prikler , "\(" , Maxime Devos , Efraim Flashner , Thiago Jung Bauermann Received: via spool by 57050-submit@debbugs.gnu.org id=B57050.166141948113032 (code B ref 57050); Thu, 25 Aug 2022 09:25:01 +0000 Received: (at 57050) by debbugs.gnu.org; 25 Aug 2022 09:24:41 +0000 Received: from localhost ([127.0.0.1]:48992 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR96O-0003O7-OM for submit@debbugs.gnu.org; Thu, 25 Aug 2022 05:24:41 -0400 Received: from mail-ej1-f66.google.com ([209.85.218.66]:33788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oR96N-0003Nu-33 for 57050@debbugs.gnu.org; Thu, 25 Aug 2022 05:24:39 -0400 Received: by mail-ej1-f66.google.com with SMTP id cu2so405988ejb.0 for <57050@debbugs.gnu.org>; Thu, 25 Aug 2022 02:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc; bh=WO8CvZWb91kybGJtWZDfH/1EG5qHZbfbxtbK8z1QPK4=; b=D+DSJas/kvYm30iZetfC1QbV1sXimA1hNWSeDynPEFrfmAEp6fc21TJRJEnhjjDRj5 BsVkBvdYY+Eacg5/ad5lh/It6YB0nfObwJP1ZakH9fdT2cpLp/7IzgX7bi8Ned/UciV5 iQqQnzvlgStCBYUfFfFtDuCNlPAjCxiYjB/IX0NreyiG71Z/7R8eMmsdzBfcV0UmabMs zAVCTArxRJC67jw4qtjXee1DTqzTRlUZDomLtUtEOdmvDjWAIZ9QKWrX9b+x5+i/jbKE Bz/AH8/BLTK21xHnklLLPqufq09IPJSEGE8u+6URve0a1dsP8EjUaWIAoB3HVV+xSsxE paZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc; bh=WO8CvZWb91kybGJtWZDfH/1EG5qHZbfbxtbK8z1QPK4=; b=uaPkR/H6R8G1Rem+CaF5zYMoOguX7ehfE5vHkOKXkqAsHW6GifyS9wzdsGGNUtwLI3 gqhAtxO+clk8TM/Oo2btSzXZKYGFbNHL9KG6zSEDbUUxCe2vvcPUu37pbjMB9RMp5GbG HkyYq1X8P09W3v4Ce2rj+U/XFZvg9v/QOJTNjJG7hPCpRVMGl5E4/AnYyX8+oGCouFj5 l1gNR1J6fezBGtoZ1HGZDDnyXDHd4Nxn8Q7yJFY1/43s+72m2vgrHc0jQmB6E1/Ume8B 5jAeGGbAFwd0XW2Q+F6/fUYMUSsFor0IA426ZpiBtlBU3S15RqEQCMyNf1UfTxMrI53s SV1A== X-Gm-Message-State: ACgBeo1jEh68QmvSvOpAt7QXhc92bJ08Zu07jfW3pUGgsXxRTlPUPPqB o/ktpoCDC6VONLcyU01ng9c= X-Google-Smtp-Source: AA6agR5bZ+ZF+RN3Uwm3rxv2r29tp6E0pjk13fsfDURbmnoFH2KyBK4lciPbwsV48Qy42+jkNiJB/w== X-Received: by 2002:a17:907:e89:b0:73d:a99a:7943 with SMTP id ho9-20020a1709070e8900b0073da99a7943mr1761600ejc.682.1661419473074; Thu, 25 Aug 2022 02:24:33 -0700 (PDT) Received: from nijino.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id 2-20020a170906328200b0073c9d68ca0dsm2179131ejw.133.2022.08.25.02.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 02:24:32 -0700 (PDT) Message-ID: From: Liliana Marie Prikler Date: Thu, 25 Aug 2022 11:24:31 +0200 In-Reply-To: <7c5ee85372e4682282dc6a543c99a3620abf2cd5.1661416343.git.philip@philipmcgrath.com> References: <7c5ee85372e4682282dc6a543c99a3620abf2cd5.1661416343.git.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-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-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661419580; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=WO8CvZWb91kybGJtWZDfH/1EG5qHZbfbxtbK8z1QPK4=; b=muS0lK6HXUM1pixKfUlQInktP2dvuMSWQ1t2HuIZQGsY2IKkIy+vUMeyPDl5kfHsI2Ib4A /4ZQ+EaLthtt78zxaVz4xgEYiNiHheX0DGZX2wv2KhCrbFHLTys/Fd4KmUDA9KI6igC8re UcIViWxxBpL7jb4DJBAArVDyqia7mKMZHpl5G2P9Se7JSdgPjZ/Z/LZC8a0UCeVZ6/2nFT yWbTI+0DBcN5al4303WbIfjqYZ5QMBQ6WGzLXxY81VD8NCLlOIrUtwwYcfFFpj/uiQ3X7o RrblI1xGuH4eJip2UvxT4MO+3gOuJaIvUTjxlmD1EpNGIKpa034SAa/96q05MQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661419580; a=rsa-sha256; cv=none; b=KSCkV7Ezu6lq7mOI1UuQ5DsdryvXXAE/4nsiGy3szs6Wc917j2GdF/bePuiSeyLhqW9PN6 4cZyzaZbllwX+2YGWO4NoprD6RoQ6KcRJzDcjd3o/Uo8Ds6uX/xrRGjJIM+mgmvHuusOfX iKY0Z4wsJjEA4dHRG7ieVP8RBrX7xGQG4veLUa6gOSBhTXA9Nsbq/G/WkfHPZCuJK2+0Xk KAUyVuomACaFBJRBuCSZz0VyhxMsVE8czDs44EffDJ6VtepGDvMPt5dPVrRdzg61lh10jp RGk1Z7QrO1jGTE1bR+16exnpuMezr2YMJlJ8Ux3r7zTEP9uf/yX+BGuadBnelQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="D+DSJas/"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: 6.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b="D+DSJas/"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (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: 184B51E493 X-Spam-Score: 6.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: ODKZLjiRp/yE Should be "Support all systems". Am Donnerstag, dem 25.08.2022 um 04:54 -0400 schrieb Philip McGrath: > On systems for which Racket's variant of Chez Scheme cannot generate > native code, it can use a 'pbarch' machine type: a variant of the > ``portable bytecode'' backend specialized to word size and endianness. > This allows Racket CS to replace Racket BC on those systems while > maintaining comparable performance. (Racket BC lacks JIT support for > those systems anyway.) It also lets us provide a Chez Scheme package on > all systems Guix supports. > > This patch adds 'pbarch' support to both 'chez-scheme-for-racket' and > 'racket-vm-cs', but it does not change the Racket VM implementation > used > for the 'racket' and 'racket-minimal' packages. > > * gnu/packages/chez.scm (nix-system->pbarch-machine-type): New > variable. > (chez-scheme-for-racket)[inputs]: Use 'libffi' for non-native systems. > [arguments]<#:configure-flags>: Always supply '-m='. Add applicable > flags for non-native systems. > [supported-systems]: Use '%supported-systems'. > [description]: Update. > (chez-scheme-for-racket-bootstrap-bootfiles)[arguments]<#:phases>: > Adapt > 'build' phase for non-native systems. > * gnu/packages/racket.scm (racket-vm-bc)[description]: Update. > (racket-vm-cs)[description]: Likewise. > [inputs]: Use 'libffi' for non-native systems. > [arguments]<#:configure-flags>: Add applicable flags for non-native > systems. > --- >  gnu/packages/chez.scm   | 76 ++++++++++++++++++++++++++++++----------- >  gnu/packages/racket.scm | 26 +++++++++----- >  2 files changed, 74 insertions(+), 28 deletions(-) > > diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm > index 26f653ea9d..5d152b3db5 100644 > --- a/gnu/packages/chez.scm > +++ b/gnu/packages/chez.scm > @@ -37,6 +37,7 @@ (define-module (gnu packages chez) >    #:use-module (gnu packages compression) >    #:use-module (gnu packages ncurses) >    #:use-module (gnu packages ghostscript) > +  #:use-module (gnu packages libffi) >    #:use-module (gnu packages linux) >    #:use-module (gnu packages netpbm) >    #:use-module (gnu packages racket) > @@ -49,6 +50,7 @@ (define-module (gnu packages chez) >    #:use-module (srfi srfi-26) >    #:export (chez-scheme-for-system >              racket-cs-native-supported-system? > +            nix-system->pbarch-machine-type >              unpack-nanopass+stex)) >   >  ;; Commentary: > @@ -231,6 +233,28 @@ (define* (chez-upstream-features-for-system > #:optional >      (and=> (assoc-ref %chez-features-table chez-os) >             (cut assoc-ref <> chez-arch)))) >   > +(define* (nix-system->pbarch-machine-type #:optional > +                                          (system > +                                           (or (%current-target- > system) > +                                               (%current-system))) > +                                          #:key (threads? #t)) > +  "Return a string naming the pseudo–machine type used by Racket's > variant of > +Chez Scheme to represent the appropriate ``pbarch'' backend for > SYSTEM: that > +is, the ``portable bytecode'' backend specialized for SYSTEM's word > size and > +endianness.  The result will name the threaded machine type unless > THREADS? is > +provided and is #f." > +  (string-append (if threads? > +                     "t" > +                     "") > +                 "pb" > +                 (if (target-64bit? system) > +                     "64" > +                     "32") > +                 ;; missing (guix utils) predicate target-little- > endian? > +                 (if (target-ppc32? system) > +                     "b" > +                     "l"))) > + Don't we already have a function that does something similar? Can't we add a #:portable-bytecode? keyword to that one? >  (define* (racket-cs-native-supported-system? #:optional >                                               (system >                                                (or (%current-target- > system) > @@ -449,10 +473,14 @@ (define-public chez-scheme-for-racket >      ;; When updating, remember to also update %racket-version in > racket.scm. >      (source #f) ; avoid problematic cycle with racket.scm >      (inputs > -     (modify-inputs (package-inputs chez-scheme) > -       (delete "libx11" "util-linux:lib") > -        (replace "chez-scheme-bootstrap-bootfiles" > -          chez-scheme-for-racket-bootstrap-bootfiles))) > +     (let ((inputs (modify-inputs (package-inputs chez-scheme) > +                     (replace "chez-scheme-bootstrap-bootfiles" > +                       chez-scheme-for-racket-bootstrap-bootfiles) > +                     (delete "libx11" "util-linux:lib")))) > +       (if (racket-cs-native-supported-system?) > +           inputs > +           (modify-inputs inputs > +             (prepend libffi))))) >      (native-inputs >       (let ((native-inputs (modify-inputs (package-native-inputs chez- > scheme) >                              (prepend zuo)))) > @@ -473,10 +501,16 @@ (define-public chez-scheme-for-racket >         ((#:configure-flags cfg-flags #~'()) >          #~`("--disable-x11" >              "--threads" ;; ok to potentially duplicate > -            #$@(if (%current-target-system) > -                   (list (string-append "-m=" > -                                        (racket-cs-native-supported- > system?))) > -                   '()) > +            #$(string-append "-m=" (or (racket-cs-native-supported- > system?) > +                                       (nix-system->pbarch-machine- > type))) > +            ;; ^ could skip -m= for non-cross non-pbarch builds > +            #$@(if (racket-cs-native-supported-system?) > +                   #~() > +                   ;; not inferred on non-native platforms: see > +                   ;; https://racket.discourse.group/t/950/9 > +                   #~("--enable-libffi" > +                      "CFLAGS=-g -O2 -D_REENTRANT -pthread" > +                      "LIBS=-lm -ldl -lrt -lffi -lncurses")) >              #$@(if (%current-target-system) >                     (list (string-append "--toolprefix=" >                                          (%current-target-system) > @@ -543,10 +577,7 @@ (define-public chez-scheme-for-racket >                (add-after 'unpack 'chdir >                  (lambda args >                    (chdir "racket/src/ChezScheme")))))))) > -    ;; TODO: How to build pbarch/pbchunks for other systems? > -    ;; See https://racket.discourse.group/t/950 > -    (supported-systems (filter racket-cs-native-supported-system? > -                               %supported-systems)) > +    (supported-systems %supported-systems) I don't think this needs to be specified, does it? See the definition in guix/packages.scm: (supported-systems package-supported-systems ; list of strings (default %supported-systems)) Cheers