~ chicken-core (chicken-5) db13aa875597888744f03f386f6b53c9993bd0dc
commit db13aa875597888744f03f386f6b53c9993bd0dc
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Oct 27 11:01:47 2017 +0200
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Sat Oct 28 18:12:04 2017 +0200
chicken-install: allow preexisting .types files
The `types-file' egg extension property now may be `(predefined [NAME])`
to specify an already existing .types file that should be installed.
Signed-off-by: Peter Bex <peter@more-magic.net>
diff --git a/chicken-install.scm b/chicken-install.scm
index e50ed870..b05be7a4 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -161,6 +161,13 @@
(define (nameprop? x)
(and (list? x) (or (symbol? (car x)) (string? (car x)))))
+(define (name-or-predefd? x)
+ (or (optname? x)
+ (and (pair? x)
+ (pair? (car x))
+ (eq? 'predefined (caar x))
+ (optname? (cdar x)))))
+
;; ENTRY = (NAME TOPLEVEL? NESTED? NAMED? [VALIDATOR])
(define egg-info-items
`((synopsis #t #f #f)
@@ -185,7 +192,7 @@
(install-name #f #f #f ,nameprop?)
(target #f #t #f)
(host #f #t #f)
- (types-file #f #f #f ,optname?)
+ (types-file #f #f #f ,name-or-predefd?)
(inline-file #f #f #f ,optname?)
(extension #f #t #t)
(generated-source-file #f #t #t)
diff --git a/egg-compile.scm b/egg-compile.scm
index ac748188..d062fc58 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -138,6 +138,7 @@
(opts '())
(mods #f)
(tfile #f)
+ (ptfile #f)
(ifile #f)
(objext (object-extension platform))
(exeext (executable-extension platform)))
@@ -159,6 +160,7 @@
(cbuild #f)
(link default-extension-linkage)
(tfile #f)
+ (ptfile #f)
(ifile #f)
(lopts '())
(oname #f)
@@ -187,6 +189,7 @@
(cons (list target dependencies: deps source: src options: opts
link-options: lopts linkage: link custom: cbuild
mode: mode types-file: tfile inline-file: ifile
+ predefined-types: ptfile
modules: (or mods (list rtarget))
output-file: rtarget)
exts)))))
@@ -276,7 +279,16 @@
((linkage)
(set! link (cdr info)))
((types-file)
- (set! tfile (or (null? (cdr info)) (arg info 1 name?))))
+ (set! tfile
+ (cond ((null? (cdr info)) #t)
+ ((not (pair? (cadr info)))
+ (arg info 1 name?))
+ (else
+ (set! ptfile #t)
+ (set! tfile
+ (or (null? (cdadr info))
+ #t
+ (arg (cadr info) 1 name?)))))))
((inline-file)
(set! ifile (or (null? (cdr info)) (arg info 1 name?))))
((custom-build)
@@ -426,6 +438,7 @@
(define ((compile-static-extension name #!key mode dependencies
source (options '())
+ predefined-types
custom types-file inline-file)
srcdir platform)
(let* ((cmd (or (and custom (prefix-custom-command custom))
@@ -435,7 +448,8 @@
(opts (append (if (null? options)
default-static-compilation-options
options)
- (if types-file
+ (if (and types-file
+ (not predefined-types))
(list "-emit-type-file"
(quotearg (prefix srcdir (conc types-file ".types"))))
'())
@@ -462,6 +476,7 @@
(define ((compile-dynamic-extension name #!key mode dependencies mode
source (options '()) (link-options '())
+ predefined-types
custom types-file inline-file)
srcdir platform)
(let* ((cmd (or (and custom (prefix-custom-command custom))
@@ -470,7 +485,8 @@
(opts (append (if (null? options)
default-dynamic-compilation-options
options)
- (if types-file
+ (if (and types-file
+ (not predefined-types))
(list "-emit-type-file"
(quotearg (prefix srcdir (conc types-file ".types"))))
'())
diff --git a/manual/Extensions b/manual/Extensions
index ba6536ec..c73b5c4a 100644
--- a/manual/Extensions
+++ b/manual/Extensions
@@ -297,6 +297,10 @@ installed for this component. This property is only used for
extension libraries. The name is optional and defaults to the
name of the extensions (with the proper extension).
+If {{NAME}} is a list of the form {{(predefined [NAME])}}, then
+no types file is created during compilation and an existing types file
+for this extension is assumed and installed.
+
====== inline-file
[egg property] (inline-file [NAME])
Trap