~ chicken-core (master) e12b2b4f74297a70ce44477e15ad1ce80ed240ed
commit e12b2b4f74297a70ce44477e15ad1ce80ed240ed
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Aug 14 16:14:18 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Mon Aug 24 12:40:56 2026 +0200
allow global custom-build egg property to override build instructions completely
diff --git a/NEWS b/NEWS
index 628ba16a..50fb7c2c 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@
- Fixed bug in handling of "export-all" library declaration which caused
the expansion of "define-library" to fail with an error.
+- Tools
+ - Added new global egg property "custom-build" which allows completely
+ overriding the build instructions.
6.0.0
diff --git a/chicken-install.scm b/chicken-install.scm
index 782604b6..bd6139fd 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -181,7 +181,7 @@
(source #f #f #f)
(csc-options #f #f #f)
(link-options #f #f #f)
- (custom-build #f #f #f)
+ (custom-build * #f #f)
(linkage #f #f #f)
(objects #f #f #f)
(destination #f #f #f ,list?)
diff --git a/egg-compile.scm b/egg-compile.scm
index f6a267b5..0b321a9a 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -216,6 +216,7 @@
(ptfile #f)
(ifile #f)
(install #t)
+ (custom-egg-build #f)
(eggfile (locate-egg-file eggfile))
(objext (object-extension platform))
(arcext (archive-extension platform))
@@ -488,6 +489,8 @@
((synopsis dependencies test-dependencies category version author maintainer
license build-dependencies foreign-dependencies platform
distribution-files) #f)
+ ((custom-build)
+ (set! custom-egg-build (arg info 1 name?)))
((components) (for-each compile-component (cdr info)))
((component-options)
(for-each compile-options (cdr info)))
@@ -531,61 +534,63 @@
;; generate + return build/install commands
(values
;; build commands
- (append-map
- (lambda (id)
- (cond ((assq id exts) =>
- (lambda (data)
- (let ((link (get-keyword linkage: (cdr data)))
- (mods (get-keyword modules: (cdr data))))
- (append (if (memq 'dynamic link)
- (list (apply compile-dynamic-extension data))
- '())
- (if (memq 'static link)
- ;; if compiling both static + dynamic, override
- ;; modules/types-file/inline-file properties to
- ;; avoid generating things twice:
- (list (apply compile-static-extension
- (if (memq 'dynamic link)
- (cons (car data)
- (append '(modules: #f
- types-file: #f
- inline-file: #f)
- (cdr data)))
- data)))
- '())
- (if (uses-compiled-import-library? mode)
- (map (lambda (mod)
- (apply compile-import-library
- mod (cdr data))) ; override name
- mods)
- '())))))
- ((assq id prgs) =>
- (lambda (data)
- (let ((link (get-keyword linkage: (cdr data))))
- (append (if (memq 'dynamic link)
- (list (apply compile-dynamic-program data))
- '())
- (if (memq 'static link)
- (list (apply compile-static-program data))
- '())))))
- ((assq id objs) =>
- (lambda (data)
- (let ((link (get-keyword linkage: (cdr data))))
- (append (if (memq 'dynamic link)
- (list (apply compile-dynamic-object data))
- '())
- (if (memq 'static link)
- (list (apply compile-static-object data))
- '())))))
- ((assq id genfiles) =>
- (lambda (data)
- (list (apply compile-generated-file data))))
- ((or (assq id data)
- (assq id cinc)
- (assq id scminc))
- '()) ;; nothing to build for data components
- (else (error "Error in chicken-install, don't know how to build component" id))))
- order)
+ (if custom-egg-build
+ (list (lambda _ (print "\nsh " (qs* custom-egg-build))))
+ (append-map
+ (lambda (id)
+ (cond ((assq id exts) =>
+ (lambda (data)
+ (let ((link (get-keyword linkage: (cdr data)))
+ (mods (get-keyword modules: (cdr data))))
+ (append (if (memq 'dynamic link)
+ (list (apply compile-dynamic-extension data))
+ '())
+ (if (memq 'static link)
+ ;; if compiling both static + dynamic, override
+ ;; modules/types-file/inline-file properties to
+ ;; avoid generating things twice:
+ (list (apply compile-static-extension
+ (if (memq 'dynamic link)
+ (cons (car data)
+ (append '(modules: #f
+ types-file: #f
+ inline-file: #f)
+ (cdr data)))
+ data)))
+ '())
+ (if (uses-compiled-import-library? mode)
+ (map (lambda (mod)
+ (apply compile-import-library
+ mod (cdr data))) ; override name
+ mods)
+ '())))))
+ ((assq id prgs) =>
+ (lambda (data)
+ (let ((link (get-keyword linkage: (cdr data))))
+ (append (if (memq 'dynamic link)
+ (list (apply compile-dynamic-program data))
+ '())
+ (if (memq 'static link)
+ (list (apply compile-static-program data))
+ '())))))
+ ((assq id objs) =>
+ (lambda (data)
+ (let ((link (get-keyword linkage: (cdr data))))
+ (append (if (memq 'dynamic link)
+ (list (apply compile-dynamic-object data))
+ '())
+ (if (memq 'static link)
+ (list (apply compile-static-object data))
+ '())))))
+ ((assq id genfiles) =>
+ (lambda (data)
+ (list (apply compile-generated-file data))))
+ ((or (assq id data)
+ (assq id cinc)
+ (assq id scminc))
+ '()) ;; nothing to build for data components
+ (else (error "Error in chicken-install, don't know how to build component" id))))
+ order))
;; installation commands
(append
(append-map
diff --git a/manual/Egg specification format b/manual/Egg specification format
index de85195a..2ce20721 100644
--- a/manual/Egg specification format
+++ b/manual/Egg specification format
@@ -179,6 +179,25 @@ forms for constraining mode and linkage.
Signal an error and abort processing. Mostly useful inside {{cond-expand}} forms.
+==== custom-build
+
+ [egg property] (custom-build STRING)
+
+Specifies a custom build script to be invoked for all components of the egg,
+ignoring all component-specific instructions and properties. {{STRING}} should be the
+name of a {{sh(1)}} shell script and thus may be platform
+sensitive. The path to the file is prepended implicitly, so you
+should '''not''' prefix it with {{./}}.
+
+The script is executed with the location of the CHICKEN
+binaries in the {{PATH}}. Also, the following environment variables
+are set in the execution environment of the script:
+
+* {{CHICKEN_CC}}: name of the C compiler used for building CHICKEN
+* {{CHICKEN_CXX}}: name of the C++ compiler set during the build of CHICKEN
+* {{CHICKEN_CSC}}: path to {{csc}}
+* {{CHICKEN_CSI}}: path to {{csi}}
+
=== Component types
==== extension
@@ -295,22 +314,17 @@ name of the extensions (with the proper extension).
[egg property] (custom-build STRING)
Specifies a custom build script that should be executed instead of
-the default build operations. This property is mandatory for
-components of type {{generated-source-file}}. {{STRING}} should be the
-name of a {{sh(1)}} shell command (e.g., a script) and thus may be platform
+the default build operations for this component. This property is mandatory for
+components of type {{generated-source-file}}.
+{{STRING}} should be the
+name of a {{sh(1)}} shell script and thus may be platform
sensitive. The path to the file is prepended implicitly, so you
should '''not''' prefix it with {{./}}.
The script will be invoked like the {{csc}} program and
is executed with the location of the CHICKEN
-binaries in the {{PATH}}. Also, the following environment variables
-are set in the execution environment of the script:
-
-* {{CHICKEN_CC}}: name of the C compiler used for building CHICKEN
-* {{CHICKEN_CXX}}: name of the C++ compiler set during the build of CHICKEN
-* {{CHICKEN_CSC}}: path to {{csc}}
-* {{CHICKEN_CSI}}: path to {{csi}}
-
+binaries in the {{PATH}}. Environment variables are set up as
+for the global {{custom-build}} property, as described above.
==== csc-options
Trap