From: florian Date: Tue, 13 Sep 2011 17:29:28 +0000 (+0000) Subject: [package] add jansson package X-Git-Url: http://git.archive.openwrt.org/?a=commitdiff_plain;h=681b62ee778969b37f16abd12bfef32e6be406bc;p=packages.git [package] add jansson package Signed-off-by: Roman Yeryomin git-svn-id: svn://svn.openwrt.org/openwrt/packages@28233 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/libs/jansson/Makefile b/libs/jansson/Makefile new file mode 100644 index 000000000..638b6dceb --- /dev/null +++ b/libs/jansson/Makefile @@ -0,0 +1,45 @@ +# +# Copyright (C) 2011 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + + +include $(TOPDIR)/rules.mk + +PKG_NAME:=jansson +PKG_VERSION:=2.2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.digip.org/jansson/releases/ +PKG_MD5SUM:=198fbff8265686894b6d088dca22896d + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/jansson + SECTION:=libs + CATEGORY:=Libraries + TITLE:=JSON library +endef + +CONFIGURE_ARGS+= LIBS="-Wl,-rpath-link=$(STAGING_DIR)/usr/lib" + +TARGET_CFLAGS += $(FPIC) + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/{lib,include} + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson* $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ +endef + +define Package/jansson/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson*so* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,jansson)) diff --git a/libs/jansson/patches/01-jansson-add-jason_object_deep_update.patch b/libs/jansson/patches/01-jansson-add-jason_object_deep_update.patch new file mode 100644 index 000000000..e9c389dec --- /dev/null +++ b/libs/jansson/patches/01-jansson-add-jason_object_deep_update.patch @@ -0,0 +1,50 @@ +This patch adds a function which can be used to update +json key values on all levels, not just one, automagically +adding new keys to objects which do not exist in old object. + +Signed-off-by: Roman Yeryomin + +--- a/src/value.c 2011-04-21 13:15:58.000000000 +0300 ++++ b/src/value.c 2011-07-01 00:23:05.105103308 +0300 +@@ -215,6 +215,41 @@ + return 0; + } + ++int json_object_deep_update(json_t *object, json_t *other) ++{ ++ void *iter; ++ ++ if(!json_is_object(object) || !json_is_object(other)) ++ return -1; ++ ++ iter = json_object_iter(other); ++ while(iter) { ++ const char *key; ++ json_t *value; ++ ++ key = json_object_iter_key(iter); ++ value = json_object_iter_value(iter); ++ ++ if (!json_is_object(value)) { ++ if ( json_object_set_nocheck( object, key, value ) ) ++ return -1; ++ } else { ++ json_t *subobj = json_object_get(object, key); ++ if (!subobj) { ++ json_object_set_nocheck( object, key, value ); ++ iter = json_object_iter_next(other, iter); ++ continue; ++ } ++ if (json_object_deep_update( subobj, value ) == -1) ++ return -1; ++ } ++ ++ iter = json_object_iter_next(other, iter); ++ } ++ ++ return 0; ++} ++ + void *json_object_iter(json_t *json) + { + json_object_t *object;