From cb29a77c94f813bb6f11f3abebb06b3a2dc039a2 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 20 Jan 2012 12:59:30 +0530 Subject: [PATCH 1/3] Add a pkgconfig file for uninstalled builds This allows systems certain types of build setups to work. Specifically, this will help when building on Android and using json-c as a dependency for another package. --- configure.in | 1 + json-uninstalled.pc.in | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 json-uninstalled.pc.in diff --git a/configure.in b/configure.in index b2c3cbe..8b3b19b 100644 --- a/configure.in +++ b/configure.in @@ -35,6 +35,7 @@ AC_CONFIG_FILES([ Makefile json.pc tests/Makefile +json-uninstalled.pc ]) AC_OUTPUT diff --git a/json-uninstalled.pc.in b/json-uninstalled.pc.in new file mode 100644 index 0000000..967f771 --- /dev/null +++ b/json-uninstalled.pc.in @@ -0,0 +1,11 @@ +prefix= +exec_prefix= +libdir=@abs_top_builddir@ +includedir=@abs_top_srcdir@ + +Name: json +Description: JSON implementation in C +Version: @VERSION@ +Requires: +Libs: -L@abs_top_builddir@ -ljson +Cflags: -I@abs_top_srcdir@ From 17caddc0ab7ae953bcbc79b5ca98a2e7abf01e00 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 20 Jan 2012 12:59:59 +0530 Subject: [PATCH 2/3] Run configure in the autogen.sh script This is convention in most open source projects. --- autogen.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/autogen.sh b/autogen.sh index c67b903..990096c 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1 +1,2 @@ autoreconf -v --install || exit 1 +exec ./configure "$@" From a1221eba70a0590a23088c365710a6d35289d04e Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Fri, 20 Jan 2012 13:00:45 +0530 Subject: [PATCH 3/3] Add an Android-friendly build system This dependson the Androgenizer project, which helps keep autofoo-based build systems in sync with the Android build. --- Android.configure.mk | 39 +++++++++++++++++++++++++++++++++++++++ Makefile.am | 14 ++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 Android.configure.mk diff --git a/Android.configure.mk b/Android.configure.mk new file mode 100644 index 0000000..a6265ad --- /dev/null +++ b/Android.configure.mk @@ -0,0 +1,39 @@ +# This file is the top android makefile for all sub-modules. + +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +json_c_TOP := $(LOCAL_PATH) + +JSON_C_BUILT_SOURCES := Android.mk + +JSON_C_BUILT_SOURCES := $(patsubst %, $(abspath $(json_c_TOP))/%, $(JSON_C_BUILT_SOURCES)) + +.PHONY: json-c-configure json-c-configure-real +json-c-configure-real: + echo $(JSON_C_BUILT_SOURCES) + cd $(json_c_TOP) ; \ + $(abspath $(json_c_TOP))/autogen.sh && \ + CC="$(CONFIGURE_CC)" \ + CFLAGS="$(CONFIGURE_CFLAGS)" \ + LD=$(TARGET_LD) \ + LDFLAGS="$(CONFIGURE_LDFLAGS)" \ + CPP=$(CONFIGURE_CPP) \ + CPPFLAGS="$(CONFIGURE_CPPFLAGS)" \ + PKG_CONFIG_LIBDIR=$(CONFIGURE_PKG_CONFIG_LIBDIR) \ + PKG_CONFIG_TOP_BUILD_DIR=/ \ + ac_cv_func_malloc_0_nonnull=yes \ + ac_cv_func_realloc_0_nonnull=yes \ + $(abspath $(json_c_TOP))/$(CONFIGURE) --host=$(CONFIGURE_HOST) \ + --prefix=/system \ + && \ + for file in $(JSON_C_BUILT_SOURCES); do \ + rm -f $$file && \ + make -C $$(dirname $$file) $$(basename $$file) ; \ + done + +json-c-configure: json-c-configure-real + +PA_CONFIGURE_TARGETS += json-c-configure + +-include $(json_c_TOP)/Android.mk diff --git a/Makefile.am b/Makefile.am index d4a7bbb..3c53b93 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,3 +44,17 @@ distclean-local: -rm -rf $(testsubdir) -rm -rf config.h.in~ Makefile.in aclocal.m4 autom4te.cache/ config.guess config.sub configure depcomp install-sh ltmain.sh missing +ANDROID_CFLAGS = -I$(top_srcdir) -DHAVE_CONFIG_H + +Android.mk: Makefile.am + androgenizer -:PROJECT json-c \ + -:SHARED libjson \ + -:TAGS eng debug \ + -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \ + -:SOURCES $(libjson_la_SOURCES) $(nodist_libjson_la_SOURCES) \ + -:CFLAGS $(DEFS) $(ANDROID_CFLAGS) $(libjson_la_CFLAGS) \ + -:LDFLAGS $(libjson_la_LDFLAGS) $(libjson_la_LIBADD) \ + -:HEADER_TARGET json \ + -:HEADERS $(libjsoninclude_HEADERS) \ + -:PASSTHROUGH LOCAL_ARM_MODE:=arm \ + > $@