[Buildroot] [PATCH] New package: lua-cjson [v2]

Danomi Manchego danomimanchego123 at gmail.com
Mon Jul 16 23:23:45 UTC 2012


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 at 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 at gmail.com>:
> > Signed-off-by: Danomi Manchego <danomimanchego123 at 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 at busybox.net
> > http://lists.busybox.net/mailman/listinfo/buildroot
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120716/d1193a8d/attachment-0002.html>


More information about the buildroot mailing list