From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uEiNDcolGmJTJQAAgWs5BA (envelope-from ) for ; Sat, 26 Feb 2022 14:06:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8C4JCsolGmLwMAEAauVa8A (envelope-from ) for ; Sat, 26 Feb 2022 14:06: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 B04213300B for ; Sat, 26 Feb 2022 14:06:17 +0100 (CET) Received: from localhost ([::1]:54632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNwm8-0001YB-Rc for larch@yhetil.org; Sat, 26 Feb 2022 08:06:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45130) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNwky-0000J4-R8 for guix-patches@gnu.org; Sat, 26 Feb 2022 08:05:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:60619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nNwky-0003Z1-Go for guix-patches@gnu.org; Sat, 26 Feb 2022 08:05:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nNwky-0005cS-A8; Sat, 26 Feb 2022 08:05:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53878] [PATCH v5 17/22] gnu: Add chez-nanopass. Resent-From: Philip McGrath Original-Sender: "Debbugs-submit" Resent-CC: philip@philipmcgrath.com, guix-patches@gnu.org Resent-Date: Sat, 26 Feb 2022 13:05: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, Liliana Marie Prikler , zimoun Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Maxime Devos , Attila Lendvai , Malte Gerdes , raingloom , philip@philipmcgrath.com X-Debbugs-Original-Xcc: philip@philipmcgrath.com Received: via spool by 53878-submit@debbugs.gnu.org id=B53878.164588068321504 (code B ref 53878); Sat, 26 Feb 2022 13:05:04 +0000 Received: (at 53878) by debbugs.gnu.org; 26 Feb 2022 13:04:43 +0000 Received: from localhost ([127.0.0.1]:54499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNwkd-0005af-0T for submit@debbugs.gnu.org; Sat, 26 Feb 2022 08:04:43 -0500 Received: from mail-qt1-f179.google.com ([209.85.160.179]:35719) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nNwk8-0005Y5-JQ for 53878@debbugs.gnu.org; Sat, 26 Feb 2022 08:04:13 -0500 Received: by mail-qt1-f179.google.com with SMTP id w1so4998946qtj.2 for <53878@debbugs.gnu.org>; Sat, 26 Feb 2022 05:04: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=PK+j54/R03k9wq48VyNtT/gU/3tF/wy2U7nSt7Dij50=; b=BhwJaEfC/xEHxit1Th9I9lGzYcr9iErAHIoxE7nlpJPG2kThfWjLitmyiqjInBQfza FW65LSEnDqADO+7tGyvBViKJd4osCqgFukkBF8Tnk9jX7l8hNr/r/Y/OR/hb1biGqdYO /GFDkfQl/U6VC16C+pGKLnOCAa8V7t09Y7OoqsVHVY1fbQ5AgizQ9NscFnv14rS/qrpW yPQsgSPXQMLTzvvRDYDgOYP1Eggn/OteyA/zU3YN9sekCfFqUnZgFGWMM5X4CGWfhoMl Ix/knOLafCXO76XOGti4ioLL5ZFM3cuh4Q+AIkrWEFU/Puil37I8dOl1GxqEPFuwyEfI tCNA== 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=PK+j54/R03k9wq48VyNtT/gU/3tF/wy2U7nSt7Dij50=; b=Kh1IyQI7wHMwDd1WvvzRxwCH7sMsYWW5fFbypFp/FR/Vjytoq7TAGHPcjS9Kct99ij 3DgO/Keesku8S9PwQ12CZY5L9rT3UfQtMZ84e+a9sG4yFbQVYFJ9ftfLt1wQiSdWYgy0 /ZKY+ZrLSRWosG8PFjK8zGl5qMOk2Q678BtMvMakK+lFUmR6DMaKnM+sWfRPhVM1/pfS XifesMUfjPrPrTyx9QwwD/Xej/YQF6wd1/rmWqco8xK/v00akazMSSOAihTJtKLsJmcK Na8jxV7FhFYvefV67Vex58l8+xXYioQWSK2YFcP5jW2V8Bs/K8ejjCTlE7hDtfG/YKL7 d68Q== X-Gm-Message-State: AOAM532W+5y3qGgEAJducdE2VugIdl+j9BLbnro7S30pwbreuKfKI13x Da2UODGstxtiFFQsXR7Xkb0hUDa9eKPicTD8r+0= X-Google-Smtp-Source: ABdhPJxZu9Qx+BsuA7ykvJp4VdLcZbBNlQa4v2cCCqqvV1BJY44T17fEnslqG1UtXu1qxD0aC6MPEw== X-Received: by 2002:a05:622a:8:b0:2dc:915a:9d20 with SMTP id x8-20020a05622a000800b002dc915a9d20mr10897038qtw.74.1645880646861; Sat, 26 Feb 2022 05:04:06 -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 t128-20020a37aa86000000b0060ddf2dc3ecsm2532874qke.104.2022.02.26.05.04.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Feb 2022 05:04:06 -0800 (PST) From: Philip McGrath Date: Sat, 26 Feb 2022 08:02:49 -0500 Message-Id: <20220226130254.1301333-18-philip@philipmcgrath.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220226130254.1301333-1-philip@philipmcgrath.com> References: <20220220060610.178131-1-philip@philipmcgrath.com> <20220226130254.1301333-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=1645880777; 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=PK+j54/R03k9wq48VyNtT/gU/3tF/wy2U7nSt7Dij50=; b=TpuY+acEW0nusb57scRv+M/1jj7g8q0umJ0PiJdXT6k8iy/ePMY3p/CAblPHk96MYcSu5z ARYt+ogBsVdbQNnG34/6ZY3moKqxIJHAml+5wL21WE/+zu/xM+b1fEavB9eCC0t1O24ub+ Tvv6WtAO3vDUTox1NqhsMnYhc2yFN5vIBV+eSMUTNr5i+02T9L47U4QkQNDKeeoVgZmUyj gX1pAIxFCWMXW9UvLC6/BIGAM1LHF5xDlTKNsF3HgefaftgujBBgp2fWg3mFZaeYXGMQx/ Il4JSQnxl4Ac5BZxYZ0CQLlj2DypSDdpXbFCCd1BAitCoP/RZPLMivFonFpxlA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1645880777; a=rsa-sha256; cv=none; b=qgj4wXWpIRbSvqIYbiOxbcrv8PGEsotUBzUnFB+SGXJPKzxaTU7YXa1WnSFXBccEu/678E 1hsTPxjP9zJm119bIdG3PfZKx9+6BJnttaPts33E9ZnU898Fm4KjPD+Ju3lolK5lYm14hf J18xWfTRH2jxe+cmY4XgZRvm/2bbbEGefhOCCgIULhh+HpDcyNrYaLQr+NOWkVtNvsmtY+ x8yrftcpChxuIxslBLTeAfM8i9bbH4o4310R05blJYpBriB/tAivvFNgRSyzHcpe3bJP5k 4xZzOLXyBE41v+ugaThglnRlW2/OPHnq9uvAlpDixBmZBwrPBsC/u0Hz3Wcfzw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=BhwJaEfC; 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.38 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=philipmcgrath.com header.s=google header.b=BhwJaEfC; 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: B04213300B X-Spam-Score: 3.38 X-Migadu-Scanner: scn0.migadu.com X-TUID: soPwK1dy3U13 * 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 99a250154f..ba555e6830 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 3ba1438014..9ed57e6154 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. - ;; TODO: Refactor enough to share this directly. - ;; Thunked to avoid evaliating 'chez-scheme' too early. - #~(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. @@ -414,6 +398,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) @@ -422,7 +407,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