From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eF8kHR7uG2JWbQAAgWs5BA (envelope-from ) for ; Sun, 27 Feb 2022 22:33:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id cEZrGh7uG2L4ZQEA9RJhRA (envelope-from ) for ; Sun, 27 Feb 2022 22:33:18 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 312563FAC6 for ; Sun, 27 Feb 2022 22:33:18 +0100 (CET) Received: from localhost ([::1]:33052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nORAL-000204-2T for larch@yhetil.org; Sun, 27 Feb 2022 16:33:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nORAA-0001rw-A9 for guix-patches@gnu.org; Sun, 27 Feb 2022 16:33:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:37262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nORA7-0005qw-P0 for guix-patches@gnu.org; Sun, 27 Feb 2022 16:33:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nORA7-0008Kd-MY for guix-patches@gnu.org; Sun, 27 Feb 2022 16:33:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH v7 19/24] gnu: Add chez-nanopass. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 27 Feb 2022 21:33:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53878 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53878@debbugs.gnu.org, Liliana Marie Prikler , zimoun Cc: Philip McGrath , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxime Devos , raingloom , Liliana Marie Prikler , Attila Lendvai , Malte Gerdes Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164599757231988 (code B ref 53878); Sun, 27 Feb 2022 21:33:03 +0000 Received: (at 53878) by debbugs.gnu.org; 27 Feb 2022 21:32:52 +0000 Received: from localhost ([127.0.0.1]:59389 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOR9v-0008Jr-JC for submit@debbugs.gnu.org; Sun, 27 Feb 2022 16:32:52 -0500 Received: from mail-qv1-f54.google.com ([209.85.219.54]:34571) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nOR9u-0008Jd-CB for 53878@debbugs.gnu.org; Sun, 27 Feb 2022 16:32:50 -0500 Received: by mail-qv1-f54.google.com with SMTP id ba20so11031133qvb.1 for <53878@debbugs.gnu.org>; Sun, 27 Feb 2022 13:32:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=philipmcgrath.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YuIdrZBKyHowWg/p07x556LhkTvzwSpYchKVBc+nIfE=; b=JSbmiqMNjXpg8u7ahYfSeZ7lvbrrgpyVDhnvMw9U27krHLDRph3xGHobQNywMFP6O8 WT3CF5jTjOZHyWZLSfZODeRbzvP6YJx6aEGL+dK+gRDXWDBqKPBYesKoWdBhL72iIJi7 MqCkPRJTvkjvjtOt7DYc5IjCm7PCsIvHGwujJFWJXXd0Jw2keAqRPGqEBLbySt2aOOPk lJY6+I9NjfaZvJx23gt17XPhHpmslNdTZiOWXliiZ4HsKhYiTUj7+GeCAvoHYAJnQs4Q +kwwrxT6ULIxeCo/S6QrQIVu2b1bN1I0C8DFpSW0L8/tQFl7EC08yxB6wtsOhCQ8yw5Q 35Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YuIdrZBKyHowWg/p07x556LhkTvzwSpYchKVBc+nIfE=; b=loEEpV7JEf5J1YpDoL/6l4xJ7+jMzLBu1VMlAnOmT/gw2OHlqYJC+N1CElpj04eb1K 2vnmMtxwxGxU8Lpsqg2W2CTlhWwsjLm2VZ/rxbMiua9MSL3AwRiCZ11fOObOHIa2pjRE Df/SeE6cxmMwpN8fbsnpmzmpmG+qPCxs9TOHFSjrBYNU5Cgs9kmR7RqXsoxIQc7zjSUP iouC1CJ/CV6Mj4S6BraxPgauMHBS/gfAHLqAe8981JFKa7NTNGjLTClRFpi9ZGy9+Fjk rZCRZhJocP+9q00wCfocS+F/azwPsuFCgdz5WyddsWD+gzcLpCzNW/coC8PnpYWMi621 kGhQ== X-Gm-Message-State: AOAM531N6DijaXPzpedTv/W8nqigADidsoLpT8rrgxUjGmOS8qT3X02R qJ/iHF8H1RRFIOTXSel96iFVCnZduUU7Emda+TA= X-Google-Smtp-Source: ABdhPJxeCwS7kn/3yYksbkO7XqvfxfGTb3C8p2Obo7gzft0cJBV03mYYiVwRZ2cUqxjmcBetwE/OwQ== X-Received: by 2002:a0c:ec04:0:b0:432:274a:a1fe with SMTP id y4-20020a0cec04000000b00432274aa1femr12223301qvo.68.1645997564643; Sun, 27 Feb 2022 13:32:44 -0800 (PST) Received: from localhost (c-73-125-98-51.hsd1.fl.comcast.net. [73.125.98.51]) by smtp.gmail.com with UTF8SMTPSA id e22-20020ac84e56000000b002dde0f47ea6sm5855924qtw.6.2022.02.27.13.32.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 27 Feb 2022 13:32:44 -0800 (PST) From: Philip McGrath Date: Sun, 27 Feb 2022 16:29:15 -0500 Message-Id: <20220227212920.2009000-20-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220227212920.2009000-1-philip@philipmcgrath.com> References: <20220220060610.178131-1-philip@philipmcgrath.com> <20220227212920.2009000-1-philip@philipmcgrath.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1645997598; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=YuIdrZBKyHowWg/p07x556LhkTvzwSpYchKVBc+nIfE=; b=N91tOxl+aYuF2rmjOpyf9VM7ym/CGX8CJhKQ7iihR9BqQFnOgoQveSTkynKXX+H9+NF1qc fpJD+nmpGfFx7xm8Y1utFPWg2fKDsWdf0qhDg0wek+alBzk2md6F6v0BPlvIOt0xHdkuRY nRS+vlzknqbXyMp34t3IdkGmmnbLyj6LZNSbDMsqE+pK6354Ps0ixfmGH9DCBCJVR5qXZ5 T3dtuLxCNi9V204mVrgxJ/SHwrFww+4WcdKZdMtcd1pPywlnoZHRFF1pIXhKCpZqP0N0U1 quIdBLYqMKHH4aTq54uTvuufU3KdxLcavQzxhnKgwSJJXhLOVUg3GRJc71anFw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645997598; a=rsa-sha256; cv=none; b=JzrLkSykVk4bbfWeEnuuVxUMjIGk/lJXM1NF7xZo0mLqDwOY7bHqqVShFGvyDpbAWK2K3C sZXQcvQfNQ2r8Tq2iGlLT5JV/4/W2QjjSuDGNA5cL3YZBsrD7+06BFt9mlghfyeLG5BB9u ha6Kjh3ZtkSchzeN/VVSXel23WWKNhHCyVYkY0TGnrjDtb/5ZYaAKccZ9THY0nWGjqc50g dDK5JGem43CqvgB6jUcOxRQU/vG7SnHjs6HglrzONdTwOggpibNDVZhiTTHIO3IZsSrxe7 3TvjZEq3JDUbKn5NxdzlBuZ4ttrKGfwMbib5TKAS/FeipbB/OPEdStTuZcu+FQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=JSbmiqMN; 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: 2.90 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=JSbmiqMN; 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: 312563FAC6 X-Spam-Score: 2.90 X-Migadu-Scanner: scn0.migadu.com X-TUID: iROUTOUjdHSB * gnu/packages/chez.scm (nanopass): Rename to ... (chez-nanopass-bootstrap): ... this new variable, and promote it from an origin to a package. (chez-nanopass): New variable. (unpack-nanopass+stex): New variable using 'chez-nanopass-bootstrap'. (chez-scheme-for-racket-bootstrap-bootfiles, chez-scheme)[native-inputs]: Add 'chez-nanopass-bootstrap'. [arguments]<#:phases>: Adapt 'unpack-nanopass+stex' phase to use the eponymous new variable. * gnu/packages/racket.scm (racket-vm-cs): Likewise. (make-unpack-nanopass+stex): Remove it. --- gnu/packages/chez.scm | 122 +++++++++++++++++++++++++++++++--------- gnu/packages/racket.scm | 19 +------ 2 files changed, 98 insertions(+), 43 deletions(-) diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index 6855195cfe..43d2c764f3 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -48,7 +48,8 @@ (define-module (gnu packages chez) #:use-module (srfi srfi-1) #:export (nix-system->chez-machine chez-machine->nonthreaded - chez-machine->threaded)) + chez-machine->threaded + unpack-nanopass+stex)) (define (chez-machine->nonthreaded machine) "Given a string MACHINE naming a Chez Scheme machine type, returns a string @@ -159,6 +160,20 @@ (define* (chez-upstream-features-for-system #:optional ;; Chez Scheme: ;; + +(define unpack-nanopass+stex + #~(begin + (copy-recursively + (dirname (search-input-file %build-inputs + "lib/chez-scheme/nanopass.ss")) + "nanopass" + #:keep-mtime? #t) + (mkdir-p "stex") + (with-output-to-file "stex/Mf-stex" + (lambda () + ;; otherwise, it will try to download submodules + (display "# to placate ../configure"))))) + (define-public chez-scheme (package (name "chez-scheme") @@ -176,6 +191,9 @@ (define-public chez-scheme (file-name (git-file-name name version)) (snippet #~(begin (use-modules (guix build utils)) + ;; TODO: consider putting this in a (guix ...) or + ;; (guix build ...) module so it can be shared + ;; with the Racket origin without cyclic issues. (for-each (lambda (dir) (when (directory-exists? dir) (delete-file-recursively dir))) @@ -193,9 +211,7 @@ (define-public chez-scheme ;; for X11 clipboard support in expeditor: ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232 libx11)) - (native-inputs - (list nanopass ; source only - stex-bootstrap)) + (native-inputs (list chez-nanopass-bootstrap stex-bootstrap)) (native-search-paths (list (search-path-specification (variable "CHEZSCHEMELIBDIRS") @@ -215,14 +231,7 @@ (define-public chez-scheme #~(modify-phases %standard-phases (add-after 'unpack 'unpack-nanopass+stex (lambda args - (copy-recursively #$nanopass - "nanopass" - #:keep-mtime? #t) - (mkdir-p "stex") - (with-output-to-file "stex/Mf-stex" - (lambda () - ;; otherwise, it will try to download submodules - (display "# to placate ../configure"))))) + #$unpack-nanopass+stex)) ;; NOTE: the custom Chez 'configure' script doesn't allow ;; unrecognized flags, such as those automatically added ;; by `gnu-build-system`. @@ -317,7 +326,7 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles ;; When updating, remember to also update %racket-version in racket.scm. (source #f) ; avoid problematic cycle with racket.scm (inputs `()) - (native-inputs (list racket-vm-bc)) + (native-inputs (list chez-nanopass-bootstrap racket-vm-bc)) (build-system copy-build-system) ;; TODO: cross compilation (arguments @@ -336,10 +345,7 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles (chdir "racket/src/ChezScheme"))) (add-after 'chdir 'unpack-nanopass+stex (lambda args - (copy-recursively - #$nanopass - "nanopass" - #:keep-mtime? #t))) + #$unpack-nanopass+stex)) (add-before 'install 'build (lambda* (#:key native-inputs inputs #:allow-other-keys) (invoke (search-input-file (or native-inputs inputs) @@ -502,15 +508,79 @@ (define-public stex (outputs '("out" "doc")) (properties '()))) -(define-public nanopass - (let ((version "1.9.2")) - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/nanopass/nanopass-framework-scheme") - (commit (string-append "v" version)))) - (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i")) - (file-name (git-file-name "nanopass" version))))) +(define-public chez-nanopass-bootstrap + (hidden-package + (package + (name "chez-nanopass") + (version "1.9.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/nanopass/nanopass-framework-scheme") + (commit (string-append "v" version)))) + (sha256 + (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i")) + (file-name (git-file-name "nanopass-framework-scheme" version)) + (snippet + #~(begin + (use-modules (guix build utils)) + (when (file-exists? "doc/user-guide.pdf") + (delete-file "doc/user-guide.pdf")) + (substitute* "doc/Makefile" + (("include ~/stex/Mf-stex") + "include $(STEXLIB)/Mf-stex")))))) + (build-system copy-build-system) + (arguments + (list #:install-plan + #~`(("nanopass.ss" "lib/chez-scheme/") + ("nanopass" "lib/chez-scheme/")))) + (home-page "https://nanopass.org") + (synopsis "DSL for compiler development") + (description "The Nanopass framework is an embedded domain-specific +language for writing compilers composed of several simple passes that +operate over well-defined intermediate languages. The goal of this +organization is both to simplify the understanding of each pass, because it +is responsible for a single task, and to simplify the addition of new passes +anywhere in the compiler. Nanopass reduces the boilerplate required to +create compilers, making them easier to understand and maintain.") + (license expat)))) + +(define-public chez-nanopass + (package/inherit chez-nanopass-bootstrap + (properties '()) + ;; TODO: cross-compilation + (native-inputs (list chez-scheme stex)) + (arguments + (substitute-keyword-arguments (package-arguments chez-nanopass-bootstrap) + ((#:install-plan base-plan) + #~`(("nanopass.so" "lib/chez-scheme/") + ("doc/user-guide.pdf" #$(string-append + "share/doc/" + (package-name this-package) + "-" + (package-version this-package) + "/")) + ,@#$base-plan)) + ((#:phases base-phases #~%standard-phases) + #~(modify-phases #$base-phases + (add-before 'install 'compile-and-test + (lambda args + (invoke "scheme" + "--compile-imported-libraries" + "--program" "test-all.ss"))) + (add-after 'compile-and-test 'build-doc + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (with-directory-excursion "doc" + (invoke "make" + (string-append "Scheme=" + (search-input-file + (or native-inputs inputs) + "/bin/scheme")) + (string-append "STEXLIB=" + (search-input-directory + (or native-inputs inputs) + "/lib/stex")))))))))))) ;; ;; Other Chez packages: diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index 035d93bfb5..f29e0791a7 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -251,22 +251,6 @@ (define (racket-vm-common-configure-flags) "--disable-strip" "--enable-origtree")) -(define (make-unpack-nanopass+stex) - ;; Adapted from chez-scheme. - ;; Thunked to avoid evaluating 'chez-scheme' too early. - ;; TODO: Refactor enough to share this directly. - #~(begin - (copy-recursively - #$nanopass - "nanopass" - #:keep-mtime? #t) - (mkdir-p "stex") - (with-output-to-file "stex/Mf-stex" - (lambda () - ;; otherwise, it will try to download submodules - (display "# to placate ../configure"))))) - - (define-public racket-vm-cgc ;; Eventually, it may make sense for some vm packages to not be hidden, ;; but this one is especially likely to remain hidden. @@ -417,6 +401,7 @@ (define-public racket-vm-cs (modify-inputs (package-native-inputs racket-vm-cgc) (delete "libtool") (prepend chez-scheme-for-racket-bootstrap-bootfiles + chez-nanopass-bootstrap racket-vm-bc))) (arguments (substitute-keyword-arguments (package-arguments racket-vm-cgc) @@ -425,7 +410,7 @@ (define-public racket-vm-cs (add-after 'unpack 'unpack-nanopass+stex (lambda args (with-directory-excursion "racket/src/ChezScheme" - #$(make-unpack-nanopass+stex)))) + #$unpack-nanopass+stex))) (add-after 'unpack-nanopass+stex 'unpack-bootfiles (lambda* (#:key native-inputs inputs #:allow-other-keys) (with-directory-excursion "racket/src/ChezScheme" -- 2.32.0