From patchwork Thu Feb 17 20:50:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 37297 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 A608F27BBE9; Thu, 17 Feb 2022 20:53:52 +0000 (GMT) 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 1134527BBEA for ; Thu, 17 Feb 2022 20:53:52 +0000 (GMT) Received: from localhost ([::1]:36598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nKnmh-0007JI-5y for patchwork@mira.cbaines.net; Thu, 17 Feb 2022 15:53:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nKnlu-0006ih-N7 for guix-patches@gnu.org; Thu, 17 Feb 2022 15:53:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58906) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nKnlu-0001cj-BF for guix-patches@gnu.org; Thu, 17 Feb 2022 15:53:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nKnlu-0003Zk-Aw for guix-patches@gnu.org; Thu, 17 Feb 2022 15:53:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH v2 07/15] gnu: Add chez-nanopass. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 17 Feb 2022 20:53:02 +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 Cc: Philip McGrath , zimoun , Ludovic =?utf-8?q?Court=C3=A8s?= , Liliana Marie Prikler , Attila Lendvai , Malte Gerdes Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164513112613565 (code B ref 53878); Thu, 17 Feb 2022 20:53:02 +0000 Received: (at 53878) by debbugs.gnu.org; 17 Feb 2022 20:52:06 +0000 Received: from localhost ([127.0.0.1]:52779 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKnl0-0003We-7o for submit@debbugs.gnu.org; Thu, 17 Feb 2022 15:52:06 -0500 Received: from mail-qk1-f182.google.com ([209.85.222.182]:43698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nKnku-0003Ux-U9 for 53878@debbugs.gnu.org; Thu, 17 Feb 2022 15:52:01 -0500 Received: by mail-qk1-f182.google.com with SMTP id z66so193634qke.10 for <53878@debbugs.gnu.org>; Thu, 17 Feb 2022 12:52:00 -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=myFOQsagaM5rWP7H+8y+MtEcVQRHE/gFDdJewhkQ1Ps=; b=VZUWLcmh90wWzcu/fh/Me74DacccZt1nEAGbTLFNQk0Jx1O2BPuCWdCdYrN2Jeta+f GP9ObkBYIunqeTj8G5YzlVpj8pFn9O0ihmt19cdhDYC/yu3WtaX7kCFyFGgn2ZtJ9knL 4OPZ08UuNgfLuw7+ZpDMYVNKMxZJE4YTXMdczvsZ0i9M6g+bbjV+3/tXFv4PSQoq0/JI gsDs1rTW/ZFjSYKSRhXnI5TV7vNylfKVIxjkcag5BvS4hFhl3zItt9UQSzO9gRH+BDBk m2Bc+XZMxAvQMgpY15eZrSYFzcxRkHuWxoIZ86uBCvydL0ejQMNfvMH4akMOo7LsQ6h1 NnbA== 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=myFOQsagaM5rWP7H+8y+MtEcVQRHE/gFDdJewhkQ1Ps=; b=OFIGJE9ySIOSMlfi/nq3eUJK9Os1JRdnj/AYhovQGeOLq9rrYC3ntDuAEDBqxWPLSZ ZaDaOSihPUwvGjFJ3VbRDmtQq7d3bhMEofQ3JzeqCn+6e8lBPvUiL+0sYqIpq9ygUKSL E/kdWJEvMwm6FRXkUX35ejNA+RZN3VFfEdaCbCEnnpfRA40qwUyBnLe5TZB6wpI3i5lU NkXu5Xif+jLFBA4AjInIGvsTTzgIoAtki3lNXhERQWN3k7oCTIV1x6UN8Vbe75yblg2R WZ5NVqFSZfn4TWtNnIov4/be3NJMxboYIS3z7VYGDpi436ZxnpiNMSAOiPyX6G1T1PMY GQow== X-Gm-Message-State: AOAM532LbLCeqqxFjkrtUcI3CU4DZIKSSbtPuLHZBybaZxHZpvB7rARO XfJ0+N+N5XbL1N0CmA6XIVBDblv9jQbv3OnE2TI= X-Google-Smtp-Source: ABdhPJyTQ8TTUYYU4hZRa4DSJbNU7KZzmb11TxM0puqLnSJeDZHEaHcw2xwvJyVCM8JayMOpXm1GMg== X-Received: by 2002:a37:a7d7:0:b0:5f1:9141:9c0c with SMTP id q206-20020a37a7d7000000b005f191419c0cmr2722540qke.783.1645131115323; Thu, 17 Feb 2022 12:51:55 -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 p15sm24460629qtk.56.2022.02.17.12.51.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Feb 2022 12:51:55 -0800 (PST) From: Philip McGrath Date: Thu, 17 Feb 2022 15:50:40 -0500 Message-Id: <20220217205048.967383-8-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220217205048.967383-1-philip@philipmcgrath.com> References: <97f8916ae5bd8d8459bdfd507864f2f55cc217a1.camel@ist.tugraz.at> <20220217205048.967383-1-philip@philipmcgrath.com> 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-and-racket-bootstrap.scm (nanopass): Rename to ... (chez-nanopass-bootstrap): ... this new variable, and promote it from an origin to a package. (chez-scheme)[native-inputs]: Add it. [arguments]<#:phases>: Adapt 'unpack-nanopass+stex'. (chez-nanopass): New variable. * gnu/packages/racket.scm (racket-bootstrap-chez-bootfiles)[native-inputs]: Adapt accordingly. --- gnu/packages/chez-and-racket-bootstrap.scm | 96 ++++++++++++++++++---- gnu/packages/racket.scm | 2 +- 2 files changed, 81 insertions(+), 17 deletions(-) diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm index 83bf15b5fb..d66955d50d 100644 --- a/gnu/packages/chez-and-racket-bootstrap.scm +++ b/gnu/packages/chez-and-racket-bootstrap.scm @@ -207,9 +207,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") @@ -228,10 +226,12 @@ (define-public chez-scheme #:phases #~(modify-phases %standard-phases (add-after 'unpack 'unpack-nanopass+stex - (lambda args - (copy-recursively #$nanopass - "nanopass" - #:keep-mtime? #t) + (lambda* (#:key native-inputs inputs #:allow-other-keys) + (copy-recursively + (dirname (search-input-file (or native-inputs inputs) + "lib/chez-scheme/nanopass.ss")) + "nanopass" + #:keep-mtime? #t) (mkdir-p "stex") (with-output-to-file "stex/Mf-stex" (lambda () @@ -454,12 +454,76 @@ (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 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")))))))))))) diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm index d8338bcd6f..e8d016c07b 100644 --- a/gnu/packages/racket.scm +++ b/gnu/packages/racket.scm @@ -334,7 +334,7 @@ (define-public racket-bootstrap-chez-bootfiles racket-minimal racket-minimal-bc-3m)) ("stex" ,(package-source stex)) - ("nanopass" ,nanopass))) + ("nanopass" ,(package-source chez-nanopass)))) (arguments `(#:phases (modify-phases %standard-phases