From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4AlsMS2p8GJlXgEAbAwnHQ (envelope-from ) for ; Mon, 08 Aug 2022 08:11:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id QIwqMS2p8GKWBgAAauVa8A (envelope-from ) for ; Mon, 08 Aug 2022 08:11:57 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 55FA520983 for ; Mon, 8 Aug 2022 08:11:57 +0200 (CEST) Received: from localhost ([::1]:53030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKvzY-0004Ft-DI for larch@yhetil.org; Mon, 08 Aug 2022 02:11:56 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1659939117; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=gNi1IqD0nPZCI+0SHmP2x3XxRAP9TB2Zk8w7H7c7mxA=; b=qRVX8JVmUCtZJLEvBly5hD4owRCV7WhL4zKra3kUm7Aj0h3VYEQ48ssDhTnv062J8ONHE8 wDmZ81N/wRGg1G76gsQadaLdU4ay7ZTcjZ5BUYTviPWKVeLJ0e+Ctm6MD63KnuPIWOGWy8 H2ShlyB8vAFhKdvegtZOEchspHiMvxbanxas/CLOKqSpoSXmKwEH5eS/Wn0EGIcAIUWbAB nDoGpHPWlOpH4OXA9VTo3rnc65vaIFMQJXd/l5tDqsGpRLjV8L5ACUVXBaWo7fVzVDrHo9 WnkxJKXgS7DlSHvMoPMMIzZnApVbbQSv9H/pYMD2vf0PzegoTNdspg7fcam1wQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1659939117; a=rsa-sha256; cv=none; b=FrpdeWPzwjbIJCCyHDxJDAt9jy2IS076+crDZGtnrnsZS2qXGtRfvLEoegsEI5siLE5Jg8 j4rOGV3M51vaf+TTpBjzDKf+EL+E0SdYUOXRQaTY1L3srCBRA6VOCRDHb0Usd150f27jbp uIV/+COYsl6iW8tO6Hy2wW8boTdscrtEINEuX/ZpyH7U+S5UmdvZrF/bd7CBBpIvy7v5og Sab7Yqbr/LHYX0yOa72gbHkK5iBf3YykC2RIUDIyMwJZ9yhCQ5xBFTw1yXTS2zJw7Cfvqb 8j3QK4Kr9RTwhcqVGPgmdl1bGw6fpJjnIq0m2iAPSmRazaPz2qwKEnZ+p2Hwug== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=PpeAX40D; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=PpeAX40D; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 55FA520983 X-Spam-Score: 1.31 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3EdfEAz74bBI 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") -- 2.32.0