~ chicken-core (chicken-5) f5b6c78fd51ff4ed5a3292d9e52eb20508eca162


commit f5b6c78fd51ff4ed5a3292d9e52eb20508eca162
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Fri Oct 1 05:47:10 2010 -0400
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Fri Oct 1 05:47:10 2010 -0400

    install-prefix handling for deployment mode and cross-chickens in chicken-install/setup-api fixed (hopefully)

diff --git a/chicken-install.scm b/chicken-install.scm
index a41a8bfd..aad78692 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -97,10 +97,10 @@
   (define *debug-setup* #f)
   (define *keep-going* #f)
 
-  (define (get-prefix)
+  (define (get-prefix #!optional runtime)
     (cond ((and *cross-chicken*
 		(not *host-extension*))
-	   (or *prefix*
+	   (or (and (not runtime) *prefix*)
 	       (foreign-value "C_TARGET_PREFIX" c-string)))
 	  (else *prefix*)))
 
@@ -413,6 +413,11 @@
 	   (sprintf " -e \"(destination-prefix \\\"~a\\\")\"" 
 	     (normalize-pathname prefix 'unix))
 	   ""))
+     (let ((prefix (get-prefix #t)))
+       (if prefix
+	   (sprintf " -e \"(runtime-prefix \\\"~a\\\")\"" 
+	     (normalize-pathname prefix 'unix))
+	   ""))
      (if (pair? *csc-features*)
 	 (sprintf " -e \"(extra-features '~s)\"" *csc-features*)
 	 "")
diff --git a/setup-api.scm b/setup-api.scm
index 553ae98a..8b641bb3 100644
--- a/setup-api.scm
+++ b/setup-api.scm
@@ -45,6 +45,7 @@
      setup-verbose-mode setup-install-mode deployment-mode
      installation-prefix
      destination-prefix
+     runtime-prefix
      chicken-prefix
      find-library find-header 
      program-path remove-file* 
@@ -230,6 +231,10 @@
   (reg "chicken-status" (foreign-value "C_CHICKEN_STATUS_PROGRAM" c-string))
   (reg "chicken-bug" (foreign-value "C_CHICKEN_BUG_PROGRAM" c-string)))
 
+(define (target-prefix fname)
+  (and-let* ((tp (runtime-prefix)))
+    (make-pathname tp fname)))
+
 (define (fixpath prg)
   (cond ((string=? prg "csc")
 	 (string-intersperse 
@@ -444,6 +449,7 @@
   (make-pathname rpath fn setup-file-extension) )
 
 (define destination-prefix (make-parameter #f))
+(define runtime-prefix (make-parameter #f))
 
 (define installation-prefix
   (let ((prefix (get-environment-variable "CHICKEN_INSTALL_PREFIX")))
@@ -574,9 +580,6 @@
 	   (dests (map (lambda (f)
 			 (let ((from (if (pair? f) (car f) f))
 			       (to (make-dest-pathname rpathd f)) )
-			   (when (and (not *windows*) 
-				      (equal? "so" (pathname-extension to)))
-			     (run (,*remove-command* ,(shellpath to)) ))
 			   (copy-file from to)
 			   (unless *windows-shell*
 			     (run (,*chmod-command* a+r ,(shellpath to))))
@@ -585,7 +588,9 @@
 					(equal? (cadr static) from) 
 					(equal? (pathname-extension to) "a"))
 			       (run (,*ranlib-command* ,(shellpath to)) ) ))
-			   to))
+			   (if (deployment-mode)
+			       f
+			       (or (target-prefix f) to))))
 		       files) ) )
       (write-info id dests (supply-version info #f)) ) ) )
 
Trap