ncurses-meson-dep

Meson ncurses detection 100% real no fake
git clone git://git.sgregoratto.me/ncurses-meson-dep
Log | Files | Refs | README

commit db29a10cdfce4bfd0d38a947b47de6e563acd238
parent 917d206ebea148206f578caf4554114eb62c21dc
Author: Stephen Gregoratto <dev@sgregoratto.me>
Date:   Fri,  4 Sep 2020 15:13:47 +1000

Improve path building, fix declare_dependency()

Diffstat:
Mncurses/meson.build | 24+++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/ncurses/meson.build b/ncurses/meson.build @@ -13,10 +13,10 @@ nc_headers = [ 'curses.h', ] nc_progs = [ - 'ncursesw6-config', - 'ncursesw5-config', - 'ncurses6-config', - 'ncurses5-config', + 'ncursesw6', + 'ncursesw5', + 'ncurses6', + 'ncurses5', ] wide_incantations = [ '-D_XOPEN_SOURCE_EXTENDED', @@ -42,10 +42,15 @@ foreach l : nc_libs endif endforeach foreach p : nc_progs - prog = find_program(p, - '/bin/' + p, - '/usr/bin/' + p, - '/usr/local/bin/' + p, + curses = dependency(p, method: 'config', required: false) + if curses.found() + subdir_done() + endif + name = p + '-config' + prog = find_program(name, + / 'bin' / name, + / 'usr' / 'bin' / name, + / 'usr' / 'local' / 'bin' / name, required: false ) if not prog.found() @@ -55,8 +60,9 @@ foreach p : nc_progs cflags = run_command(prog, '--cflags').stdout().strip() version = run_command(prog, '--version').stdout().strip() + cflags = ' '.join([cflags, wide_incantations]) curses = declare_dependency( - compile_args: [cflags, wide_incantations], + compile_args: cflags, link_args: libs, version: version, )