BuildRoot (http://buildroot.net/) makes easy to generate a complete
embedded Linux system.
So it's about package management and cross compilation.
BuildRoot is a set of Makefiles, patches and Kconfig (configuration
language from the Linux kernel).
Currently, BuildRoot (2013.11-rc1) supports Lua 5.1.5, LuaJIT 2.0.2
and 20 Lua modules.

BuildRoot supports various infrastructures for adding new packages.
See lua-ev with the CMake infrastructure,
http://git.buildroot.net/buildroot/tree/package/lua-ev/lua-ev.mk
See luaposix with the autotools infrastructure,
http://git.buildroot.net/buildroot/tree/package/luaposix/luaposix.mk
But most of Lua modules use the generic infrastructure which handles
all other cases.
See lbase64 where the supplied Makefile is used,
http://git.buildroot.net/buildroot/tree/package/lbase64/lbase64.mk
See wsapi where the Lua files are just copied,
http://git.buildroot.net/buildroot/tree/package/wsapi/wsapi.mk
See lua-msgpack-native where the compiler is directly called,
http://git.buildroot.net/buildroot/tree/package/lua-msgpack-native/lua-msgpack-native.mk

I decided to add a LuaRocks infrastructure (only for the build.type `builtin`)
The cross-compilation is not a requirement of LuaRocks.
In BuildRoot, the cross-compilation implies to manage 3 different
installation trees :
  - HOST_DIR which contains tools like the cross-compiler, the source
of LuaRocks and a host Lua executable
  - TARGET_DIR which contains the Lua executable, the shared libraries
and Lua files
  - STAGING_DIR which contains the include files of Lua and others C
libraries (like expat for LuaExpat)

The framework of BuildRoot implies some well-defined and isolated steps :
 - Download uses BuildRoot common infrastructure for retrieving the
rock source on the LuaRocks repository
 - Extract uses `luarocks unpack`
 - Patch use BuildRoot infrastructure if needed
 - Configure not used
 - Build not used
 - Install use `luarocks build --minimal` (build & install are linked
by LuaRocks)
So, I need 2 small patches for this (see,
https://raw.github.com/fperrad/br/luarocks/package/luarocks/luarocks-unpack.patch
& 
https://raw.github.com/fperrad/br/luarocks/package/luarocks/luarocks-build-minimal.patch)

Dependencies are not handled by LuaRock. BuildRoot handles two kinds
of dependency : build (in Makefile) and runtime (in Kconfig).
For example, LuaSec depends on LuaSocket at runtime, and depends on
openssl at build time.

The support of the cross-compilation is done by adding some variables
at the end of config.lua
(see https://raw.github.com/fperrad/br/luarocks/package/luarocks/luarocks.mk)

Now, I've converted 13 modules with this new infrastructure, and the
Makefile of a typical package looks like :

    
################################################################################
    #
    # luafoo
    #
    
################################################################################

    LUAFOO_VERSION = 1.0.2-1
    LUAFOO_DEPENDENCIES = foo

    $(eval $(luarocks-package))

where `luarocks-package` is a macro defined in
https://raw.github.com/fperrad/br/luarocks/package/pkg-luarocks.mk

My work is currently in BuildRoot patch queue.

In conclusion, the good design of LuaRocks allows me to do this
unexpected use of it.

François

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Luarocks-developers mailing list
Luarocks-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/luarocks-developers

Reply via email to