From patchwork Sun Feb 13 21:51:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip McGrath X-Patchwork-Id: 37236 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 2F73227BBEA; Sun, 13 Feb 2022 21:55:29 +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 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 90D4627BBE9 for ; Sun, 13 Feb 2022 21:55:28 +0000 (GMT) Received: from localhost ([::1]:58928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJMq7-00070G-Nm for patchwork@mira.cbaines.net; Sun, 13 Feb 2022 16:55:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJMom-0005cN-MJ for guix-patches@gnu.org; Sun, 13 Feb 2022 16:54:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45184) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJMom-0001uC-DI for guix-patches@gnu.org; Sun, 13 Feb 2022 16:54:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nJMom-0003EF-Dc for guix-patches@gnu.org; Sun, 13 Feb 2022 16:54:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH 06/11] gnu: Add chez-nanopass. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 13 Feb 2022 21:54:04 +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: Liliana Marie Prikler , Philip McGrath Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164478919512251 (code B ref 53878); Sun, 13 Feb 2022 21:54:04 +0000 Received: (at 53878) by debbugs.gnu.org; 13 Feb 2022 21:53:15 +0000 Received: from localhost ([127.0.0.1]:39063 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJMny-0003BS-Sh for submit@debbugs.gnu.org; Sun, 13 Feb 2022 16:53:15 -0500 Received: from mail-qk1-f179.google.com ([209.85.222.179]:40881) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJMnw-0003Ax-It for 53878@debbugs.gnu.org; Sun, 13 Feb 2022 16:53:12 -0500 Received: by mail-qk1-f179.google.com with SMTP id o25so12986269qkj.7 for <53878@debbugs.gnu.org>; Sun, 13 Feb 2022 13:53:12 -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=0RoPqjGuiAdlkTJfEuvvQASmSYaOTDgT7ADK6BvAjY0=; b=SNH3cAF0xRaq78IK5sHzA1dJwvRiu138+v4cv5nSV9RK7J+XCAANYeEKK91UvBFIrc zmO3+s447pjM8v+olvD0/FsjPy3iNQsCo5pQBGamtc7XKZVXBJWpqbd2pXRMeRQH07IL baiYYMa1g06KuGMPReWWpilIUXTgnU6YYCIupxuaCvMLa0OgMa45cOhy91RsUiRDvnf5 xCtW0VmgHcxzl/L7U7hWA6CY4GbYVpeinQDZ/Iwd7wPhuAIUDC+d7cuFN4E1iIMyEbgh Au1V7FooH56DXXZB0FHZataIDbN3Uitdfvzek3Lm8Ixv82M36zWBGAThMsY7/BSKr190 4QHg== 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=0RoPqjGuiAdlkTJfEuvvQASmSYaOTDgT7ADK6BvAjY0=; b=zfm32rTkeSqa76qkPxeQYZfk8VHX5dap83qkZt268uquRQprEv8WQu1OUZM7Pt2894 qtBAxzfqoW0Fgfv/YTWk9KE6+C2L2etByTuEcttMMjbIboSP9FZXTyxEMq3ysFvZ+i3u vGcdGwN9CSWqyrGYNPGvy6paxWaA0VSuaWaXfj5wAVof6TB0tpbqZSb6wNaXWUl3ZRP7 8hlc4YzyXC5LG53gkN6Sz3M0WEZyD+UytILlZTtXbz1N7o8xcZgYuJJZGMR4M+fUbw37 3biCT/q80FKbwtxV9QIxBby3lAtdOQH3GNFcE3JESa7iXGrHRdKB/NCI/mIsZqqtylyW VQOA== X-Gm-Message-State: AOAM5312Z+C42/h6yvgWNqqUk0l/fzve0mlxTwZi2L5X2TqOW7fIqj2Q M1nQP6qBuaW1mA40Iaiq4qd/y8qCna3LQDrSmak= X-Google-Smtp-Source: ABdhPJxl1oFGTbGXdsiJLScfAl5adcMTPLpqe4jpF7b/UEc7/2TkRWNrw2UUdIB/UIZ9m/oVZCYm4g== X-Received: by 2002:a05:620a:e1d:: with SMTP id y29mr4776400qkm.274.1644789187066; Sun, 13 Feb 2022 13:53:07 -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 f20sm17374305qte.14.2022.02.13.13.53.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Feb 2022 13:53:06 -0800 (PST) From: Philip McGrath Date: Sun, 13 Feb 2022 16:51:22 -0500 Message-Id: <20220213215127.218952-7-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220213215127.218952-1-philip@philipmcgrath.com> References: <20220213215127.218952-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. (chez-nanopass): New variable. (unpack-nanopass+stex): Adapt accordingly. * gnu/packages/racket.scm (racket-bootstrap-chez-bootfiles)[native-inputs]: Likewise. --- gnu/packages/chez-and-racket-bootstrap.scm | 97 ++++++++++++++++++---- gnu/packages/racket.scm | 2 +- 2 files changed, 82 insertions(+), 17 deletions(-) diff --git a/gnu/packages/chez-and-racket-bootstrap.scm b/gnu/packages/chez-and-racket-bootstrap.scm index 945d1ce2ed..90fd63b5ae 100644 --- a/gnu/packages/chez-and-racket-bootstrap.scm +++ b/gnu/packages/chez-and-racket-bootstrap.scm @@ -203,12 +203,13 @@ (define unbundle-chez-submodules "lz4" "zlib")))) -(define (unpack-nanopass+stex) - ;; delayed resolution of `nanopass` +(define unpack-nanopass+stex #~(begin - (copy-recursively #$nanopass - "nanopass" - #:keep-mtime? #t) + (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 () @@ -241,7 +242,7 @@ (define-public chez-scheme ;; for X11 clipboard support in expeditor: ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232 libx11)) - (native-inputs (list stex-bootstrap)) + (native-inputs (list chez-nanopass-bootstrap stex-bootstrap)) (native-search-paths (list (search-path-specification (variable "CHEZSCHEMELIBDIRS") @@ -261,7 +262,7 @@ (define-public chez-scheme #~(modify-phases %standard-phases (add-after 'unpack 'unpack-nanopass+stex (lambda args - #$(unpack-nanopass+stex))) + #$unpack-nanopass+stex)) ;; NOTE: the custom Chez 'configure' script doesn't allow ;; unrecognized flags, such as those automatically added ;; by `gnu-build-system`. @@ -485,12 +486,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