Coming from https://github.com/conan-io/conan-center-index/pull/971#discussion_r384523076
To enable proper MinGW support in some of the recipes, we are repeating every time the code
def build_requirements(self):
if tools.os_info.is_windows and "CONAN_BASH_PATH" not in os.environ and \
tools.os_info.detect_windows_subsystem() != "msys2":
self.build_requires("msys2/20190524")
I personally understand that it is very convenient to have the build require there, but this is clearly a pattern in all the recipes that enable support for MinGW.
My question is: Should we stop adding this code in the recipes and recommend people using the msys package in their mingw profiles as the cannonical way to create the packages?
I think having msys together with mingw should be a well-known pratice for all of those that are these creating packages
cc/ @SSE4 @uilianries @madebr
No, the build requirement must be there.
It is often present for MSVC builds if there is only a autotools build system.
What I do not know is why we add tools.os_info.detect_windows_subsystem() != "msys2":.
Most often, I think it does not matter what subsystem is used.
I think the following would also be fine:
def build_requirements(self):
if tools.os_info.is_windows and "CONAN_BASH_PATH" not in os.environ and \
not tools.os_info.detect_windows_subsystem():
self.build_requires("msys2/20190524")
But granted, most of us build and test using the msys2 subsystem.
Ok, now I understand better.
Regarding the tools.os_info.detect_windows_subsystem() != "msys2", maybe @ericLemanissier can help us with this
Some projects explicitly mention cygwin (or msys2). Accepting all subsystem means we have to at least do a test on several subsystems, and this have to be done on a case by case basis. Replacing tools.os_info.detect_windows_subsystem() != "msys2" with not tools.os_info.detect_windows_subsystem() is not a major simplification anyway
@ericLemanissier I agree. Thanks for the clarification!
Thanks a lot for the feedback guys!
Most helpful comment
No, the build requirement must be there.
It is often present for MSVC builds if there is only a autotools build system.