From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CIDgCnbkGmLQWQEAgWs5BA (envelope-from ) for ; Sun, 27 Feb 2022 03:39:50 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GGFXB3bkGmINTgEAauVa8A (envelope-from ) for ; Sun, 27 Feb 2022 03:39:50 +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 D299E35924 for ; Sun, 27 Feb 2022 03:39:49 +0100 (CET) Received: from localhost ([::1]:41394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO9TR-0008Hx-1D for larch@yhetil.org; Sat, 26 Feb 2022 21:39:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO9Sm-00070z-Ha for guix-patches@gnu.org; Sat, 26 Feb 2022 21:39:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO9Sm-0006Vu-6Y for guix-patches@gnu.org; Sat, 26 Feb 2022 21:39:08 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nO9Sm-0004Jx-2j for guix-patches@gnu.org; Sat, 26 Feb 2022 21:39:08 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH v6 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 02:39:07 +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.164592954216515 (code B ref 53878); Sun, 27 Feb 2022 02:39:07 +0000 Received: (at 53878) by debbugs.gnu.org; 27 Feb 2022 02:39:02 +0000 Received: from localhost ([127.0.0.1]:56588 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nO9Sf-0004I3-M1 for submit@debbugs.gnu.org; Sat, 26 Feb 2022 21:39:02 -0500 Received: from mail-qv1-f47.google.com ([209.85.219.47]:39638) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nO9SP-0004H4-M4 for 53878@debbugs.gnu.org; Sat, 26 Feb 2022 21:38:46 -0500 Received: by mail-qv1-f47.google.com with SMTP id a1so9819837qvl.6 for <53878@debbugs.gnu.org>; Sat, 26 Feb 2022 18:38:45 -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=37H5h/fHk3NNbAT7Uc9bISFfMqOBQXf0BvVKkBIp2Fs=; b=PTHC7osGRGdFdvGB5rkcNarMJgqhYrCuRB+9Qmnms2a8HOKtdFT3FOUVjlSLv/6981 GvkFFJ0xqsLFqH5bUP+epou5Y9L+SKRyVk4FZFx8f4KI47o15cQbWC2kevGmpWbKs4Lj EWZ0SNx3eryCvc2EjB8uQV2IEF4dDUgGo4pKL5RNEsnvNCAb9k2ZeZWntpKjMAB0uXQC c+Io/Hc9l0nFcIxET5lYLWzaqsW3RhbUzLnpfVrC8+C8MJdJZahjx87KD/rIl3+0Zron yQ/n/mMorTw+0M04033Pgd1PR237BNnw+z+MrNXIq2HXbXJEM3ByuKzwzWikB3H4lCJA cCaw== 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=37H5h/fHk3NNbAT7Uc9bISFfMqOBQXf0BvVKkBIp2Fs=; b=NgghkjDJT3mgriSW+ly1UtEnQ7C1+WYgZDJiaFaujB+QjPHwj9kdxEOvf6eCoD/1Gy G33qGMHqVwkMdkJ9eAMSsAIYNUNrzH69Ll+B6/UqulDncD659vmMA/w/Fwhtn687nN2l Ybld/J6sWJTqH3wqJLfWea8yXuTogG0wk0jMfXPPTMbrmEm0VvhmwKI/rwFQ8PwjxQzk 2gHRrku1pQnb6lTyPhK888TwZtxzUUOeYTkUS3tqIebpIwUBsXJJU3s0PHLAbNtRbocL jUS0CieLYdQ7PabGiKccfEqt11woChuEqy5IR5fm1uSzH1EZgyw/ZLfn98xcGtF8PrLV f0Rg== X-Gm-Message-State: AOAM530lMgkJ2os2ZTi6xaF+sfvAaLb/98+JR7F1269Q7AtP3+l3iFEu zY0W4YcXpdw292oGbFO7Pvcpi+2CX/KFFWMc3po= X-Google-Smtp-Source: ABdhPJyk91sfi2fm5bHg8zQuR6RxVpQDGRGm8IJbESVsKhWDWMTYBZpmTa+fzbfENxWN72yRskdsCw== X-Received: by 2002:a05:6214:2482:b0:432:4bf6:47b7 with SMTP id gi2-20020a056214248200b004324bf647b7mr10640590qvb.38.1645929520031; Sat, 26 Feb 2022 18:38:40 -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 n8-20020a05620a222800b004e0e071f382sm3161150qkh.125.2022.02.26.18.38.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Feb 2022 18:38:39 -0800 (PST) From: Philip McGrath Date: Sat, 26 Feb 2022 21:34:45 -0500 Message-Id: <20220227023450.1877215-20-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220227023450.1877215-1-philip@philipmcgrath.com> References: <20220220060610.178131-1-philip@philipmcgrath.com> <20220227023450.1877215-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=1645929589; 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=37H5h/fHk3NNbAT7Uc9bISFfMqOBQXf0BvVKkBIp2Fs=; b=GZmqeKFBOzm2k0ueAb2r2XAomQDfp5bkrSKsJUQSmJjjiE+p/ZJLS82Z3IO0Nw4gJTPUZg PDuQJHZwphvDz2PLMEO0zIQ7NB0jIA/pSlGnDI2AcUrAeVYU37u6HGkUzdNOG2KmRc5Hb9 zL9RsBQJmAuqspuDaGSYTcCsMS/iwJ7WUu0tP21Mq7G78sr8dHQGWK4rd1FAj6Sx3r6ZR1 sdzbrhP1HH/UdXq7dCTDX3tt5uqdhKU62VLieUoc1f3lQJIKkeZc4WUvi+s+j65Wpi6Cf6 Nd84QvfwIACeCiejT1u6IpcYX7ClpEgMvca5GO3RJNvUog0IOxzWNfarwVnzTQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645929589; a=rsa-sha256; cv=none; b=MekoWdTAeqSVMUHftRpl5/YRDLPAoR6ODAPak+VFc4yJ8L8oYLj9+axNY18fnr0mORuOd0 8lUBtChj8Iq0JvsZvMp0bTicnD5rY3mU3r3R/1Ri1hCSg1j/esJ9/ee6r1d7iO7jLGWlMi EWTTDq5gsytZJD8wdY7eGWbI5sQJ5UYC56TZbJjDFVmbgzCZoBo+i5RY6i5DcKOaysCq8M oJUvMHoAXpS81+JQbVcaekjVdmlC3YGVXNbRuDT7FgtmZpmeISjdp6fWYxU29bcxKcF6hD Qs+4UDmcJwAGN/vej7PcN0ZM1U3mV+aaK0bwINM+kzZzndCmXED5kWjxo/6swA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=PTHC7osG; 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: 3.89 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=PTHC7osG; 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: D299E35924 X-Spam-Score: 3.89 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1+XiDBk7Gu3a * 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 73de273c64..c96bebe325 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