~ chicken-core (chicken-5) 5fa67777f2cddf12b2fb53049ae7cae8de42fa6e


commit 5fa67777f2cddf12b2fb53049ae7cae8de42fa6e
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Sat Apr 8 23:31:35 2017 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sat Apr 8 23:31:35 2017 +0200

    chicken-install: set DYLD_LIBRARY_PATH on Mac OS when running build/install script, if needed

diff --git a/chicken-install.scm b/chicken-install.scm
index b35c796d..50ebfa08 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -40,6 +40,7 @@
 (import (chicken io))
 (import (chicken time))
 (import (chicken pathname))
+(import (chicken process))
 (import (chicken pretty-print))
 
 (define +defaults-version+ 2)
@@ -869,12 +870,21 @@
 
 (define (run-script dir script platform #!key sudo (stop #t))
   (d "running script ~a~%" script)
-  (if (eq? platform 'windows)
-      (exec script stop)
-      (exec (string-append (if sudo 
-                               (string-append sudo-program " ")
-                               "")
-                           "sh " script) stop)))
+  (exec (if (eq? platform 'windows)
+            script
+            (string-append
+              (if sudo 
+                  (string-append sudo-program " ")
+                  "")
+              (let ((dyld (and (eq? (software-version) 'macosx)
+                               (get-environment-variable "DYLD_LIBRARY_PATH"))))
+                (if dyld
+                    (string-append "/usr/bin/env DYLD_LIBRARY_PATH="
+                                   (qs dyld)
+                                   " ")
+                    ""))
+              "sh " script))
+        stop))
 
 (define (write-info name info mode)
   (d "writing info for egg ~a~%" name info)
Trap