[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    Re: [PATCH xserver] meson: Add an option to build XSELINUX.
From:       Peter Hutterer <peter.hutterer () who-t ! net>
Date:       2018-08-10 4:21:30
Message-ID: 20180810042130.GA21917 () jelly
[Download RAW message or body]

On Thu, Aug 09, 2018 at 08:05:05PM -0700, Eric Anholt wrote:
> Peter Hutterer <peter.hutterer@who-t.net> writes:
> 
> > On Thu, Aug 09, 2018 at 01:02:41PM -0700, Eric Anholt wrote:
> >> Dependencies are ported from the automake build.
> >> 
> >> v2: Make it a tristate defaulting to 'auto'.  Use pkg-config for libaudit.
> >> 
> >> Signed-off-by: Eric Anholt <eric@anholt.net>
> >> ---
> >>  meson.build       | 20 +++++++++++++++++---
> >>  meson_options.txt |  2 ++
> >>  2 files changed, 19 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/meson.build b/meson.build
> >> index e7ce68a502c3..53cdbe2beb3d 100644
> >> --- a/meson.build
> >> +++ b/meson.build
> >> @@ -442,9 +442,6 @@ elif get_option('mitshm') == 'true'
> >>      build_mitshm = true
> >>  endif
> >>  
> >> -# XXX: Allow configuration of these.
> >> -build_xselinux = false
> >> -
> >>  m_dep = cc.find_library('m', required : false)
> >>  dl_dep = cc.find_library('dl', required : false)
> >>  
> >> @@ -506,6 +503,23 @@ inc = include_directories(
> >>      'xfixes',
> >>  )
> >>  
> >> +build_xselinux = false
> >> +if get_option('xselinux') != 'false'
> >> +    dep_selinux = dependency('libselinux', version: '>= 2.0.86',
> >> +			     required: get_option('xselinux') == 'true')
> >> +    dep_audit = dependency('audit', required: get_option('xselinux') == 'true')
> >> +    if get_option('xselinux') == 'true'
> >> +        build_xselinux = true
> >> +    else
> >
> > you don't need the if here, if option(xselinux) is true, both deps will
> > are required and cannot be anything but found() == true.
> >
> > but either way, Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
> 
> I'm trying to make sure that build_xselinux is never set if the tristate
> is set to false, but that we auto-select if we're in auto mode.

sure, but this (hand-written) diff should give you the same result:

+build_xselinux = false
+if get_option('xselinux') != 'false'
+    dep_selinux = dependency('libselinux', version: '>= 2.0.86',
+			     required: get_option('xselinux') == 'true')
+    dep_audit = dependency('audit', required: get_option('xselinux') == 'true')
+    build_xselinux = dep_selinux.found() and dep_audit.found()
+
+    if build_xselinux
+        common_dep += dep_selinux
+        common_dep += dep_audit
+    endif
+endif

if xselinux is false, you never enter this anyway
if xselinux is true, you either have both libs or fail earlier, so found() and
        found() is always true
if xselinux is auto, found() and found() decides whether to build it

arguably the second "if build_xselinux" isn't required either because
dep_selinux/dep_audit are valid dependency objects even if not found. but I
guess we don't want to add one if the other one doesn't exist.

Cheers,
   Peter
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic