summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2023-04-28 11:35:50 +0200
committerDavid Gibson <github@gibson.dropbear.id.au>2023-05-14 15:11:32 +1000
commit0ac8b30ba5a112a616d0e9d482546e50bf7a6fdf (patch)
tree53931bad8284922a059f3b1c2043673c41914441
parentf1657b2fb5be12d85ceb6a50d2db8a006dee830c (diff)
downloaddevice-tree-compiler-0ac8b30ba5a112a616d0e9d482546e50bf7a6fdf.tar.gz
yaml: Depend on libyaml >= 0.2.3
libyaml before 0.2.3 expects non-const string parameters. Supporting both variants would require either cpp magic or ignoring "discarded-qualifiers" compiler warnings. For the sake of simplicity just support libyaml 0.2.3 and newer. Note that NO_YAML can be overwritten on the make command line. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--Makefile6
-rw-r--r--meson.build2
-rwxr-xr-xtests/run_tests.sh2
3 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6ccee13..784e2f8 100644
--- a/Makefile
+++ b/Makefile
@@ -55,7 +55,11 @@ else
CFLAGS += $(shell $(PKG_CONFIG) --cflags valgrind)
endif
-NO_YAML := $(shell $(PKG_CONFIG) --exists yaml-0.1; echo $$?)
+# libyaml before version 0.2.3 expects non-const string parameters. Supporting
+# both variants would require either cpp magic or passing
+# -Wno-error=discarded-qualifiers to the compiler. For the sake of simplicity
+# just support libyaml >= 0.2.3.
+NO_YAML := $(shell $(PKG_CONFIG) --atleast-version 0.2.3 yaml-0.1; echo $$?)
ifeq ($(NO_YAML),1)
CFLAGS += -DNO_YAML
else
diff --git a/meson.build b/meson.build
index cef113f..4654803 100644
--- a/meson.build
+++ b/meson.build
@@ -42,7 +42,7 @@ else
endif
yamltree = 'yamltree.c'
-yaml = dependency('yaml-0.1', required: get_option('yaml'), static: static_build)
+yaml = dependency('yaml-0.1', version: '>=0.2.3', required: get_option('yaml'), static: static_build)
if not yaml.found()
add_project_arguments('-DNO_YAML', language: 'c')
yamltree = []
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 2af8c15..d7a6d49 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -32,7 +32,7 @@ if [ -n "$NO_YAML" ]; then
no_yaml=false
fi
else
- if pkg-config --exists yaml-0.1; then
+ if pkg-config --atleast-version 0.2.3 yaml-0.1; then
no_yaml=false
else
no_yaml=true