[Mesa-dev] [PATCH 2/2] meson: prefer 'auto', 'true', 'false'

Erik Faye-Lund kusmabite at gmail.com
Tue Oct 31 07:29:29 UTC 2017


This way users don't have to care if these options are boolean or
not, as they take the same values (apart from 'auto').

Signed-off-by: Erik Faye-Lund <kusmabite at gmail.com>
---

I'm not quite sure about this patch. Yes, it cleans up the semantics, but
at the same time, it breaks backwards compatibility for some of these
options. On the other hand, since the meson-support is so young, perhaps
breaking backwards-compatibility like this is not the end of the world?

 meson.build       | 14 +++++++-------
 meson_options.txt |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/meson.build b/meson.build
index 24019e7460..d22d49535a 100644
--- a/meson.build
+++ b/meson.build
@@ -170,7 +170,7 @@ endif
 with_gbm = get_option('gbm')
 if with_gbm == 'auto' and with_dri  # TODO: or gallium
   with_gbm = host_machine.system() == 'linux'
-elif with_gbm == 'yes'
+elif with_gbm == 'true'
   if not ['linux', 'bsd'].contains(host_machine.system())
     error('GBM only supports unix-like platforms')
   endif
@@ -182,7 +182,7 @@ endif
 _egl = get_option('egl')
 if _egl == 'auto'
   with_egl = with_dri and with_shared_glapi and egl_native_platform != ''
-elif _egl == 'yes'
+elif _egl == 'true'
   if not with_dri
     error('EGL requires dri')
   elif not with_shared_glapi
@@ -264,7 +264,7 @@ if with_dri3 == 'auto'
   else
     with_dri3 = false
  endif
-elif with_dri3 == 'yes'
+elif with_dri3 == 'true'
   with_dri3 = true
 else
   with_dri3 = false
@@ -691,8 +691,8 @@ if with_glvnd
 endif
 
 # TODO: make this conditional
-if with_valgrind != 'no'
-  dep_valgrind = dependency('valgrind', required : with_valgrind == 'yes')
+if with_valgrind != 'false'
+  dep_valgrind = dependency('valgrind', required : with_valgrind == 'true')
   if dep_valgrind.found()
     pre_args += '-DHAVE_VALGRIND'
   endif
@@ -713,8 +713,8 @@ endif
 
 # TODO: llvm-prefix and llvm-shared-libs
 
-if with_libunwind != 'no'
-  dep_unwind = dependency('libunwind', required : with_libunwind == 'yes')
+if with_libunwind != 'false'
+  dep_unwind = dependency('libunwind', required : with_libunwind == 'true')
   if dep_unwind.found()
     pre_args += '-DHAVE_LIBUNWIND'
   endif
diff --git a/meson_options.txt b/meson_options.txt
index e4a20bfad4..f6f21b4c02 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -140,14 +140,14 @@ option(
   'valgrind',
   type : 'combo',
   value : 'auto',
-  choices : ['auto', 'yes', 'no'],
+  choices : ['auto', 'true', 'false'],
   description : 'Build with valgrind support'
 )
 option(
   'libunwind',
   type : 'combo',
   value : 'auto',
-  choices : ['auto', 'yes', 'no'],
+  choices : ['auto', 'true', 'false'],
   description : 'Use libunwind for stack-traces'
 )
 option(
-- 
2.11.0



More information about the mesa-dev mailing list