[PATCH] build-aux: use GNU sed for syntax-check on FreeBSD

Roman Bogorodskiy bogorodskiy at gmail.com
Wed Aug 5 16:02:41 UTC 2020


BSD sed(1) and GNU sed(1) syntax are not compatible, and as
syntax-check.mk uses the GNU flavor, set SED variable to
'gsed' by default.

Signed-off-by: Roman Bogorodskiy <bogorodskiy at gmail.com>
---
 build-aux/syntax-check.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

I'm not sure if this requires a more comprehensive solution.
I have mixed feeling about this. If we try to just use gsed like in this
patch, it'll fail because we don't require gsed to be installed.

OTOH, an alternative solution like checking for gsed in meson.build,
and probably even generation of some files with variables to be sourced
by .mk files feels like too much of a hassle, esp. in this context.

diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 6eb59cf90e..bbfcb63152 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -28,7 +28,15 @@ ME := build-aux/syntax-check.mk
 # ignoring the module description.
 AWK ?= awk
 GREP ?= grep
+# FreeBSD (and probably some other OSes too) ships own version of sed(1), not
+# compatible with the GNU sed. GNU sed is available as gsed(1), so use this
+# instead
+UNAME := $(shell uname)
+ifeq ($(UNAME),FreeBSD)
+SED ?= gsed
+else
 SED ?= sed
+endif
 
 # Helper variables.
 _empty =
-- 
2.27.0




More information about the libvir-list mailing list