Skip to contentSkip to conversation

jsmn: new package

PATCH New David Bachelart 2 participants 2 messages Jan 3, 2017 – Jan 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 jsmn: new package

---
Changes v1 -> v2:
- Add JSMN_INSTALL_TARGET = NO in mk file (suggested by Lionel Orry)

---
 package/Config.in      |  1 +
 package/jsmn/Config.in |  7 +++++++
 package/jsmn/jsmn.hash |  4 ++++
 package/jsmn/jsmn.mk   | 26 ++++++++++++++++++++++++++
 4 files changed, 38 insertions(+)
 create mode 100644 package/jsmn/Config.in
 create mode 100644 package/jsmn/jsmn.hash
 create mode 100644 package/jsmn/jsmn.mk
package/Config.in +1 -0
index 59fa851..18b23a0 100644
@@ -1107,6 +1107,7 @@ menu "JSON/XML"
 	source "package/expat/Config.in"
 	source "package/ezxml/Config.in"
 	source "package/jansson/Config.in"
+	source "package/jsmn/Config.in"
 	source "package/json-c/Config.in"
 	source "package/json-glib/Config.in"
 	source "package/jsoncpp/Config.in"
package/jsmn/Config.in new file +7 -0
new file mode 100644
index 0000000..23d20f5
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_JSMN
+	bool "jsmn"
+	help
+	  jsmn (pronounced like 'jasmine') is a minimalistic JSON parser in C. It can 
+	  be easily integrated into resource-limited or embedded projects.
+
+	  https://github.com/zserge/jsmn/
package/jsmn/jsmn.hash new file +4 -0
new file mode 100644
index 0000000..5cc51c3
@@ -0,0 +1,4 @@
+# Locally computed
+md5 78e2731c5697a3c35795b6350402e015    jsmn-6021415cc75e7922d45b12935f56348b064d8a7f.tar.gz
+sha1    09b1a3493db6b1a77b03bc835aa9be6345db5269    jsmn-6021415cc75e7922d45b12935f56348b064d8a7f.tar.gz
+sha256  e08993848b2abab62aa9572a560bb6e5ed4762f8537cd67c4de6cb17e17090a0    jsmn-6021415cc75e7922d45b12935f56348b064d8a7f.tar.gz
package/jsmn/jsmn.mk new file +26 -0
new file mode 100644
index 0000000..86cfef4
@@ -0,0 +1,26 @@
+################################################################################
+#
+# jsmn
+#
+################################################################################
+
+JSMN_VERSION = 6021415cc75e7922d45b12935f56348b064d8a7f
+JSMN_SITE = $(call github,zserge,jsmn,$(JSMN_VERSION))
+JSMN_LICENSE = BSD
+JSMN_LICENSE_FILES = LICENSE
+
+JSMN_INSTALL_STAGING = YES
+JSMN_INSTALL_TARGET = NO
+
+define JSMN_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)" \
+		AR="$(TARGET_AR)"
+endef
+
+define JSMN_INSTALL_STAGING_CMDS
+    $(INSTALL) -m 0644 $(@D)/libjsmn.a $(STAGING_DIR)/usr/lib/
+    $(INSTALL) -m 0644 $(@D)/jsmn.h $(STAGING_DIR)/usr/include/
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/1 jsmn: new package

Hello,

Thanks for this contribution! I applied, but after doing a number of changes. See below.

package/jsmn/Config.in line 5

Quoted 11 lines · David Bachelart
package/jsmn/Config.in new file +5 -0
new file mode 100644
index 0000000..23d20f5
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_JSMN
+	bool "jsmn"
+	help
+	  jsmn (pronounced like 'jasmine') is a minimalistic JSON parser in C. It can 
+	  be easily integrated into resource-limited or embedded projects.

Those lines were too long, so I rewrapped the Config.in help text.

package/jsmn/jsmn.hash line 4

Quoted 10 lines
package/jsmn/jsmn.hash new file +4 -0
new file mode 100644
index 0000000..5cc51c3
@@ -0,0 +1,4 @@
+# Locally computed
+md5 78e2731c5697a3c35795b6350402e015    jsmn-6021415cc75e7922d45b12935f56348b064d8a7f.tar.gz
+sha1    09b1a3493db6b1a77b03bc835aa9be6345db5269    jsmn-6021415cc75e7922d45b12935f56348b064d8a7f.tar.gz
+sha256  e08993848b2abab62aa9572a560bb6e5ed4762f8537cd67c4de6cb17e17090a0    jsmn-6021415cc75e7922d45b12935f56348b064d8a7f.tar.gz

Having a sha256 is sufficient, we consider it a sufficiently strong hash.

package/jsmn/jsmn.hash

Quoted 3 lines
package/jsmn/jsmn.hash new file +3 -0
+JSMN_VERSION = 6021415cc75e7922d45b12935f56348b064d8a7f
+JSMN_SITE = $(call github,zserge,jsmn,$(JSMN_VERSION))
+JSMN_LICENSE = BSD

This is wrong. First BSD is not a license, you must specify BSD-2c or BSD-3c. But more importantly, the project is not under a BSD license, it's under a MIT license.

package/jsmn/jsmn.hash

Quoted 9 lines
package/jsmn/jsmn.hash new file +9 -0
+JSMN_LICENSE_FILES = LICENSE
+
+JSMN_INSTALL_STAGING = YES
+JSMN_INSTALL_TARGET = NO
+
+define JSMN_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS)" \
+		AR="$(TARGET_AR)"

Instead of passing CC and AR manually, I've used $(TARGET_CONFIGURE_OPTS), which is shorter and better.

package/jsmn/jsmn.hash

Quoted 5 lines
package/jsmn/jsmn.hash new file +5 -0
+endef
+
+define JSMN_INSTALL_STAGING_CMDS
+    $(INSTALL) -m 0644 $(@D)/libjsmn.a $(STAGING_DIR)/usr/lib/
+    $(INSTALL) -m 0644 $(@D)/jsmn.h $(STAGING_DIR)/usr/include/

Indentation was wrong: you should use one tab to indent commands. And the destination paths should be full paths, including the filename.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com