Created attachment 63995 [details] [review] Escape spaces in autodetected ${prefix} values on Windows. On Windows, when pkg-config auto-rewrites the "prefix" variable and the path contains spaces, it considers each side of the space as a separate argument when it comes time to consolidate duplicate arguments. In most cases, this results in useless output. Example: (pkg-config is in "Z:\test dir\bin" and the .pc files are in "Z:\test dir\lib\pkgconfig") $ pkg-config --cflags glib-2.0 dir/include/glib-2.0 dir/lib/glib-2.0/include -mms-bitfields -IZ:/test $ pkg-config --cflags --libs gthread-2.0 dir/include/glib-2.0 dir/lib/glib-2.0/include -mms-bitfields -IZ:/test dir/lib -LZ:/test -lgthread-2.0 -lglib-2.0 -lintl The attached patch adds a level of escaping at the time the value of ${prefix} is determined, which keeps the path together through pkg-config's processing and makes the result directly usable in compilation commands, despite the spaces. Here are the same examples done with the patch applied: $ pkg-config-patched --cflags glib-2.0 -mms-bitfields -IZ:/test\ dir/include/glib-2.0 -IZ:/test\ dir/lib/glib-2.0/include $ pkg-config-patched --cflags --libs gthread-2.0 -mms-bitfields -IZ:/test\ dir/include/glib-2.0 -IZ:/test\ dir/lib/glib-2.0/include -LZ:/test\ dir/lib -lgthread-2.0 -lglib-2.0 -lintl
Comment on attachment 63995 [details] [review] Escape spaces in autodetected ${prefix} values on Windows. Review of attachment 63995 [details] [review]: ----------------------------------------------------------------- I haven't tested, but this looks good. If you can address the comment below, I'll be happy to commit. ::: parse.c @@ +1060,5 @@ > + gchar *oldprefix = prefix; > + prefix = strdup_escape_shell(prefix); > + g_free(oldprefix); > + } > + Instead of adding another block and variable, can we just reuse the q local variable? Also, space after function like other coding style.
I made those small changes and pushed them in commit f57fafe. Please reopen if you're still having issues.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.