diff mbox

New package: lua-cjson [v2]

Message ID 1342407627-2861-2-git-send-email-danomimanchego123@gmail.com
State Accepted
Headers show

Commit Message

Danomi Manchego July 16, 2012, 3 a.m. UTC
Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
---
 package/Config.in              |    1 +
 package/lua-cjson/Config.in    |   13 +++++++++++++
 package/lua-cjson/lua-cjson.mk |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+)
 create mode 100644 package/lua-cjson/Config.in
 create mode 100644 package/lua-cjson/lua-cjson.mk

Comments

François Perrad July 16, 2012, 2:29 p.m. UTC | #1
in lua-cjson.mk :
- the variable LUA_CJSON_SOURCE is useless, because the default scheme
(packagename-$(LIBFOO_VERSION).tar.gz) is used
- PREFIX=$(STAGING_DIR)/usr in LUA_CJSON_BUILD_CMDS is useless

a good use of PREFIX & DESTDIR is, for example :
    define LUA_FOO_INSTALL_TARGET_CMDS
	     $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX="/usr" install
    endef

François

2012/7/16 Danomi Manchego <danomimanchego123@gmail.com>:
> Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
> ---
>  package/Config.in              |    1 +
>  package/lua-cjson/Config.in    |   13 +++++++++++++
>  package/lua-cjson/lua-cjson.mk |   32 ++++++++++++++++++++++++++++++++
>  3 files changed, 46 insertions(+)
>  create mode 100644 package/lua-cjson/Config.in
>  create mode 100644 package/lua-cjson/lua-cjson.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 99257b4..9cbf1e2 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -250,6 +250,7 @@ menu "LUA libraries/modules"
>  source "package/cgilua/Config.in"
>  source "package/copas/Config.in"
>  source "package/coxpcall/Config.in"
> +source "package/lua-cjson/Config.in"
>  source "package/luafilesystem/Config.in"
>  source "package/luasocket/Config.in"
>  source "package/rings/Config.in"
> diff --git a/package/lua-cjson/Config.in b/package/lua-cjson/Config.in
> new file mode 100644
> index 0000000..c9d6abd
> --- /dev/null
> +++ b/package/lua-cjson/Config.in
> @@ -0,0 +1,13 @@
> +config BR2_PACKAGE_LUA_CJSON
> +       bool "lua_cjson"
> +       help
> +         The Lua CJSON module provides JSON support for Lua. It features:
> +         - Fast, standards compliant encoding/parsing routines
> +         - Full support for JSON with UTF-8, including decoding surrogate pairs
> +         - Optional run-time support for common exceptions to the JSON
> +           specification (infinity, NaN, ...)
> +         - No dependencies on other libraries
> +
> +         (C-module)
> +
> +         http://www.kyne.com.au/~mark/software/lua-cjson.php
> diff --git a/package/lua-cjson/lua-cjson.mk b/package/lua-cjson/lua-cjson.mk
> new file mode 100644
> index 0000000..05087ea
> --- /dev/null
> +++ b/package/lua-cjson/lua-cjson.mk
> @@ -0,0 +1,32 @@
> +#############################################################
> +#
> +# lua-cjson
> +#
> +#############################################################
> +LUA_CJSON_VERSION      = 2.1.0
> +LUA_CJSON_SOURCE       = lua-cjson-$(LUA_CJSON_VERSION).tar.gz
> +LUA_CJSON_SITE         = http://www.kyne.com.au/~mark/software/download
> +LUA_CJSON_DEPENDENCIES = lua
> +
> +define LUA_CJSON_BUILD_CMDS
> +       $(MAKE) -C $(@D) \
> +               CFLAGS="$(TARGET_CFLAGS)"   \
> +               LDFLAGS="$(TARGET_LDFLAGS)" \
> +               CC="$(TARGET_CC)"           \
> +               LD="$(TARGET_LD)"           \
> +               PREFIX=$(STAGING_DIR)/usr
> +endef
> +
> +define LUA_CJSON_INSTALL_TARGET_CMDS
> +       install -D -m 0644 $(@D)/cjson.so $(TARGET_DIR)/usr/lib/lua/cjson.so
> +endef
> +
> +define LUA_CJSON_CLEAN_CMDS
> +       $(MAKE) -C $(@D) clean
> +endef
> +
> +define LUA_CJSON_UNINSTALL_TARGET_CMDS
> +       rm -f "$(TARGET_DIR)/usr/lib/lua/cjson.so"
> +endef
> +
> +$(eval $(call GENTARGETS))
> --
> 1.7.9.5
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Danomi Manchego July 16, 2012, 11:23 p.m. UTC | #2
François,

