1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-06-21 08:44:04 +02:00

gnu: chicken: Bootstrap from Scheme source code.

The CHICKEN compiler is itself written in CHICKEN.  To mitigate the
compiler bootstrapping problem, the CHICKEN release tarball includes
auto-generated C code, from which the CHICKEN compiler is build using
a C compiler.

However, if we want to patch the CHICKEN Scheme source (for  #8471), we
need to be able to build the CHICKEN compiler from its Scheme source
files.  This is achieved here by separate the build into two packages
chicken-bootstrap (build from the auto-generated C code) and chicken
(build from the Scheme source).

Note that this still isn't a full-source bootstrap, we still require
the auto-generated C source code, but at least we can now patch the
package based on the Scheme source. Hence, it improves the situation.

See also: https://issues.guix.gnu.org/22366

* gnu/packages/chicken.scm (chicken-bootstrap): Rename from chicken.
* gnu/packages/chicken.scm (chicken): New package.

Change-Id: Ie656e95e2112241b066158a62e55ac07c722c150
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
This commit is contained in:
Sören Tempel
2026-05-09 16:17:03 +02:00
committed by Liliana Marie Prikler
parent a13589b2b9
commit f032a41f41
+80 -47
View File
@@ -20,65 +20,98 @@
(define-module (gnu packages chicken)
#:use-module (gnu packages)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix build-system chicken)
#:use-module (guix build-system gnu)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix svn-download)
#:use-module ((guix licenses)
#:prefix license:))
#:prefix license:)
#:use-module (srfi srfi-1))
;; This package is build from pre-built C source code, provided in the CHICKEN
;; release tarball. Based on this bootstrap compiler, we build CHICKEN from
;; the Scheme source, thus enabling us to (at least) patch it.
;;
;; See <https://issues.guix.gnu.org/22366>.
(define-public chicken-bootstrap
(hidden-package
(package
(name "chicken-bootstrap")
(version "5.4.0")
(source (origin
(method url-fetch)
(uri (string-append "https://code.call-cc.org/releases/"
version "/chicken-" version ".tar.gz"))
(sha256
(base32
"0pzcrnzkjw2sa44vy59wbygvlc3nva8zisprkdnvyrqi3jk4lp9w"))))
(build-system gnu-build-system)
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1))
;; No `configure' script; run "make check" after "make install" as
;; prescribed by README.
#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'check)
(add-after 'install 'check
(assoc-ref %standard-phases 'check)))
#:make-flags (let ((out (assoc-ref %outputs "out")))
(list "PLATFORM=linux"
(string-append "PREFIX=" out)
(string-append "VARDIR=" out "/var/lib")))
;; Parallel builds are not supported, as noted in README.
#:parallel-build? #f))
(native-search-paths
(list (search-path-specification
(variable "CHICKEN_REPOSITORY_PATH")
;; TODO extract binary version into a module level definition.
(files (list "var/lib/chicken/11")))))
;; Reference gcc-toolchain lazily to avoid circular module dependency
;; problems.
(propagated-inputs (list (module-ref (resolve-interface
'(gnu packages commencement))
'gcc-toolchain)))
(home-page "https://www.call-cc.org/")
(synopsis "R5RS Scheme implementation that compiles native code via C")
(description
"CHICKEN is a compiler for the Scheme programming language. CHICKEN
pr oduces portable and efficient C, supports almost all of the R5RS Scheme
la nguage standard, and includes many enhancements and extensions.")
(license license:bsd-3))))
;; The CHICKEN compiler is itself written in CHICKEN, the CHICKEN release
;; tarballs includes auto-generated C code to mitigate the compiler
;; bootstrapping problem. To be able to patch the original Scheme source,
;; we compile from this Scheme source here using the chicken-bootstrap
;; compiler obtained from the autogenerated C code.
;;
;; See <https://issues.guix.gnu.org/22366>.
(define-public chicken
(package
(inherit chicken-bootstrap)
(name "chicken")
(version "5.4.0")
(source (origin
(method url-fetch)
(uri (string-append "https://code.call-cc.org/releases/"
version "/chicken-" version ".tar.gz"))
(sha256
(base32
"0pzcrnzkjw2sa44vy59wbygvlc3nva8zisprkdnvyrqi3jk4lp9w"))))
(build-system gnu-build-system)
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)
(srfi srfi-1))
;; No `configure' script; run "make check" after "make install" as
;; prescribed by README.
#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'check)
(add-after 'install 'check
(assoc-ref %standard-phases 'check)))
#:make-flags (let ((out (assoc-ref %outputs "out")))
(list "PLATFORM=linux"
(string-append "PREFIX=" out)
(string-append "VARDIR=" out "/var/lib")))
;; Parallel builds are not supported, as noted in README.
#:parallel-build? #f))
(native-search-paths
(list (search-path-specification
(variable "CHICKEN_REPOSITORY_PATH")
;; TODO extract binary version into a module level definition.
(files (list "var/lib/chicken/11")))))
;; Reference gcc-toolchain lazily to avoid circular module dependency
;; problems.
(propagated-inputs (list (module-ref (resolve-interface
'(gnu packages commencement))
'gcc-toolchain)))
(home-page "https://www.call-cc.org/")
(synopsis "R5RS Scheme implementation that compiles native code via C")
(description
"CHICKEN is a compiler for the Scheme programming language. CHICKEN
produces portable and efficient C, supports almost all of the R5RS Scheme
language standard, and includes many enhancements and extensions.")
(license license:bsd-3)))
(substitute-keyword-arguments (package-arguments chicken-bootstrap)
((#:phases phases)
#~(modify-phases #$phases
;; CHICKEN contains auto-generated C code, remove it and
;; compile from the Scheme source using chicken-bootstrap.
(add-after 'unpack 'remove-auto-generated-code
(lambda _
(invoke "make" "spotless")))))))
(inputs (list chicken-bootstrap))
(properties
(alist-delete 'hidden? (package-properties chicken-bootstrap)))))
(define-public chicken-compile-file
(package