>From c6dc365c494713ee8ed25f81db936b533a0a5563 Mon Sep 17 00:00:00 2001 From: Evan Hanson Date: Tue, 30 Apr 2019 22:18:59 +1200 Subject: [PATCH 1/2] Generate import libraries when static linkage is used Previously, it was not possible to use (linkage static) since an extension with modules would not emit their import libraries before trying to compile them. This change conditionalises import library generation when compiling a static extension based on whether or not a dynamic version of the extension has already been built (and thus emitted the necessary files), the same way we already do for types and inline files. The usual behaviour stays the same (i.e. the dynamic build emits the import libraries), but the static-only case will now work correctly too. --- egg-compile.scm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/egg-compile.scm b/egg-compile.scm index 4f8bd538..e3c2d361 100644 --- a/egg-compile.scm +++ b/egg-compile.scm @@ -475,12 +475,13 @@ '()) (if (memq 'static link) ;; if compiling both static + dynamic, override - ;; types-file: + inline-file: properties to + ;; modules/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 + (append '(modules: #f + types-file: #f inline-file: #f) (cdr data))) data))) @@ -559,7 +560,7 @@ source-dependencies source (options '()) predefined-types eggfile - link-objects + link-objects modules custom types-file inline-file) srcdir platform) (let* ((cmd (qs* (or (custom-cmd custom srcdir platform) @@ -594,7 +595,11 @@ platform))) (targets (append (list out3 lfile) (maybe types-file tfile) - (maybe inline-file ifile))) + (maybe inline-file ifile) + (map (lambda (m) + (qs* (prefix srcdir (conc m ".import.scm")) + platform)) + (or modules '())))) (src (qs* (or source (conc name ".scm")) platform))) (when custom (prepare-custom-command cmd platform)) @@ -605,6 +610,7 @@ (filelist srcdir source-dependencies platform) " : " cmd (if keep-generated-files " -k" "") + (if modules " -J" "") " -setup-mode -static -I " srcdir " -emit-link-file " lfile (if (eq? mode 'host) " -host" "") @@ -663,7 +669,7 @@ (map (lambda (m) (qs* (prefix srcdir (conc m ".import.scm")) platform)) - modules)))) + (or modules '()))))) (when custom (prepare-custom-command cmd platform)) (print "\n" (qs* default-builder platform #t) " " @@ -678,7 +684,8 @@ cmd (if keep-generated-files " -k" "") (if (eq? mode 'host) " -host" "") - " -D compiling-extension -J -s" + (if modules " -J" "") + " -D compiling-extension -s" " -setup-mode -I " srcdir " -C -I" srcdir (arglist opts platform) -- 2.11.0