From 5b3aad43f52644be3f2f54aea86456295522d855 Mon Sep 17 00:00:00 2001 From: felix Date: Mon, 11 Sep 2017 19:08:44 +0200 Subject: [PATCH] ensure paths to types- and inline-files are absolute, document optional filenames for types-file/inline-file egg properties, pass proper options to csc in these cases. Thanks to Kooda for pointing out these omissions. --- egg-compile.scm | 56 +++++++++++++++++++++++++++++++++++++++-------------- manual/Extensions | 10 ++++++---- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/egg-compile.scm b/egg-compile.scm index 5ed16c4..a96615a 100644 --- a/egg-compile.scm +++ b/egg-compile.scm @@ -354,10 +354,18 @@ (append (if (memq 'dynamic link) (list (apply compile-dynamic-extension data)) '()) - ;; static must come last, as *.o file will be overwritten - ;; and removed by dynamic build (meh) (if (memq 'static link) - (list (apply compile-static-extension data)) + ;; if compiling both static + dynamic, + ;; override types-file: + inline-file: + ;; properties to avoid generating things + ;; twice: + (list (apply compile-static-extension + (if (memq 'dynamic link) + (cons (car data) + (append '(types-file: #f + inline-file: #f) + (cdr data))) + data))) '()) (if (uses-compiled-import-library? mode) (map (lambda (mod) @@ -418,15 +426,25 @@ ;;; shell code generation - build operations (define ((compile-static-extension name #!key mode dependencies source - (options '()) custom) + (options '()) custom types-file + inline-file) srcdir platform) (let* ((cmd (or (and custom (prefix-custom-command custom)) default-csc)) (sname (prefix srcdir name)) (ssname (and source (prefix srcdir source))) - (opts (if (null? options) - default-static-compilation-options - options)) + (opts (append (if (null? options) + default-static-compilation-options + options) + (if types-file + (list "-emit-type-file" + (quotearg (prefix srcdir + (conc types-file ".types")))) + '()) + (if inline-file + (list "-emit-inline-file" + (quotearg (prefix srcdir (conc inline-file ".inline")))) + '()))) (out (quotearg (target-file (conc sname ".static" (object-extension platform)) @@ -446,14 +464,23 @@ (define ((compile-dynamic-extension name #!key mode dependencies mode source (options '()) (link-options '()) - custom) + custom types-file inline-file) srcdir platform) (let* ((cmd (or (and custom (prefix-custom-command custom)) default-csc)) (sname (prefix srcdir name)) - (opts (if (null? options) - default-dynamic-compilation-options - options)) + (opts (append (if (null? options) + default-dynamic-compilation-options + options) + (if types-file + (list "-emit-type-file" + (quotearg (prefix srcdir + (conc types-file ".types")))) + '()) + (if inline-file + (list "-emit-inline-file" + (quotearg (prefix srcdir (conc inline-file ".inline")))) + '()))) (ssname (and source (prefix srcdir source))) (out (quotearg (target-file (conc sname ".so") mode))) (src (quotearg (or ssname (conc sname ".scm"))))) @@ -551,7 +578,7 @@ (mkdir (mkdir-command platform)) (ext (object-extension platform)) (sname (prefix srcdir name)) - (out (quotearg (target-file (conc sname ".static" ext) + (out (quotearg (target-file (conc sname ".static" ext) mode))) (outlnk (quotearg (conc sname +link-file-extension+))) (dest (destination-repository mode)) @@ -611,8 +638,7 @@ srcdir platform) (let* ((cmd (install-file-command platform)) (mkdir (mkdir-command platform)) - (sname (prefix srcdir name)) - (out (quotearg (conc types-file ".types"))) + (out (quotearg (prefix srcdir (conc types-file ".types")))) (dest (destination-repository mode)) (dfile (quotearg (slashify dest platform))) (ddir (shell-variable "DESTDIR" platform))) @@ -626,7 +652,7 @@ (let* ((cmd (install-file-command platform)) (mkdir (mkdir-command platform)) (sname (prefix srcdir name)) - (out (quotearg (conc inline-file ".inline"))) + (out (quotearg (prefix srcdir (conc inline-file ".inline")))) (dest (destination-repository mode)) (dfile (quotearg (slashify dest platform))) (ddir (shell-variable "DESTDIR" platform))) diff --git a/manual/Extensions b/manual/Extensions index 25bc75b..9a397de 100644 --- a/manual/Extensions +++ b/manual/Extensions @@ -290,19 +290,21 @@ property only makes sense for extension libraries. ====== types-file -[egg property] (types-file NAME) +[egg property] (types-file [NAME]) Specifies that a "type-database" file should be generated and installed for this component. This property is only used for -extension libraries. +extension libraries. The name is optional and defaults to the +name of the extensions (with the proper extension). ====== inline-file -[egg property] (inline-file NAME) +[egg property] (inline-file [NAME]) Specifies that an "inline" file should be generated and installed for this component. This property is only used for extension -libraries. +libraries. The name is optional and defaults to the +name of the extensions (with the proper extension). ====== custom-build -- 1.7.9.5