From patchwork Sat Feb 19 06:42:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 37350 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 E6B7F27BBEA; Sat, 19 Feb 2022 07:13:16 +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 DB21327BBE9 for ; Sat, 19 Feb 2022 07:13:15 +0000 (GMT) Received: from localhost ([::1]:54374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLJvd-0001pf-89 for patchwork@mira.cbaines.net; Sat, 19 Feb 2022 02:13:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLJTT-00071T-3C for guix-patches@gnu.org; Sat, 19 Feb 2022 01:44:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLJTR-00082W-Uf for guix-patches@gnu.org; Sat, 19 Feb 2022 01:44:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nLJTR-0004nd-T7 for guix-patches@gnu.org; Sat, 19 Feb 2022 01:44:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH v3 07/15] gnu: Add chez-nanopass. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 19 Feb 2022 06:44:05 +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 Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Attila Lendvai , Philip McGrath , Malte Gerdes , zimoun Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164525301618269 (code B ref 53878); Sat, 19 Feb 2022 06:44:05 +0000 Received: (at 53878) by debbugs.gnu.org; 19 Feb 2022 06:43:36 +0000 Received: from localhost ([127.0.0.1]:56732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJSx-0004kW-K5 for submit@debbugs.gnu.org; Sat, 19 Feb 2022 01:43:36 -0500 Received: from mail-qv1-f45.google.com ([209.85.219.45]:41586) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nLJSu-0004jn-P5 for 53878@debbugs.gnu.org; Sat, 19 Feb 2022 01:43:33 -0500 Received: by mail-qv1-f45.google.com with SMTP id x3so19174541qvd.8 for <53878@debbugs.gnu.org>; Fri, 18 Feb 2022 22:43:32 -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=QbBHSzf4hnZ6Jjrj/8rbponDQC/HIJs6ty7J+dhTRMkV7Y+mwg9UIExqIE6ViNUcJF GPpTK8Wn8yqIzOgg8NTISnzouXxhNm1z9X0rFBY0fnO5EunDg9GmiTk5RUws3NdPoE+7 4/PvQgfvF21/x8kvsYDThuOL2ZiDEyVk+fNTbYb2/50yL8T3SIytL2wURQOvrm01MTm8 oaMxo5vkq8te+pEx9CWSMRjnL5YYENtwoRNLOfuV5QgAZI2RRxyv2DE7CxdRP+ZcpnKH x7AbFxEOpNHcLQjBeXz0YNSXN26I2AZ7Jo4an+30n6dmrJBJRVe6oZM3FZusbzRBxiZO Th9Q== 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=HJ6dywr+I/kVfim6L9Bh0ZJ2eFCm4J72Se9iES648CN+dAG2mQjfAoM/Sqbk8wD40C SSUmSCJA+7uVA6WwR7LXfdOoKj7GTMYs5i888Jgef9ntwSbkE+H0iBBJlBI6Sd2g0Am8 nt2JdYtY5pE3cwHBojUam8dk6k10DmNfSo44NVBk2RAZ9qqXEUNd8gQCIFEdHXN43C1C WZfeFJNpXqwiWq/2z5jhoC4WJFVcsi3hKnlAUS0TNIRAlkVRmUB0PtInjXJ0m6CyTE/i M9k4c4etThZhtHMBgydXUlU6gng3jhpru+spWECwAH4DDdAqs7MMWvlkHFH0QDZO/q1j CO0Q== X-Gm-Message-State: AOAM531BWmGJseAD1UupjhXy4ldtr7delviN3BVDs03BdQuoITsmbRls mf5aUXl0bf4Povu1En0KqTiQLgls1Y1GhBFq2sA= X-Google-Smtp-Source: ABdhPJw13Bk3i6Toe7XuuVpAt0c2yIBWDbDStP6YwgED/R36PVK/tT15KcMSuE783reh9NcqPIiFww== X-Received: by 2002:a05:622a:5d2:b0:2dd:2d7b:db15 with SMTP id d18-20020a05622a05d200b002dd2d7bdb15mr9837872qtb.570.1645253007094; Fri, 18 Feb 2022 22:43:27 -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 d23sm5805725qka.50.2022.02.18.22.43.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Feb 2022 22:43:26 -0800 (PST) From: Philip McGrath Date: Sat, 19 Feb 2022 01:42:20 -0500 Message-Id: <20220219064228.246917-8-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220219064228.246917-1-philip@philipmcgrath.com> References: <20220208151316.1897345-1-philip@philipmcgrath.com> <20220219064228.246917-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