~ chicken-core (chicken-5) 0a6036bfc146993f19f41d88ba6e6c90a344f355


commit 0a6036bfc146993f19f41d88ba6e6c90a344f355
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Tue Nov 1 10:39:32 2022 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Tue Nov 1 10:51:53 2022 +0100

    Add a way to pass in already-quoted arguments to qs*
    
    The librarian options are kept around in the binary as a foreign
    string which may contain multiple flags separated by spaces.  These
    should be taken verbatim by print-build-command.
    
    The way we do this is by wrapping such verbatim snippets in a "raw"
    record type and detecting these values in qs* and unpacking their
    strings directly from the struct instead of quoting them.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/egg-compile.scm b/egg-compile.scm
index 662fad3d..c1f2ceb0 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -650,7 +650,7 @@
                                link-objects))))
 	(print-build-command (list out3)
 			     `(,out2 ,@lobjs)
-			     `(,target-librarian ,target-librarian-options ,out3 ,out2 ,@lobjs)
+			     `(,target-librarian ,(raw-arg target-librarian-options) ,out3 ,out2 ,@lobjs)
 			     platform)))
     (print-end-command platform)))
 
@@ -1152,10 +1152,19 @@ EOF
 ;; have to undo that here again.  It can also convert slashes to
 ;; backslashes on Windows, which is necessary in many cases when
 ;; running programs via "cmd".
+;;
+;; It also supports already-quoted arguments which can be taken as-is.
 (define (qs* arg platform #!optional slashify?)
-  (let* ((arg (->string arg))
-	 (path (if slashify? (slashify arg platform) arg)))
-    (qs path (if (eq? platform 'windows) 'mingw32 platform))))
+  (if (raw-arg? arg)
+      (raw-arg-value arg)
+      (let* ((arg (->string arg))
+	     (path (if slashify? (slashify arg platform) arg)))
+	(qs path (if (eq? platform 'windows) 'mingw32 platform)))))
+
+(define-record-type raw-arg
+  (raw-arg value)
+  raw-arg?
+  (value raw-arg-value))
 
 (define (slashify str platform)
   (if (eq? platform 'windows)
Trap