Monday, 18 August 2014

libhubbub: allow build with json-c 0.12

>From 13bd4b9cc2e311b43f49b0e6f002dc738a779cb9 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@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

Hi,

the attached patch fixes ${SUBJECT}.

D.

No comments:

Post a Comment