> - the variable LUA_CJSON_SOURCE is useless, because the default scheme
> (packagename-$(LIBFOO_VERSION).tar.gz) is used

True.

> - PREFIX=$(STAGING_DIR)/usr in LUA_CJSON_BUILD_CMDS is useless
>
> a good use of PREFIX & DESTDIR is, for example :
>     define LUA_FOO_INSTALL_TARGET_CMDS
>       $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX="/usr" install
>     endef

Not quite true.  If you look at the Makefile in lua-cjson, you will see
that DESTDIR is only used for the install targets, which I have avoided in
the .mk.  But the PREFIX is used in the build phase for -I:

LUA_INCLUDE_DIR =   $(PREFIX)/include
...
BUILD_CFLAGS =      -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS)
...
.c.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(BUILD_CFLAGS) -o $@ $<

Since we need header files to come from staging rather than /usr, I set
PREFIX=$(STAGING_DIR)/usr.  If you prefer, I can override BUILD_CFLAGS or
LUA_INCLUDE_DIR, but I think that proper compilation is obtained with the
file as-is.

Danomi -


On Mon, Jul 16, 2012 at 10:29 AM, François Perrad
<francois.perrad@gadz.org>wrote:

> in lua-cjson.mk :
> - the variable LUA_CJSON_SOURCE is useless, because the default scheme
> (packagename-$(LIBFOO_VERSION).tar.gz) is used
> - PREFIX=$(STAGING_DIR)/usr in LUA_CJSON_BUILD_CMDS is useless
>
> a good use of PREFIX & DESTDIR is, for example :
>     define LUA_FOO_INSTALL_TARGET_CMDS
>              $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX="/usr" install
>     endef
>
> François
>
> 2012/7/16 Danomi Manchego <danomimanchego123@gmail.com>:
> > Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
> > ---
> >  package/Config.in              |    1 +
> >  package/lua-cjson/Config.in    |   13 +++++++++++++
> >  package/lua-cjson/lua-cjson.mk |   32 ++++++++++++++++++++++++++++++++
> >  3 files changed, 46 insertions(+)
> >  create mode 100644 package/lua-cjson/Config.in
> >  create mode 100644 package/lua-cjson/lua-cjson.mk
> >
> > diff --git a/package/Config.in b/package/Config.in
> > index 99257b4..9cbf1e2 100644
> > --- a/package/Config.in
> > +++ b/package/Config.in
> > @@ -250,6 +250,7 @@ menu "LUA libraries/modules"
> >  source "package/cgilua/Config.in"
> >  source "package/copas/Config.in"
> >  source "package/coxpcall/Config.in"
> > +source "package/lua-cjson/Config.in"
> >  source "package/luafilesystem/Config.in"
> >  source "package/luasocket/Config.in"
> >  source "package/rings/Config.in"
> > diff --git a/package/lua-cjson/Config.in b/package/lua-cjson/Config.in
> > new file mode 100644
> > index 0000000..c9d6abd
> > --- /dev/null
> > +++ b/package/lua-cjson/Config.in
> > @@ -0,0 +1,13 @@
> > +config BR2_PACKAGE_LUA_CJSON
> > +       bool "lua_cjson"
> > +       help
> > +         The Lua CJSON module provides JSON support for Lua. It
> features:
> > +         - Fast, standards compliant encoding/parsing routines
> > +         - Full support for JSON with UTF-8, including decoding
> surrogate pairs
> > +         - Optional run-time support for common exceptions to the JSON
> > +           specification (infinity, NaN, ...)
> > +         - No dependencies on other libraries
> > +
> > +         (C-module)
> > +
> > +         http://www.kyne.com.au/~mark/software/lua-cjson.php
> > diff --git a/package/lua-cjson/lua-cjson.mk b/package/lua-cjson/
> lua-cjson.mk
> > new file mode 100644
> > index 0000000..05087ea
> > --- /dev/null
> > +++ b/package/lua-cjson/lua-cjson.mk
> > @@ -0,0 +1,32 @@
> > +#############################################################
> > +#
> > +# lua-cjson
> > +#
> > +#############################################################
> > +LUA_CJSON_VERSION      = 2.1.0
> > +LUA_CJSON_SOURCE       = lua-cjson-$(LUA_CJSON_VERSION).tar.gz
> > +LUA_CJSON_SITE         = http://www.kyne.com.au/~mark/software/download
> > +LUA_CJSON_DEPENDENCIES = lua
> > +
> > +define LUA_CJSON_BUILD_CMDS
> > +       $(MAKE) -C $(@D) \
> > +               CFLAGS="$(TARGET_CFLAGS)"   \
> > +               LDFLAGS="$(TARGET_LDFLAGS)" \
> > +               CC="$(TARGET_CC)"           \
> > +               LD="$(TARGET_LD)"           \
> > +               PREFIX=$(STAGING_DIR)/usr
> > +endef
> > +
> > +define LUA_CJSON_INSTALL_TARGET_CMDS
> > +       install -D -m 0644 $(@D)/cjson.so
> $(TARGET_DIR)/usr/lib/lua/cjson.so
> > +endef
> > +
> > +define LUA_CJSON_CLEAN_CMDS
> > +       $(MAKE) -C $(@D) clean
> > +endef
> > +
> > +define LUA_CJSON_UNINSTALL_TARGET_CMDS
> > +       rm -f "$(TARGET_DIR)/usr/lib/lua/cjson.so"
> > +endef
> > +
> > +$(eval $(call GENTARGETS))
> > --
> > 1.7.9.5
> >
> > _______________________________________________
> > buildroot mailing list
> > buildroot@busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot
>
François Perrad July 17, 2012, 8:03 a.m. UTC | #3
2012/7/17 Danomi Manchego <danomimanchego123@gmail.com>:
> François,
>
>> - the variable LUA_CJSON_SOURCE is useless, because the default scheme
>> (packagename-$(LIBFOO_VERSION).tar.gz) is used
>
> True.
>
>> - PREFIX=$(STAGING_DIR)/usr in LUA_CJSON_BUILD_CMDS is useless
>>
>> a good use of PREFIX & DESTDIR is, for example :
>>     define LUA_FOO_INSTALL_TARGET_CMDS
>>       $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX="/usr" install
>>     endef
>
> Not quite true.  If you look at the Makefile in lua-cjson, you will see that
> DESTDIR is only used for the install targets, which I have avoided in the
> .mk.  But the PREFIX is used in the build phase for -I:
>
> LUA_INCLUDE_DIR =   $(PREFIX)/include
> ...
> BUILD_CFLAGS =      -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS)
> ...
> .c.o:
> $(CC) -c $(CFLAGS) $(CPPFLAGS) $(BUILD_CFLAGS) -o $@ $<
>
> Since we need header files to come from staging rather than /usr, I set
> PREFIX=$(STAGING_DIR)/usr.  If you prefer, I can override BUILD_CFLAGS or
> LUA_INCLUDE_DIR, but I think that proper compilation is obtained with the
> file as-is.
>

