From 651f70a66ed2ab3e70334466ae8a93b57ffbaa10 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Tue, 1 Nov 2022 10:39:32 +0100 Subject: [PATCH] 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. --- egg-compile.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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) -- 2.36.2