File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
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,25 @@ option_find_curses() {
6565 if is_plat " mingw" ; then
6666 ncurses=" ncursesw"
6767 fi
68+ # try to find homebrew ncurses pkgconfig path on macOS (keg-only)
69+ local ncurses_pkg_config_path=" ${PKG_CONFIG_PATH} "
70+ if is_host " macosx" ; then
71+ local brew_ncurses_pkgconfig=" "
72+ if test -d " /usr/local/opt/ncurses/lib/pkgconfig" ; then
73+ brew_ncurses_pkgconfig=" /usr/local/opt/ncurses/lib/pkgconfig"
74+ elif test -d " /opt/homebrew/opt/ncurses/lib/pkgconfig" ; then
75+ brew_ncurses_pkgconfig=" /opt/homebrew/opt/ncurses/lib/pkgconfig"
76+ fi
77+ if test_nz " ${brew_ncurses_pkgconfig} " ; then
78+ ncurses_pkg_config_path=" ${brew_ncurses_pkgconfig} :${PKG_CONFIG_PATH} "
79+ fi
80+ fi
6881 local ncurses_ldflags=" "
69- ncurses_ldflags=$( pkg-config --libs ${ncurses} 2> /dev/null)
82+ ncurses_ldflags=$( PKG_CONFIG_PATH= " ${ncurses_pkg_config_path} " pkg-config --libs ${ncurses} 2> /dev/null)
7083 option " curses"
7184 if test_nz " ${ncurses_ldflags} " ; then
72- add_cflags ` pkg-config --cflags ${ncurses} 2> /dev/null`
85+ add_cflags ` PKG_CONFIG_PATH= " ${ncurses_pkg_config_path} " pkg-config --cflags ${ncurses} 2> /dev/null`
7386 add_ldflags " ${ncurses_ldflags} "
74- elif is_plat " macosx" ; then
75- add_links " ncurses"
7687 else
7788 add_links " curses"
7889 fi
You can’t perform that action at this time.
0 commit comments