diff mbox

[v5] luvi: new package

Message ID 1446104703-21295-1-git-send-email-joerg.krause@embedded.rocks
State Accepted
Headers show

Commit Message

Jörg Krause Oct. 29, 2015, 7:45 a.m. UTC
Add package luvi version v2.3.5.

luvi extends LuaJIT with asynchronous I/O and several optional modules to run
Lua applications and build self-contained binaries.

Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
---
Changes v3 -> v5: (v4 is same as v3, forgot commit --amend)
 - bump to v2.3.5
 - remove patch from upstream

Changes v2 -> v3:
 - Adapt version string to v2.3.4 (Jerzy Grzegorek)
 - Add else clauses to explicitly disable PCRE, OpenSSL and zlib support
   (Thomas Petazzoni)

Changes v1 -> v2:
 - replace too generic TARGET_ARCH variable by LUVI_TARGET_ARCH (Baruch Siach)
---
 package/Config.in      |  1 +
 package/luvi/Config.in | 30 +++++++++++++++++++++++++
 package/luvi/luvi.hash |  2 ++
 package/luvi/luvi.mk   | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)
 create mode 100644 package/luvi/Config.in
 create mode 100644 package/luvi/luvi.hash
 create mode 100644 package/luvi/luvi.mk

Comments

Thomas Petazzoni Dec. 20, 2015, 10:28 p.m. UTC | #1
Dear Jörg Krause,

On Thu, 29 Oct 2015 08:45:03 +0100, Jörg Krause wrote:
> Add package luvi version v2.3.5.
> 
> luvi extends LuaJIT with asynchronous I/O and several optional modules to run
> Lua applications and build self-contained binaries.
> 
> Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
> ---
> Changes v3 -> v5: (v4 is same as v3, forgot commit --amend)
>  - bump to v2.3.5
>  - remove patch from upstream

Thanks, patch applied. I must say I don't really understand what this
luvi thing is doing, but it built fine here, and the packaging seems
reasonable.

I was somewhat surprised by:

	-DLUA_PATH=$(HOST_DIR)/usr/share/luajit-2.0.4/?.lua

as this ?.lua doesn't really look like a path, but since it builds
fine, maybe I'm missing something.

I'm CC'ing François, in case he has something to say about this new
package.

Thanks,

Thomas
Jörg Krause Dec. 25, 2015, 9:51 p.m. UTC | #2
Dear Thomas Petazzoni,

On So, 2015-12-20 at 23:28 +0100, Thomas Petazzoni wrote:
> Dear Jörg Krause,
> 
> On Thu, 29 Oct 2015 08:45:03 +0100, Jörg Krause wrote:
> > Add package luvi version v2.3.5.
> > 
> > luvi extends LuaJIT with asynchronous I/O and several optional
> > modules to run
> > Lua applications and build self-contained binaries.
> > 
> > Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
> > ---
> > Changes v3 -> v5: (v4 is same as v3, forgot commit --amend)
> >  - bump to v2.3.5
> >  - remove patch from upstream
> 
> Thanks, patch applied. I must say I don't really understand what this
> luvi thing is doing, but it built fine here, and the packaging seems
> reasonable.

luvi is a LuaJIT runtime with additional bindings, e.g. libuv. You can
compare it with the V8 engine (the JavaScript engine used by Node.js),
the main difference is, that luvi already contains the libuv bindings,
whereas Node.js adds the libuv bindings to V8.

All together, it is a Node.js like system for Lua.

I want to integrate some luvi applications like lit and luvit into
Buildroot. lit is similar to npm and luvit adds a Node.js like API to
luvi.

This will be done in follow-up patches...

> I was somewhat surprised by:
> 
> 	-DLUA_PATH=$(HOST_DIR)/usr/share/luajit-2.0.4/?.lua
> 
> as this ?.lua doesn't really look like a path, but since it builds
> fine, maybe I'm missing something.

Lua(JIT) uses this string as a path to search for files. In this case
we have to tell LuaJIT where to search for its bundled modules.

Best regards
Jörg
Thomas Petazzoni Dec. 26, 2015, 9:52 a.m. UTC | #3
Jörg,

On Fri, 25 Dec 2015 22:51:08 +0100, Jörg Krause wrote:

> > Thanks, patch applied. I must say I don't really understand what this
> > luvi thing is doing, but it built fine here, and the packaging seems
> > reasonable.
> 
> luvi is a LuaJIT runtime with additional bindings, e.g. libuv. You can
> compare it with the V8 engine (the JavaScript engine used by Node.js),
> the main difference is, that luvi already contains the libuv bindings,
> whereas Node.js adds the libuv bindings to V8.
> 
> All together, it is a Node.js like system for Lua.

Thanks a lot for the explanation, makes sense!

> I want to integrate some luvi applications like lit and luvit into
> Buildroot. lit is similar to npm and luvit adds a Node.js like API to
> luvi.
> 
> This will be done in follow-up patches...

Cool!

> > as this ?.lua doesn't really look like a path, but since it builds
> > fine, maybe I'm missing something.
> 
> Lua(JIT) uses this string as a path to search for files. In this case
> we have to tell LuaJIT where to search for its bundled modules.

Ok. So this "?" is interpreted by LuaJIT in a "special" way.

Thanks,

