~ chicken-core (chicken-5) 9a7d2ea3cf2708af43f8adadbb1bc6334b56f897


commit 9a7d2ea3cf2708af43f8adadbb1bc6334b56f897
Author:     LemonBoy <thatlemon@gmail.com>
AuthorDate: Thu May 25 15:53:30 2017 +0200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Sun May 28 10:02:33 2017 +1200

    Respect install-name when specified.
    
    Do this for 'program' and 'extension' components.
    
    Signed-off-by: Peter Bex <peter@more-magic.net>
    Signed-off-by: Evan Hanson <evhan@foldling.org>

diff --git a/egg-compile.scm b/egg-compile.scm
index 4d7332c0..7ba5f76e 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -143,15 +143,17 @@
                       (oname #f)
                       (opts '()))
             (for-each compile-extension/program (cddr info))
-            (let ((dest (destination-repository mode #t)))
-              (when (eq? #t tfile) (set! tfile target))
-              (when (eq? #t ifile) (set! ifile target))
+            (let ((dest (destination-repository mode #t))
+                  ;; Respect install-name if specified
+                  (rtarget (or oname target)))
+              (when (eq? #t tfile) (set! tfile rtarget))
+              (when (eq? #t ifile) (set! ifile rtarget))
               (addfiles 
                 (if (memq 'static link) 
-                    (list (conc dest "/" target objext)
-                          (conc dest "/" target +link-file-extension+))
+                    (list (conc dest "/" rtarget objext)
+                          (conc dest "/" rtarget +link-file-extension+))
                     '())
-                (if (memq 'dynamic link) (list (conc dest "/" target ".so")) '())
+                (if (memq 'dynamic link) (list (conc dest "/" rtarget ".so")) '())
                 (if tfile 
                     (list (conc dest "/" tfile ".types"))
                     '())
@@ -159,8 +161,8 @@
                     (list (conc dest "/" ifile ".inline"))
                     '())
                 (list (if (uses-compiled-import-library? mode)
-                          (conc dest "/" target ".import.so")
-                          (conc dest "/" target ".import.scm")))))
+                          (conc dest "/" rtarget ".import.so")
+                          (conc dest "/" rtarget ".import.scm")))))
             (set! exts 
               (cons (list target dependencies: deps source: src options: opts 
                           link-options: lopts linkage: link custom: cbuild
@@ -235,13 +237,15 @@
             (for-each compile-extension/program (cddr info))
             (let ((dest (if (eq? mode 'target) 
                             default-bindir   ; XXX wrong!
-                            host-bindir)))
-              (addfiles (list (conc dest "/" target exeext))))
-            (set! prgs 
-              (cons (list target dependencies: deps source: src options: opts 
-                          link-options: lopts linkage: link custom: cbuild
-                          mode: mode output-file: (or oname target))                         
-                    prgs))))))
+                            host-bindir))
+                  ;; Respect install-name if specified
+                  (rtarget (or oname target)))
+              (addfiles (list (conc dest "/" rtarget exeext)))
+	      (set! prgs
+		(cons (list target dependencies: deps source: src options: opts
+			    link-options: lopts linkage: link custom: cbuild
+			    mode: mode output-file: rtarget)
+		      prgs)))))))
     (define (compile-extension/program info)
       (case (car info)
         ((target) 
Trap