[libhubbub] fix build with json-c 0.12

David Tardon dtardon at fedoraproject.org
Mon Aug 18 11:05:07 UTC 2014


commit a9b0dfa9f0371331e6eb8f9a97559032b4092049
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Aug 18 13:04:33 2014 +0200

    fix build with json-c 0.12

 0001-allow-build-with-json-c-0.12.patch |   47 +++++++++++++++++++++++++++++++
 libhubbub.spec                          |    2 +
 2 files changed, 49 insertions(+), 0 deletions(-)
---
diff --git a/0001-allow-build-with-json-c-0.12.patch b/0001-allow-build-with-json-c-0.12.patch
new file mode 100644
index 0000000..4bc181c
--- /dev/null
+++ b/0001-allow-build-with-json-c-0.12.patch
@@ -0,0 +1,47 @@
+From 13bd4b9cc2e311b43f49b0e6f002dc738a779cb9 Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Mon, 18 Aug 2014 12:46:44 +0200
+Subject: [PATCH] allow build with json-c 0.12
+
+The library, the include dir and the .pc file were renamed from json to
+json-c a few releases ago, but the old names were kept for backwards
+compatibility. They were finally removed in version 0.12.
+---
+ Makefile | 18 ++++++++++++++----
+ 1 file changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 4ec03f3..afbbe46 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,13 +46,23 @@ include $(NSBUILD)/Makefile.top
+ ifeq ($(WANT_TEST),yes)
+   # We require the presence of libjson -- http://oss.metaparadigm.com/json-c/
+   ifneq ($(PKGCONFIG),)
++    # The pkgconfig file name has changed from json.pc to json-c.pc
++    JSONC_CFLAGS := $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json-c)
++    JSONC_LIBS := $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --libs json-c)
++    JSON_CFLAGS := $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json)
++    JSON_LIBS := $(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --libs json)
+     TESTCFLAGS := $(TESTCFLAGS) \
+-		$(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --cflags json)
++		$(if $(strip $(JSONC_CFLAGS)),$(JSONC_CFLAGS),$(JSON_CFLAGS))
+     TESTLDFLAGS := $(TESTLDFLAGS) \
+-		$(shell $(PKGCONFIG) $(PKGCONFIGFLAGS) --libs json)
++		$(if $(strip $(JSONC_LIBS)),$(JSONC_LIBS),$(JSON_LIBS))
+   else
+-    TESTCFLAGS := $(TESTCFLAGS) -I$(PREFIX)/include/json
+-    TESTLDFLAGS := $(TESTLDFLAGS) -ljson
++    ifeq ($(wildcard $(PREFIX)/include/json-c/json.h),)
++        TESTCFLAGS := $(TESTCFLAGS) -I$(PREFIX)/include/json
++        TESTLDFLAGS := $(TESTLDFLAGS) -ljson
++    else
++        TESTCFLAGS := $(TESTCFLAGS) -I$(PREFIX)/include/json-c
++        TESTLDFLAGS := $(TESTLDFLAGS) -ljson-c
++    endif
+   endif
+ 
+   ifneq ($(GCCVER),2)
+-- 
+1.9.3
+
diff --git a/libhubbub.spec b/libhubbub.spec
index 3ce1054..60fa378 100644
--- a/libhubbub.spec
+++ b/libhubbub.spec
@@ -14,6 +14,8 @@ BuildRequires: pkgconfig(check)
 BuildRequires: pkgconfig(json-c)
 BuildRequires: pkgconfig(libparserutils)
 
+Patch0: 0001-allow-build-with-json-c-0.12.patch
+
 %description
 Hubbub is an HTML5 compliant parsing library, written in C. It was
 developed as part of the NetSurf project.


More information about the scm-commits mailing list