[PATCH] meson: fix some FreeBSD checks regressions

Roman Bogorodskiy posted 1 patch 3 years, 8 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200808092209.65263-1-bogorodskiy@gmail.com
meson.build | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
[PATCH] meson: fix some FreeBSD checks regressions
Posted by Roman Bogorodskiy 3 years, 8 months ago
 * Add missing prerequisite headers for checking link_addr(3)
   in net/if_dl.h,
 * Add missing prerequisite headers for checking BRDGSFD, BRDGADD,
   BRDGDEL in net/if_bridgevar.h,
 * When checking for ifconfig(8), set not only IFCONFIG value,
   but also IFCONFIG_PATH as it's used in util/virnetdevip.c.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
 meson.build | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index 19b4795527..0913308bec 100644
--- a/meson.build
+++ b/meson.build
@@ -770,7 +770,7 @@ symbols = [
   [ 'linux/if_vlan.h', 'GET_VLAN_VID_CMD' ],
 
   # Check for BSD approach for setting MAC addr
-  [ 'net/if_dl.h', 'link_addr' ],
+  [ 'net/if_dl.h', 'link_addr', '#include <sys/types.h>\n#include <sys/socket.h>' ],
 ]
 
 if host_machine.system() == 'linux'
@@ -791,15 +791,18 @@ if host_machine.system() == 'linux'
 endif
 
 foreach symbol : symbols
-  if cc.has_header_symbol(symbol[0], symbol[1], args: '-D_GNU_SOURCE')
+  if cc.has_header_symbol(symbol[0], symbol[1], args: '-D_GNU_SOURCE', prefix: symbol.get(2, ''))
     conf.set('HAVE_DECL_@0@'.format(symbol[1].to_upper()), 1)
   endif
 endforeach
 
 # Check for BSD approach for bridge management
-if (cc.has_header_symbol('net/if_bridgevar.h', 'BRDGSFD') and
-    cc.has_header_symbol('net/if_bridgevar.h', 'BRDGADD') and
-    cc.has_header_symbol('net/if_bridgevar.h', 'BRDGDEL'))
+brd_required_headers = '''#include <stdint.h>
+#include <net/if.h>
+#include <net/ethernet.h>'''
+if (cc.has_header_symbol('net/if_bridgevar.h', 'BRDGSFD', prefix: brd_required_headers) and
+    cc.has_header_symbol('net/if_bridgevar.h', 'BRDGADD', prefix: brd_required_headers) and
+    cc.has_header_symbol('net/if_bridgevar.h', 'BRDGDEL', prefix: brd_required_headers))
   conf.set('HAVE_BSD_BRIDGE_MGMT', 1)
 endif
 
@@ -900,6 +903,7 @@ foreach name : required_programs
   prog = find_program(name, required: true, dirs: libvirt_sbin_path)
   varname = name.underscorify()
   conf.set_quoted(varname.to_upper(), prog.path())
+  conf.set_quoted('@0@_PATH'.format(varname.to_upper()), prog.path())
   set_variable('@0@_prog'.format(varname), prog)
 endforeach
 
-- 
2.27.0

Re: [PATCH] meson: fix some FreeBSD checks regressions
Posted by Pavel Hrdina 3 years, 8 months ago
On Sat, Aug 08, 2020 at 01:22:09PM +0400, Roman Bogorodskiy wrote:
>  * Add missing prerequisite headers for checking link_addr(3)
>    in net/if_dl.h,
>  * Add missing prerequisite headers for checking BRDGSFD, BRDGADD,
>    BRDGDEL in net/if_bridgevar.h,
>  * When checking for ifconfig(8), set not only IFCONFIG value,
>    but also IFCONFIG_PATH as it's used in util/virnetdevip.c.
> 
> Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
> ---
>  meson.build | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)

It would be probably better to split this into 3 patches as it fixes
three different issues but it's good enough.

<rant>
I really hate a lot the fact that in order to use some headers you have
to include some other headers. It's so annoying and ridiculous.
</rant>

Thanks for addressing these regressions!

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Re: [PATCH] meson: fix some FreeBSD checks regressions
Posted by Roman Bogorodskiy 3 years, 8 months ago
  Pavel Hrdina wrote:

> On Sat, Aug 08, 2020 at 01:22:09PM +0400, Roman Bogorodskiy wrote:
> >  * Add missing prerequisite headers for checking link_addr(3)
> >    in net/if_dl.h,
> >  * Add missing prerequisite headers for checking BRDGSFD, BRDGADD,
> >    BRDGDEL in net/if_bridgevar.h,
> >  * When checking for ifconfig(8), set not only IFCONFIG value,
> >    but also IFCONFIG_PATH as it's used in util/virnetdevip.c.
> > 
> > Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
> > ---
> >  meson.build | 14 +++++++++-----
> >  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> It would be probably better to split this into 3 patches as it fixes
> three different issues but it's good enough.

Thanks for the reviews, pushed as 3 separate patches.

> <rant>
> I really hate a lot the fact that in order to use some headers you have
> to include some other headers. It's so annoying and ridiculous.
> </rant>

Indeed.
It's also frustrating that there's no way (I guess) to differentiate
cases when the symbol is not present, or there's an error in the check
itself.

> 
> Thanks for addressing these regressions!
> 
> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>



Roman Bogorodskiy