in order to explain your intention, I prefer
LUA_INCLUDE_DIR="$(STAGING_DIR)/usr/include"

François

> Danomi -
>
>
> On Mon, Jul 16, 2012 at 10:29 AM, François Perrad <francois.perrad@gadz.org>
> wrote:
>>
>> in lua-cjson.mk :
>> - the variable LUA_CJSON_SOURCE is useless, because the default scheme
>> (packagename-$(LIBFOO_VERSION).tar.gz) is used
>> - PREFIX=$(STAGING_DIR)/usr in LUA_CJSON_BUILD_CMDS is useless
>>
>> a good use of PREFIX & DESTDIR is, for example :
>>     define LUA_FOO_INSTALL_TARGET_CMDS
>>              $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR) PREFIX="/usr" install
>>     endef
>>
>> François
>>
Thomas Petazzoni July 17, 2012, 9:33 p.m. UTC | #4
Le Sun, 15 Jul 2012 23:00:27 -0400,
Danomi Manchego <danomimanchego123@gmail.com> a écrit :

> Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>
> ---
>  package/Config.in              |    1 +
>  package/lua-cjson/Config.in    |   13 +++++++++++++
>  package/lua-cjson/lua-cjson.mk |   32 ++++++++++++++++++++++++++++++++
>  3 files changed, 46 insertions(+)
>  create mode 100644 package/lua-cjson/Config.in
>  create mode 100644 package/lua-cjson/lua-cjson.mk

