From patchwork Mon Aug 8 06:10:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 41359 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 511BC27BBEB; Mon, 8 Aug 2022 07:11:59 +0100 (BST) 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 104DF27BBEA for ; Mon, 8 Aug 2022 07:11:59 +0100 (BST) Received: from localhost ([::1]:53000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvza-0004EX-7d for patchwork@mira.cbaines.net; Mon, 08 Aug 2022 02:11:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKvyh-0003je-Ml for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49197) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKvyg-0002nh-E7 for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKvyg-0002tr-A3 for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH 1/6] gnu: stex: Update to 1.2.2-2.afa6075. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 06:11:02 +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.165993902711035 (code B ref 57050); Mon, 08 Aug 2022 06:11:02 +0000 Received: (at 57050) by debbugs.gnu.org; 8 Aug 2022 06:10:27 +0000 Received: from localhost ([127.0.0.1]:38929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvy6-0002rv-Nw for submit@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:27 -0400 Received: from mail-qt1-f170.google.com ([209.85.160.170]:43570) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvy4-0002rY-GR for 57050@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:25 -0400 Received: by mail-qt1-f170.google.com with SMTP id a4so1091851qto.10 for <57050@debbugs.gnu.org>; Sun, 07 Aug 2022 23:10:24 -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=T6gG0upqRvGYsYUd7HyRCudJf0QW/TkeNmZoflcoPII=; b=DX+IUpfn/NtgrgYN8+C1oB3ixA2hPDwE0cymrEltp6ILgWvIOsc61h1pqx+SqXkURV iBXhzs4Hebh6rQy5HnHZyxD/6IYbYx5bMZ+8E0MEiQXpbdxuQ1EN+tPvLC0o/Lbzgqty Df+oxSzM+LNfUfp/Ko4Ti0j7Id5ddLpFMeoLP45GKPoNAFPPSzMmP7XqMKr4s2ayMuYs h3wN9hbXYwWHvSQu0SqCCjwBFo1tG8xJxrv9m3oATxSIBXX8f42r5HNwrqAHl5Eorpcp MMM3ffcCXKOdLpPSr1HrBGMA/lOmcPePppazvUAawfZTxpxs06UByjy7ItYTd2LVwbqR oR1w== 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=T6gG0upqRvGYsYUd7HyRCudJf0QW/TkeNmZoflcoPII=; b=EcjvcpS7Sf4bHe0T0ZiEkfjk9Fo6lcrnRchkvjyChqpLF9AQw5CHhPqxg9b/bT2jgu MS/7DnAjjrrCJ6TsHbJRpPje3GsAURMxXusty/v7DAWvqsZAbUJoJS98OCFL3+ftlFLn KgoM5937mhalAkYUoxXT429QMvxC1o8yfQM3ZdDEGXIZhev50LKH6Tdz5Q3WB0bWxiQF 8k95/ZmWWIwOROkpno5aDdjuROQ4BpsORgBQzCZlBrf2g1Rz8VrMnScFO+r3BNfHtOH5 xhY6wfSRU0+2xPDqn7KUMrzKtrsDUXfz0Zw4kBdNIE0rvGnZ5+gRyU7jPV8npAia45lF QEVQ== X-Gm-Message-State: ACgBeo2rn5oa/An7au2YstghxSfZQqNEzXYIEEROdeKdZed4DJMT6NbO 20xjJ17TdpyLYJQKlLj7dH1O7ehEKN43DfmB X-Google-Smtp-Source: AA6agR6oBQFlHijyqhas7RV02YPbXVE+r0llqQkK867WmvL5ekkby+GD6HMphNl3uGr6b/Zvn5VTmw== X-Received: by 2002:ac8:5a02:0:b0:31f:3761:9dda with SMTP id n2-20020ac85a02000000b0031f37619ddamr14769947qta.158.1659939018847; Sun, 07 Aug 2022 23:10:18 -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 w12-20020a05620a444c00b006af10bd3635sm9151999qkp.57.2022.08.07.23.10.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 23:10:18 -0700 (PDT) From: Philip McGrath Date: Mon, 8 Aug 2022 02:10:02 -0400 Message-Id: <589dad1228cdf770746dd451e1531fc942867c6f.1659936550.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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 * gnu/packages/chez.scm (stex-bootstrap): Update to 1.2.2-2.afa6075. --- gnu/packages/chez.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index b037efe8d4..043f2ae47a 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -594,8 +594,8 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles (define-public stex-bootstrap ;; This commit includes a fix which we would otherwise want to use as ;; patch. Let's revert to tagged releases as soon as one becomes available. - (let ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5") - (revision "1")) + (let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c") + (revision "2")) (hidden-package (package (name "stex") @@ -611,7 +611,7 @@ (define-public stex-bootstrap (url "https://github.com/dybvig/stex") (commit commit))) (sha256 - (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d")) + (base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp")) (file-name (git-file-name name version)) (snippet #~(for-each delete-file From patchwork Mon Aug 8 06:10:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 41356 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 84D3227BBE9; Mon, 8 Aug 2022 07:11:41 +0100 (BST) 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 EB20C27BBE9 for ; Mon, 8 Aug 2022 07:11:40 +0100 (BST) Received: from localhost ([::1]:52334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvzI-0003lO-3Y for patchwork@mira.cbaines.net; Mon, 08 Aug 2022 02:11:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKvyh-0003jg-NX for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49198) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKvyg-0002ni-Qs for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKvyg-0002ty-MJ for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH 2/6] gnu: stex: Fix read-only gifs and math directories. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 06:11:02 +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.165993903111053 (code B ref 57050); Mon, 08 Aug 2022 06:11:02 +0000 Received: (at 57050) by debbugs.gnu.org; 8 Aug 2022 06:10:31 +0000 Received: from localhost ([127.0.0.1]:38932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyB-0002sD-3F for submit@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:31 -0400 Received: from mail-qk1-f179.google.com ([209.85.222.179]:42516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvy9-0002rm-Mu for 57050@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:30 -0400 Received: by mail-qk1-f179.google.com with SMTP id o1so5771307qkg.9 for <57050@debbugs.gnu.org>; Sun, 07 Aug 2022 23:10:29 -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=1w0XFErZb+3ZZ4FYstzgkYHHV/b0yMlZZXWqzhsmXx4=; b=SeV8xuAhgVSX7DFylIkBn0W/Y/6BdMb2jMHfZ7bvLPNEF0XgYzWvjS84YaNS7YbXvG OQ05XH0wtG3FQ/XuqTqJDHjXd6/NgRazTuxa/QniXPvLO4IiKO/YwyKIyruFs2v2zSfe EGyxJBYMXdDZCMKiCd1WqHFGc8ExzFOozcS90KCbJGbzz81RCGLfWyM21cqwjQBT3BI0 6FQzgRnO0h/9cnLHzIeEx6l4vYnVFln9s0YnTAJ9cHGUPtIKunnF3x1Au6aRNXz/q6oL HHw7E2MZQhPu+DLKpkZRdXwG+bIM9qZLMLfGPkktOuyMUa5ZSRl8xjTAr6f/Ln6e6wUt wTWQ== 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=1w0XFErZb+3ZZ4FYstzgkYHHV/b0yMlZZXWqzhsmXx4=; b=CYPw275TsQm5G43p5N+ooVrcIvWJvoRgmTLDlv+vQJ2aCs39Y3g+1XzaBs9zA4nqJ+ +JeG3WvsTdfg8xcHi2CdGS/8SvApwbJ4T9rEHl/t0bZQw9IKeShwgzr2u/uZLv+S03Kn SP98PiIVSkRzj9hm/bKtHkcHJjjQtKdIip7/QjLvNvF1a2LlvRG7Xm2gAi2YbcSY6Rmw tauTJlGJ3DVL8A4fsuuRv1bc8JA85t0ckn0kQTfMxDbXDDHvgHNP2/JpSMenZkL9m1Kv 1nUYlU+a3M4WqVq65b/sEslCO5vdIq0XalVIxdiYSomocD72NfI6yPacVbjkKqPecRE1 vgSQ== X-Gm-Message-State: ACgBeo3ru1Mhwl1beNCRQteUqozo/63Oh7VWfaVH3WpfYD+hXXJfRVEV JUk587jezNzT7TOaM/v/2sCxlJAomBxz71xW X-Google-Smtp-Source: AA6agR56bbqUaLpuvuXiCJbETQBGIqe5DnYYTTOKztJppnncombPVU8Rh72rjktbaDsl9Ad6naTxgQ== X-Received: by 2002:ae9:f805:0:b0:6b8:e67d:475e with SMTP id x5-20020ae9f805000000b006b8e67d475emr12602328qkh.745.1659939024055; Sun, 07 Aug 2022 23:10:24 -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 m20-20020a05620a24d400b006a787380a5csm9251066qkn.67.2022.08.07.23.10.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 23:10:23 -0700 (PDT) From: Philip McGrath Date: Mon, 8 Aug 2022 02:10:03 -0400 Message-Id: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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 Excplicitly set the user write bit when initializing the gifs or math directories from the skeletons installed in the store. See also upstream discussion at . This problem would be exposed by the upcoming changes to Racket's build system. * gnu/packages/patches/stex-copy-from-immutable-store.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it. [version]: Increment revision to 1.2.2-3.afa6075. --- gnu/local.mk | 1 + gnu/packages/chez.scm | 5 ++- .../stex-copy-from-immutable-store.patch | 41 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/stex-copy-from-immutable-store.patch diff --git a/gnu/local.mk b/gnu/local.mk index a837d16e34..234f21ad33 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1822,6 +1822,7 @@ dist_patch_DATA = \ %D%/packages/patches/slim-reset.patch \ %D%/packages/patches/slim-login.patch \ %D%/packages/patches/slim-display.patch \ + %D%/packages/patches/stex-copy-from-immutable-store.patch \ %D%/packages/patches/syslinux-gcc10.patch \ %D%/packages/patches/syslinux-strip-gnu-property.patch \ %D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \ diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 043f2ae47a..4c253effa0 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -595,7 +595,7 @@ (define-public stex-bootstrap ;; This commit includes a fix which we would otherwise want to use as ;; patch. Let's revert to tagged releases as soon as one becomes available. (let ((commit "afa607564a5662ffd748e824801277a6b5a3d11c") - (revision "2")) + (revision "3")) (hidden-package (package (name "stex") @@ -613,6 +613,9 @@ (define-public stex-bootstrap (sha256 (base32 "0n6dryv5j7cw2qmsj55wqb0ph901h83a2hl4j891ppxp0xx18nkp")) (file-name (git-file-name name version)) + (patches + ;; submitted upstream in https://github.com/dybvig/stex/pull/6 + (search-patches "stex-copy-from-immutable-store.patch")) (snippet #~(for-each delete-file '("sbin/install" "doc/stex.pdf" "doc/stex.html"))))) diff --git a/gnu/packages/patches/stex-copy-from-immutable-store.patch b/gnu/packages/patches/stex-copy-from-immutable-store.patch new file mode 100644 index 0000000000..4562e431c1 --- /dev/null +++ b/gnu/packages/patches/stex-copy-from-immutable-store.patch @@ -0,0 +1,41 @@ +From 9434b4a36646c036db8de326158056aa3293fb82 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 28 Apr 2022 22:56:20 -0400 +Subject: [PATCH] fix read-only gifs and math directories + +An installed copy of stex might have all write permission bits removed, +even for the owner of the installed files: this is the case with Guix +package of stex, for example. If such an installation is used to +initialize the gifs or math directories (e.g. for an out-of-source +build), tar likewise creates them without write permissions, preventing +subdirectories from being created later. Set the user write bit +explicitly to avoid this problem. + Mf-stex + +Related to https://github.com/racket/racket/pull/4203 +--- + +Submitted upstream in https://github.com/dybvig/stex/pull/6 + + Mf-stex | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Mf-stex b/Mf-stex +index 09ec6f3..11fb214 100644 +--- a/Mf-stex ++++ b/Mf-stex +@@ -112,9 +112,11 @@ $(x).mathrun: gifs $(mathfiles) + + gifs: + (cd $(STEXLIB); tar -cf - gifs) | tar -xpf - ++ chmod u+w gifs + + math: + (cd $(STEXLIB); tar -cf - math) | tar -xpf - ++ chmod u+w math + + $(mathfiles): $(x).hthirdrun $(figps) + echo -n gifs= > $(mathfiles) +-- +2.32.0 + From patchwork Mon Aug 8 06:10:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 41358 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 31FD927BBEA; Mon, 8 Aug 2022 07:11:43 +0100 (BST) 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 03DF127BBE9 for ; Mon, 8 Aug 2022 07:11:42 +0100 (BST) Received: from localhost ([::1]:52374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvzJ-0003ox-5m for patchwork@mira.cbaines.net; Mon, 08 Aug 2022 02:11:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKvyh-0003jf-NA for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49199) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKvyh-0002nj-6d for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKvyh-0002u5-2J for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH 3/6] gnu: chez-scheme: Fix use of "/bin/sh". Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 06:11:03 +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.165993903711073 (code B ref 57050); Mon, 08 Aug 2022 06:11:03 +0000 Received: (at 57050) by debbugs.gnu.org; 8 Aug 2022 06:10:37 +0000 Received: from localhost ([127.0.0.1]:38935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyG-0002sV-Jk for submit@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:37 -0400 Received: from mail-qt1-f170.google.com ([209.85.160.170]:38412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyE-0002s5-9a for 57050@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:35 -0400 Received: by mail-qt1-f170.google.com with SMTP id z3so5825691qtv.5 for <57050@debbugs.gnu.org>; Sun, 07 Aug 2022 23:10:34 -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=DtZfqtIsJ2MblxYqADhd/qvG/+8w4KiA6L+Lj97pd8A=; b=CcdhslzqYH9EYkHy/xOABk6yPsV1PjtPjv9X43fe7G3zUAz82WZgvuhQswgqSKW5n2 MfdwE5kXrmpFJjwJHXkl8LAFAas6c5yEvEVp1MAFuyn1+KooJIS02KY4EmKbZG/Vs1sb 8iAp7AVYyDsxBeGO5yy0PA6BBmVRK/ihwfIoJAUUDB8uNlNAwB+SKHlB1HJm7bcm4eE5 RqOXN07g77QCmPKX00ziw1zxO1WiEwKZmKv6FH/iScvKFY1UWgP1OyD7Gp8HUc2/27Ks 45gqroazeEPbcL3BEy9qdebJjbxRTmUk6RYGAKLKgeCz2TwG99CImiQPEWIB37DgHAMu wAUQ== 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=DtZfqtIsJ2MblxYqADhd/qvG/+8w4KiA6L+Lj97pd8A=; b=Ccik/S5M7u2ISfRsz9sn4pKQGzhavimtvkYQbp2hvY+lJcV86dIMuLuGxSFRN0JU3e XZR+1IpUKGZmUq8meTPh4Z/PPXILt3v5IMuEg9OafRjNMM8LCIQ+es45qZ2pqp7+nc4y 193OBscAT2lWKpHLcHUkI06vMLyh2B+bQza/csBiG4V+opoCURiMX9d3AcJzufxALoH9 bWKdhVWfvj/l67+uO6s7WtNSOvKro+8wmqSxwsrGNYhzvk8FtiR3prYboKbvvora0MF1 aElfEqF63eQ5rNyfL6qyaNGyKV+qZiDBcbR3SSlGNI7q3mQFawf/mGy0HvG441MqSv7R Z2HQ== X-Gm-Message-State: ACgBeo1ICfHwlmPFVB8Jq9e105LmXaajo4z4xk1ISrcIlTB88WWYYdlf 0NHxajzoesT2MYq0oPqMKqhKYoNWOSTM7/ch X-Google-Smtp-Source: AA6agR6IJDxRhkqCVhwhHv3aDbbJHmXlsfR4DemyV/JlyCEAcd454HBryiVIiApMNLqNTugPER6tew== X-Received: by 2002:ac8:7318:0:b0:342:f5bf:2093 with SMTP id x24-20020ac87318000000b00342f5bf2093mr5012607qto.235.1659939028128; Sun, 07 Aug 2022 23:10:28 -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 u17-20020a05622a011100b003051ea4e7f6sm7642771qtw.48.2022.08.07.23.10.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 23:10:27 -0700 (PDT) From: Philip McGrath Date: Mon, 8 Aug 2022 02:10:04 -0400 Message-Id: <5e5e8f491c7cbee3ef7a21437a52675dd47d186e.1659936550.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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 unsuccessful attempt to execute "/bin/sh" by Chez Scheme's 'process' function seems to have caused parts of the Chez Scheme test suite to have been silently skipped. The issue was exposed by the upcoming changes to Racket's build system. * gnu/packages/patches/chez-scheme-bin-sh.patch, gnu/packages/patches/racket-chez-scheme-bin-sh.patch: New patches. * gnu/packages/patches/racket-minimal-sh-via-rktio.patch: Rename to ... * gnu/packages/patches/racket-rktio-bin-sh.patch: ... this, refresh with upstream, and shorten the macro name. * gnu/local.mk (dist_patch_DATA): Update accordingly. * gnu/packages/racket.scm (%racket-origin)[patches]: Likewise. (racket-vm-common-configure-flags): Likewise. * gnu/packages/chez.scm (chez-scheme)[origin]: Likewise. [inputs]: Add bash-minimal. [arguments]<#:configure-flags>: Set CPPFLAGS to enable new patches. --- gnu/local.mk | 4 +- gnu/packages/chez.scm | 5 ++ gnu/packages/patches/chez-scheme-bin-sh.patch | 66 +++++++++++++++++++ .../patches/racket-chez-scheme-bin-sh.patch | 66 +++++++++++++++++++ ...-rktio.patch => racket-rktio-bin-sh.patch} | 28 ++++---- gnu/packages/racket.scm | 5 +- 6 files changed, 158 insertions(+), 16 deletions(-) create mode 100644 gnu/packages/patches/chez-scheme-bin-sh.patch create mode 100644 gnu/packages/patches/racket-chez-scheme-bin-sh.patch rename gnu/packages/patches/{racket-minimal-sh-via-rktio.patch => racket-rktio-bin-sh.patch} (79%) diff --git a/gnu/local.mk b/gnu/local.mk index 234f21ad33..e827feed36 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -940,6 +940,7 @@ dist_patch_DATA = \ %D%/packages/patches/ceph-boost-compat.patch \ %D%/packages/patches/ceph-rocksdb-compat.patch \ %D%/packages/patches/cheese-vala-update.patch \ + %D%/packages/patches/chez-scheme-bin-sh.patch \ %D%/packages/patches/chmlib-inttypes.patch \ %D%/packages/patches/cl-asdf-config-directories.patch \ %D%/packages/patches/clamav-config-llvm-libs.patch \ @@ -1769,7 +1770,8 @@ dist_patch_DATA = \ %D%/packages/patches/ripperx-missing-file.patch \ %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ %D%/packages/patches/rtags-separate-rct.patch \ - %D%/packages/patches/racket-minimal-sh-via-rktio.patch \ + %D%/packages/patches/racket-chez-scheme-bin-sh.patch \ + %D%/packages/patches/racket-rktio-bin-sh.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 4c253effa0..66098c7a24 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -34,6 +34,7 @@ (define-module (gnu packages chez) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system copy) + #:use-module (gnu packages bash) #:use-module (gnu packages compression) #:use-module (gnu packages ncurses) #:use-module (gnu packages ghostscript) @@ -269,6 +270,7 @@ (define-public chez-scheme (base32 "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc")) (file-name (git-file-name name version)) + (patches (search-patches "chez-scheme-bin-sh.patch")) (snippet #~(begin (use-modules (guix build utils)) ;; TODO: consider putting this in a (guix ...) or @@ -287,6 +289,7 @@ (define-public chez-scheme `(,util-linux "lib") ;<-- libuuid zlib lz4 + bash-minimal ;<-- for process ncurses ;<-- for expeditor ;; for X11 clipboard support in expeditor: ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232 @@ -313,6 +316,8 @@ (define-public chez-scheme (cut memq 'threads <>)) #~("--threads") #~()) + ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH=" + #$(file-append bash-minimal "/bin/sh")) "ZLIB=-lz" "LZ4=-llz4" "--libkernel" diff --git a/gnu/packages/patches/chez-scheme-bin-sh.patch b/gnu/packages/patches/chez-scheme-bin-sh.patch new file mode 100644 index 0000000000..e6228e3264 --- /dev/null +++ b/gnu/packages/patches/chez-scheme-bin-sh.patch @@ -0,0 +1,66 @@ +From c170f0f3a326f293ee1f460a70303382966ca41b Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 19 May 2022 13:41:56 -0400 +Subject: [PATCH] patch s_process for "/bin/sh" on Guix + +This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH` +from a previous patch. + +If: + + 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and + + 2. The path specified by `GUIX_RKTIO_BIN_SH` exists; + +then `s_process` will call `execl` with the file specified by +`GUIX_RKTIO_BIN_SH` instead of "/bin/sh". + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + c/prim5.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/c/prim5.c b/c/prim5.c +index 5a07893..926d68d 100644 +--- a/c/prim5.c ++++ b/c/prim5.c +@@ -746,6 +746,22 @@ static ptr s_process(char *s, IBOOL stderrp) { + + INT tofds[2], fromfds[2], errfds[2]; + struct sigaction act, oint_act; ++ /* BEGIN PATCH for Guix */ ++#if defined(GUIX_RKTIO_BIN_SH) ++# define GUIX_AS_a_STR_HELPER(x) #x ++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) ++ /* A level of indirection makes `#` work as needed: */ ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf)) ++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH) ++ : "/bin/sh"; ++# undef GUIX_AS_a_STR ++# undef GUIX_AS_a_STR_HELPER ++#else /* GUIX_RKTIO_BIN_SH */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -771,7 +787,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); + CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); + {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} +- execl("/bin/sh", "/bin/sh", "-c", s, NULL); ++ /* BEGIN PATCH for Guix */ ++ execl(guix_sh, guix_sh, "-c", s, NULL); ++ /* END PATCH for Guix */ + _exit(1) /* only if execl fails */; + /*NOTREACHED*/ + } else { + +base-commit: 9df56e7b25bc523663eac3da24be33afc5f76c84 +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch new file mode 100644 index 0000000000..df2eb671b3 --- /dev/null +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -0,0 +1,66 @@ +From 5f3fc12bf123f30485800960b0493f5dd538d107 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 19 May 2022 13:41:56 -0400 +Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix + +This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH` +from a previous patch. + +If: + + 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and + + 2. The path specified by `GUIX_RKTIO_BIN_SH` exists; + +then `s_process` will call `execl` with the file specified by +`GUIX_RKTIO_BIN_SH` instead of "/bin/sh". + +This patch does not change the behavior of `s_system`, which relies +on `system` from the C library. +--- + racket/src/ChezScheme/c/prim5.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c +index f5e3e345be..9db2989138 100644 +--- a/racket/src/ChezScheme/c/prim5.c ++++ b/racket/src/ChezScheme/c/prim5.c +@@ -856,6 +856,22 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { + + INT tofds[2], fromfds[2], errfds[2]; + struct sigaction act, oint_act; ++ /* BEGIN PATCH for Guix */ ++#if defined(GUIX_RKTIO_BIN_SH) ++# define GUIX_AS_a_STR_HELPER(x) #x ++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) ++ /* A level of indirection makes `#` work as needed: */ ++ struct stat guix_stat_buf; ++ char *guix_sh = ++ (0 == stat(GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH), &guix_stat_buf)) ++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH) ++ : "/bin/sh"; ++# undef GUIX_AS_a_STR ++# undef GUIX_AS_a_STR_HELPER ++#else /* GUIX_RKTIO_BIN_SH */ ++ char *guix_sh = "/bin/sh"; ++#endif ++ /* END PATCH for Guix */ + + if (pipe(tofds)) S_error("process","cannot open pipes"); + if (pipe(fromfds)) { +@@ -881,7 +897,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { + CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); + CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); + {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} +- execl("/bin/sh", "/bin/sh", "-c", s, NULL); ++ /* BEGIN PATCH for Guix */ ++ execl(guix_sh, guix_sh, "-c", s, NULL); ++ /* END PATCH for Guix */ + _exit(1) /* only if execl fails */; + /*NOTREACHED*/ + } else { + +base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch b/gnu/packages/patches/racket-rktio-bin-sh.patch similarity index 79% rename from gnu/packages/patches/racket-minimal-sh-via-rktio.patch rename to gnu/packages/patches/racket-rktio-bin-sh.patch index 6bc2ee8331..4f7f2da083 100644 --- a/gnu/packages/patches/racket-minimal-sh-via-rktio.patch +++ b/gnu/packages/patches/racket-rktio-bin-sh.patch @@ -1,7 +1,7 @@ -From 3574b567c486d264d680a37586436c3b5a8cb978 Mon Sep 17 00:00:00 2001 +From 070abbcc0d880ca4f97f997e096ac66650ccaaa0 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Thu, 4 Mar 2021 04:11:50 -0500 -Subject: [PATCH] patch rktio_process for "/bin/sh" on Guix +Subject: [PATCH] rktio: patch rktio_process for "/bin/sh" on Guix Racket provides the functions `system` and `process`, which execute shell commands using `sh` (or `cmd` on Windows). @@ -13,17 +13,17 @@ the C function that implements the core of `system`, `process`, and related Racket functions. Guix should enable the special case by defining the C preprocessor -macro `GUIX_RKTIO_PATCH_BIN_SH` with the path to `sh` in the store. +macro `GUIX_RKTIO_BIN_SH` with the path to `sh` in the store. If: - 1. The `GUIX_RKTIO_PATCH_BIN_SH` macro is defined; and + 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and 2. `rktio_process` is called with the exact path "/bin/sh"; and - 3. The path specified by `GUIX_RKTIO_PATCH_BIN_SH` does exists; + 3. The file specified by `GUIX_RKTIO_BIN_SH` exists; then `rktio_process` will execute the file specified -by `GUIX_RKTIO_PATCH_BIN_SH` instead of "/bin/sh". +by `GUIX_RKTIO_BIN_SH` instead of "/bin/sh". Compared to previous attempts to patch the Racket sources, making this change at the C level is both: @@ -39,10 +39,10 @@ making this change at the C level is both: 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/racket/src/rktio/rktio_process.c b/racket/src/rktio/rktio_process.c -index 89202436c0..465ebdd5c5 100644 +index fafaf728c1..0a319b381a 100644 --- a/racket/src/rktio/rktio_process.c +++ b/racket/src/rktio/rktio_process.c -@@ -1224,12 +1224,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) +@@ -1301,12 +1301,14 @@ int rktio_process_allowed_flags(rktio_t *rktio) /*========================================================================*/ rktio_process_result_t *rktio_process(rktio_t *rktio, @@ -58,19 +58,19 @@ index 89202436c0..465ebdd5c5 100644 rktio_process_result_t *result; intptr_t to_subprocess[2], from_subprocess[2], err_subprocess[2]; int pid; -@@ -1255,6 +1257,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio, +@@ -1333,6 +1335,23 @@ rktio_process_result_t *rktio_process(rktio_t *rktio, int i; #endif +/* BEGIN PATCH for Guix */ -+#if defined(GUIX_RKTIO_PATCH_BIN_SH) ++#if defined(GUIX_RKTIO_BIN_SH) +# define GUIX_AS_a_STR_HELPER(x) #x +# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) + /* A level of indirection makes `#` work as needed: */ + command = + ((0 == strcmp(_guix_orig_command, "/bin/sh")) -+ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH))) -+ ? GUIX_AS_a_STR(GUIX_RKTIO_PATCH_BIN_SH) ++ && rktio_file_exists(rktio, GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH))) ++ ? GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH) + : _guix_orig_command; +# undef GUIX_AS_a_STR +# undef GUIX_AS_a_STR_HELPER @@ -82,6 +82,8 @@ index 89202436c0..465ebdd5c5 100644 /* avoid compiler warnings: */ to_subprocess[0] = -1; to_subprocess[1] = -1; + +base-commit: 9d228d16fb99c274c964e5bef93e97333888769f -- -2.21.1 (Apple Git-122.3) +2.32.0 diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 3399bcc3fe..cddb617232 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -212,7 +212,8 @@ (define %racket-origin (sha256 (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-minimal-sh-via-rktio.patch")) + (patches (search-patches "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -248,7 +249,7 @@ (define (racket-vm-common-configure-flags) (list (string-append "--enable-racket=" racket)))) (else '())) - ,(string-append "CPPFLAGS=-DGUIX_RKTIO_PATCH_BIN_SH=" + ,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH=" #$(file-append bash-minimal "/bin/sh")) "--disable-strip" ;; Using --enable-origtree lets us distinguish the VM from subsequent From patchwork Mon Aug 8 06:10:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 41360 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 8BBD327BBEA; Mon, 8 Aug 2022 07:12:09 +0100 (BST) 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 8DFDC27BBE9 for ; Mon, 8 Aug 2022 07:12:05 +0100 (BST) Received: from localhost ([::1]:53030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvzg-0004Ft-9I for patchwork@mira.cbaines.net; Mon, 08 Aug 2022 02:12:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKvyi-0003jo-0v for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49200) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKvyh-0002nw-ON for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKvyh-0002uD-Jf for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH 4/6] gnu: Update Racket to 8.6. Add Zuo. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 06:11:03 +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.165993904711107 (code B ref 57050); Mon, 08 Aug 2022 06:11:03 +0000 Received: (at 57050) by debbugs.gnu.org; 8 Aug 2022 06:10:47 +0000 Received: from localhost ([127.0.0.1]:38939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyN-0002sv-He for submit@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:47 -0400 Received: from mail-qv1-f52.google.com ([209.85.219.52]:40555) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyI-0002sM-RR for 57050@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:42 -0400 Received: by mail-qv1-f52.google.com with SMTP id i4so5730258qvv.7 for <57050@debbugs.gnu.org>; Sun, 07 Aug 2022 23:10:38 -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=gNi1IqD0nPZCI+0SHmP2x3XxRAP9TB2Zk8w7H7c7mxA=; b=PpeAX40DJKP2r8cRzvesUhwBuBfPyH6VsktlVxIwp1zCUKQUQYiXwadT7PgnqQ2HyA gSSAzV+6m1IXAr7f2Ah94TGrA29VI/04FCr4vswVKtRRscOY/fwsXmXugv3qGSsbzjDK opyK+oCOK/jUp8RMORZumT8jbVrDq05UzMKqBgGiHUX6F9KSUjeJ18igpxpRvRttuafx 6l+TX71TPXU6iIwQMvQGUNpvBp0SRXCajzX3w6Xy1HK8+eBbaLkf++fM5B23G3awYkB0 Ul9BYngdG6Bzchf0Cl0LLihDTY6gdLl7slbwFUzzJf4gVncMY4VknszkslcLF+nEa8n3 2X4A== 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=gNi1IqD0nPZCI+0SHmP2x3XxRAP9TB2Zk8w7H7c7mxA=; b=PsUdwMVtpkGF/Oe55KkDpt3X+cngTxxHgZSyV3AuAFa9W9HtVx91tuP4XNgBBq0kKt xeD+1Am6022/yzp7gWf0eRrpDHpognYsv/cyxA6w63jzPkFP57u+/bnxz+u+f6QBwFW3 8RDAU2BjW7hFvCVGurUvW9+kTd+/HCrqxYK04/LodA8hgKoZpAkkb0dcmuhsZwdXyhjS zDC6o2Z6h/5PDd1WliGl3BHEUW3jUYcAXVPXWtEiXlCewrSMaVs1bUTasPR4LnHQBqbD /ebZoYedIiGDv6ybPqCq2GFFHStbwdvXjACmfsGg8qX9X5q+tobjro7R+wVmNf+lbe4A Egrg== X-Gm-Message-State: ACgBeo0YKecjtpOZvD6G56uIfjfMOV6+EFQbGCTJ7mn1AqyjPOP4L2IS mpoQU/HuXrd27W/kKJ65i4t4zqMOIrKxnvhH X-Google-Smtp-Source: AA6agR4zkPn9p0u4E+tIMqjEnu6iT//cU32xWUJ6XwC8ASjULayQbZiJqNndwMsYZQt3SiIzxnvg9Q== X-Received: by 2002:a0c:a889:0:b0:473:d709:8753 with SMTP id x9-20020a0ca889000000b00473d7098753mr14839687qva.16.1659939032145; Sun, 07 Aug 2022 23:10:32 -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 j10-20020a37ef0a000000b006b8e049cf08sm1696315qkk.2.2022.08.07.23.10.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 23:10:31 -0700 (PDT) From: Philip McGrath Date: Mon, 8 Aug 2022 02:10:05 -0400 Message-Id: <0d47e0372925c83fb72ff37c0f00c8196327c636.1659936550.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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 Also, update 'chez-scheme-for-racket' to 9.5.9.2. These packages must be updated together because they are built from the same origin. In particular, Zuo was added after the Racket 8.5 release and is needed to build this release. * gnu/packages/patches/racket-chez-scheme-bin-sh.patch: Refresh patch. * gnu/packages/patches/racket-backport-8.6-cross-install.patch, gnu/packages/patches/racket-backport-8.6-docindex-write.patch, gnu/packages/patches/racket-backport-8.6-hurd.patch, gnu/packages/patches/racket-backport-8.6-zuo.patch, gnu/packages/patches/racket-zuo-bin-sh.patch: New patches. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/racket.scm (%racket-origin)[patches]: Use them. (%racket-version): Update to 8.6. (%zuo-version): New variable. (zuo): New package. (racket-vm-cgc)[native-inputs]: Add 'zuo'. [arguments]<#:make-flags>: Use 'zuo' from 'native-inputs'. (racket)[inputs]: Update checksums. * gnu/packages/chez.scm (target-chez-os): Handle Hurd and QNX. (%chez-features-table): Likewise. (chez-scheme-for-racket): Update to 9.5.9.2. [native-inputs]: Add 'zuo'. [arguments]<#:out-of-source?>: Use out-of-source build. <#:tests?>: Skip them due to ongoing problems. <#:configure-flags>: Add '--install-csug=' and '--installreleasenotes='. <#:make-flags>: Use 'zuo' from 'native-inputs'. Supply 'STEXLIB=' here, rather than in a phase. <#:phases>: Replace 'install-docs' using new 'make' target. --- gnu/local.mk | 5 + gnu/packages/chez.scm | 52 +- .../racket-backport-8.6-cross-install.patch | 32 + .../racket-backport-8.6-docindex-write.patch | 36 ++ .../patches/racket-backport-8.6-hurd.patch | 609 ++++++++++++++++++ .../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++ .../patches/racket-chez-scheme-bin-sh.patch | 16 +- gnu/packages/patches/racket-zuo-bin-sh.patch | 72 +++ gnu/packages/racket.scm | 159 +++-- 9 files changed, 1403 insertions(+), 59 deletions(-) create mode 100644 gnu/packages/patches/racket-backport-8.6-cross-install.patch create mode 100644 gnu/packages/patches/racket-backport-8.6-docindex-write.patch create mode 100644 gnu/packages/patches/racket-backport-8.6-hurd.patch create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch diff --git a/gnu/local.mk b/gnu/local.mk index e827feed36..a3f2564d44 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1770,8 +1770,13 @@ dist_patch_DATA = \ %D%/packages/patches/ripperx-missing-file.patch \ %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ %D%/packages/patches/rtags-separate-rct.patch \ + %D%/packages/patches/racket-backport-8.6-cross-install.patch \ + %D%/packages/patches/racket-backport-8.6-docindex-write.patch \ + %D%/packages/patches/racket-backport-8.6-hurd.patch \ + %D%/packages/patches/racket-backport-8.6-zuo.patch \ %D%/packages/patches/racket-chez-scheme-bin-sh.patch \ %D%/packages/patches/racket-rktio-bin-sh.patch \ + %D%/packages/patches/racket-zuo-bin-sh.patch \ %D%/packages/patches/remake-impure-dirs.patch \ %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 66098c7a24..dde2c22ca5 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -116,7 +116,7 @@ (define* (target-chez-os #:optional (system (or (%current-target-system) ((target-linux? system) "le") ((target-hurd? system) - #f) + "gnu") ((target-mingw? system) "nt") ;; missing (guix utils) predicates @@ -132,6 +132,8 @@ (define* (target-chez-os #:optional (system (or (%current-target-system) ;; Nix says "x86_64-solaris", but accommodate "-solaris2" ((string-contains system "solaris") "s2") + ((string-suffix? "-qnx" system) + "qnx") ;; unknown (else #f))) @@ -168,6 +170,9 @@ (define %chez-features-table ("arm32" bootstrap-bootfiles) ("arm64" . #f) ("ppc32" threads)) + ;; Hurd + ("gnu" + ("i3" . #f)) ;; FreeBSD ("fb" ("i3" threads) ;; commented out @@ -193,6 +198,9 @@ (define %chez-features-table ("s2" ("i3" threads) ;; commented out ("a6" threads)) ;; commented out + ;; QNX + ("qnx" + ("i3" . #f)) ;; Windows ("nt" ("i3" threads bootstrap-bootfiles) @@ -437,7 +445,7 @@ (define-public chez-scheme-for-racket (package (inherit chez-scheme) (name "chez-scheme-for-racket") - (version "9.5.7.6") + (version "9.5.9.2") ;; 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! @@ -448,18 +456,52 @@ (define-public chez-scheme-for-racket (delete "libx11" "util-linux:lib"))) (native-inputs (modify-inputs (package-native-inputs chez-scheme) + (append zuo) (replace "chez-scheme-bootstrap-bootfiles" chez-scheme-for-racket-bootstrap-bootfiles))) (arguments (substitute-keyword-arguments (package-arguments chez-scheme) + ((#:out-of-source? _ #f) + #t) + ((#:tests? _ #t) + ;; FIXME: There have been some flaky test failures. Some have been + ;; fixed upstream post-release but have proven non-trivial to + ;; backport; at least one issue remains. Re-enable tests once + ;; https://github.com/racket/racket/issues/4359 is fixed. + #f) ((#:configure-flags cfg-flags #~'()) - #~(cons* "--disable-x11" - "--threads" ;; ok to potentially duplicate - #$cfg-flags)) + #~`("--disable-x11" + "--threads" ;; ok to potentially duplicate + ,@(let* ((chez+version (strip-store-file-name #$output)) + (doc-prefix (assoc-ref %outputs "doc")) + (doc-dir (string-append doc-prefix + "/share/doc/" + chez+version))) + (list (string-append "--installcsug=" + doc-dir + "/csug") + (string-append "--installreleasenotes=" + doc-dir + "/release_notes"))) + ,@#$cfg-flags)) + ((#:make-flags mk-flags #~'()) + #~(cons* (string-append "ZUO=" + #+(this-package-native-input "zuo") + "/bin/zuo") + (string-append "STEXLIB=" + #+(this-package-native-input "stex") + "/lib/stex") + #$mk-flags)) ((#:phases those-phases #~%standard-phases) #~(let* ((those-phases #$those-phases) (unpack (assoc-ref those-phases 'unpack))) (modify-phases those-phases + (replace 'install-docs + (lambda* (#:key make-flags #:allow-other-keys) + (apply invoke + "make" + "install-docs" + make-flags))) (replace 'unpack (lambda args (unpack #:source #$(or (package-source this-package) diff --git a/gnu/packages/patches/racket-backport-8.6-cross-install.patch b/gnu/packages/patches/racket-backport-8.6-cross-install.patch new file mode 100644 index 0000000000..4f7849ecc6 --- /dev/null +++ b/gnu/packages/patches/racket-backport-8.6-cross-install.patch @@ -0,0 +1,32 @@ +From 585215c5c42f7ee0fee05e6a637ab1bc17f5e8e0 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 30 Jul 2022 07:06:55 -0600 +Subject: [PATCH] CS makefiles: fix Unix-style install for cross compilation + +Closes #4377 + +(cherry picked from commit 053be470e7c5454cdf48e934f3254d2d916bbbc5) +--- + racket/src/cs/c/build.zuo | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/racket/src/cs/c/build.zuo b/racket/src/cs/c/build.zuo +index 8d3950bb27..d8b74c509d 100644 +--- a/racket/src/cs/c/build.zuo ++++ b/racket/src/cs/c/build.zuo +@@ -1016,10 +1016,9 @@ + (define (setup) + (call-with-dest-racket + (lambda (bindir dest-racket) +- (define copytree-racket (and cross? (config-bootstrap-racket))) ++ (define copytree-racket (and cross? (hash-ref (config-bootstrap-racket) 'racket))) + (maybe-copytree config dest-racket copytree-racket at-dir) +- (run-raco-setup config dest-racket +- (and cross? (hash-ref (config-bootstrap-racket) 'racket)) ++ (run-raco-setup config dest-racket copytree-racket + ;; this can be redundant if it's also supplied via `SETUP_MACHINE_FLAGS`, + ;; but redundant should be ok: + (list "-MCR" (~a (at-dir "compiled") ":") +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-backport-8.6-docindex-write.patch b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch new file mode 100644 index 0000000000..abe1984507 --- /dev/null +++ b/gnu/packages/patches/racket-backport-8.6-docindex-write.patch @@ -0,0 +1,36 @@ +From 8b4d686a62fd66dedfc40ecdcf3698316993d614 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Sun, 17 Jul 2022 22:51:44 -0400 +Subject: [PATCH] racket-index: set write permission when copying + `docindex.sqlite` + +Fixes https://github.com/racket/racket/issues/4357 + +(cherry picked from commit 55b6cbdca1f36a4f37bab1519c1b658717d3cad2) +--- + pkgs/racket-index/setup/scribble.rkt | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/pkgs/racket-index/setup/scribble.rkt b/pkgs/racket-index/setup/scribble.rkt +index 6694f0b793..e27a8fa348 100644 +--- a/pkgs/racket-index/setup/scribble.rkt ++++ b/pkgs/racket-index/setup/scribble.rkt +@@ -252,7 +252,14 @@ + (unless (file-exists? db-file) + (define-values (base name dir?) (split-path db-file)) + (make-directory* base) +- (when copy-from (copy-file copy-from db-file)) ++ (when copy-from ++ (copy-file copy-from db-file) ++ ;; we might not have write permissions for the previous layer: ++ ;; ensure that we do for the new file ++ (define orig-mode (file-or-directory-permissions db-file 'bits)) ++ (define writeable-mode (bitwise-ior user-write-bit orig-mode)) ++ (unless (= writeable-mode orig-mode) ++ (file-or-directory-permissions db-file writeable-mode))) + (doc-db-disconnect + (doc-db-file->connection db-file #t)))) + (when (or (ormap can-build*? main-docs) +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-backport-8.6-hurd.patch b/gnu/packages/patches/racket-backport-8.6-hurd.patch new file mode 100644 index 0000000000..d593b01e62 --- /dev/null +++ b/gnu/packages/patches/racket-backport-8.6-hurd.patch @@ -0,0 +1,609 @@ +From f17b030fa2f902bb3666913d4a3cd6ba9c146d22 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Wed, 3 Aug 2022 03:13:03 -0400 +Subject: [PATCH 1/3] Chez Scheme: Fix build on GNU/Hurd + +Mostly GNU/Hurd should take the same options as GNU/Linux. One +difference is that the Hurd does not define macros such as `PATH_MAX` or +`NOFILE`, because it avoids imposing arbitrary limits on such resources. +This patch provides alternatives for localized uses of those constants, +but it accepts the pervasive use of `PATH_MAX` in finding bootfiles for +now. See https://www.gnu.org/software/hurd/hurd/porting/guidelines.html. + +(cherry picked from commit 87eee6e2adb8c6bc11e60619c706fa6295096085) +--- + racket/src/ChezScheme/README.md | 1 + + racket/src/ChezScheme/c/number.c | 22 +++++++++---------- + racket/src/ChezScheme/c/prim5.c | 35 ++++++++++++++++++++++++++++-- + racket/src/ChezScheme/c/scheme.c | 34 +++++++++++++++++------------ + racket/src/ChezScheme/c/version.h | 7 ++++-- + racket/src/ChezScheme/configure | 17 ++++++++++----- + racket/src/ChezScheme/s/cmacros.ss | 1 + + racket/src/cs/c/configure | 14 ++++++++++-- + racket/src/cs/c/configure.ac | 14 ++++++++++-- + racket/src/cs/rumble/system.ss | 3 +++ + 10 files changed, 109 insertions(+), 39 deletions(-) + +diff --git a/racket/src/ChezScheme/README.md b/racket/src/ChezScheme/README.md +index a4a11a5eef..25231dd9bb 100644 +--- a/racket/src/ChezScheme/README.md ++++ b/racket/src/ChezScheme/README.md +@@ -13,6 +13,7 @@ Supported platforms (bytecode interpreter may work for others): + * OpenBSD: x86, x86_64, ARMv6, AArch64, PowerPC32 + * NetBSD: x86, x86_64, ARMv6, AArch64, PowerPC32 + * Solaris: x86, x86_64 ++ * GNU/Hurd: x86 + * Android: ARMv7, AArch64 + * iOS: AArch64 + * WebAssembly via Emscripten (bytecode interpreter only) +diff --git a/racket/src/ChezScheme/c/number.c b/racket/src/ChezScheme/c/number.c +index ede38cc626..e2bce0d2d3 100644 +--- a/racket/src/ChezScheme/c/number.c ++++ b/racket/src/ChezScheme/c/number.c +@@ -1041,15 +1041,15 @@ floating-point operations + + #ifdef IEEE_DOUBLE + /* exponent stored + 1024, hidden bit to left of decimal point */ +-#define bias 1023 +-#define bitstoright 52 +-#define m1mask 0xf +-#ifdef WIN32 +-#define hidden_bit 0x10000000000000 +-#else +-#define hidden_bit 0x10000000000000ULL +-#endif +-#ifdef LITTLE_ENDIAN_IEEE_DOUBLE ++# define bias 1023 ++# define bitstoright 52 ++# define m1mask 0xf ++# ifdef WIN32 ++# define hidden_bit 0x10000000000000 ++# else ++# define hidden_bit 0x10000000000000ULL ++# endif ++# ifdef LITTLE_ENDIAN_IEEE_DOUBLE + struct dblflt { + UINT m4: 16; + UINT m3: 16; +@@ -1058,7 +1058,7 @@ struct dblflt { + UINT e: 11; + UINT sign: 1; + }; +-#else ++# else + struct dblflt { + UINT sign: 1; + UINT e: 11; +@@ -1067,7 +1067,7 @@ struct dblflt { + UINT m3: 16; + UINT m4: 16; + }; +-#endif ++# endif + #endif + + double S_random_double(U32 m1, U32 m2, U32 m3, U32 m4, double scale) { +diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c +index 124d1e049c..82bbf8d687 100644 +--- a/racket/src/ChezScheme/c/prim5.c ++++ b/racket/src/ChezScheme/c/prim5.c +@@ -23,6 +23,10 @@ + #include + #include + ++#if defined(__GNU__) /* Hurd */ ++#include ++#endif ++ + /* locally defined functions */ + static INT s_errno(void); + static IBOOL s_addr_in_heap(uptr x); +@@ -58,7 +62,7 @@ static void s_showalloc(IBOOL show_dump, const char *outfn); + static ptr s_system(const char *s); + static ptr s_process(char *s, IBOOL stderrp); + static I32 s_chdir(const char *inpath); +-#ifdef GETWD ++#if defined(GETWD) || defined(__GNU__) /* Hurd */ + static char *s_getwd(void); + #endif + static ptr s_set_code_byte(ptr p, ptr n, ptr x); +@@ -881,7 +885,18 @@ static ptr s_process(char *s, IBOOL stderrp) { + CLOSE(0); if (dup(tofds[0]) != 0) _exit(1); + CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); + CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); ++#ifndef __GNU__ /* Hurd */ + {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} ++#else /* __GNU__ Hurd: no NOFILE */ ++ { ++ INT i; ++ struct rlimit rlim; ++ getrlimit(RLIMIT_NOFILE, &rlim); ++ for (i = 3; i < rlim.rlim_cur; i++) { ++ (void)CLOSE(i); ++ } ++ } ++#endif /* __GNU__ Hurd */ + execl("/bin/sh", "/bin/sh", "-c", s, NULL); + _exit(1) /* only if execl fails */; + /*NOTREACHED*/ +@@ -927,6 +942,22 @@ static I32 s_chdir(const char *inpath) { + static char *s_getwd() { + return GETWD(TO_VOIDP(&BVIT(S_bytevector(PATH_MAX), 0))); + } ++#elif defined(__GNU__) /* Hurd: no PATH_MAX */ ++static char *s_getwd() { ++ char *path; ++ size_t len; ++ ptr bv; ++ path = getcwd(NULL, 0); ++ if (NULL == path) { ++ return NULL; ++ } else { ++ len = strlen(path); ++ bv = S_bytevector(len); ++ memcpy(TO_VOIDP(&BVIT(bv, 0)), path, len); ++ free(path); ++ return TO_VOIDP(&BVIT(bv, 0)); ++ } ++} + #endif /* GETWD */ + + static ptr s_set_code_byte(ptr p, ptr n, ptr x) { +@@ -1817,7 +1848,7 @@ void S_prim5_init(void) { + Sforeign_symbol("(cs)s_rational", (void *)S_rational); + Sforeign_symbol("(cs)sub", (void *)S_sub); + Sforeign_symbol("(cs)rem", (void *)S_rem); +-#ifdef GETWD ++#if defined(GETWD) || defined(__GNU__) /* Hurd */ + Sforeign_symbol("(cs)s_getwd", (void *)s_getwd); + #endif + Sforeign_symbol("(cs)s_chdir", (void *)s_chdir); +diff --git a/racket/src/ChezScheme/c/scheme.c b/racket/src/ChezScheme/c/scheme.c +index ed5564540b..0c40e3eaf0 100644 +--- a/racket/src/ChezScheme/c/scheme.c ++++ b/racket/src/ChezScheme/c/scheme.c +@@ -458,6 +458,12 @@ static IBOOL next_path(char *path, const char *name, const char *ext, const char + static const char *path_last(const char *path); + static char *get_defaultheapdirs(void); + ++#ifdef PATH_MAX ++# define BOOT_PATH_MAX PATH_MAX ++#else /* hack for Hurd: better to remove the restriction */ ++# define BOOT_PATH_MAX 4096 ++#endif ++ + static const char *path_last(const char *p) { + const char *s; + #ifdef WIN32 +@@ -483,7 +489,7 @@ static const char *path_last(const char *p) { + + static char *get_defaultheapdirs() { + char *result; +- wchar_t buf[PATH_MAX]; ++ wchar_t buf[BOOT_PATH_MAX]; + DWORD len = sizeof(buf); + if (ERROR_SUCCESS != RegGetValueW(HKEY_LOCAL_MACHINE, L"Software\\Chez Scheme\\csv" VERSION, L"HeapSearchPath", RRF_RT_REG_SZ, NULL, buf, &len)) + return DEFAULT_HEAP_PATH; +@@ -512,14 +518,14 @@ static char *get_defaultheapdirs() { + * leaving the full path with name affixed in path and *sp / *dsp pointing + * past the current entry. it returns 1 on success and 0 if at the end of + * the search path. path should be a pointer to an unoccupied buffer +- * PATH_MAX characters long. either or both of sp/dsp may be empty, ++ * BOOT_PATH_MAX characters long. either or both of sp/dsp may be empty, + * but neither may be null, i.e., (char *)0. */ + static IBOOL next_path(char *path, const char *name, const char *ext, + const char **sp, const char **dsp) { + char *p; + const char *s, *t; + +-#define setp(c) if (p >= path + PATH_MAX) { fprintf(stderr, "search path entry too long\n"); S_abnormal_exit(); } else *p++ = (c) ++#define setp(c) if (p >= path + BOOT_PATH_MAX) { fprintf(stderr, "search path entry too long\n"); S_abnormal_exit(); } else *p++ = (c) + for (;;) { + s = *sp; + p = path; +@@ -532,10 +538,10 @@ static IBOOL next_path(char *path, const char *name, const char *ext, + switch (*s) { + #ifdef WIN32 + case 'x': { +- wchar_t exepath[PATH_MAX]; DWORD n; ++ wchar_t exepath[BOOT_PATH_MAX]; DWORD n; + s += 1; +- n = GetModuleFileNameW(NULL, exepath, PATH_MAX); +- if (n == 0 || (n == PATH_MAX && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) { ++ n = GetModuleFileNameW(NULL, exepath, BOOT_PATH_MAX); ++ if (n == 0 || (n == BOOT_PATH_MAX && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) { + fprintf(stderr, "warning: executable path is too long; ignoring %%x\n"); + } else { + char *tstart; +@@ -608,7 +614,7 @@ typedef struct { + iptr len; /* 0 => unknown */ + iptr offset; + IBOOL need_check, close_after; +- char path[PATH_MAX]; ++ char path[BOOT_PATH_MAX]; + } boot_desc; + + #define MAX_BOOT_FILES 10 +@@ -695,14 +701,14 @@ static void finish_dependencies_header(int fd, const char *path, int c) { + static IBOOL find_boot(const char *name, const char *ext, IBOOL direct_pathp, + int fd, + IBOOL errorp) { +- char pathbuf[PATH_MAX], buf[PATH_MAX]; ++ char pathbuf[BOOT_PATH_MAX], buf[BOOT_PATH_MAX]; + uptr n = 0; + INT c; + const char *path; + char *expandedpath; + + if ((fd != -1) || direct_pathp || S_fixedpathp(name)) { +- if (strlen(name) >= PATH_MAX) { ++ if (strlen(name) >= BOOT_PATH_MAX) { + fprintf(stderr, "boot-file path is too long %s\n", name); + S_abnormal_exit(); + } +@@ -776,7 +782,7 @@ static IBOOL find_boot(const char *name, const char *ext, IBOOL direct_pathp, + if (boot_count == 0) { + for (;;) { + /* try to load heap or boot file this boot file requires */ +- if (get_string(fd, buf, PATH_MAX, &c) != 0) { ++ if (get_string(fd, buf, BOOT_PATH_MAX, &c) != 0) { + fprintf(stderr, "unexpected end of file on %s\n", path); + CLOSE(fd); + S_abnormal_exit(); +@@ -796,7 +802,7 @@ static IBOOL find_boot(const char *name, const char *ext, IBOOL direct_pathp, + c = get_u8(fd); + for (sep = " "; ; sep = "or ") { + if (c == ')') break; +- (void) get_string(fd, buf, PATH_MAX, &c); ++ (void) get_string(fd, buf, BOOT_PATH_MAX, &c); + fprintf(stderr, "%s%s.boot ", sep, buf); + } + fprintf(stderr, "required by %s\n", path); +@@ -1090,7 +1096,7 @@ extern void Sregister_boot_file_fd_region(const char *name, + int close_after) { + check_boot_file_state("Sregister_boot_file_fd"); + +- if (strlen(name) >= PATH_MAX) { ++ if (strlen(name) >= BOOT_PATH_MAX) { + fprintf(stderr, "boot-file path is too long %s\n", name); + S_abnormal_exit(); + } +@@ -1141,14 +1147,14 @@ extern void Sbuild_heap(const char *kernel, void (*custom_init)(void)) { + } + + name = path_last(kernel); +- if (strlen(name) >= PATH_MAX) { ++ if (strlen(name) >= BOOT_PATH_MAX) { + fprintf(stderr, "executable name too long: %s\n", name); + S_abnormal_exit(); + } + + #ifdef WIN32 + { /* strip off trailing .exe, if any */ +- static char buf[PATH_MAX]; ++ static char buf[BOOT_PATH_MAX]; + iptr n; + + n = strlen(name) - 4; +diff --git a/racket/src/ChezScheme/c/version.h b/racket/src/ChezScheme/c/version.h +index a79d12621b..61751a9fad 100644 +--- a/racket/src/ChezScheme/c/version.h ++++ b/racket/src/ChezScheme/c/version.h +@@ -80,7 +80,7 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + /*****************************************/ + /* Operating systems */ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) /* Hurd */ + #define NOBLOCK O_NONBLOCK + #define LOAD_SHARED_OBJECT + #define USE_MMAP +@@ -91,7 +91,10 @@ FORCEINLINE void store_unaligned_uptr(uptr *addr, uptr val) { + #define GETPAGESIZE() getpagesize() + typedef char *memcpy_t; + #define MAKE_NAN(x) { x = 0.0; x = x / x; } +-#define GETWD(x) getcwd((x),PATH_MAX) ++#ifndef __GNU__ /* Hurd: no PATH_MAX */ ++/* n.b. don't test PATH_MAX directly: we have not yet included */ ++# define GETWD(x) getcwd((x),PATH_MAX) ++#endif + typedef int tputsputcchar; + #ifndef __ANDROID__ + # define LOCKF +diff --git a/racket/src/ChezScheme/configure b/racket/src/ChezScheme/configure +index f64b639c3a..efdb6029cb 100755 +--- a/racket/src/ChezScheme/configure ++++ b/racket/src/ChezScheme/configure +@@ -102,6 +102,11 @@ case "${CONFIG_UNAME}" in + installprefix=/usr + installmansuffix=share/man + ;; ++ GNU) ++ unixsuffix=gnu # the Hurd ++ installprefix=/usr ++ installmansuffix=share/man ++ ;; + QNX) + if uname -a | egrep 'x86' > /dev/null 2>&1 ; then + m32=i3qnx +@@ -591,7 +596,7 @@ fi + + # Infer flags needed for threads: + case "${flagsm}" in +- *le|*fb|*ob|*nb) ++ *le|*gnu|*fb|*ob|*nb) + threadFlags="-D_REENTRANT -pthread" + threadLibs="-lpthread" + ;; +@@ -627,7 +632,7 @@ if [ "$cflagsset" = "no" ] ; then + a6*) + CFLAGS="-m64 ${optFlags}" + ;; +- i3le) ++ i3le) # intentionally not including i3gnu, which may not support sse2 + CFLAGS="-m32 -msse2 -mfpmath=sse ${optFlags}" + ;; + i3nt) +@@ -688,7 +693,7 @@ fi + # Add automatic linking flags, unless suppressed by --disable-auto-flags + if [ "$addflags" = "yes" ] ; then + case "${flagsm}" in +- *le) ++ *le|*gnu) + LDFLAGS="${LDFLAGS} -rdynamic" + ;; + *fb|*nb) +@@ -702,7 +707,7 @@ if [ "$addflags" = "yes" ] ; then + esac + + case "${flagsm}" in +- *le) ++ *le|*gnu) + LIBS="${LIBS} -lm -ldl ${ncursesLib} -lrt" + ;; + *fb|*ob) +@@ -749,7 +754,7 @@ exeSuffix= + + # compile flags for c/Mf-unix and mats/Mf-unix + case "${flagsmuni}" in +- *le) ++ *le|*gnu) + mdcflags="-fPIC -shared" + ;; + *fb|*ob) +@@ -781,7 +786,7 @@ case "${flagsmuni}" in + i3le) + mdldflags="-melf_i386" + ;; +- *le) ++ *le|*gnu) + ;; + i3nb) + mdldflags="-m elf_i386" +diff --git a/racket/src/ChezScheme/s/cmacros.ss b/racket/src/ChezScheme/s/cmacros.ss +index ff2b09217b..2e79a4d8de 100644 +--- a/racket/src/ChezScheme/s/cmacros.ss ++++ b/racket/src/ChezScheme/s/cmacros.ss +@@ -385,6 +385,7 @@ + i3fb ti3fb + i3ob ti3ob + i3osx ti3osx ++ i3gnu ti3gnu + a6le ta6le + a6osx ta6osx + a6ob ta6ob +diff --git a/racket/src/cs/c/configure b/racket/src/cs/c/configure +index 454d79e11a..dab545c0b4 100755 +--- a/racket/src/cs/c/configure ++++ b/racket/src/cs/c/configure +@@ -4449,8 +4449,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ *linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -4730,6 +4737,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd: must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/c/configure.ac b/racket/src/cs/c/configure.ac +index 5bce979c92..43e7307b1b 100644 +--- a/racket/src/cs/c/configure.ac ++++ b/racket/src/cs/c/configure.ac +@@ -272,8 +272,15 @@ case "$host_os" in + ;; + irix*) + ;; +- linux*) +- MACH_OS=le ++ linux*|gnu*) ++ case "$host_os" in ++ linux*) ++ MACH_OS=le ++ ;; ++ *) ++ MACH_OS=gnu # Hurd ++ ;; ++ esac + case "$host_os" in + *linux-android*) + ;; +@@ -466,6 +473,9 @@ if test "${build_os}_${build_cpu}" != "${host_os}_${host_cpu}" ; then + linux*) + BUILD_OS=le + ;; ++ gnu*) # Hurd - must come after linux* ++ BUILD_OS=gnu ++ ;; + *mingw*) + BUILD_OS=nt + ;; +diff --git a/racket/src/cs/rumble/system.ss b/racket/src/cs/rumble/system.ss +index 2319cbe7a5..773eb79cf3 100644 +--- a/racket/src/cs/rumble/system.ss ++++ b/racket/src/cs/rumble/system.ss +@@ -48,6 +48,8 @@ + arm32le tarm32le arm64le tarm64le + ppc32le tppc32le) + 'linux] ++ [(i3gnu ti3gnu) ++ 'gnu-hurd] + [(a6fb ta6fb i3fb ti3fb + arm32fb tarm32fb arm64fb tarm64fb + ppc32fb tppc32fb) +@@ -85,6 +87,7 @@ + i3nb ti3nb + i3fb ti3fb + i3s2 ti3s2 ++ i3gnu ti3gnu + i3qnx) + 'i386] + [(arm32le tarm32le +-- +2.32.0 + + +From 8653294b771c741d320aba31e692b4f0ed0c702f Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Thu, 4 Aug 2022 20:18:09 -0400 +Subject: [PATCH 2/3] BC: Fix build on GNU/Hurd + +(cherry picked from commit 5c05496afd6159c2f9cd52e7f23389fdc6b55f43) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + racket/src/bc/sconfig.h | 14 +++++++++----- + 3 files changed, 11 insertions(+), 7 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ddb607b37..4ee346014d 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index deef8f3077..866851236e 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*) ++ linux*,gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/sconfig.h b/racket/src/bc/sconfig.h +index 01ecb48158..8468942fcd 100644 +--- a/racket/src/bc/sconfig.h ++++ b/racket/src/bc/sconfig.h +@@ -79,12 +79,14 @@ + + #endif + +- /************** Linux with gcc ****************/ ++ /************** Linux (or Hurd) with gcc ****************/ + +-#if defined(__linux__) ++#if defined(__linux__) || defined(__GNU__) + + # ifdef __ANDROID__ + # define SCHEME_OS "android" ++# elif defined(__GNU__) ++# define SCHEME_OS "gnu-hurd" + # else + # define SCHEME_OS "linux" + # endif +@@ -146,13 +148,15 @@ + # define USE_IEEE_FP_PREDS + # define USE_EXPLICT_FP_FORM_CHECK + +-# define LINUX_FIND_STACK_BASE ++# define LINUX_FIND_STACK_BASE /* also ok for Hurd */ + + # define FLAGS_ALREADY_SET + + #if defined(__i386__) +-# define MZ_USE_JIT_I386 +-# define MZ_JIT_USE_MPROTECT ++# ifndef __GNU__ /* Hurd */ ++# define MZ_USE_JIT_I386 ++# define MZ_JIT_USE_MPROTECT ++# endif + # ifndef MZ_NO_UNWIND_SUPPORT + # define MZ_USE_DWARF_LIBUNWIND + # endif +-- +2.32.0 + + +From 1b0cd08557f58506c96f0ddd855bd9051a45a2f1 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Sat, 6 Aug 2022 22:48:40 -0400 +Subject: [PATCH 3/3] BC: repair configure script + +Hopefully this will fix the DrDr failures caused by 5c05496. + +Related to https://github.com/racket/racket/pull/4384 + +(cherry picked from commit c3dd01055ed7589a18136904510fe4db557d6e77) +--- + racket/src/bc/configure | 2 +- + racket/src/bc/configure.ac | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/racket/src/bc/configure b/racket/src/bc/configure +index 4ee346014d..b1c5175b84 100755 +--- a/racket/src/bc/configure ++++ b/racket/src/bc/configure +@@ -5018,7 +5018,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +diff --git a/racket/src/bc/configure.ac b/racket/src/bc/configure.ac +index 866851236e..ecc3b0b579 100644 +--- a/racket/src/bc/configure.ac ++++ b/racket/src/bc/configure.ac +@@ -557,7 +557,7 @@ case "$host_os" in + X_PRE_LIBS="" + fi + ;; +- linux*,gnu*) ++ linux*|gnu*) + LIBS="$LIBS -ldl -lm -lrt -rdynamic" + DYN_CFLAGS="-fPIC" + curses_portable_link="/usr/lib/${host_cpu}-${host_os}/libncurses.a /usr/lib/${host_cpu}-${host_os}/libtermcap.a" +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-backport-8.6-zuo.patch b/gnu/packages/patches/racket-backport-8.6-zuo.patch new file mode 100644 index 0000000000..b86679b7ec --- /dev/null +++ b/gnu/packages/patches/racket-backport-8.6-zuo.patch @@ -0,0 +1,481 @@ +From 8761fc06b188b9ca2f4b7f2b7d1235075c44a321 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 17:10:58 -0600 +Subject: [PATCH 1/4] Zuo: support cross compilation via `configure` and + `CC_FOR_BUILD` + +(cherry picked from commit 798a989ba6d1a30c491a3120b2c2f1570ecab911) +--- + racket/src/zuo/Makefile.in | 7 ++++++- + racket/src/zuo/README.md | 10 ++++++++++ + racket/src/zuo/configure | 15 +++++++++++++++ + racket/src/zuo/configure.ac | 11 +++++++++++ + 4 files changed, 42 insertions(+), 1 deletion(-) + +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in +index 5d16e145bf..747b584c5c 100644 +--- a/racket/src/zuo/Makefile.in ++++ b/racket/src/zuo/Makefile.in +@@ -17,6 +17,11 @@ CPPFLAGS = @CPPFLAGS@ + LDFLAGS = @LDFLAGS@ + LIBS = @LIBS@ + ++CC_FOR_BUILD = @CC_FOR_BUILD@ ++CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ ++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ ++LIBS_FOR_BUILD = @LIBS_FOR_BUILD@ ++ + EMBED_LIBS = @EMBED_LIBS@ + + .PHONY: zuos-to-run-and-install +@@ -24,7 +29,7 @@ zuos-to-run-and-install: zuo + ./zuo . zuos-to-run-and-install + + zuo: $(srcdir)/zuo.c +- $(CC) $(CPPFLAGS) $(CFLAGS) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS) $(LIBS) ++ $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) + + .PHONY: check + check: zuo +diff --git a/racket/src/zuo/README.md b/racket/src/zuo/README.md +index 17c88ee9ec..3aad504b7e 100644 +--- a/racket/src/zuo/README.md ++++ b/racket/src/zuo/README.md +@@ -84,6 +84,16 @@ A boot image is machine-independent, whether in a stand-alone file or + embedded in `.c` source. + + ++Cross Compiling ++--------------- ++ ++If you use `./configure --host=...` to cross compile, then you will ++also need to add something like `CC_FOR_BUILD=cc` as a `./configure` ++argument to specify the compiler for a `zuo` to use on the build ++machine. If necessary, you can also specify `CFLAGS_FOR_BUILD`, ++`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`. ++ ++ + Embedding Zuo in Another Application + ------------------------------------ + +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure +index 1fa34a3fe8..575ce07d96 100755 +--- a/racket/src/zuo/configure ++++ b/racket/src/zuo/configure +@@ -589,6 +589,10 @@ enable_embed="zuo" + ac_subst_vars='LTLIBOBJS + LIBOBJS + EMBED_LIBS ++LIBS_FOR_BUILD ++LDFLAGS_FOR_BUILD ++CFLAGS_FOR_BUILD ++CC_FOR_BUILD + OBJEXT + EXEEXT + ac_ct_CC +@@ -2584,6 +2588,17 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ++if test "${CC_FOR_BUILD}" = ""; then ++ CC_FOR_BUILD='$(CC) -O2' ++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ LDFLAGS_FOR_BUILD='$(LDFLAGS)' ++ LIBS_FOR_BUILD='$(LIBS)' ++fi ++ ++ ++ ++ ++ + + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5 + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;} +diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac +index 89b3c6391d..598ff79629 100644 +--- a/racket/src/zuo/configure.ac ++++ b/racket/src/zuo/configure.ac +@@ -25,6 +25,17 @@ AS_IF([test "x$enable_embed" = xno], + AC_PROG_MAKE_SET() + AC_PROG_CC + ++if test "${CC_FOR_BUILD}" = ""; then ++ CC_FOR_BUILD='$(CC) -O2' ++ CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ LDFLAGS_FOR_BUILD='$(LDFLAGS)' ++ LIBS_FOR_BUILD='$(LIBS)' ++fi ++AC_SUBST(CC_FOR_BUILD) ++AC_SUBST(CFLAGS_FOR_BUILD) ++AC_SUBST(LDFLAGS_FOR_BUILD) ++AC_SUBST(LIBS_FOR_BUILD) ++ + AC_SUBST(EMBED_LIBS) + AC_MSG_NOTICE([zuo libraries to embed: "${EMBED_LIBS}"]) + +-- +2.32.0 + + +From f65194ea41eb472fbdd45d5f6c13eabe5e681704 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 17:47:03 -0600 +Subject: [PATCH 2/4] Zuo: sort hash keys + +Printing in a sorted order is helpful to make things more +deterministic independent of symbol inputs. Making `hash-keys` +produce a sorted list generalizes that determinism. + +(cherry picked from commit 4e7ffd3b365d01c5d0993c0b3fd24c9623962edf) +--- + racket/src/zuo/build.zuo | 5 ++- + racket/src/zuo/tests/hash.zuo | 8 ++-- + racket/src/zuo/zuo-doc/lang-zuo.scrbl | 18 +++++++-- + racket/src/zuo/zuo.c | 57 ++++++++++++++++++++++++++- + 4 files changed, 78 insertions(+), 10 deletions(-) + +diff --git a/racket/src/zuo/build.zuo b/racket/src/zuo/build.zuo +index c1b5e8ce66..129240120a 100644 +--- a/racket/src/zuo/build.zuo ++++ b/racket/src/zuo/build.zuo +@@ -47,7 +47,10 @@ + (target (at-dir (add-exe name)) + (lambda (path token) + (rule (list image_zuo.c +- (input-data-target 'config config) ++ (input-data-target 'config (cons ++ lib-path ++ (map (lambda (key) (hash-ref config key)) ++ '(CC CPPFLAGS CFLAGS LDFLAGS LIBS)))) + (quote-module-path)) + (lambda () + (define l (split-path path)) +diff --git a/racket/src/zuo/tests/hash.zuo b/racket/src/zuo/tests/hash.zuo +index a35741c730..0d3d7f3af6 100644 +--- a/racket/src/zuo/tests/hash.zuo ++++ b/racket/src/zuo/tests/hash.zuo +@@ -35,9 +35,7 @@ + + (check (hash-keys (hash)) '()) + (check (hash-keys (hash 'a 1)) '(a)) +-(check (let ([keys (hash-keys (hash 'a 1 'b 2))]) +- (or (equal? keys '(a b)) +- (equal? keys '(b a))))) ++(check (hash-keys (hash 'a 1 'b 2)) '(a b)) ; always in order + (check (length (hash-keys (hash 'a 1 'b 2 'c 3))) 3) + (check (length (hash-keys (hash 'a 1 'b 2 'a 3))) 2) + (check-arg-fail (hash-keys 0) "not a hash table") +@@ -50,3 +48,7 @@ + (check (hash-keys-subset? (hash 'a 1 'b 2) (hash 'b 1)) #f) + (check-arg-fail (hash-keys-subset? 0 (hash)) "not a hash table") + (check-arg-fail (hash-keys-subset? (hash) 0) "not a hash table") ++ ++;; print sorts keys alphabetically: ++(check (~a (hash 'a 1 'b 2)) "#hash((a . 1) (b . 2))") ++(check (~a (hash 'b 2 'a 1)) "#hash((a . 1) (b . 2))") +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +index 94641d041e..4605e47471 100644 +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +@@ -538,10 +538,20 @@ support to convert the textual form back into a hash table value. + + Analogous to @realracket*[hash? hash hash-ref hash-set hash-remove + hash-keys hash-count hash-keys-subset?] from @racketmodname[racket]. +-Besides being constrained to symbol keys, there is one additional +-difference: the third argument to @racket[hash-ref], when supplied, +-is always used as a value to return if a key is missing, as +-opposed to a failure thunk.} ++ ++Besides being constrained to symbol keys, there are two additional ++differences: ++ ++@itemlist[ ++ ++ @item{the third argument to @racket[hash-ref], when supplied, is ++ always used as a value to return if a key is missing, as ++ opposed to a failure thunk; and} ++ ++ @item{the @racket[hash-keys] function returns interned keys sorted ++ alphabetically.} ++ ++]} + + + @section{Procedures} +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c +index 2957d478af..88d5747326 100644 +--- a/racket/src/zuo/zuo.c ++++ b/racket/src/zuo/zuo.c +@@ -1298,6 +1298,59 @@ static zuo_t *zuo_trie_keys(zuo_t *trie_in, zuo_t *accum) { + return accum; + } + ++/*======================================================================*/ ++/* symbol-list sorting */ ++/*======================================================================*/ ++ ++/* merge sort used to make hash printing deterministic */ ++static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) { ++ zuo_t *l, *left, *right, *first, *last; ++ zuo_uint_t len = 0, i; ++ ++ for (l = l_in, len = 0; l != z.o_null; l = _zuo_cdr(l)) ++ len++; ++ ++ if (len < 2) ++ return l_in; ++ ++ left = z.o_null; ++ for (l = l_in, i = len >> 1; i > 0; l = _zuo_cdr(l), i--) ++ left = zuo_cons(_zuo_car(l), left); ++ right = l; ++ ++ left = zuo_symbol_list_sort(left); ++ right = zuo_symbol_list_sort(right); ++ ++ first = last = z.o_null; ++ while ((left != z.o_null) && (right != z.o_null)) { ++ zuo_t *p; ++ ++ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str), ++ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str)) ++ < 1) { ++ p = zuo_cons(_zuo_car(left), z.o_null); ++ left = _zuo_cdr(left); ++ } else { ++ p = zuo_cons(_zuo_car(right), z.o_null); ++ right = _zuo_cdr(right); ++ } ++ ++ if (first == z.o_null) ++ first = p; ++ else ++ ((zuo_pair_t *)last)->cdr = p; ++ last = p; ++ } ++ ++ ((zuo_pair_t *)last)->cdr = ((left != z.o_null) ? left : right); ++ ++ return first; ++} ++ ++static zuo_t *zuo_trie_sorted_keys(zuo_t *trie_in, zuo_t *accum) { ++ return zuo_symbol_list_sort(zuo_trie_keys(trie_in, accum)); ++} ++ + /*======================================================================*/ + /* terminal support */ + /*======================================================================*/ +@@ -1571,7 +1624,7 @@ static void zuo_out(zuo_out_t *out, zuo_t *obj, zuo_print_mode_t mode) { + out_string(out, "opaque"); + out_string(out, ">"); + } else if (obj->tag == zuo_trie_node_tag) { +- zuo_t *keys = zuo_trie_keys(obj, z.o_null); ++ zuo_t *keys = zuo_trie_sorted_keys(obj, z.o_null); + if (mode == zuo_print_mode) { + out_string(out, "(hash"); + if (keys != z.o_null) +@@ -2587,7 +2640,7 @@ static zuo_t *zuo_hash_remove(zuo_t *ht, zuo_t *sym) { + + static zuo_t *zuo_hash_keys(zuo_t *ht) { + check_hash("hash-keys", ht); +- return zuo_trie_keys(ht, z.o_null); ++ return zuo_trie_sorted_keys(ht, z.o_null); + } + + static zuo_t *zuo_hash_keys_subset_p(zuo_t *ht, zuo_t *ht2) { +-- +2.32.0 + + +From f2eecaa1dd875479d2cf51566223b3d0d7b9f738 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 18:06:41 -0600 +Subject: [PATCH 3/4] Zuo: check for nul characters in `string->symbol` + +(cherry picked from commit e20022ccfad40d0ba2e77aa75bc4f775018c781f) +--- + racket/src/zuo/tests/symbol.zuo | 3 +++ + racket/src/zuo/zuo-doc/lang-zuo.scrbl | 4 ++- + racket/src/zuo/zuo.c | 37 +++++++++++++++++---------- + 3 files changed, 29 insertions(+), 15 deletions(-) + +diff --git a/racket/src/zuo/tests/symbol.zuo b/racket/src/zuo/tests/symbol.zuo +index 7775aeeb04..5600a89755 100644 +--- a/racket/src/zuo/tests/symbol.zuo ++++ b/racket/src/zuo/tests/symbol.zuo +@@ -19,3 +19,6 @@ + (check (not (equal? 'apple (string->uninterned-symbol "apple")))) + (check-arg-fail (string->symbol 'apple) not-string) + (check-arg-fail (string->uninterned-symbol 'apple) not-string) ++ ++(check-arg-fail (string->symbol "apple\0spice") "without a nul character") ++(check (symbol? (string->uninterned-symbol "apple\0spice"))) +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +index 4605e47471..07dd5815b0 100644 +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl +@@ -500,7 +500,9 @@ back into Zuo. + )]{ + + Analogous to @realracket*[symbol? symbol->string string->symbol +-string->uninterned-symbol] from @racketmodname[racket].} ++string->uninterned-symbol] from @racketmodname[racket], but ++@racket[string->symbol] accepts only strings that do not contain the ++null character.} + + + @section{Hash Tables (Persistent Maps)} +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c +index 88d5747326..17f161826d 100644 +--- a/racket/src/zuo/zuo.c ++++ b/racket/src/zuo/zuo.c +@@ -1323,7 +1323,7 @@ static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) { + + first = last = z.o_null; + while ((left != z.o_null) && (right != z.o_null)) { +- zuo_t *p; ++ zuo_t *p, *s_left, *s_right; + + if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str), + ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str)) +@@ -2573,8 +2573,28 @@ static zuo_t *zuo_substring(zuo_t *obj, zuo_t *start_i, zuo_t *end_i) { + return zuo_sized_string((const char *)&((zuo_string_t *)obj)->s[s_idx], e_idx - s_idx); + } + ++static int zuo_is_string_without_nul(zuo_t *obj) { ++ zuo_int_t i; ++ ++ if ((obj->tag != zuo_string_tag) ++ || ZUO_STRING_LEN(obj) == 0) ++ return 0; ++ ++ for (i = ZUO_STRING_LEN(obj); i--; ) { ++ if (((zuo_string_t *)obj)->s[i] == 0) ++ return 0; ++ } ++ ++ return 1; ++} ++ + static zuo_t *zuo_string_to_symbol(zuo_t *obj) { +- check_string("string->symbol", obj); ++ if (!zuo_is_string_without_nul(obj)) { ++ const char *who = "string->symbol"; ++ check_string(who, obj); ++ zuo_fail_arg(who, "string without a nul character", obj); ++ } ++ + return zuo_symbol_from_string(ZUO_STRING_PTR(obj), obj); + } + +@@ -3577,18 +3597,7 @@ static void *zuo_envvars_block(const char *who, zuo_t *envvars) + #endif + + static int zuo_is_path_string(zuo_t *obj) { +- zuo_int_t i; +- +- if ((obj->tag != zuo_string_tag) +- || ZUO_STRING_LEN(obj) == 0) +- return 0; +- +- for (i = ZUO_STRING_LEN(obj); i--; ) { +- if (((zuo_string_t *)obj)->s[i] == 0) +- return 0; +- } +- +- return 1; ++ return zuo_is_string_without_nul(obj); + } + + static zuo_t *zuo_path_string_p(zuo_t *obj) { +-- +2.32.0 + + +From de6618cb3819d25580e3cd400ea09c8cf4f673a9 Mon Sep 17 00:00:00 2001 +From: Matthew Flatt +Date: Sat, 23 Jul 2022 19:50:46 -0600 +Subject: [PATCH 4/4] Zuo: CPPFLAGS_FOR_BUILD, too + +(cherry picked from commit cf82706c4b298f654a04c4bc8d98dff39b62a2ac) +--- + racket/src/zuo/Makefile.in | 3 ++- + racket/src/zuo/configure | 5 ++++- + racket/src/zuo/configure.ac | 4 +++- + 3 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in +index 747b584c5c..0376c038a8 100644 +--- a/racket/src/zuo/Makefile.in ++++ b/racket/src/zuo/Makefile.in +@@ -19,6 +19,7 @@ LIBS = @LIBS@ + + CC_FOR_BUILD = @CC_FOR_BUILD@ + CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ ++CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ + LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ + LIBS_FOR_BUILD = @LIBS_FOR_BUILD@ + +@@ -29,7 +30,7 @@ zuos-to-run-and-install: zuo + ./zuo . zuos-to-run-and-install + + zuo: $(srcdir)/zuo.c +- $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) ++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) + + .PHONY: check + check: zuo +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure +index 575ce07d96..7ac453e3bc 100755 +--- a/racket/src/zuo/configure ++++ b/racket/src/zuo/configure +@@ -591,6 +591,7 @@ LIBOBJS + EMBED_LIBS + LIBS_FOR_BUILD + LDFLAGS_FOR_BUILD ++CPPFLAGS_FOR_BUILD + CFLAGS_FOR_BUILD + CC_FOR_BUILD + OBJEXT +@@ -2590,7 +2591,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test "${CC_FOR_BUILD}" = ""; then + CC_FOR_BUILD='$(CC) -O2' +- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)' ++ CFLAGS_FOR_BUILD='$(CFLAGS)' + LDFLAGS_FOR_BUILD='$(LDFLAGS)' + LIBS_FOR_BUILD='$(LIBS)' + fi +@@ -2600,6 +2602,7 @@ fi + + + ++ + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EMBED_LIBS}\"" >&5 + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;} + +diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac +index 598ff79629..051ea0beb5 100644 +--- a/racket/src/zuo/configure.ac ++++ b/racket/src/zuo/configure.ac +@@ -27,12 +27,14 @@ AC_PROG_CC + + if test "${CC_FOR_BUILD}" = ""; then + CC_FOR_BUILD='$(CC) -O2' +- CFLAGS_FOR_BUILD='$(CPPFLAGS) $(CFLAGS)' ++ CPPFLAGS_FOR_BUILD='$(CPPFLAGS)' ++ CFLAGS_FOR_BUILD='$(CFLAGS)' + LDFLAGS_FOR_BUILD='$(LDFLAGS)' + LIBS_FOR_BUILD='$(LIBS)' + fi + AC_SUBST(CC_FOR_BUILD) + AC_SUBST(CFLAGS_FOR_BUILD) ++AC_SUBST(CPPFLAGS_FOR_BUILD) + AC_SUBST(LDFLAGS_FOR_BUILD) + AC_SUBST(LIBS_FOR_BUILD) + +-- +2.32.0 + diff --git a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch index df2eb671b3..69aca3b483 100644 --- a/gnu/packages/patches/racket-chez-scheme-bin-sh.patch +++ b/gnu/packages/patches/racket-chez-scheme-bin-sh.patch @@ -1,4 +1,4 @@ -From 5f3fc12bf123f30485800960b0493f5dd538d107 Mon Sep 17 00:00:00 2001 +From 988eea0a875d570d8ec155cb0925b4586d36e8d7 Mon Sep 17 00:00:00 2001 From: Philip McGrath Date: Thu, 19 May 2022 13:41:56 -0400 Subject: [PATCH] Chez Scheme: patch s_process for "/bin/sh" on Guix @@ -22,10 +22,10 @@ on `system` from the C library. 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/racket/src/ChezScheme/c/prim5.c b/racket/src/ChezScheme/c/prim5.c -index f5e3e345be..9db2989138 100644 +index 82bbf8d687..307c8673a1 100644 --- a/racket/src/ChezScheme/c/prim5.c +++ b/racket/src/ChezScheme/c/prim5.c -@@ -856,6 +856,22 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { +@@ -861,6 +861,22 @@ static ptr s_process(char *s, IBOOL stderrp) { INT tofds[2], fromfds[2], errfds[2]; struct sigaction act, oint_act; @@ -48,10 +48,10 @@ index f5e3e345be..9db2989138 100644 if (pipe(tofds)) S_error("process","cannot open pipes"); if (pipe(fromfds)) { -@@ -881,7 +897,9 @@ static ptr s_process(s, stderrp) char *s; IBOOL stderrp; { - CLOSE(1); if (dup(fromfds[1]) != 1) _exit(1); - CLOSE(2); if (dup(stderrp ? errfds[1] : 1) != 2) _exit(1); - {INT i; for (i = 3; i < NOFILE; i++) (void)CLOSE(i);} +@@ -897,7 +913,9 @@ static ptr s_process(char *s, IBOOL stderrp) { + } + } + #endif /* __GNU__ Hurd */ - execl("/bin/sh", "/bin/sh", "-c", s, NULL); + /* BEGIN PATCH for Guix */ + execl(guix_sh, guix_sh, "-c", s, NULL); @@ -60,7 +60,7 @@ index f5e3e345be..9db2989138 100644 /*NOTREACHED*/ } else { -base-commit: 9d228d16fb99c274c964e5bef93e97333888769f +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 -- 2.32.0 diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/patches/racket-zuo-bin-sh.patch new file mode 100644 index 0000000000..392ea05129 --- /dev/null +++ b/gnu/packages/patches/racket-zuo-bin-sh.patch @@ -0,0 +1,72 @@ +From 4888106cdfd80d1af925e5a485a2812d35a83b46 Mon Sep 17 00:00:00 2001 +From: Philip McGrath +Date: Mon, 11 Apr 2022 20:43:18 -0400 +Subject: [PATCH] Zuo: patch zuo_process for "/bin/sh" on Guix + +This patch reuses the C preprocessor macro `GUIX_RKTIO_BIN_SH` +from a previous patch. + +If: + + 1. The `GUIX_RKTIO_BIN_SH` macro is defined; and + + 2. `zuo_process` is called with the exact path "/bin/sh"; and + + 3. The path specified by `GUIX_RKTIO_BIN_SH` exists; + +then `zuo_process` will execute the file specified by +`GUIX_RKTIO_BIN_SH` instead of "/bin/sh". +--- + racket/src/zuo/zuo.c | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c +index 17f161826d..10e7a2a297 100644 +--- a/racket/src/zuo/zuo.c ++++ b/racket/src/zuo/zuo.c +@@ -5730,7 +5730,18 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_raw_handle_t *_w) + zuo_t *zuo_process(zuo_t *command_and_args) + { + const char *who = "process"; +- zuo_t *command = _zuo_car(command_and_args); ++ /* BEGIN PATCH for Guix */ ++ zuo_t *_guix_orig_command = _zuo_car(command_and_args); ++ zuo_t *command; ++#if defined(GUIX_RKTIO_BIN_SH) ++# define GUIX_AS_a_STR_HELPER(x) #x ++# define GUIX_AS_a_STR(x) GUIX_AS_a_STR_HELPER(x) ++ /* A level of indirection makes `#` work as needed: */ ++ const char *guix_sh = GUIX_AS_a_STR(GUIX_RKTIO_BIN_SH); ++# undef GUIX_AS_a_STR ++# undef GUIX_AS_a_STR_HELPER ++#endif ++ /* END PATCH for Guix */ + zuo_t *args = _zuo_cdr(command_and_args), *rev_args = z.o_null; + zuo_t *options = z.o_empty_hash, *opt; + zuo_t *dir, *l, *p_handle, *result; +@@ -5741,7 +5752,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) + void *env; + int as_child, exact_cmdline; + +- check_path_string(who, command); ++ /* BEGIN PATCH for Guix */ ++ check_path_string(who, _guix_orig_command); ++#if defined(GUIX_RKTIO_BIN_SH) ++ command = ++ ((z.o_false == zuo_string_eql(_guix_orig_command, zuo_string("/bin/sh"))) ++ || (z.o_false == zuo_stat(zuo_string(guix_sh), z.o_false, z.o_true))) ++ ? _guix_orig_command ++ : zuo_string(guix_sh); ++#else ++ command = _guix_orig_command; ++#endif ++ /* END PATCH for Guix */ ++ + for (l = args; l->tag == zuo_pair_tag; l = _zuo_cdr(l)) { + zuo_t *a = _zuo_car(l); + if (a == z.o_null) { + +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 +-- +2.32.0 + diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index cddb617232..f1a2794164 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -54,7 +54,7 @@ (define-module (gnu packages racket) #:use-module (gnu packages xorg) #:use-module ((guix licenses) #:prefix license:)) -;; Commentary: +;; COMMENTARY: ;; ;; Anatomy of Racket: ;; ------------------ @@ -73,14 +73,16 @@ (define-module (gnu packages racket) ;; ├── bc/ ;; ├── cs/ ;; ├── ChezScheme/ +;; ├── zuo/ ;; └── ... ;; ;; The 'racket/src/' directory contains the source of the runtime system, core ;; compiler, and primitives for the major Racket implementations: this layer -;; is called the ``Racket VM''. It is basically a normal autotools -;; project. (Even when Racket VM implementations use components implemented in -;; Racket, they are compiled in special modes to produce VM primitives.) -;; (There are or have been experimental Racket VM implementations elsewhere, +;; is called the ``Racket VM''. It is basically a normal Autoconf project, +;; except that the makefiles just run Zuo to do the real work. (Even when +;; Racket VM implementations use components implemented in Racket, they are +;; compiled in special modes to produce VM primitives.) (There are or have +;; been experimental Racket VM implementations elsewhere, ;; e.g. .) ;; ;; The 'racket/collects/' directory contains ``built in'' Racket libraries @@ -101,10 +103,10 @@ (define-module (gnu packages racket) ;; ;; The top-level 'Makefile' is more like a directory of scripts: it has ;; convienience targets for developing Racket, and it cooperates with the -;; 'distro-build' package to assemble custom Racket distributions. It is not -;; part of Racket source distributions: the root of a source distribution is -;; basically 'racket/src' with some extra package sources and configuration -;; added. +;; 'distro-build' package to assemble custom Racket distributions. (Again, +;; the makefile just delegates to Zuo.) It is not part of Racket source +;; distributions: the root of a source distribution is basically 'racket/src' +;; with some extra package sources and configuration added. ;; ;; A ''minimal Racket'' installation includes two packages: 'base', which is a ;; sort of bridge between the current ``built-in'' collections and the package @@ -130,12 +132,12 @@ (define-module (gnu packages racket) ;; output. The function 'racket-vm-for-system' returns the recomended Racket ;; VM package for a given system. ;; -;; The file 'racket.scm' builds on these packages to define 'racket-minimal' -;; and 'racket' packages. These use Racket's support for ``layered -;; installations'', which allow an immutable base layer to be extended with -;; additional packages. They use the layer configuration directly provide -;; ready-to-install FHS-like trees, rather than relying on the built in -;; ``Unix-style install'' mechanism. +;; We then define the packages 'racket-minimal' and +;; 'racket'. These use Racket's support for ``layered installations'', which +;; allow an immutable base layer to be extended with additional packages. +;; They use the layer configuration directly provide ready-to-install FHS-like +;; trees, rather than relying on the built in ``Unix-style install'' +;; mechanism. ;; ;; Bootstrapping Racket: ;; --------------------- @@ -178,16 +180,18 @@ (define-module (gnu packages racket) ;; 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 -;; as of Racket 7.0. +;; as of Racket 7.0. See also . ;; ;; 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.) ;; -;; Code: +;; Zuo is notably *not* a problem for bootstrapping. The implementation is a +;; single hand-written C file designed to build with just `cc -o zuo zuo.c`, +;; even with very old or limited compilers. (We use the Autoconf support for +;; convienience.) +;; +;; CODE: (define* (racket-vm-for-system #:optional (system (or (%current-target-system) @@ -200,7 +204,8 @@ (define* (racket-vm-for-system #:optional racket-vm-cs racket-vm-bc)) -(define %racket-version "8.5") ; Remember to update chez-scheme-for-racket! +(define %racket-version "8.6") ; Remember to update chez-scheme-for-racket! +(define %zuo-version "1.0") ;; defined in racket/src/zuo/zuo.c (define %racket-commit (string-append "v" %racket-version)) (define %racket-origin @@ -210,10 +215,15 @@ (define %racket-origin (url "https://github.com/racket/racket") (commit %racket-commit))) (sha256 - (base32 "0f9zyhdvbh4xsndrqjzl85j5ziz0rmqi676g9s1lw3h3skq2636h")) + (base32 "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk")) (file-name (git-file-name "racket" %racket-version)) - (patches (search-patches "racket-chez-scheme-bin-sh.patch" - "racket-rktio-bin-sh.patch")) + (patches (search-patches "racket-backport-8.6-cross-install.patch" + "racket-backport-8.6-docindex-write.patch" + "racket-backport-8.6-hurd.patch" + "racket-backport-8.6-zuo.patch" + "racket-chez-scheme-bin-sh.patch" + "racket-rktio-bin-sh.patch" + "racket-zuo-bin-sh.patch")) (modules '((guix build utils))) (snippet #~(begin @@ -233,6 +243,58 @@ (define %racket-origin ;; Unbundle libffi. (delete-file-recursively "racket/src/bc/foreign/libffi"))))) + +(define-public zuo + (let ((revision #f)) + (package + (name "zuo") + (version (string-append %zuo-version + "-racket" + %racket-version + (if revision "-guix" "") + (or revision ""))) + (source %racket-origin) + (outputs '("out" "debug")) + (build-system gnu-build-system) + (inputs (list bash-minimal)) + (native-inputs (list bash-minimal)) + (arguments + (list + #:configure-flags + #~`(,(string-append "CPPFLAGS=-DGUIX_RKTIO_BIN_SH=" + #$(file-append (this-package-input "bash-minimal") + "/bin/sh")) + #+@(if (%current-target-system) + (list #~,(string-append + "CPPFLAGS_FOR_BUILD=-DGUIX_RKTIO_BIN_SH=" + #+(file-append + (this-package-native-input "bash-minimal") + "/bin/sh"))) + '())) + #:out-of-source? #t + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda args + (chdir "racket/src/zuo")))))) + (home-page "https://github.com/racket/zuo") + ;; ^ This is downstream of https://github.com/racket/racket, + ;; but it's designed to be a friendly landing place + (synopsis "Tiny Racket for build scripts") + (description "You should use Racket to write scripts. But what if you +need something much smaller than Racket for some reason—or what if you're +trying to script a build of Racket itself? Zuo is a tiny Racket with +primitives for dealing with files and running processes, and it comes with a +@command{make}-like embedded DSL. + +Zuo is a Racket variant in the sense that program files start with +@code{#lang}, and the module path after @code{#lang} determines the parsing +and expansion of the file content. That's how the @command{make}-like DSL is +defined, and even the base Zuo language is defined by layers of @code{#lang}s. +One of the early layers implements macros.") + (license (list license:asl2.0 license:expat))))) + + (define (racket-vm-common-configure-flags) ;; under a lambda abstraction to avoid evaluating bash-minimal too early. #~`(,@(cond @@ -270,7 +332,8 @@ (define-public racket-vm-cgc (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 + (native-inputs (list zuo ;; <- for all variants + libtool)) ;; <- only for BC variants (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -278,6 +341,10 @@ (define-public racket-vm-cgc #:configure-flags #~(cons "--enable-cgcdefault" #$(racket-vm-common-configure-flags)) + #:make-flags + #~(list (string-append "ZUO=" + #+(this-package-native-input "zuo") + "/bin/zuo")) ;; Tests are in packages like racket-test-core and ;; main-distribution-test that aren't part of the main ;; distribution. @@ -637,25 +704,25 @@ (define-public racket "contract-profile" (base32 "1xm2z8g0dpv5d9h2sg680vx1a8ix9gbsdpxxb8qv1w7akp73paj3") '(("contract-profile" "."))) (simple-racket-origin - "data" (base32 "10iabgrk9alaggvksnyb0hdq7f1p30pq6pq2bcakvhzpxwiv1f55") + "data" (base32 "08sj4m0g0cp7gwb0nq90m770f0c21b7ydif7nljc8rxmcdprfisc") '("data" "data-doc" "data-enumerate-lib" "data-lib")) (simple-racket-origin "datalog" (base32 "0nf6cy4djpyhfvgpa6yn72apbz9s83gp0qg95pzjd0az4v6qwq1s") '(("datalog" "."))) (simple-racket-origin - "db" (base32 "1n02ja0yj3mjjhmz0yv04yfhyvrsznbljn8bjviyfxnm4xf9rcc5") + "db" (base32 "0jzsbfcdm3xj0g8xxw3ky2swrhiqqsq2aqa3r08m641dc981dmjq") '("db" "db-doc" "db-lib")) (simple-racket-origin - "deinprogramm" (base32 "0g8flr1qg3bcyhdinqhs4w7dyisaqyailbxrjgd2a7zlqmdyicfr") + "deinprogramm" (base32 "16ncs3ms3mmdavbk0mkhm2qi62vyyif9cch3sn1y64pij489x34v") '("deinprogramm" "deinprogramm-signature")) (simple-racket-origin "distributed-places" (base32 "1dajpkj9balqcpv6cdk9hwjz592h1vq8rrx5vncariiac4vbdpa0") '("distributed-places" "distributed-places-doc" "distributed-places-lib")) (simple-racket-origin - "draw" (base32 "1fpk85rs2crd63bxnmwj2pysisd62pxcqaip01si67dv1ri8ff92") + "draw" (base32 "00rq5y4ba6z1d6jh76kl8rwpxrlqqp81a875zyhk3k81i42635sm") '("draw" "draw-doc" "draw-lib")) (simple-racket-origin - "drracket" (base32 "0dipnz92c63zxys9z1kl5215rm7arc35g9r8bs8ivp96p75mljnz") + "drracket" (base32 "05d7wssi0ry13alb5hl3llpsg30dd0jhyfv5nb1nmg189fn42q62") '("drracket" "drracket-plugin-lib" "drracket-tool" @@ -672,7 +739,7 @@ (define-public racket "eopl" (base32 "1fmiixj6rxsgzwvgva8lvrvv0gl49v2405mp3s0i7ipis5c4n27s") '(("eopl" "."))) (simple-racket-origin - "errortrace" (base32 "14m7rhaxngj36070iw15am434hm438pfgmwjfsiqhsglz4pcxhip") + "errortrace" (base32 "0r5630bb2d6hk0fbi95fmyfja54nnwdfcj2zjba124pp6xkjyavx") '("errortrace" "errortrace-doc" "errortrace-lib")) (simple-racket-origin "expeditor" (base32 "0mjfwb4wzwsg5xj3k6cmik0va432n56rp5h7rxx1c2yy3prh1j7q") @@ -689,13 +756,13 @@ (define-public racket "games" (base32 "0kpn3izlx1ccd0pj0dnvmnrhny51b85xy418a7psj70lz8j8415d") '(("games" "."))) (simple-racket-origin - "gui" (base32 "0r3ck4gxdhnzr1a1fi0f1i7gwfip7akq10qgcxza66pp57hnl0wx") + "gui" (base32 "18pcnx3wi8f32i2frm8bn9pi08n4y3c5jgqs4gy21w6f84dv401w") '("gui" "gui-doc" "gui-lib" "tex-table")) (simple-racket-origin "gui-pkg-manager" (base32 "1ji9448d723nklqvycwdswj0ni28sabrncag14f9mx47did5myb5") '("gui-pkg-manager-lib")) (simple-racket-origin - "htdp" (base32 "19xqixrqbwdxph17w9jga19008j88harb5wgml4hpqj3x0apx9g3") + "htdp" (base32 "173xy6ks55npvwn6cykjs41s9qfb70hc2gfjiqvw91hdsbjykwir") '("htdp" "htdp-doc" "htdp-lib")) (simple-racket-origin "html" (base32 "18n1jnjgzfknc8nv8dppi85nb8q08gqdwkg6hfjk08x0p00anx2x") @@ -719,7 +786,7 @@ (define-public racket "make" (base32 "10852fj30bz5r46c3d99s37fkgy5yh44gb01j29sf3kxnhi0g2sa") '(("make" "."))) (simple-racket-origin - "math" (base32 "02sqbnvxvmvslk33b44fx4v93zafcvhva0cx8z21jqbl5wp217ac") + "math" (base32 "00ld38in5jfshs1q4zf07w84cyv4yjr40kmw30pyd5wqgs2zq9ai") '("math" "math-doc" "math-lib")) (simple-racket-origin "mysterx" (base32 "11p9jzrafw0hizhl0cs4sxx7rv281185q8hryic2rpk0kzjdyr48") @@ -754,16 +821,16 @@ (define-public racket (git-file-name "stamourv-optimization-coach" %racket-version))) '(("optimization-coach" "."))) (simple-racket-origin - "option-contract" (base32 "026b7n5l0c3024nymshz8zp1yhn493rdzgpflzfd52hj7awafqhk") + "option-contract" (base32 "07cncg9pi15cm19k7rzv54vx83wq7y42i2m6bgzaqja1h8vnj2ww") '("option-contract" "option-contract-doc" "option-contract-lib")) (simple-racket-origin - "parser-tools" (base32 "08pvz4zramirzm3j64hbhjm0mmh5zfy37iv4s3vmq0rj49cr8fl3") + "parser-tools" (base32 "04ycihliikh0c47ivp09gayxiql9d9wpl216czic19cj6f7rmcnj") '("parser-tools" "parser-tools-doc" "parser-tools-lib")) (simple-racket-origin "pconvert" (base32 "00czi0p399mmyrvxyrs5kniizpkqfxyz2ncxqi2jy79a7wk79pb1") '("pconvert-lib")) (simple-racket-origin - "pict" (base32 "0v7a3l77swsbh80mnb9rakdwgw7s66ji0mall7qcqfwyg1b4zmlv") + "pict" (base32 "1n0v7kynkiin1v8igs9m8k8vfwjn5cswanhq2imp1pxzjvdyq6sx") '("pict" "pict-doc" "pict-lib")) (simple-racket-origin "pict-snip" (base32 "081nwiy4a0n4f7xws16hqbhf0j3kz5alizndi3nnyr3chm4kng6x") @@ -817,7 +884,7 @@ (define-public racket "racklog" (base32 "0fbq0fpfb3l6h7h772dvkmlzlk2dnq5f8296xx1qxhhwypibqzr9") '(("racklog" "."))) (simple-racket-origin - "rackunit" (base32 "0vfwcddzrgrdv5awjka7m0jzqhqvfc5wlkih83a670y96496a83n") + "rackunit" (base32 "1gpz9sgnm8hrc0cb3rii0wzbcwp9mgy5k1amnxidy7gyzl7prn81") '("rackunit" "rackunit-doc" "rackunit-gui" @@ -830,10 +897,10 @@ (define-public racket "readline" (base32 "13kbcn2wchv82d709mw3r8n37bk8iwq0y4kpvm9dbzx0w2pxkfwn") '("readline" "readline-doc" "readline-lib")) (simple-racket-origin - "realm" (base32 "0hxcgla08iack54j8v40fj51811chpy66ym2zq76zb52c7kzn0hi") + "realm" (base32 "0rlvwyd6rpyl0zda4a5p8dp346fvqzc8555dgfnrhliymkxb6x4g") '(("realm" "."))) (simple-racket-origin - "redex" (base32 "18rn8ddsqh1s7hdlb2cb9wxln63bz0wysjssaf9v92r712xnnv8i") + "redex" (base32 "06dhyqmin0qdm6b6sdvgzpy3pa4svlw42ld9k2h1dxcr852czil7") '("redex" "redex-benchmark" "redex-doc" @@ -848,7 +915,7 @@ (define-public racket "scheme-lib" (base32 "0pcf0y8rp4qyjhaz5ww5sr5diq0wpcdfrrnask7zapyklzx1jx8x") '(("scheme-lib" "."))) (simple-racket-origin - "scribble" (base32 "0fbb7xgz95y90247hfc1a19v7ry8m6blvv4y8irdgzhjvik70zb3") + "scribble" (base32 "0a11kvcnzp04mp4xxq68rkl09jv00hv81k2nmwkmwpfx9b2acvd3") '("scribble" "scribble-doc" "scribble-html-lib" @@ -880,7 +947,7 @@ (define-public racket "snip" (base32 "01r9wc5xr3q3n4yyif6j0a37rgdzmpslxn05k13ksik73b3wj6hj") '("snip" "snip-lib")) (simple-racket-origin - "typed-racket" (base32 "0z6bagp6qiw0i3slhvq035y5hqgq664xw3bdlvdayad0bgbg0mdc") + "typed-racket" (base32 "03wsz647fi58brbg33fw1xavp100gzfvngdy8bk7bdc0jfg8a18l") '("source-syntax" "typed-racket" "typed-racket-compatibility" @@ -891,13 +958,13 @@ (define-public racket "srfi" (base32 "0aqbcdv2dfc2xnk0h6zfi56p7bpwqji8s88qds3d03hhh9k28gvn") '("srfi" "srfi-doc" "srfi-lib" "srfi-lite-lib")) (simple-racket-origin - "string-constants" (base32 "0b1ji31pv6bjb0a2bh9sqp5abvf91gn2rai8r4c4nkar1fzfwfac") + "string-constants" (base32 "1kg3vxq2hcd0vl76brgpzdwbrb65a4nrrkc6hj4az5lfbbdvqz47") '("string-constants" "string-constants-doc" "string-constants-lib")) (simple-racket-origin - "swindle" (base32 "164gdsphjzdl2vv7zxz7dfk9jwax8njpmim6sidm8qz8a8589y67") + "swindle" (base32 "03n9ymjhrw45h7hxkw4nq8nidnvs9mfzb4228s2cjfaqbgqxvsyb") '(("swindle" "."))) (simple-racket-origin - "syntax-color" (base32 "17lb2403ymz6sflw4vs3gsh2y7kgsf0gn8sncsxjhi16rpj3a9vm") + "syntax-color" (base32 "02dcd4yvdnw35m3srvfd43csxffxw3j4rk6zi379b8dsvbbrjyq1") '("syntax-color" "syntax-color-doc" "syntax-color-lib")) (simple-racket-origin "trace" (base32 "070ihla5j796hdarn5wxdwn4xj0xnkm50shgh49jy994mribvhia") @@ -906,7 +973,7 @@ (define-public racket "unix-socket" (base32 "02dfwas5ynbpyz74w9kwb4wgb37y5wys7svrlmir8k0n9ph9vq0y") '("unix-socket" "unix-socket-doc" "unix-socket-lib")) (simple-racket-origin - "web-server" (base32 "1g4x79ym3mgxv4f3z3z84j12355pf44pjlzlb7f0h6r0i7p0cbjd") + "web-server" (base32 "104lnzjykkd6f3gxpv7p14l94if6zac33nmb4sj5jxmd6r3fwcpf") '("web-server" "web-server-doc" "web-server-lib")) (simple-racket-origin "wxme" (base32 "1qp5gr9gqsakiq3alw6m4yyv5vw4i3hp4y4nhq8vl2nkjmirvn0b") From patchwork Mon Aug 8 06:10:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 41361 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 5486A27BBEA; Mon, 8 Aug 2022 07:12:19 +0100 (BST) 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 45DA427BBE9 for ; Mon, 8 Aug 2022 07:12:18 +0100 (BST) Received: from localhost ([::1]:53470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvzt-0004YJ-FD for patchwork@mira.cbaines.net; Mon, 08 Aug 2022 02:12:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKvyj-0003jq-06 for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49201) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKvyi-0002o1-4u 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-0002uK-0s for guix-patches@gnu.org; Mon, 08 Aug 2022 02:11:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH 5/6] gnu: racket: Use Racket CS on all systems. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 08 Aug 2022 06:11:03 +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.165993904811114 (code B ref 57050); Mon, 08 Aug 2022 06:11:03 +0000 Received: (at 57050) by debbugs.gnu.org; 8 Aug 2022 06:10:48 +0000 Received: from localhost ([127.0.0.1]:38942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyR-0002t6-CE for submit@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:48 -0400 Received: from mail-qt1-f171.google.com ([209.85.160.171]:45782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKvyL-0002sW-Pr for 57050@debbugs.gnu.org; Mon, 08 Aug 2022 02:10:42 -0400 Received: by mail-qt1-f171.google.com with SMTP id j17so1020132qtp.12 for <57050@debbugs.gnu.org>; Sun, 07 Aug 2022 23:10:41 -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=rlyMJ2HDC3VXq/4buniVDog5X+AbTWspFUQWZp9ZxgE=; b=gtbhS8cj1j0J4A4HHnQRcPr5v2mqP0iIA+ZnrNGTh77+6TbhI62bU9gPaytrKt5E55 rucWMLpfVODBEg+l4QDyX42K+kCPrb2hAffxDpW9DkibF+ch2huTN2ryB/dfd1HTLMZ/ PuJMvnrF2ZEZIDsZlstwlWe7sSyArF9Acnv9hNo+ixIDx6khzoU0d6MIx3hHLo1LiHsC vqcOp1f9vMek83g2uMX513c3Mm1CP1i78g3opkCokbom1jXhVXzZC38T6AmYpQg4EqRf yJYfW21hPvWFiJ5gNPK0YGdTzCjqsZ+3lSsA8wqdrv6jpeYv+nO9eMVZNvc5qP1WqmjK 4NPg== 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=rlyMJ2HDC3VXq/4buniVDog5X+AbTWspFUQWZp9ZxgE=; b=g9TGZMjbt3v6y0ZKmwd7DZl3XodkboAXWPEzYjrVUTUSoUx1ayMhEv5xEnBgoukVRr s6uhnyC/xYXkK6eqLOxB8hVBz3fgs6hyOBgwtzpZPE6HYHvBuQHjc9QoJ5Dnkak7PLVo 82A+sRKlepdjmZPZtFbotlq+5RkNck6HMyr556D7Pa98dFpZtrnEvk7HdKyYG9pBDizI kINU9iCTxiNLlNkw2bue9BvarT/YHahdlU3yT8qUJS/DNq82JrPJ0u5EZM8nXqiG9aSr 4SypMQJRfXuKnxE5Rw0bdNAqQa1zS/5IYqeGscFXPqE/oRoO/iT2452Qy1rC0e3IoHOa L8Yw== X-Gm-Message-State: ACgBeo1xdi4rMUgtwQeirge7nXMVK7K4GutK1LWIoHXCoVxAq0dfaFNW 05OqWrMzRps4CcdBHxm4YIdZ26F6tRu6Xa8+ X-Google-Smtp-Source: AA6agR4d9B3k3YGyhv+mO1XAB20E2aVFVcrV3ZT01zx56Y6owRc85PjnhQBQoI20NQ+i/mF2QuFEuA== X-Received: by 2002:a05:622a:14c8:b0:342:f7fe:ab33 with SMTP id u8-20020a05622a14c800b00342f7feab33mr3374009qtx.327.1659939036163; Sun, 07 Aug 2022 23:10:36 -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 ay39-20020a05620a17a700b006a5d2eb58b2sm8431884qkb.33.2022.08.07.23.10.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Aug 2022 23:10:36 -0700 (PDT) From: Philip McGrath Date: Mon, 8 Aug 2022 02:10:06 -0400 Message-Id: <497d143fafeb9c866e278454dd0b1235796ac68f.1659936550.git.philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: 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 On systems for which Racket CS cannot generate native code, it can use a 'pbarch' machine type---a variant of the ``portable bytecode'' backend specialized to word size and endianness---allowing Racket CS to replace Racket BC on those systems while maintaining comparable performance. (Racket BC lacks JIT support for those systems anyway.) This patch adds 'pbarch' support to 'racket-vm-cs' and 'chez-scheme-for-racket-bootstrap-bootfiles' and changes 'racket' and 'racket-minimal' to use 'racket-vm-cs' on all systems. In the process, it also adds support for cross-compiling the bootfiles, 'racket-vm-cgc', 'racket-vm-bc', and 'racket-vm-cs'. This is not enough to cross-compile 'racket-minimal' or 'racket': that would require building and loading cross-compilation pluggins for 'racket-vm-cs', which will be much easier once we can build the package 'raco-cross'. This patch does not address 'chez-scheme-for-racket'. * gnu/packages/chez.scm (nix-system->pbarch-machine-type): New variable. (racket-cs-native-supported-system): Change to return the applicable machine type instead of '#t'. (chez-scheme-for-racket-bootstrap-bootfiles)[native-inputs]: When cross-compiling, use 'zuo' and 'chez-scheme-for-racket' instead of 'racket-vm-bc'. [arguments]: Support cross-compilation and 'pbarch' machine types. [supported-systems]: Use '%supported-systems' instead of inheriting. * gnu/packages/racket.scm (racket-vm-for-system): Remove. (racket-vm-cgc)[native-inputs]: Add 'this-package' when cross-compiling. (racket-vm-bc)[native-inputs]: Adjust accordingly. [description]: Update. (racket-vm-cs)[description]: Likewise. [inputs]: Use 'libffi' for 'pbarch' machine types. [native-inputs]: Use 'racket-vm-cs' instead of 'racket-vm-bc' when cross-compiling. Adapt to changes to 'racket-vm-cgc'. [arguments]<#:configure-flags>: Support cross-compilation and 'pbarch' machine types. (racket-minimal, racket)[inputs]: Replace '(racket-vm-for-system)' with 'racket-vm-cs'. --- gnu/packages/chez.scm | 65 ++++++++++++++++++++++++++++------ gnu/packages/racket.scm | 77 ++++++++++++++++++++++------------------- 2 files changed, 97 insertions(+), 45 deletions(-) diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index dde2c22ca5..2afef8d3bd 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -50,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: @@ -232,18 +233,41 @@ (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"))) + (define* (racket-cs-native-supported-system? #:optional (system (or (%current-target-system) (%current-system)))) - "Can Racket's variant of Chez Scheme generate native code for SYSTEM? -Otherwise, SYSTEM can use only the ``portable bytecode'' backends." + "Can Racket's variant of Chez Scheme generate native code for SYSTEM? If +so, return the applicable machine type as a string. Otherwise, when SYSTEM +can use only the ``portable bytecode'' backends, return #f." (let ((chez-arch (target-chez-arch system)) (chez-os (target-chez-os system))) (and (and=> (assoc-ref %chez-features-table chez-os) ;; NOT assoc-ref: supported even if cdr is #f (cut assoc chez-arch <>)) - #t))) + (string-append "t" chez-arch chez-os)))) ;; ;; Chez Scheme: @@ -587,8 +611,12 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles (name "chez-scheme-for-racket-bootstrap-bootfiles") (version (package-version chez-scheme-for-racket)) (source #f) ; avoid problematic cycle with racket.scm - (native-inputs (list chez-nanopass-bootstrap racket-vm-bc)) - ;; TODO: cross compilation + (native-inputs + (cons* chez-nanopass-bootstrap + (if (%current-target-system) + (list zuo + chez-scheme-for-racket) + (list racket-vm-bc)))) (arguments (substitute-keyword-arguments (package-arguments chez-scheme-bootstrap-bootfiles) @@ -608,11 +636,28 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles #$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")))))))) - (supported-systems - (package-supported-systems chez-scheme-for-racket)) + #$(cond + ((%current-target-system) + ;; cross-compiling + #~(invoke + (search-input-file (or native-inputs inputs) + "/bin/zuo") + "makefiles/boot.zuo" + (search-input-file (or native-inputs inputs) + "/bin/scheme") + #$(or (racket-cs-native-supported-system?) + (nix-system->pbarch-machine-type)))) + (else + ;; bootstrapping + #~(invoke + (search-input-file (or native-inputs inputs) + "/opt/racket-vm/bin/racket") + "rktboot/main.rkt" + #$@(if (racket-cs-native-supported-system?) + #~() + (let ((m (nix-system->pbarch-machine-type))) + #~("--machine" #$m))))))))))))) + (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 diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index f1a2794164..7920d6812c 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -129,10 +129,9 @@ (define-module (gnu packages racket) ;; This file defines the packages 'racket-vm-cgc', 'racket-vm-bc', and ;; 'racket-vm-cs'. All three are in-place builds of 'racket/src/' and ;; 'racket/collects/' and are installed to 'opt/racket-vm/' in the store -;; output. The function 'racket-vm-for-system' returns the recomended Racket -;; VM package for a given system. +;; output. ;; -;; We then define the packages 'racket-minimal' and +;; Using 'racket-vm-cs', we then define the packages 'racket-minimal' and ;; 'racket'. These use Racket's support for ``layered installations'', which ;; allow an immutable base layer to be extended with additional packages. ;; They use the layer configuration directly provide ready-to-install FHS-like @@ -193,17 +192,6 @@ (define-module (gnu packages racket) ;; ;; CODE: -(define* (racket-vm-for-system #:optional - (system (or (%current-target-system) - (%current-system)))) - "Return 'racket-vm-cs' if we are able to build it for SYSTEM; 'racket-vm-bc' -otherwise." - ;; Once we figure out the issues in https://racket.discourse.group/t/950, - ;; we can use 'racket-vm-cs' everywhere. - (if (racket-cs-native-supported-system? system) - racket-vm-cs - racket-vm-bc)) - (define %racket-version "8.6") ; Remember to update chez-scheme-for-racket! (define %zuo-version "1.0") ;; defined in racket/src/zuo/zuo.c (define %racket-commit @@ -331,9 +319,12 @@ (define-public racket-vm-cgc (source %racket-origin) (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 zuo ;; <- for all variants - libtool)) ;; <- only for BC variants + libffi)) ;; <- for BC and non-native CS variants + (native-inputs (cons* zuo ;; <- for all variants + libtool ;; <- only for BC variants + (if (%current-target-system) + (list this-package) + '()))) (outputs '("out" "debug")) (build-system gnu-build-system) (arguments @@ -421,8 +412,10 @@ (define-public racket-vm-bc (inherit racket-vm-cgc) (name "racket-vm-bc") (native-inputs - (modify-inputs (package-native-inputs racket-vm-cgc) - (prepend racket-vm-cgc))) + (if (%current-target-system) + (package-native-inputs racket-vm-cgc) + (modify-inputs (package-native-inputs racket-vm-cgc) + (prepend racket-vm-cgc)))) (arguments (substitute-keyword-arguments (package-arguments racket-vm-cgc) ((#:configure-flags _ '()) @@ -432,10 +425,8 @@ (define-public racket-vm-bc (description "The Racket BC (``before Chez'' or ``bytecode'') implementation was the default before Racket 8.0. It uses a compiler written in C targeting architecture-independent bytecode, plus a JIT compiler on most -platforms. Racket BC has a different C API and supports a slightly different -set of architectures than the current default runtime system, Racket CS (based -on ``Chez Scheme''). It is the recommended implementation for architectures -that Racket CS doesn't support. +platforms. Racket BC has a different C API than the current default runtime +system, Racket CS (based on ``Chez Scheme''). This package is the normal implementation of Racket BC with a precise garbage collector, 3M (``Moving Memory Manager'').") @@ -448,15 +439,24 @@ (define-public racket-vm-cs (inherit racket-vm-bc) (name "racket-vm-cs") (inputs - (modify-inputs (package-inputs racket-vm-cgc) - (prepend zlib lz4) - (delete "libffi"))) + (let ((inputs (modify-inputs (package-inputs racket-vm-cgc) + (prepend zlib lz4)))) + (if (racket-cs-native-supported-system?) + (modify-inputs inputs + (delete "libffi")) + inputs))) (native-inputs - (modify-inputs (package-native-inputs racket-vm-cgc) - (delete "libtool") - (prepend chez-scheme-for-racket - chez-nanopass-bootstrap - racket-vm-bc))) + (let ((native-inputs (package-native-inputs racket-vm-cgc))) + (modify-inputs (if (%current-target-system) + (modify-inputs native-inputs + (delete "racket-vm-cgc")) + native-inputs) + (delete "libtool") + (prepend chez-scheme-for-racket + chez-nanopass-bootstrap + (if (%current-target-system) + racket-vm-cs + racket-vm-bc))))) (arguments (substitute-keyword-arguments (package-arguments racket-vm-cgc) ((#:phases those-phases #~%standard-phases) @@ -470,15 +470,22 @@ (define-public racket-vm-cs "--enable-libz" "--enable-lz4" (string-append "--enable-scheme=" - #$(this-package-native-input + #+(this-package-native-input "chez-scheme-for-racket") "/bin/scheme") + #$@(if (racket-cs-native-supported-system?) + #~() + #~(#$(string-append "--enable-mach=" + (nix-system->pbarch-machine-type)) + "--enable-pb")) #$(racket-vm-common-configure-flags))))) (synopsis "Racket CS implementation") (description "The Racket CS implementation, which uses ``Chez Scheme'' as its core compiler and runtime system, has been the default Racket VM implementation since Racket 8.0. It performs better than the Racket BC -implementation for most programs. +implementation for most programs. On systems for which Racket CS cannot +generate machine code, this package uses a variant of its ``portable +bytecode'' backend specialized for word size and endianness. Using the Racket VM packages directly is not recommended: instead, install the @code{racket-minimal} or @code{racket} packages.") @@ -554,7 +561,7 @@ (define-public racket-minimal (inputs (list openssl sqlite - (racket-vm-for-system) + racket-vm-cs (racket-packages-origin "base" %racket-origin '(("base" "pkgs/base") @@ -672,7 +679,7 @@ (define-public racket unixodbc libedit ;; TODO reconsider in light of expeditor and readline-gpl racket-minimal ;; <-- TODO non-tethered layer - (racket-vm-for-system) + racket-vm-cs (simple-racket-origin "2d" (base32 "0fb5v6058ls08xw3zbmqyr2ym0psm119gl9ffgmhm9w8rs9i4dq7") '("2d" "2d-doc" "2d-lib")) From patchwork Mon Aug 8 06:10:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 41357 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 4D46627BBEB; Mon, 8 Aug 2022 07:11:42 +0100 (BST) 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 6354927BBEA for ; Mon, 8 Aug 2022 07:11:41 +0100 (BST) Received: from localhost ([::1]:52348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvzI-0003nZ-I7 for patchwork@mira.cbaines.net; Mon, 08 Aug 2022 02:11:40 -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 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 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)))