From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QId1NhSp8GLv7QAAbAwnHQ (envelope-from ) for ; Mon, 08 Aug 2022 08:11:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id rG9jNhSp8GKPGAEA9RJhRA (envelope-from ) for ; Mon, 08 Aug 2022 08:11:32 +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 A3C6732346 for ; Mon, 8 Aug 2022 08:11:32 +0200 (CEST) Received: from localhost ([::1]:52348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvz9-0003nZ-RV for larch@yhetil.org; Mon, 08 Aug 2022 02:11:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKvyj-0003jr-04 for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49202) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKvyi-0002o2-JX for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKvyi-0002uT-FB for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH 6/6] gnu: chez-scheme-for-racket: Suport all systems. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 06:11:04 +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: 57050@debbugs.gnu.org Cc: Philip McGrath Received: via spool by 57050-submit@debbugs.gnu.org id=B57050.165993904811122 (code B ref 57050); Mon, 08 Aug 2022 06:11:04 +0000 Received: (at 57050) by debbugs.gnu.org; 8 Aug 2022 06:10:48 +0000 Received: from localhost ([127.0.0.1]:38944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyS-0002tI-6q for submit@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:48 -0400 Received: from mail-qk1-f177.google.com ([209.85.222.177]:33486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyP-0002sh-Mv for 57050@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:46 -0400 Received: by mail-qk1-f177.google.com with SMTP id f14so5830688qkm.0 for <57050@debbugs.gnu.org>; Sun, 07 Aug 2022 23:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=YzilF9zyhdFXx64R4lDSMRLhRzWY8AyGWoBbhI0uEdQ=; b=knEakOQj+xRQHg3gJKGrF2tmQoLozpmxHhBUykuZ3FLUk6qYG3ffAjKd4CWskZgiEo 3x/hdcoGFS+gXGheYksay7vHtNBybAkyvxNdw3b1ZNkwuZVZBFf1apdqErPqMGBvJ5db Z4Xb21AAU0SxJFRgus3stuncqSEKNkOAxI5tNkb6X3YVZYB0pd9errENYG5faVP98M0B vsYqdESRyC0jUW4zPv5+Op1Ac2Lww0Ov3NOgVSHv225TFeEQxRAmKGNCALwkozSdpUbQ qKs9QhZiBQWWTQLjTjDs3ml7aF7mk6ZNWCvpYeeSLQ2OdUjd6forMKqjYa4jzivyK3PT dxUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=YzilF9zyhdFXx64R4lDSMRLhRzWY8AyGWoBbhI0uEdQ=; b=IoSB7CPz67IxNxrGyREpZbHdOvmug78shKabdq+MMkFbpvOW8kC3m6rYkCHsNMdFk6 bPAkCZ3rbpUpeEZ8yY+B7jwTJ6aX/v8Nv5lkctyoo0ZS8Uao8lCTVJv2u84jpPjciA1y WInzKdi4YtT8doDL3pXbUlTsie4LN4amyT8R3ZyOKkSU3+T18hRa9l4WUXFopXW9JeuW oKS0p+LXw+cu4Ijc8n6KJ7kvqo3wUpAsUFbE0tDuvbaHhD/HeMUzsvqeI8vLJuwKyUII cWXLPG/EUJ3hPc1ERMwcDW99LyLymzgsZWL9TyNOhDGtjC/KsOZrgB/Okv93wxNWuoBw 25XQ== X-Gm-Message-State: ACgBeo2wGjbXskunYMVTaMM2MCLPiBNs03C61+vG16R2t/m1zDomzh1F KceSPYxR1Pu1nC6zOHbAis5nj8Vn4dt1ni+q X-Google-Smtp-Source: AA6agR6G2isKwZWcB3k0V7CEUHe0HZh9OnS3xUMYEy2FnB3CabPkpTFHsqps7BilhIeDSfYPlH415Q== X-Received: by 2002:a05:620a:4899:b0:6b8:fe02:8609 with SMTP id ea25-20020a05620a489900b006b8fe028609mr12780933qkb.721.1659939040098; Sun, 07 Aug 2022 23:10:40 -0700 (PDT) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id j7-20020ac86647000000b0031f0485aee0sm7257874qtp.88.2022.08.07.23.10.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 23:10:39 -0700 (PDT) From: Philip McGrath Date: Mon, 8 Aug 2022 02:10:07 -0400 Message-Id: <00975c823227acd41fc714d237449834f88d1530.1659936550.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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=1659939092; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=YzilF9zyhdFXx64R4lDSMRLhRzWY8AyGWoBbhI0uEdQ=; b=pifGwNtzU+e6+dq5N8IqmKZzPDpWF1hitWF6E25EPi67DLcLe3TvAlPtyNnrhiaPMlziZs Km5bf8P3fRx/02B19SQ0LJ9NN07neNTru48quWQ8v3txAy4U8xQkyGSCr8qiaecYaK8+il OHROJasG1/c73kaOYLMcDcKwyDRMfYX7du+oY6F9nuPZS+K7zBaICXaQ4oOwSYks14EYwi hTbUFcVO1kB3X+aMkKD7MB1YF2PYLdfbI2lDiENBWA7Cd4JyM2oOcTdiXGO+R5SU+bfINY pAWK6tUl3+nAVI8n/6PEz5DkK6iPMFT/+J/ppcfncHTZHYLEZGYFBe/jPtjpdw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659939092; a=rsa-sha256; cv=none; b=S5Er8TQrym3LVzcvMt16aoyJSc2ukGG1xwkQ3o8ITsVGYpZ3bpQXYdRk2XMSYvJRCF2Qzf n2KRRQxxflU8CWxuQL1H8BuGH+5P/pZt3XKlS+aMyzsiTH7EXYk+/OSo+VmNZQuSCNgyNZ S0wa6QvpdgeHaqtXugdFVNAC5eTWSozZhZ9sUjG+BWoGl/WdGotzGhgR+bBSMZ6mdRJxrm xrbB19D4gBi/LiEnu+VT1rCf/FhRNH1egh2JqKNotRDVx54nSQkGmNgroNjR3vQ0PtFPWm ba/6CV3WapYgL/5TiGqISKc4T5//amf6goqQ4lRRpvbh9x+y+cpczZynR2Mv4A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=knEakOQj; dmarc=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: 1.81 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=knEakOQj; dmarc=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: A3C6732346 X-Spam-Score: 1.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: AgcAt0DY0BF9 On systems for which 'chez-scheme-for-racket' cannot generate native code, use the applicable 'pbarch' machine type as with 'racket-vm-cs'. In the process, this commit adds support for cross-compiling 'chez-scheme-for-racket', though not support for compiling it as a cross-compiler to use in cross-compiling other Scheme programs. * gnu/packages/chez.scm (chez-scheme)[native-inputs]: Move 'chez-scheme-bootstrap-bootfiles' to ... [inputs]: ... this field. [arguments]<#:phases>: Update 'unpack-bootfiles' accordingly. (chez-scheme-for-racket)[native-inputs]: Add 'this-package' when cross-compiling. Move 'chez-scheme-for-racket-bootstrap-bootfiles' to ... [inputs]: ... this field. Add 'libffi' for 'pbarch' machine types. [arguments]: Support cross-compilation and 'pbarch' machine types. [supported-systems]: Use '%supported-systems'. [description]: Update. --- gnu/packages/chez.scm | 93 ++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 23 deletions(-) diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 2afef8d3bd..0ab82ef8bf 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -38,6 +38,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) @@ -318,6 +319,7 @@ (define-public chez-scheme (build-system gnu-build-system) (inputs (list + chez-scheme-bootstrap-bootfiles `(,util-linux "lib") ;<-- libuuid zlib lz4 @@ -326,8 +328,7 @@ (define-public chez-scheme ;; for X11 clipboard support in expeditor: ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232 libx11)) - (native-inputs (list chez-scheme-bootstrap-bootfiles - chez-nanopass-bootstrap + (native-inputs (list chez-nanopass-bootstrap stex-bootstrap)) (native-search-paths (list (search-path-specification @@ -366,7 +367,7 @@ (define-public chez-scheme (when (directory-exists? "boot") (delete-file-recursively "boot")) (copy-recursively - (search-input-directory (or native-inputs inputs) + (search-input-directory inputs "lib/chez-scheme-bootfiles") "boot"))) ;; NOTE: The custom Chez 'configure' script doesn't allow @@ -476,13 +477,21 @@ (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"))) + (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 + (append libffi))))) (native-inputs - (modify-inputs (package-native-inputs chez-scheme) - (append zuo) - (replace "chez-scheme-bootstrap-bootfiles" - chez-scheme-for-racket-bootstrap-bootfiles))) + (let ((native-inputs (modify-inputs (package-native-inputs chez-scheme) + (append zuo)))) + (if (%current-target-system) + (modify-inputs native-inputs + (append this-package)) + native-inputs))) (arguments (substitute-keyword-arguments (package-arguments chez-scheme) ((#:out-of-source? _ #f) @@ -496,6 +505,21 @@ (define-public chez-scheme-for-racket ((#:configure-flags cfg-flags #~'()) #~`("--disable-x11" "--threads" ;; ok to potentially duplicate + #$(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) + "-")) + '()) ,@(let* ((chez+version (strip-store-file-name #$output)) (doc-prefix (assoc-ref %outputs "doc")) (doc-dir (string-append doc-prefix @@ -518,25 +542,46 @@ (define-public chez-scheme-for-racket #$mk-flags)) ((#:phases those-phases #~%standard-phases) #~(let* ((those-phases #$those-phases) - (unpack (assoc-ref those-phases 'unpack))) + (gnu:unpack (assoc-ref those-phases 'unpack)) + (gnu:build (assoc-ref those-phases 'build))) (modify-phases those-phases + (replace 'build + ;; need to override target for cross-compilation + ;; https://racket.discourse.group/t/950/19 + (lambda* (#:key target (make-flags '()) (parallel-build? #t) + #:allow-other-keys) + (gnu:build #:make-flags (if target + (cons "kernel" make-flags) + make-flags) + #:parallel-build? parallel-build?))) (replace 'install-docs - (lambda* (#:key make-flags #:allow-other-keys) + (lambda* (#:key native-inputs (make-flags '()) + #:allow-other-keys) + ;; The tests for 'native-inputs' are cross-compilation + ;; workarounds that would be better to address upstream: + ;; see . + (when native-inputs + (substitute* "Makefile" + (("install-docs: build \\$[(]ZUO[)]") + "install-docs: $(ZUO)"))) (apply invoke "make" "install-docs" - make-flags))) + (if native-inputs + (cons (string-append + "Scheme=" + (search-input-file native-inputs + "/bin/scheme")) + make-flags) + make-flags)))) (replace 'unpack (lambda args - (unpack #:source #$(or (package-source this-package) - (package-source racket-vm-bc))))) + (gnu:unpack #:source #$(or (package-source this-package) + (package-source racket-vm-bc))))) (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) (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 @@ -549,13 +594,17 @@ (define-public chez-scheme-for-racket Main additions to Chez Scheme in the Racket variant: @itemize @bullet @item -AArch64 support +AArch64 code generation @item -Portable bytes (@code{pb}) support, which is mainly useful for bootstrapping -a build on any supported platform +Portable bytecode (@code{pb}) mode, which is mainly useful for bootstrapping a +build on any platform, but can also be used on platforms without native-code +generation, compiled via Emscripten, linked with @code{libffi}, or used with +bytecode partially compiled to C @item Unboxed floating-point arithmetic and flvectors @item +Faster multiplication and division for large exact numbers +@item Type reconstruction during optimization (especially for safe code) @item Continuation attachments @@ -566,8 +615,6 @@ (define-public chez-scheme-for-racket @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 asl2.0))) -- 2.32.0