aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Anderson <scott@anderso.nz>2019-05-17 23:15:33 +1200
committerScott Anderson <ascent12@hotmail.com>2019-05-17 23:03:24 +0000
commitc0ce7c653c56c36edad1e1a69c6a903f3824be54 (patch)
tree0f6f58166bfeb6b11837c33fac529866165920a5
parent783d64e77861f5b179a6e40e39a1cb341a03eecc (diff)
downloadexternal_drm_info-c0ce7c653c56c36edad1e1a69c6a903f3824be54.tar.gz
external_drm_info-c0ce7c653c56c36edad1e1a69c6a903f3824be54.tar.bz2
external_drm_info-c0ce7c653c56c36edad1e1a69c6a903f3824be54.zip
Add json-c meson wrap
Needed for distros like Debian that still only have an old json-c. Also, apparantly json-c intends people to use <json.h> with -I${prefix}/include/json-c, as that's what their pkg-config and documentation says, so this also swaps over to that. It's also needed for the subproject to work.
-rw-r--r--.gitignore2
-rw-r--r--json.c2
-rw-r--r--main.c3
-rw-r--r--meson.build2
-rw-r--r--pretty.c2
-rw-r--r--subprojects/json-c.wrap10
6 files changed, 17 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3d6b41c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+subprojects/packagecache
+subprojects/json-c-0.13.1
diff --git a/json.c b/json.c
index 7361493..7dba4aa 100644
--- a/json.c
+++ b/json.c
@@ -8,7 +8,7 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <json-c/json_object.h>
+#include <json_object.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
diff --git a/main.c b/main.c
index 1b2650e..0e30a26 100644
--- a/main.c
+++ b/main.c
@@ -4,7 +4,8 @@
#include <stdlib.h>
#include <unistd.h>
-#include <json-c/json_util.h>
+#include <json_object.h>
+#include <json_util.h>
#include "drm_info.h"
diff --git a/meson.build b/meson.build
index eaaa433..604300a 100644
--- a/meson.build
+++ b/meson.build
@@ -11,7 +11,7 @@ add_project_arguments('-D_POSIX_C_SOURCE=200809L', language: 'c')
conf = configuration_data()
libdrm = dependency('libdrm', version: '>= 2.4.74')
-jsonc = dependency('json-c', version: '>=0.13')
+jsonc = dependency('json-c', version: '>=0.13', fallback: ['json-c', 'json_c'])
# These specific versions added more modifiers, so we check for these instead
# of using #ifdef on every single one
diff --git a/pretty.c b/pretty.c
index e680fa7..98f6b53 100644
--- a/pretty.c
+++ b/pretty.c
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <string.h>
-#include <json-c/json.h>
+#include <json.h>
#include <drm_fourcc.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
diff --git a/subprojects/json-c.wrap b/subprojects/json-c.wrap
new file mode 100644
index 0000000..648f377
--- /dev/null
+++ b/subprojects/json-c.wrap
@@ -0,0 +1,10 @@
+[wrap-file]
+directory = json-c-0.13.1
+
+source_url = https://s3.amazonaws.com/json-c_releases/releases/json-c-0.13.1.tar.gz
+source_filename = json-c-0.13.1.tar.gz
+source_hash = b87e608d4d3f7bfdd36ef78d56d53c74e66ab278d318b71e6002a369d36f4873
+
+patch_url = https://github.com/ascent12/json-c/releases/download/0.13.1-1/json-c_0.13.1-1_meson.tar.gz
+patch_filename = json-c_0.13.1-1_meson.tar.gz
+patch_hash = 35b3fb0163a8c0359b10f348236a04990d313cb5c56c6fd2e437375f4e9932a6