New package: cJSON (v2)
PATCH 1/1 New package: cJSON (v2)
--- package/Config.in | 1 + package/cjson/Config.in | 7 +++++++ package/cjson/cjson.mk | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 package/cjson/Config.in create mode 100644 package/cjson/cjson.mk
package/Config.in +1 -0
@@ -462,6 +462,7 @@ source "package/slang/Config.in" endmenu menu "JSON/XML" +source "package/cjson/Config.in" source "package/expat/Config.in" source "package/ezxml/Config.in" source "package/json-c/Config.in"
package/cjson/Config.in new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_CJSON + bool "cJSON" + help + An ultra-lightweight, portable, single-file, simple-as-can-be ANSI-C + compliant JSON parser, under MIT license. + + http://cjson.sourceforge.net/
package/cjson/cjson.mk new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 1/1 New package: cJSON (v2)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Danomi" == Danomi Manchego <[email protected]> writes:
Danomi> Signed-off-by: Danomi Manchego <[email protected]> Danomi> ---
Danomi> package/Config.in | 1 + Danomi> package/cjson/Config.in | 7 +++++++ Danomi> package/cjson/cjson.mk | 41 +++++++++++++++++++++++++++++++++++++++++
Danomi> +++ b/package/cjson/cjson.mk
Danomi> @@ -0,0 +1,41 @@
Danomi> +############################################################# Danomi> +#
Danomi> +# cjson
Danomi> +#
Danomi> +#############################################################
Danomi> +CJSON_VERSION = undefined Danomi> +CJSON_SOURCE = cJSONFiles.zip Danomi> +CJSON_SITE = http://$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/project/cjson/
Danomi> +CJSON_INSTALL_STAGING = YES
Danomi> +
Danomi> +define CJSON_EXTRACT_CMDS
Danomi> + unzip -d $(@D) $(DL_DIR)/$(CJSON_SOURCE)
Danomi> +endef
Danomi> +
Danomi> +define CJSON_BUILD_CMDS
Danomi> + cd $(@D)/cJSON && $(TARGET_CC) -Wall -O2 -shared -fpic cJSON.c -o libcJSON.so
I'm not sure it makes sense to build a .so of something as simple (and unversioned) as this. How about just doing a static .a like ezxml? You also shouldn't hardcode compiler flags like -Wall / -O2 but use $(TARGET_CFLAGS) instead - E.G.
cd $(@D)/cJSON && $(TARGET_CC) $(TARGET_CFLAGS) -o cJSON.o cJSON.c cd $(@D)/cJSON && $(TARGET_AR) rcs libcJSON.a cJSON.o
Danomi> +endef
Danomi> +
Danomi> +define CJSON_INSTALL_STAGING_CMDS
Danomi> + $(INSTALL) -D $(@D)/cJSON/cJSON.h $(STAGING_DIR)/usr/include/cJSON.h
Danomi> + $(INSTALL) -D $(@D)/cJSON/libcJSON.so $(STAGING_DIR)/usr/lib/libcJSON.so
Danomi> +endef
Danomi> +
Danomi> +define CJSON_INSTALL_TARGET_CMDS
Danomi> + $(INSTALL) -D $(@D)/cJSON/libcJSON.so $(TARGET_DIR)/usr/lib/libcJSON.so
You should also install the header file into TARGET_DIR. It will get removed by target-finalize if it isn't needed.
Care to fix and resend?
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 New package: cJSON (v2)
Peter,
Quoted 2 lines
I'm not sure it makes sense to build a .so of something as simple (and unversioned) as this. How about just doing a static .a like ezxml?
We use cJSON in about half a dozen apps in our project, so a .so seemed like the way to go. If you feel strongly about this, would you be open to having an option to make a shared object? (Maybe something like the logic in zlib.mk or qt.mk.)
Quoted 2 lines
You also shouldn't hardcode compiler flags like -Wall / -O2 but use $(TARGET_CFLAGS) instead - E.G.
Understood, will adjust.
Quoted 2 lines
You should also install the header file into
TARGET_DIR. It will get removed by target-finalize if it isn't needed.
Ah, I didn't know that. Nice!
Quoted 1 line
Care to fix and resend?
Certainly - after hearing your feedback on the .so/.a question.
Danomi -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120611/9411f836/attachment.html>
PATCH 1/1 New package: cJSON (v2)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Danomi" == Danomi Manchego <[email protected]> writes:
Danomi> Peter,
Quoted 2 lines
Quoted 2 lines
I'm not sure it makes sense to build a .so of something as simple (and unversioned) as this. How about just doing a static .a like ezxml??
Danomi> We use cJSON in about half a dozen apps in our project, so a Danomi> .so seemed like the way to go. ?If you feel strongly about Danomi> this, would you be open to having an option to make a shared Danomi> object? ?(Maybe something like the logic in zlib.mk or qt.mk.)
cJSON is quite small, so the overhead of dynamically loading it is probably in the same ballpark:
size cJSON.o
text data bss dec hex filename
7047 16 8 7071 1b9f cJSON.o
But ok, I don't feel strongly about it. If you prefer .so, then keep it like that.
Signature · 1 line
Bye, Peter Korsgaard