]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
build: Set minimum version for json-c and add fallback support
authorDaniel Wagner <dwagner@suse.de>
Mon, 18 Oct 2021 15:40:18 +0000 (17:40 +0200)
committerDaniel Wagner <dwagner@suse.de>
Tue, 19 Oct 2021 09:28:37 +0000 (11:28 +0200)
commitcad1ef9710f39e9ec0235aa9f26003960eac32fa
tree91fb30959a5e2bc818187d27f9c25a9492f8f9ab
parent86fb31315708f38a82edd72790f94a171a96e6f8
build: Set minimum version for json-c and add fallback support

Set minimum version for json-c to 0.13.

nvme-cli uses json_util_get_last_err() which got introduced in 0.13,
released in December 2017.

Also, meson supports embedded library build. This is very handy for
system which ship outdated an really outdated json-c library.

The include path for json.h has to be adapted. The json-c upstream
project is not clear which include prefix should be used ('#include
<json-c/json.h>" vs '#include <json.h>'. In order to support embedded
builds, we need to use the second version of the include. The source
code is added to the build, hence we use the include directory path of
the project layout. And json-c has all include files in the root
directory. This is no problem when using a installed version of json-c
as pkg-config adds '-I/usr/inlude/json-c' to the include paths:

  $pkg-config --cflags json-c
  -I/usr/include/json-c

So the simplest thing to support both build cased (external/embedded)
just drop the include prefix.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
Makefile
meson.build
nvme.h