mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
gnu: chez-scheme: Reorganize package definitions.
A future commit will change 'chez-scheme' to inherit from 'chez-scheme-for-racket', so 'chez-scheme-for-racket' will need to be defined before 'chez-scheme'. In an attempt to produce better diffs, this commit re-orders the definitions while keeping their contents exactly the same. * gnu/packages/chez.scm (chez-scheme): Move below 'chez-scheme-for-racket'. (chez-scheme-bootstrap-bootfiles): Move below 'chez-scheme-for-racket-bootstrap-bootfiles'. Change-Id: Ie088abea2b44329f9d8399fbfb95c51d8912b05e Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
5b5d18e29d
commit
522cbed9b2
1 changed files with 215 additions and 215 deletions
|
@ -282,191 +282,6 @@ (define unpack-nanopass
|
|||
"lib/chez-scheme/nanopass.ss"))
|
||||
"nanopass"))))
|
||||
|
||||
(define-public chez-scheme
|
||||
(package
|
||||
(name "chez-scheme")
|
||||
;; The version should match `(scheme-version-number)`.
|
||||
;; See s/cmacros.ss c. line 360.
|
||||
(version "9.5.8")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/cisco/ChezScheme")
|
||||
(commit (string-append "v" version))))
|
||||
(sha256
|
||||
(base32
|
||||
"0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
|
||||
(file-name (git-file-name name version))
|
||||
(patches (search-patches "chez-scheme-bin-sh.patch"))
|
||||
(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)))
|
||||
'("stex"
|
||||
"nanopass"
|
||||
"lz4"
|
||||
"zlib"))))))
|
||||
(build-system gnu-build-system)
|
||||
(inputs
|
||||
(list
|
||||
chez-scheme-bootstrap-bootfiles
|
||||
`(,util-linux "lib") ;<-- libuuid
|
||||
zlib
|
||||
lz4
|
||||
ncurses ;<-- for expeditor
|
||||
;; for X11 clipboard support in expeditor:
|
||||
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
|
||||
libx11))
|
||||
(native-inputs (list chez-nanopass-bootstrap
|
||||
stex-bootstrap))
|
||||
(native-search-paths
|
||||
(list (search-path-specification
|
||||
(variable "CHEZSCHEMELIBDIRS")
|
||||
(files '("lib/chez-scheme")))))
|
||||
(outputs '("out" "doc"))
|
||||
(arguments
|
||||
(list
|
||||
#:modules
|
||||
'((guix build gnu-build-system)
|
||||
(guix build utils)
|
||||
(ice-9 ftw)
|
||||
(ice-9 match))
|
||||
#:test-target "test"
|
||||
#:configure-flags
|
||||
#~`(,(string-append "--installprefix=" #$output)
|
||||
#$@(if (and=> (chez-upstream-features-for-system)
|
||||
(cut memq 'threads <>))
|
||||
#~("--threads")
|
||||
#~())
|
||||
"ZLIB=-lz"
|
||||
"LZ4=-llz4"
|
||||
"--libkernel"
|
||||
;; Guix will do 'compress-man-pages',
|
||||
;; and letting Chez try causes an error
|
||||
"--nogzip-man-pages")
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'unpack-nanopass+stex
|
||||
(lambda args
|
||||
(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"))))))
|
||||
(add-after 'unpack-nanopass+stex 'unpack-bootfiles
|
||||
(lambda* (#:key native-inputs inputs #:allow-other-keys)
|
||||
(when (directory-exists? "boot")
|
||||
(delete-file-recursively "boot"))
|
||||
(copy-recursively
|
||||
(search-input-directory inputs
|
||||
"lib/chez-scheme-bootfiles")
|
||||
"boot")))
|
||||
;; NOTE: The custom Chez 'configure' script doesn't allow
|
||||
;; unrecognized flags, such as those automatically added
|
||||
;; by `gnu-build-system`. This replacement phase uses only
|
||||
;; the explicitly provided `#:configure-flags`.
|
||||
(replace 'configure
|
||||
(lambda* (#:key inputs (configure-flags '()) out-of-source?
|
||||
#:allow-other-keys)
|
||||
(let* ((abs-srcdir (getcwd))
|
||||
(srcdir (if out-of-source?
|
||||
(string-append "../" (basename abs-srcdir))
|
||||
".")))
|
||||
(format #t "source directory: ~s (relative from build: ~s)~%"
|
||||
abs-srcdir srcdir)
|
||||
(if out-of-source?
|
||||
(begin
|
||||
(mkdir "../build")
|
||||
(chdir "../build")))
|
||||
(format #t "build directory: ~s~%" (getcwd))
|
||||
(format #t "configure flags: ~s~%" configure-flags)
|
||||
(apply invoke
|
||||
(string-append srcdir "/configure")
|
||||
configure-flags))))
|
||||
(add-after 'configure 'configure-environment-variables
|
||||
(lambda args
|
||||
;; Some makefiles (for tests) don't seem to propagate CC
|
||||
;; properly, so we take it out of their hands:
|
||||
(setenv "CC" #$(cc-for-target))
|
||||
;; Likewise, some tests have needed HOME to be set:
|
||||
(setenv "HOME" "/tmp")))
|
||||
;; The binary file name is called "scheme" as is the one from
|
||||
;; MIT/GNU Scheme. We add a symlink to use in case both are
|
||||
;; installed.
|
||||
(add-after 'install 'install-symlink
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let* ((scheme (search-input-file outputs "/bin/scheme"))
|
||||
(bin-dir (dirname scheme)))
|
||||
(symlink scheme
|
||||
(string-append bin-dir "/chez-scheme"))
|
||||
(match (find-files (string-append bin-dir "/../lib")
|
||||
"scheme.boot")
|
||||
((scheme.boot)
|
||||
(symlink scheme.boot
|
||||
(string-append (dirname scheme.boot)
|
||||
"/chez-scheme.boot")))))))
|
||||
;; Building the documentation requires stex and a running scheme.
|
||||
(add-after 'install-symlink 'install-docs
|
||||
(lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
|
||||
(let* ((doc-prefix (or (assoc-ref outputs "doc")
|
||||
(assoc-ref outputs "out")))
|
||||
(chez+version (strip-store-file-name #$output))
|
||||
(scheme (search-input-file outputs "/bin/scheme"))
|
||||
(stexlib (search-input-directory (or native-inputs
|
||||
inputs)
|
||||
"/lib/stex"))
|
||||
(doc-dir (string-append doc-prefix
|
||||
"/share/doc/"
|
||||
chez+version)))
|
||||
(define* (stex-make #:optional (suffix ""))
|
||||
(invoke "make" "install"
|
||||
(string-append "Scheme=" scheme)
|
||||
(string-append "STEXLIB=" stexlib)
|
||||
(string-append "installdir=" doc-dir suffix)))
|
||||
(with-directory-excursion "csug"
|
||||
(stex-make "/csug"))
|
||||
(with-directory-excursion "release_notes"
|
||||
(stex-make "/release_notes")))))
|
||||
(add-after 'install-docs 'link-doc-pdfs
|
||||
;; otherwise, it's hard to notice them in a forest of HTML files
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(with-directory-excursion
|
||||
(string-append (or (assoc-ref outputs "doc")
|
||||
(assoc-ref outputs "out"))
|
||||
"/share/doc/"
|
||||
(strip-store-file-name #$output))
|
||||
(symlink "release_notes/release_notes.pdf"
|
||||
"release_notes.pdf")
|
||||
(match (find-files "csug"
|
||||
"csug.*\\.pdf$" ;; embeded version number
|
||||
#:fail-on-error? #t)
|
||||
((pth)
|
||||
(symlink pth
|
||||
"csug.pdf")))))))))
|
||||
(supported-systems
|
||||
(delete
|
||||
"armhf-linux" ;; XXX reportedly broken, needs checking
|
||||
(filter chez-upstream-features-for-system
|
||||
%supported-systems)))
|
||||
(home-page "https://cisco.github.io/ChezScheme/")
|
||||
(synopsis "R6RS Scheme compiler and run-time")
|
||||
(description
|
||||
"Chez Scheme is a compiler and run-time system for the language of the
|
||||
Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
|
||||
generates native code for each target processor, with support for x86, x86_64,
|
||||
and 32-bit PowerPC architectures.")
|
||||
(license asl2.0)))
|
||||
|
||||
(define chez-configure
|
||||
;; The custom Chez 'configure' script doesn't allow unrecognized flags, such
|
||||
;; as those automatically added by `gnu-build-system`. This replacement
|
||||
|
@ -689,40 +504,195 @@ (define-public chez-scheme-for-racket
|
|||
version of Chez Scheme.")
|
||||
(license asl2.0)))
|
||||
|
||||
(define-public chez-scheme
|
||||
(package
|
||||
(name "chez-scheme")
|
||||
;; The version should match `(scheme-version-number)`.
|
||||
;; See s/cmacros.ss c. line 360.
|
||||
(version "9.5.8")
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/cisco/ChezScheme")
|
||||
(commit (string-append "v" version))))
|
||||
(sha256
|
||||
(base32
|
||||
"0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
|
||||
(file-name (git-file-name name version))
|
||||
(patches (search-patches "chez-scheme-bin-sh.patch"))
|
||||
(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)))
|
||||
'("stex"
|
||||
"nanopass"
|
||||
"lz4"
|
||||
"zlib"))))))
|
||||
(build-system gnu-build-system)
|
||||
(inputs
|
||||
(list
|
||||
chez-scheme-bootstrap-bootfiles
|
||||
`(,util-linux "lib") ;<-- libuuid
|
||||
zlib
|
||||
lz4
|
||||
ncurses ;<-- for expeditor
|
||||
;; for X11 clipboard support in expeditor:
|
||||
;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
|
||||
libx11))
|
||||
(native-inputs (list chez-nanopass-bootstrap
|
||||
stex-bootstrap))
|
||||
(native-search-paths
|
||||
(list (search-path-specification
|
||||
(variable "CHEZSCHEMELIBDIRS")
|
||||
(files '("lib/chez-scheme")))))
|
||||
(outputs '("out" "doc"))
|
||||
(arguments
|
||||
(list
|
||||
#:modules
|
||||
'((guix build gnu-build-system)
|
||||
(guix build utils)
|
||||
(ice-9 ftw)
|
||||
(ice-9 match))
|
||||
#:test-target "test"
|
||||
#:configure-flags
|
||||
#~`(,(string-append "--installprefix=" #$output)
|
||||
#$@(if (and=> (chez-upstream-features-for-system)
|
||||
(cut memq 'threads <>))
|
||||
#~("--threads")
|
||||
#~())
|
||||
"ZLIB=-lz"
|
||||
"LZ4=-llz4"
|
||||
"--libkernel"
|
||||
;; Guix will do 'compress-man-pages',
|
||||
;; and letting Chez try causes an error
|
||||
"--nogzip-man-pages")
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(add-after 'unpack 'unpack-nanopass+stex
|
||||
(lambda args
|
||||
(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"))))))
|
||||
(add-after 'unpack-nanopass+stex 'unpack-bootfiles
|
||||
(lambda* (#:key native-inputs inputs #:allow-other-keys)
|
||||
(when (directory-exists? "boot")
|
||||
(delete-file-recursively "boot"))
|
||||
(copy-recursively
|
||||
(search-input-directory inputs
|
||||
"lib/chez-scheme-bootfiles")
|
||||
"boot")))
|
||||
;; NOTE: The custom Chez 'configure' script doesn't allow
|
||||
;; unrecognized flags, such as those automatically added
|
||||
;; by `gnu-build-system`. This replacement phase uses only
|
||||
;; the explicitly provided `#:configure-flags`.
|
||||
(replace 'configure
|
||||
(lambda* (#:key inputs (configure-flags '()) out-of-source?
|
||||
#:allow-other-keys)
|
||||
(let* ((abs-srcdir (getcwd))
|
||||
(srcdir (if out-of-source?
|
||||
(string-append "../" (basename abs-srcdir))
|
||||
".")))
|
||||
(format #t "source directory: ~s (relative from build: ~s)~%"
|
||||
abs-srcdir srcdir)
|
||||
(if out-of-source?
|
||||
(begin
|
||||
(mkdir "../build")
|
||||
(chdir "../build")))
|
||||
(format #t "build directory: ~s~%" (getcwd))
|
||||
(format #t "configure flags: ~s~%" configure-flags)
|
||||
(apply invoke
|
||||
(string-append srcdir "/configure")
|
||||
configure-flags))))
|
||||
(add-after 'configure 'configure-environment-variables
|
||||
(lambda args
|
||||
;; Some makefiles (for tests) don't seem to propagate CC
|
||||
;; properly, so we take it out of their hands:
|
||||
(setenv "CC" #$(cc-for-target))
|
||||
;; Likewise, some tests have needed HOME to be set:
|
||||
(setenv "HOME" "/tmp")))
|
||||
;; The binary file name is called "scheme" as is the one from
|
||||
;; MIT/GNU Scheme. We add a symlink to use in case both are
|
||||
;; installed.
|
||||
(add-after 'install 'install-symlink
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let* ((scheme (search-input-file outputs "/bin/scheme"))
|
||||
(bin-dir (dirname scheme)))
|
||||
(symlink scheme
|
||||
(string-append bin-dir "/chez-scheme"))
|
||||
(match (find-files (string-append bin-dir "/../lib")
|
||||
"scheme.boot")
|
||||
((scheme.boot)
|
||||
(symlink scheme.boot
|
||||
(string-append (dirname scheme.boot)
|
||||
"/chez-scheme.boot")))))))
|
||||
;; Building the documentation requires stex and a running scheme.
|
||||
(add-after 'install-symlink 'install-docs
|
||||
(lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
|
||||
(let* ((doc-prefix (or (assoc-ref outputs "doc")
|
||||
(assoc-ref outputs "out")))
|
||||
(chez+version (strip-store-file-name #$output))
|
||||
(scheme (search-input-file outputs "/bin/scheme"))
|
||||
(stexlib (search-input-directory (or native-inputs
|
||||
inputs)
|
||||
"/lib/stex"))
|
||||
(doc-dir (string-append doc-prefix
|
||||
"/share/doc/"
|
||||
chez+version)))
|
||||
(define* (stex-make #:optional (suffix ""))
|
||||
(invoke "make" "install"
|
||||
(string-append "Scheme=" scheme)
|
||||
(string-append "STEXLIB=" stexlib)
|
||||
(string-append "installdir=" doc-dir suffix)))
|
||||
(with-directory-excursion "csug"
|
||||
(stex-make "/csug"))
|
||||
(with-directory-excursion "release_notes"
|
||||
(stex-make "/release_notes")))))
|
||||
(add-after 'install-docs 'link-doc-pdfs
|
||||
;; otherwise, it's hard to notice them in a forest of HTML files
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(with-directory-excursion
|
||||
(string-append (or (assoc-ref outputs "doc")
|
||||
(assoc-ref outputs "out"))
|
||||
"/share/doc/"
|
||||
(strip-store-file-name #$output))
|
||||
(symlink "release_notes/release_notes.pdf"
|
||||
"release_notes.pdf")
|
||||
(match (find-files "csug"
|
||||
"csug.*\\.pdf$" ;; embeded version number
|
||||
#:fail-on-error? #t)
|
||||
((pth)
|
||||
(symlink pth
|
||||
"csug.pdf")))))))))
|
||||
(supported-systems
|
||||
(delete
|
||||
"armhf-linux" ;; XXX reportedly broken, needs checking
|
||||
(filter chez-upstream-features-for-system
|
||||
%supported-systems)))
|
||||
(home-page "https://cisco.github.io/ChezScheme/")
|
||||
(synopsis "R6RS Scheme compiler and run-time")
|
||||
(description
|
||||
"Chez Scheme is a compiler and run-time system for the language of the
|
||||
Revised^6 Report on Scheme (R6RS), with numerous extensions. The compiler
|
||||
generates native code for each target processor, with support for x86, x86_64,
|
||||
and 32-bit PowerPC architectures.")
|
||||
(license asl2.0)))
|
||||
|
||||
;;
|
||||
;; Bootfiles:
|
||||
;;
|
||||
|
||||
(define-public chez-scheme-bootstrap-bootfiles
|
||||
(package
|
||||
(inherit chez-scheme)
|
||||
(name "chez-scheme-bootstrap-bootfiles")
|
||||
(inputs '())
|
||||
(native-inputs '())
|
||||
(outputs '("out"))
|
||||
(build-system copy-build-system)
|
||||
;; TODO: cross compilation
|
||||
(arguments
|
||||
(list #:install-plan
|
||||
#~`(("boot/" "lib/chez-scheme-bootfiles"))))
|
||||
(supported-systems
|
||||
(filter (lambda (system)
|
||||
(and=> (chez-upstream-features-for-system system)
|
||||
(cut memq 'bootstrap-bootfiles <>)))
|
||||
%supported-systems))
|
||||
(synopsis "Chez Scheme bootfiles (binary seed)")
|
||||
(description
|
||||
"Chez Scheme is a self-hosting compiler: building it requires
|
||||
``bootfiles'' containing the Scheme-implemented portions compiled for the
|
||||
current platform. (Chez can then cross-compile bootfiles for all other
|
||||
supported platforms.)
|
||||
|
||||
This package provides bootstrap bootfiles for upstream Chez Scheme.
|
||||
Currently, it simply packages the binaries checked in to the upstream
|
||||
repository. Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
|
||||
work with upstream Chez Scheme so that we can bootstrap these files from
|
||||
source.")))
|
||||
|
||||
(define-public chez-scheme-for-racket-bootstrap-bootfiles
|
||||
(package
|
||||
(name "chez-scheme-for-racket-bootstrap-bootfiles")
|
||||
|
@ -803,6 +773,36 @@ (define-public chez-scheme-for-racket-bootstrap-bootfiles
|
|||
7.1 and later, including the Racket BC variant.")
|
||||
(license asl2.0)))
|
||||
|
||||
(define-public chez-scheme-bootstrap-bootfiles
|
||||
(package
|
||||
(inherit chez-scheme)
|
||||
(name "chez-scheme-bootstrap-bootfiles")
|
||||
(inputs '())
|
||||
(native-inputs '())
|
||||
(outputs '("out"))
|
||||
(build-system copy-build-system)
|
||||
;; TODO: cross compilation
|
||||
(arguments
|
||||
(list #:install-plan
|
||||
#~`(("boot/" "lib/chez-scheme-bootfiles"))))
|
||||
(supported-systems
|
||||
(filter (lambda (system)
|
||||
(and=> (chez-upstream-features-for-system system)
|
||||
(cut memq 'bootstrap-bootfiles <>)))
|
||||
%supported-systems))
|
||||
(synopsis "Chez Scheme bootfiles (binary seed)")
|
||||
(description
|
||||
"Chez Scheme is a self-hosting compiler: building it requires
|
||||
``bootfiles'' containing the Scheme-implemented portions compiled for the
|
||||
current platform. (Chez can then cross-compile bootfiles for all other
|
||||
supported platforms.)
|
||||
|
||||
This package provides bootstrap bootfiles for upstream Chez Scheme.
|
||||
Currently, it simply packages the binaries checked in to the upstream
|
||||
repository. Hopefully we can eventually adapt Racket's @code{cs-bootstrap} to
|
||||
work with upstream Chez Scheme so that we can bootstrap these files from
|
||||
source.")))
|
||||
|
||||
;;
|
||||
;; Chez's bootstrap dependencies:
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue