bazel-contrib / rules_foreign_cc

Build rules for interfacing with "foreign" (non-Bazel) build systems (CMake, configure-make, GNU Make, boost, ninja, Meson)
https://bazel-contrib.github.io/rules_foreign_cc
Apache License 2.0
680 stars 249 forks source link

fix: change cygpath to mixed mode #1204

Closed jsun-splunk closed 6 months ago

jsun-splunk commented 6 months ago

'autoconf' applications often has a ./configure stage that checks the $srcdir (source directory). This is represented in foreign_cc by a combination of $EXT_BUILD_ROOT and a relative path to the source. This check fails on windows if $EXT_BUILD_ROOT contains '\' since it is an escape char under unix. Therefore, we need to generate $EXT_BUILD_ROOT with '/' instead.

Generating $EXT_BUILD_ROOT with '/' present a different problem as now the resulting PATH variable becomes the format "/C:/path/to/a:/C:/path/to/b". Due to ':' being used as both window drive leter assignment and linux path delimiter, MSYS2 gets very confused and doesn't resolve this correctly. Therefore, we need this to become the format "/C/path/to/a:/C/path/to/b".

$EXT_BUILD_ROOT is sometimes passed through the 'env' attribute by the user. We need to handle this scenario as well.

jsun-splunk commented 6 months ago

Hi @jsharpe,

Could I trouble you to review?

jsun-splunk commented 6 months ago

This MR has the same purpose as https://github.com/bazelbuild/rules_foreign_cc/pull/1091 but also fixes the meson issue.