Applied, thanks.

I have renamed the package to just luacjson, for consistency with other
lua* modules. I've also removed useless quotes in
LUA_CJSON_UNINSTALL_TARGET_CMDS, and used the new generic-package macro
instead of GENTARGETS.

Thomas
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 99257b4..9cbf1e2 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -250,6 +250,7 @@  menu "LUA libraries/modules"
 source "package/cgilua/Config.in"
 source "package/copas/Config.in"
 source "package/coxpcall/Config.in"
+source "package/lua-cjson/Config.in"
 source "package/luafilesystem/Config.in"
 source "package/luasocket/Config.in"
 source "package/rings/Config.in"
diff --git a/package/lua-cjson/Config.in b/package/lua-cjson/Config.in
new file mode 100644
index 0000000..c9d6abd
--- /dev/null
+++ b/package/lua-cjson/Config.in
@@ -0,0 +1,13 @@ 
+config BR2_PACKAGE_LUA_CJSON
+	bool "lua_cjson"
+	help
+	  The Lua CJSON module provides JSON support for Lua. It features:
+	  - Fast, standards compliant encoding/parsing routines
+	  - Full support for JSON with UTF-8, including decoding surrogate pairs
+	  - Optional run-time support for common exceptions to the JSON
+	    specification (infinity, NaN, ...)
+	  - No dependencies on other libraries
+
+	  (C-module)
+
+	  http://www.kyne.com.au/~mark/software/lua-cjson.php
diff --git a/package/lua-cjson/lua-cjson.mk b/package/lua-cjson/lua-cjson.mk
new file mode 100644
index 0000000..05087ea
--- /dev/null
+++ b/package/lua-cjson/lua-cjson.mk
@@ -0,0 +1,32 @@ 
+#############################################################
+#
+# lua-cjson
+#
+#############################################################
+LUA_CJSON_VERSION      = 2.1.0
+LUA_CJSON_SOURCE       = lua-cjson-$(LUA_CJSON_VERSION).tar.gz
+LUA_CJSON_SITE         = http://www.kyne.com.au/~mark/software/download
+LUA_CJSON_DEPENDENCIES = lua
+
+define LUA_CJSON_BUILD_CMDS
+	$(MAKE) -C $(@D) \
+		CFLAGS="$(TARGET_CFLAGS)"   \
+		LDFLAGS="$(TARGET_LDFLAGS)" \
+		CC="$(TARGET_CC)"           \
+		LD="$(TARGET_LD)"           \
+		PREFIX=$(STAGING_DIR)/usr
+endef
+
+define LUA_CJSON_INSTALL_TARGET_CMDS
+	install -D -m 0644 $(@D)/cjson.so $(TARGET_DIR)/usr/lib/lua/cjson.so
+endef
+
+define LUA_CJSON_CLEAN_CMDS
+	$(MAKE) -C $(@D) clean
+endef
+
+define LUA_CJSON_UNINSTALL_TARGET_CMDS
+	rm -f "$(TARGET_DIR)/usr/lib/lua/cjson.so"
+endef
+
+$(eval $(call GENTARGETS))