Toggle diff (443 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index a10aa2cefd..b5f922b538 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1017,6 +1017,7 @@ dist_patch_DATA = \
%D%/packages/patches/ccextractor-add-missing-header.patch \
%D%/packages/patches/ccextractor-autoconf-tesseract.patch \
%D%/packages/patches/ccextractor-fix-ocr.patch \
+ %D%/packages/patches/chez-scheme-backport-configure.patch \
%D%/packages/patches/chez-scheme-bin-sh.patch \
%D%/packages/patches/circos-remove-findbin.patch \
%D%/packages/patches/cdparanoia-fpic.patch \
diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm
index 19520cdf4a..5b98b3ce1f 100644
--- a/gnu/packages/chez.scm
+++ b/gnu/packages/chez.scm
@@ -69,21 +69,9 @@ (define-module (gnu packages chez)
;; Code:
(define* (chez-scheme-for-system #:optional
- (system (or (%current-target-system)
- (%current-system))))
- "Return 'chez-scheme' if it fully supports SYSTEM, including support for
-bootstrapping and native threads. Otherwise, return
-'chez-scheme-for-racket'."
- (if (and=> (chez-upstream-features-for-system system)
- (lambda (features)
- (every (cut memq <> features)
- '(threads
- ;; We can cross-compile for platforms without
- ;; bootstrap bootfiles, but we can't self-host
- ;; on them short of adding more binary seeds.
- bootstrap-bootfiles))))
- chez-scheme
- chez-scheme-for-racket))
+ system)
+ "Returns 'chez-scheme'."
+ chez-scheme)
(define* (target-chez-arch #:optional (system
(or (%current-target-system)
@@ -506,10 +494,11 @@ (define-public chez-scheme-for-racket
(define-public chez-scheme
(package
+ (inherit chez-scheme-for-racket)
(name "chez-scheme")
- ;; The version should match `(scheme-version-number)`.
+ ;; The version should match `(scheme-version-number #t)`.
;; See s/cmacros.ss c. line 360.
- (version "9.5.8")
+ (version "10.0.0")
(source (origin
(method git-fetch)
(uri (git-reference
@@ -517,9 +506,10 @@ (define-public chez-scheme
(commit (string-append "v" version))))
(sha256
(base32
- "0xchqq8cm0ka5wgpn18sjs0hh15rc3nb7xrjqbbc9al3asq0d7gc"))
+ "1q66vafhiwk617z51qkm1v64r3bxqhhf5lzrmsa4l9d5yhvlyk09"))
(file-name (git-file-name name version))
- (patches (search-patches "chez-scheme-bin-sh.patch"))
+ (patches (search-patches "chez-scheme-backport-configure.patch"
+ "chez-scheme-bin-sh.patch"))
(snippet #~(begin
(use-modules (guix build utils))
;; TODO: consider putting this in a (guix ...) or
@@ -528,165 +518,30 @@ (define-public chez-scheme
(for-each (lambda (dir)
(when (directory-exists? dir)
(delete-file-recursively dir)))
- '("stex"
+ '("lz4"
"nanopass"
- "lz4"
- "zlib"))))))
+ "stex"
+ "zlib"
+ "zuo"))))))
(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)))
+ (modify-inputs (package-inputs chez-scheme-for-racket)
+ (replace "chez-scheme-for-racket-bootstrap-bootfiles"
+ chez-scheme-bootstrap-bootfiles)
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ (prepend libx11)))
+ ;; replace unpack phase?
(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.")
+ "Chez Scheme is both a programming language and a high-performance
+implementation of that language. The language is a superset of R6RS Scheme
+with numerous extensions, including native threads, non-blocking I/O, local
+modules, and much more. Chez Scheme compiles source expressions incrementally
+to machine code, providing the speed of compiled code in an interactive
+system. The system is intended to be as reliable and efficient as possible,
+with reliability taking precedence over efficiency if necessary.")
(license asl2.0)))
;;
@@ -785,11 +640,6 @@ (define-public chez-scheme-bootstrap-bootfiles
(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
diff --git a/gnu/packages/patches/chez-scheme-backport-configure.patch b/gnu/packages/patches/chez-scheme-backport-configure.patch
new file mode 100644
index 0000000000..584dcb3f0b
--- /dev/null
+++ b/gnu/packages/patches/chez-scheme-backport-configure.patch
@@ -0,0 +1,463 @@
+From 24ab36374f2e366b6c939fffe8c129c8b0ae3b9c Mon Sep 17 00:00:00 2001
+From: Philip McGrath <philip@philipmcgrath.com>
+Date: Wed, 28 Feb 2024 19:41:22 -0500
+Subject: [PATCH 1/2] Repairs and improvements for building with external
+ dependencies (#807)
+
+* configure: fix zlib and lz4 submodule checks
+
+Conditionals to skip the submodule checks were using the wrong
+variable names, so the checks were always skipped. The correct
+behavior is to perform the check unless given `ZLIB=<zlib>` or
+`LZ4=<lz4>`, as applicable.
+
+* configure: support `ZUO=<zuo>`
+
+Supplying `ZUO=<zuo>` skips the submodule check in `configure`
+and configures the generated makefile not to build or remove Zuo.
+
+* configure: support `STEXLIB=<stex>`
+
+For compatibility with older scripts, when not explicitly configured,
+continue to honor the `STEXLIB` environment variable at build time.
+
+(cherry picked from commit b8838c3280ef10e115236d2f7ac9ae857f83e268)
+---
+ BUILDING | 5 +++--
+ build.zuo | 13 +++++++++----
+ configure | 40 +++++++++++++++++++++++++++++++++-------
+ makefiles/Makefile.in | 6 ++----
+ 4 files changed, 47 insertions(+), 17 deletions(-)
+
+diff --git a/BUILDING b/BUILDING
+index 7b3dc9c8..9e9a268b 100644
+--- a/BUILDING
++++ b/BUILDING
+@@ -149,7 +149,8 @@ information on the supported options.
+ The generated makefile mostly just ensures that a `zuo` executable is
+ built in a `bin` directory, and then it defers the actual build work
+ to `zuo`, which uses the "main.zuo" file. If you have `zuo` installed,
+-you can use `zuo` directly instead of `make`. In general, instead of
++you can use `zuo` directly instead of `make`: in that case, you may
++wish to use `./configure ZUO=<zuo>`. In general, instead of
+ the command `make X` to build target `X` as described below, you can
+ use `zuo . X` (or `bin/zuo . X` after `bin/zuo` is built).
+
+@@ -333,7 +334,7 @@ The makefile supports several targets:
+ * `make clean`
+
+ Removes all built elements from the workarea, and then removes
+- `bin/zuo`.
++ `bin/zuo` (unless configured with `ZUO=<zuo>`).
+
+
+ WINDOWS VIA COMMAND PROMPT
+diff --git a/build.zuo b/build.zuo
+index c21d2caa..c5896396 100644
+--- a/build.zuo
++++ b/build.zuo
+@@ -224,10 +224,15 @@
+ token))
+
+ (define stexlib
+- (let ((found (assoc "STEXLIB" (hash-ref (runtime-env) 'env))))
+- (if found
+- (cdr found)
+- (at-source "stex"))))
++ (let ([configured (hash-ref config 'STEXLIB "")]
++ [env (assoc "STEXLIB" (hash-ref (runtime-env) 'env))])
++ (cond
++ [(not (equal? "" configured))
++ configured]
++ [env
++ (cdr env)]
++ [else
++ (at-source "stex")])))
+ (define stex-sources
+ (source-tree stexlib))
+
+diff --git a/configure b/configure
+index 2b4b594e..782dd09b 100755
+--- a/configure
++++ b/configure
+@@ -93,6 +93,7 @@ default_warning_flags="-Wpointer-arith -Wall -Wextra -Wno-implicit-fallthrough"
+ CFLAGS_ADD=
+ zlibLib=
+ LZ4Lib=
++STEXLIB=
+ Kernel=KernelLib
+ buildKernelOnly=no
+ enableFrompb=yes
+@@ -103,6 +104,7 @@ moreBootFiles=
+ preloadBootFiles=
+ alwaysUseBootFile=
+ skipSubmoduleUpdate=
++zuoExternal=
+
+ CONFIG_UNAME=`uname`
+
+@@ -446,6 +448,12 @@ while [ $# != 0 ] ; do
+ LZ4=*)
+ LZ4Lib=`echo $1 | sed -e 's/^LZ4=//'`
+ ;;
++ STEXLIB=*)
++ STEXLIB=`echo $1 | sed -e 's/^STEXLIB=//'`
++ ;;
++ ZUO=*)
++ zuoExternal=`echo $1 | sed -e 's/^ZUO=//'`
++ ;;
+ *)
+ echo "option '$1' unrecognized or missing an argument; try $0 --help"
+ exit 1
+@@ -672,6 +680,8 @@ if [ "$help" = "yes" ]; then
+ echo " STRIP=<strip> executable stripper"
+ echo " ZLIB=<lib> link to <lib> instead of own zlib"
+ echo " LZ4=<lib> link to <lib> instead of own LZ4"
++ echo " STEXLIB=<stex> build docs with <stex> instead of own stex"
++ echo " ZUO=<zuo> build with <zuo> instead of own Zuo"
+ echo ""
+ echo "Available machine types: $machs"
+ echo ""
+@@ -889,28 +899,39 @@ submod_instructions () {
+ exit 1
+ }
+
+-if [ ! -f "$srcdir"/zuo/configure ] ; then
+- submod_instructions 'Source in "zuo" is missing'
++if [ "${zuoExternal}" = "" ] ; then
++ if [ ! -f "$srcdir"/zuo/configure ] ; then
++ submod_instructions 'Source in "zuo" is missing'
++ fi
++ ZUO="bin/zuo"
++ RM_ZUO="rm -f bin/zuo"
++ ZUO_TARGET="bin/zuo"
++else
++ ZUO="${zuoExternal}"
++ RM_ZUO="@echo 'Not cleaning external ${zuoExternal}'"
++ ZUO_TARGET="DoNotBuildZuo"
+ fi
+
+ if [ ! -f "$srcdir"/nanopass/nanopass.ss ] ; then
+ submod_instructions 'Source in "nanopass" is missing'
+ fi
+
+-if [ "${zlibDep}" != "" ] ; then
++if [ "${zlibLib}" = "" ] ; then
+ if [ ! -f "$srcdir"/zlib/configure ] ; then
+ submod_instructions 'Source in "zlib" is missing'
+ fi
+ fi
+
+-if [ "${LZ4Dep}" != "" ] ; then
++if [ "${LZ4Lib}" = "" ] ; then
+ if [ ! -f "$srcdir"/lz4/lib/Makefile ] ; then
+ submod_instructions 'Source in "lz4" is missing'
+ fi
+ fi
+
+-if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
+- submod_instructions 'Source in "stex" is missing'
++if [ "${STEXLIB}" = "" ] ; then
++ if [ ! -f "$srcdir"/stex/Mf-stex ] ; then
++ submod_instructions 'Source in "stex" is missing'
++ fi
+ fi
+
+ # more compile and link flags for c/Mf-unix and mats/Mf-unix
+@@ -1083,7 +1104,7 @@ cp "$srcdir"/makefiles/buildmain.zuo main.zuo
+ # Some idea, but in the workarea, so it refers to "workarea.zuo" here:
+ cp "$srcdir"/makefiles/workmain.zuo $w/main.zuo
+
+-# The content of "$w/Makefile" records configuration decisions,
++# The content of "$w/Mf-config" records configuration decisions,
+ # and the Zuo build scrip