From ff9bf223c24143260a975f45963eb90f40565c57 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 17 May 2018 13:44:30 -0700 Subject: [PATCH] meson: make nm binary optional This makes nm not required, but used if found. In general I imagine that this means that on windows nm wont be found, and on other platforms it will. v2: - fix gbm and egl symbols check tests to only be run if nm is found - reword commit message to reflect the code change Reviewed-by: Eric Anholt --- meson.build | 5 ++++- src/egl/meson.build | 2 +- src/gbm/meson.build | 2 +- src/mapi/es1api/meson.build | 2 +- src/mapi/es2api/meson.build | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 87ce5f7872e..f72bdc946bf 100644 --- a/meson.build +++ b/meson.build @@ -1502,8 +1502,11 @@ endif pkg = import('pkgconfig') +prog_nm = find_program('nm', required : false) env_test = environment() -env_test.set('NM', find_program('nm').path()) +if prog_nm.found() + env_test.set('NM', prog_nm.path()) +endif # This quirk needs to be applied to sources with functions defined in assembly # as GCC LTO drops them. See: https://bugs.freedesktop.org/show_bug.cgi?id=109391 diff --git a/src/egl/meson.build b/src/egl/meson.build index 38ffb512f1c..3a0fd01d244 100644 --- a/src/egl/meson.build +++ b/src/egl/meson.build @@ -192,7 +192,7 @@ pkg.generate( extra_cflags : gl_pkgconfig_c_flags, ) -if with_tests +if with_tests and prog_nm.found() if with_glvnd # TODO: add glvnd symbol check else diff --git a/src/gbm/meson.build b/src/gbm/meson.build index b2ad6673592..b7262c59802 100644 --- a/src/gbm/meson.build +++ b/src/gbm/meson.build @@ -66,7 +66,7 @@ pkg.generate( libraries_private : '-ldl', # FIXME: autotools lists this a incomplete ) -if with_tests +if with_tests and prog_nm.found() test( 'gbm-symbols-check', find_program('gbm-symbols-check'), diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build index 8e9587e3580..53bdc16d946 100644 --- a/src/mapi/es1api/meson.build +++ b/src/mapi/es1api/meson.build @@ -52,7 +52,7 @@ pkg.generate( libraries_private : gl_priv_libs, ) -if with_tests +if with_tests and prog_nm.found() test( 'es1-ABI-check', find_program('ABI-check'), diff --git a/src/mapi/es2api/meson.build b/src/mapi/es2api/meson.build index 5b2c52b024d..d374bd80849 100644 --- a/src/mapi/es2api/meson.build +++ b/src/mapi/es2api/meson.build @@ -52,7 +52,7 @@ pkg.generate( libraries_private : gl_priv_libs, ) -if with_tests +if with_tests and prog_nm.found() test( 'es2-ABI-check', find_program('ABI-check'), -- 2.30.2