~ chicken-core (chicken-5) 73ea256188901192b63d1c4fd7b4a4ea2b850962


commit 73ea256188901192b63d1c4fd7b4a4ea2b850962
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sun Apr 29 12:22:46 2018 +0200
Commit:     Kooda <kooda@upyum.com>
CommitDate: Sun Apr 29 13:34:12 2018 +0200

    chicken-install: make extensions and programs dependent on the .egg file
    
    This was suggested by klm: during development, changing compiler options
    in the .egg file need to force recompilation.
    
    Signed-off-by: Kooda <kooda@upyum.com>

diff --git a/chicken-install.scm b/chicken-install.scm
index 5197e08a..e5753cbd 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -800,7 +800,10 @@
         (when (or host-extension 
                   (and (not target-extension)
                        (not host-extension)))
-          (let-values (((build install info) (compile-egg-info info platform 'host)))
+          (let-values (((build install info) (compile-egg-info eggfile 
+                                                               info
+                                                               platform
+                                                               'host)))
             (check-installed-files name info)                         
             (let ((bscript (make-pathname dir name 
                                           (build-script-extension 'host platform)))
@@ -826,7 +829,10 @@
                                  (not (test-egg egg platform)))
                         (exit 2)))))))
         (when target-extension
-          (let-values (((build install info) (compile-egg-info info platform 'target)))
+          (let-values (((build install info) (compile-egg-info eggfile
+                                                               info
+                                                               platform
+                                                               'target)))
             (let ((bscript (make-pathname dir name 
                                           (build-script-extension 'target platform)))
                   (iscript (make-pathname dir name 
diff --git a/egg-compile.scm b/egg-compile.scm
index 53e8213d..b42b1f1b 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -120,7 +120,7 @@
 
 ;;; compile an egg-information tree into abstract build/install operations
 
-(define (compile-egg-info info platform mode)
+(define (compile-egg-info eggfile info platform mode)
   (let ((exts '())
         (prgs '())
         (data '())
@@ -142,6 +142,7 @@
         (tfile #f)
         (ptfile #f)
         (ifile #f)
+        (eggfile (locate-egg-file eggfile))
         (objext (object-extension platform))
         (exeext (executable-extension platform)))
     (define (check-target t lst)
@@ -189,7 +190,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
+                            predefined-types: ptfile eggfile: eggfile
                             modules: (or mods (list rtarget))
                             output-file: rtarget)
                     exts)))))
@@ -268,7 +269,7 @@
 	      (set! prgs
 		(cons (list target dependencies: deps source: src options: opts
 			    link-options: lopts linkage: link custom: cbuild
-			    mode: mode output-file: rtarget)
+			    mode: mode output-file: rtarget eggfile: eggfile)
 		      prgs)))))
         (else (compile-common info compile-component))))
     (define (compile-extension/program info)
@@ -442,7 +443,7 @@
 
 (define ((compile-static-extension name #!key mode dependencies
                                    source (options '())
-                                   predefined-types
+                                   predefined-types eggfile
                                    custom types-file inline-file)
          srcdir platform)
   (let* ((cmd (or (and custom (prefix srcdir custom))
@@ -478,11 +479,11 @@
            " -D compiling-static-extension"
            " -C -I" srcdir (arglist opts) 
            " " src " -o " out " : "
-           src #;(arglist dependencies))))
+           src " " (quotearg eggfile) #;(arglist dependencies))))
 
 (define ((compile-dynamic-extension name #!key mode dependencies mode
                                     source (options '()) (link-options '()) 
-                                    predefined-types
+                                    predefined-types eggfile
                                     custom types-file inline-file)
          srcdir platform)
   (let* ((cmd (or (and custom (prefix srcdir custom))
@@ -511,7 +512,7 @@
            " -D compiling-extension -J -s"
            " -setup-mode -I " srcdir " -C -I" srcdir (arglist opts)
            (arglist link-options) " " src " -o " out " : "
-           src #;(arglist dependencies))))
+           src " " (quotearg eggfile) #;(arglist dependencies))))
 
 (define ((compile-import-library name #!key dependencies mode
                                  (options '()) (link-options '())
@@ -537,7 +538,7 @@
 
 (define ((compile-dynamic-program name #!key dependencies source mode
                                      (options '()) (link-options '())
-                                     custom)
+                                     custom eggfile)
          srcdir platform)
   (let* ((cmd (or (and custom (prefix srcdir custom))
                   default-csc))
@@ -558,11 +559,11 @@
            (if (eq? mode 'host) " -host" "")
            " -I " srcdir " -C -I" srcdir (arglist opts)
            (arglist link-options) " " src " -o " out " : "
-           src #;(arglist dependencies))))
+           src " " (quotearg eggfile) #;(arglist dependencies))))
 
 (define ((compile-static-program name #!key dependencies source
                                     (options '()) (link-options '())
-                                    custom mode)
+                                    custom mode eggfile)
          srcdir platform)
   (let* ((cmd (or (and custom (prefix srcdir custom))
                   default-csc))
@@ -583,7 +584,7 @@
            " -static -setup-mode -I " srcdir " -C -I" 
            srcdir (arglist opts)
            (arglist link-options) " " src " -o " out " : "
-           src #;(arglist dependencies))))
+           src " " (quotearg eggfile) #;(arglist dependencies))))
 
 (define ((compile-generated-file name #!key dependencies source custom) 
          srcdir platform)
diff --git a/egg-information.scm b/egg-information.scm
index b575ec85..d4f00c18 100644
--- a/egg-information.scm
+++ b/egg-information.scm
@@ -26,11 +26,16 @@
 
 ;;; load egg-info from file and perform validation
 
-(define (load-egg-info fname)
+(define (locate-egg-file fname)
   (let ((fname* (make-pathname (make-pathname (pathname-directory fname)
                                               "chicken")
-                               (pathname-file fname) (pathname-extension fname))))
-    (with-input-from-file (if (file-exists? fname*) fname* fname) read)))
+                               (pathname-file fname) 
+                               (pathname-extension fname))))
+    (if (file-exists? fname*) fname* fname)))
+
+(define (load-egg-info fname)
+  (let ((fname (locate-egg-file fname)))
+    (with-input-from-file fname read)))
 
 
 ;;; lookup specific toplevel properties of egg-information
Trap