diff options
author | Francois Perrad <fperrad@gmail.com> | 2014-01-11 16:42:11 +0100 |
---|---|---|
committer | Peter Korsgaard <peter@korsgaard.com> | 2014-01-13 23:18:48 +0100 |
commit | 89d738dd5eb8e1fd545356031cf241673721752c (patch) | |
tree | b3f6cc44eded98840bb7f103a73677cdadaeee7e /docs/manual/adding-packages-luarocks.txt | |
parent | 5886f8c339fb0c37de0ba3e991471800906e310e (diff) | |
download | buildroot-89d738dd5eb8e1fd545356031cf241673721752c.tar.gz buildroot-89d738dd5eb8e1fd545356031cf241673721752c.zip |
manual: adding packages luarocks
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
[yann.morin.1998@free.fr: some cleanups and rephrasing]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'docs/manual/adding-packages-luarocks.txt')
-rw-r--r-- | docs/manual/adding-packages-luarocks.txt | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/docs/manual/adding-packages-luarocks.txt b/docs/manual/adding-packages-luarocks.txt new file mode 100644 index 0000000000..6e68852d3f --- /dev/null +++ b/docs/manual/adding-packages-luarocks.txt @@ -0,0 +1,93 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +Infrastructure for LuaRocks-based packages +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +[[luarocks-package-tutorial]] + ++luarocks-package+ tutorial +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +First, let's see how to write a +.mk+ file for a LuaRocks-based package, +with an example : + +------------------------ +01: ################################################################################ +02: # +03: # luafoo +04: # +05: ################################################################################ +06: +07: LUAFOO_VERSION = 1.0.2-1 +08: LUAFOO_DEPENDENCIES = foo +09: +10: LUAFOO_BUILD_OPT += FOO_INCDIR=$(STAGING_DIR)/usr/include +11: LUAFOO_BUILD_OPT += FOO_LIBDIR=$(STAGING_DIR)/usr/lib +12: LUAFOO_LICENSE = luaFoo license +13: LUAFOO_LICENSE_FILES = COPYING +14: +15: $(eval $(luarocks-package)) +------------------------ + +On line 7, we declare the version of the package (the same as in the rockspec, +which is the concatenation of the upstream version and the rockspec revision, +separated by a hyphen '-'). + +On line 8, we declare our dependencies against native libraries, so that they +are built before the build process of our package starts. + +On lines 10-11, we tell Buildroot to pass custom options to LuaRocks when it is +building the package. + +On lines 12-13, we specify the licensing terms for the package. + +Finally, on line 15, we invoke the +luarocks-package+ +macro that generates all the Makefile rules that actually allows the +package to be built. + +[[luarocks-package-reference]] + ++luarocks-package+ reference +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +LuaRocks is a deployment and management system for Lua modules, and supports +various +build.type+: +builtin+, +make+ and +cmake+. In the contetx of +Buildroot, the +luarocks-package+ infrastructure only supports the +builtin+ +mode. LuaRocks packages that use the +make+ or +cmake+ build mechanisms +should instead be packaged using the +generic-package+ and +cmake-package+ +infrastructures in Buildroot, respectively. + +The main macro of the LuaRocks package infrastructure is +luarocks-package+: +like +generic-package+ it works by defining a number of variables providing +meta informations about the package, and then calling +luarocks-package+. It +is worth mentioning that building LuaRocks packages for the host is not +supported, so the macro +host-luarocks-package+ is not implemented. + +Just like the generic infrastructure, the LuaRocks infrastructure works +by defining a number of variables before calling the +luarocks-package+ +macro. + +First, all the package metadata information variables that exist in +the generic infrastructure also exist in the LuaRocks infrastructure: ++LUAFOO_VERSION+, +LUAFOO_SOURCE+, +LUAFOO_SITE+, ++LUAFOO_DEPENDENCIES+, +LUAFOO_LICENSE+, +LUAFOO_LICENSE_FILES+. + +Two of them are populated by the LuaRocks infrastructure (for the ++download+ step). If your package is not hosted on the LuaRocks mirror ++$(BR2_LUAROCKS_MIRROR)+, you can override them: + +* +LUAFOO_SITE+, which defaults to +$(BR2_LUAROCKS_MIRROR)+ + +* +LUAFOO_SOURCE+, which defaults to +luafoo-$(LUAFOO_VERSION).src.rock+ + +A few additional variables, specific to the LuaRocks infrastructure, are +also defined. They can be overridden in specific cases. + +* +LUAFOO_ROCKSPEC+, which defaults to +luafoo-$(LUAFOO_VERSION).rockspec+ + +* +LUAFOO_SUBDIR+, which defaults to + +luafoo-$(LUAFOO_VERSION_WITHOUT_ROCKSPEC_REVISION)+ + +* +LUAFOO_BUILD_OPT+ contains additional build options for the + +luarocks build+ call. |