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.
pull/13748/head
Nirbheek Chauhan 2 months ago committed by Nirbheek Chauhan
parent 0f914b75fe
commit d48602a5f3
  1. 9
      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')

Loading…
Cancel
Save