Skip to contentSkip to conversation

Fix meson.build on FreeBSD

PATCH In review Niclas Zeising 2 participants 5 messages Jun 2, 2019 – Jun 16, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Fix meson.build on FreeBSD

There are a few small nits needed to make the meson build script work properly on FreeBSD. In short: sys/sysctl.h needs sys/types.h Use sh if bash isn't around.

Also fix a typo while I'm here.

[ please CC me, I'm not subscribed to dri-devel@ ]

Niclas Zeising (2):
meson.build: Fix typo
meson.build: Fix meson script on FreeBSD

 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/2 meson.build: Fix typo

---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
index be768afa..64f0d5b1 100644
@@ -248,7 +248,7 @@ if prog_xslt.found()
 endif
 with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
 
-# Used for tets
+# Used for tests
 prog_bash = find_program('bash')
 
 config.set10('HAVE_VISIBILITY',
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 2/2 meson.build: Fix meson script on FreeBSD

In reply to Niclas Zeising

FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the includes when checking for headers.
Instead of splitting out the check for sys/sysctl.h from the other header checks, just add sys/types.h to all header checks.

FreeBSD doesn't normally ship bash, try regular sh instead if we can't find bash.

---
 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meson.build +2 -2
index 64f0d5b1..eb55b918 100644
@@ -181,7 +181,7 @@ endif
 dep_m = cc.find_library('m', required : false)
 foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
   config.set('HAVE_' + header.underscorify().to_upper(),
-    cc.compiles('#include <@0@>'.format(header), name : '@0@ works'.format(header)))
+    cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
 endforeach
 if cc.has_header_symbol('sys/sysmacros.h', 'major')
   config.set10('MAJOR_IN_SYSMACROS', true)
@@ -249,7 +249,7 @@ endif
 with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found()
 
 # Used for tests
-prog_bash = find_program('bash')
+prog_bash = find_program('bash', 'sh')
 
 config.set10('HAVE_VISIBILITY',
   cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''',
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH libdrm 2/2] meson.build: Fix meson script on FreeBSD

Quoted 6 lines · Niclas Zeising

FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the includes when checking for headers.
Instead of splitting out the check for sys/sysctl.h from the other header checks, just add sys/types.h to all header checks.

If header X depends on Y, then the former should include Y. Can you please file a FreeBSD bug?

That said, the workaround is safe, so I'll split it out + add a comment. I'll send v2 in a second.

Quoted 2 lines

FreeBSD doesn't normally ship bash, try regular sh instead if we can't find bash.

Actually not sure why we're looking for bash. The lot works fine with bash, zsh, dash, ksh you-name it.
Will include those with v2.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH libdrm 2/2] meson.build: Fix meson script on FreeBSD

Quoted 9 lines · Emil Velikov
Quoted 6 lines · Niclas Zeising

FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the includes when checking for headers.
Instead of splitting out the check for sys/sysctl.h from the other header checks, just add sys/types.h to all header checks.

If header X depends on Y, then the former should include Y. Can you please file a FreeBSD bug?

This is how it's documented in the sysctl(3) manual on FreeBSD. I will ask around why that is, but I don't expect it to change.

Quoted 10 lines

That said, the workaround is safe, so I'll split it out + add a comment. I'll send v2 in a second.

Quoted 2 lines

FreeBSD doesn't normally ship bash, try regular sh instead if we can't find bash.

Actually not sure why we're looking for bash. The lot works fine with bash, zsh, dash, ksh you-name it.
Will include those with v2.

As long as it's only using posix stuff, FreeBSD /bin/sh should work fine, as should those others, I think. I had no problems running the tests with FreeBSD /bin/sh when I tried, at least.
Regards

Signature · 5 lines
Niclas Zeising
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel