[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#53878] [RFC PATCH 6/9] gnu: Add chez-nanopass.
From: |
Philip McGrath |
Subject: |
[bug#53878] [RFC PATCH 6/9] gnu: Add chez-nanopass. |
Date: |
Tue, 8 Feb 2022 10:18:54 -0500 |
* 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 | 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 c0d5e2897d..9125d34ab7 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`.
@@ -490,12 +491,75 @@ (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
--
2.32.0
- [bug#53878] [PATCH 08/11] gnu: Add chez-scheme-for-racket., (continued)
- [bug#53878] [PATCH 09/11] gnu: chez-mit: Support chez-scheme-for-racket., Philip McGrath, 2022/02/13
- [bug#53878] [PATCH 10/11] gnu: chez-and-racket-bootstrap: Add 'chez-scheme-for-system'., Philip McGrath, 2022/02/13
- [bug#53878] [PATCH 11/11] gnu: racket: Update to 8.4., Philip McGrath, 2022/02/13
- [bug#53878] [PATCH 11/11] gnu: racket: Update to 8.4., Liliana Marie Prikler, 2022/02/14
- [bug#53878] [PATCH 11/11] gnu: racket: Update to 8.4., Philip McGrath, 2022/02/16
[bug#53878] [RFC PATCH 4/9] gnu: chez-and-racket-bootstrap: Add utilities for Chez machine types., Philip McGrath, 2022/02/08
[bug#53878] [RFC PATCH 7/9] gnu: chez-scheme: Explicitly package bootstrap bootfiles., Philip McGrath, 2022/02/08
[bug#53878] [RFC PATCH 5/9] gnu: Add stex., Philip McGrath, 2022/02/08
[bug#53878] [RFC PATCH 6/9] gnu: Add chez-nanopass.,
Philip McGrath <=
[bug#53878] [PATCH v3 00/15] Update Racket to 8.4. Adjust Chez Scheme packages., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 01/15] gnu: chez-scheme: Move to (gnu packages chez-and-racket-bootstrap)., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 02/15] gnu: chez-scheme: Use "lib/chez-scheme" for search path., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 03/15] gnu: chez-scheme: Use shared zlib and lz4., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 10/15] gnu: Add racket-vm-bc., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 06/15] gnu: Add stex., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 07/15] gnu: Add chez-nanopass., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 12/15] gnu: Add racket-vm-cs., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 05/15] gnu: chez-scheme: Use new package style., Philip McGrath, 2022/02/19
- [bug#53878] [PATCH v3 09/15] gnu: Add racket-vm-cgc., Philip McGrath, 2022/02/19