From d48602a5f3dade3c1800b3e3d11ad09a45a761a2 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 26 Sep 2024 14:56:34 +0530 Subject: [PATCH] curses: Ignore /usr/bin/ncurses5.4-config on macOS macOS mistakenly ships /usr/bin/ncurses5.4-config and a man page for it, but none of the headers or libraries are available in the location advertised by it. Ignore /usr/bin because it can only contain this broken configtool script. Homebrew is /usr/local or /opt/homebrew. Xcode's command-line tools SDK does include curses, but the configtool in there is wrong too, and anyway we can't just randomly pick it up since the user must explicitly select that as a target by using a native file. The MacOSX SDK itself does not include curses. We also can't ignore ncurses5.4-config entirely because it might be available in a different prefix. --- mesonbuild/dependencies/misc.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index b5c40984a..4815e1c18 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -312,7 +312,14 @@ class CursesConfigToolDependency(ConfigToolDependency): tools = ['ncursesw6-config', 'ncursesw5-config', 'ncurses6-config', 'ncurses5-config', 'ncurses5.4-config'] def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any], language: T.Optional[str] = None): - super().__init__(name, env, kwargs, language) + exclude_paths = None + # macOS mistakenly ships /usr/bin/ncurses5.4-config and a man page for + # it, but none of the headers or libraries. Ignore /usr/bin because it + # can only contain this broken configtool script. + # Homebrew is /usr/local or /opt/homebrew. + if env.machines.build and env.machines.build.system == 'darwin': + exclude_paths = ['/usr/bin'] + super().__init__(name, env, kwargs, language, exclude_paths=exclude_paths) if not self.is_found: return self.compile_args = self.get_config_value(['--cflags'], 'compile_args')