File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ option("curses")
101101 option :add (" links" , " ncursesw" )
102102 elseif is_plat (" macosx" ) then
103103 option :add (" cincludes" , " curses.h" )
104- option :add (" links" , " ncurses " )
104+ option :add (" links" , " curses " )
105105 else
106106 option :add (" cincludes" , " curses.h" )
107107 option :add (" links" , " curses" )
Original file line number Diff line number Diff line change @@ -65,14 +65,23 @@ option_find_curses() {
6565 if is_plat " mingw" ; then
6666 ncurses=" ncursesw"
6767 fi
68- local ncurses_ldflags=" "
69- ncurses_ldflags=$( pkg-config --libs ${ncurses} 2> /dev/null)
68+ # on macOS, homebrew ncurses is keg-only, add its pkgconfig path
69+ local pkg_config_path=" ${PKG_CONFIG_PATH} "
70+ if is_host " macosx" ; then
71+ local brew_prefix=$( brew --prefix ncurses 2> /dev/null)
72+ if test_nz " ${brew_prefix} " ; then
73+ pkg_config_path=" ${brew_prefix} /lib/pkgconfig:${pkg_config_path} "
74+ fi
75+ fi
76+ local ncurses_cflags=$( PKG_CONFIG_PATH=" ${pkg_config_path} " pkg-config --cflags ${ncurses} 2> /dev/null)
77+ local ncurses_ldflags=$( PKG_CONFIG_PATH=" ${pkg_config_path} " pkg-config --libs ${ncurses} 2> /dev/null)
7078 option " curses"
7179 if test_nz " ${ncurses_ldflags} " ; then
72- add_cflags ` pkg-config --cflags ${ncurses} 2> /dev/null `
80+ add_cflags " ${ncurses_cflags} "
7381 add_ldflags " ${ncurses_ldflags} "
74- elif is_plat " macosx" ; then
75- add_links " ncurses"
82+ elif is_host " macosx" ; then
83+ # disable curses to avoid header/library mismatch with homebrew
84+ set_default " false"
7685 else
7786 add_links " curses"
7887 fi
You can’t perform that action at this time.
0 commit comments