From 2d4408e394edba0741972d46225d13b14a6f237f Mon Sep 17 00:00:00 2001 From: Mirko Vukovic Date: Wed, 6 Apr 2016 22:40:30 -0400 Subject: [PATCH 1/2] parse-command-flags: Added #\Return to separators On Windows7+MSYS, the output of pkg-config as read by CCL included \#RETURN. I added #\Return the bag of separators. I also reformatted the code a bit, to make it a bit more readable (fewer long lines or ackward line splits). --- toolchain/c-toolchain.lisp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toolchain/c-toolchain.lisp b/toolchain/c-toolchain.lisp index 8645c3b..9c6758c 100644 --- a/toolchain/c-toolchain.lisp +++ b/toolchain/c-toolchain.lisp @@ -33,7 +33,8 @@ ;;; Utils (defun parse-command-flags (flags) - (remove-if 'emptyp (split-string flags :separator '(#\Space #\Tab #\Newline)))) + (let ((separators '(#\Space #\Tab #\Newline #\Return))) + (remove-if 'emptyp (split-string flags :separator separators)))) (defun parse-command-flags-list (strings) (loop for flags in strings append (parse-command-flags flags))) -- 2.6.3 From e687880d3ac5238dff7d9b78d70490265079a4a1 Mon Sep 17 00:00:00 2001 From: Mirko Vukovic Date: Wed, 6 Apr 2016 22:57:40 -0400 Subject: [PATCH 2/2] Remove duplicates in *cc-flags* `define-grovel-syntax pkg-config-cflags' would add the same paths even if they were already in *cc-flags*. The modified code appends the new flags, and then removes the duplicates. The new flags are placed at the end of *cc-flags* --- grovel/grovel.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/grovel/grovel.lisp b/grovel/grovel.lisp index 9240685..2b73c72 100644 --- a/grovel/grovel.lisp +++ b/grovel/grovel.lisp @@ -281,8 +281,13 @@ int main(int argc, char**argv) { (run-program program+args :output (make-broadcast-stream output-stream *debug-io*) :error-output output-stream) - (appendf *cc-flags* - (parse-command-flags (get-output-stream-string output-stream)))) + (setf *cc-flags* + (nreverse + (remove-duplicates + (append (parse-command-flags + (get-output-stream-string output-stream)) + (nreverse *cc-flags*)) + :test #'string=)))) (error (e) (let ((message (format nil "~a~&~%~a~&" e (get-output-stream-string output-stream)))) -- 2.6.3