Thomas
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 10ff94e..bc19405 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -505,6 +505,7 @@  menu "Lua libraries/modules"
 	source "package/luasql-sqlite3/Config.in"
 	source "package/lunit/Config.in"
 	source "package/luv/Config.in"
+	source "package/luvi/Config.in"
 	source "package/lzlib/Config.in"
 	source "package/orbit/Config.in"
 	source "package/rings/Config.in"
diff --git a/package/luvi/Config.in b/package/luvi/Config.in
new file mode 100644
index 0000000..2f01f5c
--- /dev/null
+++ b/package/luvi/Config.in
@@ -0,0 +1,30 @@ 
+config BR2_PACKAGE_LUVI
+	bool "luvi"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libuv
+	depends on BR2_USE_MMU # libuv
+	depends on !BR2_STATIC_LIBS # libuv
+	depends on BR2_PACKAGE_LUAJIT
+	select BR2_PACKAGE_LIBUV
+	select BR2_PACKAGE_LUV
+	help
+	  A project in-between luv and luvit. The goal of this is to make
+	  building luvit and derivatives much easier.
+
+	  luvi extends LuaJIT with asynchronous I/O and several optional
+	  modules to run Lua applications and build self-contained binaries
+	  on systems that don't have a compiler.
+
+	  The luvi core can be extended with several Lua modules by adding its
+	  bundled Lua binding libraries. To get the Lua module...
+	    * 'rex' select PCRE (BR2_PACKAGE_PCRE)
+	    * 'ssl' select OpenSSL (BR2_PACKAGE_OPENSSL)
+	    * 'zlib' select zlib (BR2_PACKAGE_ZLIB)
+
+	  https://github.com/luvit/luvi
+
+comment "luvi needs a toolchain w/ threads, dynamic library"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
+	depends on BR2_USE_MMU
+
+comment "luvi needs LuaJIT"
+	depends on !BR2_PACKAGE_LUAJIT
diff --git a/package/luvi/luvi.hash b/package/luvi/luvi.hash
new file mode 100644
index 0000000..c967558
--- /dev/null
+++ b/package/luvi/luvi.hash
@@ -0,0 +1,2 @@ 
+# Locally calculated
+sha256  9d13baba7870160bd0f9be9d52f8ef1dafe282490d5f83a8e14765aa43387765  luvi-src-v2.3.5.tar.gz
diff --git a/package/luvi/luvi.mk b/package/luvi/luvi.mk
new file mode 100644
index 0000000..7611c11
--- /dev/null
+++ b/package/luvi/luvi.mk
@@ -0,0 +1,60 @@ 
+################################################################################
+#
+# luvi
+#
+################################################################################
+
+LUVI_VERSION = v2.3.5
+LUVI_SOURCE = luvi-src-$(LUVI_VERSION).tar.gz
+LUVI_SITE = https://github.com/luvit/luvi/releases/download/$(LUVI_VERSION)
+LUVI_LICENSE = Apache-2.0
+LUVI_LICENSE_FILES = LICENSE.txt
+LUVI_DEPENDENCIES = libuv luajit luv host-luajit
+
+# Dispatch all architectures of LuaJIT
+ifeq ($(BR2_i386),y)
+LUVI_TARGET_ARCH = x86
+else ifeq ($(BR2_x86_64),y)
+LUVI_TARGET_ARCH = x64
+else ifeq ($(BR2_powerpc),y)
+LUVI_TARGET_ARCH = ppc
+else ifeq ($(BR2_arm)$(BR2_armeb),y)
+LUVI_TARGET_ARCH = arm
+else ifeq ($(BR2_mips)$(BR2_mipsel),y)
+LUVI_TARGET_ARCH = mips
+else
+LUVI_TARGET_ARCH = $(BR2_ARCH)
+endif
+
+# Bundled lua bindings have to be linked statically into the luvi executable
+LUVI_CONF_OPTS = \
+	-DBUILD_SHARED_LIBS=OFF \
+	-DWithSharedLibluv=ON \
+	-DTARGET_ARCH=$(LUVI_TARGET_ARCH) \
+	-DLUA_PATH=$(HOST_DIR)/usr/share/luajit-2.0.4/?.lua
+
+# Add "rex" module (PCRE via bundled lrexlib)
+ifeq ($(BR2_PACKAGE_PCRE),y)
+LUVI_DEPENDENCIES += pcre
+LUVI_CONF_OPTS += -DWithPCRE=ON -DWithSharedPCRE=ON
+else
+LUVI_CONF_OPTS += -DWithPCRE=OFF -DWithSharedPCRE=OFF
+endif
+
+# Add "ssl" module (via bundled lua-openssl)
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+LUVI_DEPENDENCIES += openssl
+LUVI_CONF_OPTS += -DWithOpenSSL=ON -DWithOpenSSLASM=ON -DWithSharedOpenSSL=ON
+else
+LUVI_CONF_OPTS += -DWithOpenSSL=OFF -DWithOpenSSLASM=OFF -DWithSharedOpenSSL=OFF
+endif
+
+# Add "zlib" module (via bundled lua-zlib)
+ifeq ($(BR2_PACKAGE_ZLIB),y)
+LUVI_DEPENDENCIES += zlib
+LUVI_CONF_OPTS += -DWithZLIB=ON -DWithSharedZLIB=ON
+else
+LUVI_CONF_OPTS += -DWithZLIB=OFF -DWithSharedZLIB=OFF
+endif
+
+$(eval $(cmake-package))