Skip to contentSkip to conversation

lua

PATCH New Francois Perrad 2 participants 7 messages Jul 19, 2014 – Jul 12, 2015

lore
Share & tools
lore
#0 lore raw

v4 cover lua

delta V4 vs V3 (remaining)
- refactor with the host-virtual-package infrastructure

Francois Perrad (4):
luajit: add host variant
luainterpreter: add host variant
luarocks: allow to work with host-luainterpreter
lua-iconv: new package

 package/Config.in                        |  1 +
 package/lua-iconv/Config.in              |  8 ++++++++
 package/lua-iconv/lua-iconv.mk           | 14 ++++++++++++++
 package/luainterpreter/luainterpreter.mk |  3 +++
 package/luajit/luajit.mk                 |  9 +++++++++
 package/luarocks/luarocks.mk             | 18 ++++++++++++------
 6 files changed, 47 insertions(+), 6 deletions(-)
 create mode 100644 package/lua-iconv/Config.in
 create mode 100644 package/lua-iconv/lua-iconv.mk
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/4 luajit: add host variant

the goal is to use host-luajit with pkg-luarocks when luajit is on the selected luainterpreter for the target

---
 package/luajit/luajit.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/luajit/luajit.mk +9 -0
index 72240b2..42d6a72 100644
@@ -64,4 +64,13 @@ define LUAJIT_INSTALL_TARGET_CMDS
 	$(MAKE) PREFIX="/usr" DESTDIR="$(TARGET_DIR)" LDCONFIG=true -C $(@D) install
 endef
 
+define HOST_LUAJIT_BUILD_CMDS
+	$(MAKE) PREFIX="/usr" BUILDMODE=static -C $(@D) amalg
+endef
+
+define HOST_LUAJIT_INSTALL_CMDS
+	$(MAKE) PREFIX="/usr" DESTDIR="$(HOST_DIR)" -C $(@D) install
+endef
+
 $(eval $(generic-package))
+$(eval $(host-generic-package))
Signature · 1 line
1.9.1
#2 lore raw

PATCH v4 2/4 luainterpreter: add host variant

In reply to Francois Perrad

host-luainterpreter is host-lua or host-luajit

---
 package/luainterpreter/luainterpreter.mk | 1 +
 1 file changed, 1 insertion(+)
package/luainterpreter/luainterpreter.mk +1 -0
index aa02696..4ef0a45 100644
@@ -7,3 +7,4 @@
 LUAINTERPRETER_ABIVER = $(call qstrip,$(BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION))
 
 $(eval $(virtual-package))
+$(eval $(host-virtual-package))
Signature · 1 line
1.9.1
#3 lore raw

PATCH v4 3/4 luarocks: allow to work with host-luainterpreter

In reply to Francois Perrad

when we embed luajit on target,
we use luarocks with host-luajit instead of host-lua, in order to use the same interpreter on the both side.

---
 package/luainterpreter/luainterpreter.mk |  2 ++
 package/luarocks/luarocks.mk             | 18 ++++++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)
package/luainterpreter/luainterpreter.mk +2 -0
index 4ef0a45..a6c98ab 100644
@@ -8,3 +8,5 @@ LUAINTERPRETER_ABIVER = $(call qstrip,$(BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION))
 
 $(eval $(virtual-package))
 $(eval $(host-virtual-package))
+
+LUA_RUN = $(HOST_DIR)/usr/bin/$(call qstrip,$(BR2_PACKAGE_PROVIDES_LUAINTERPRETER))
package/luarocks/luarocks.mk +12 -6
index 926fd04..5680ab4 100644
@@ -9,16 +9,22 @@ LUAROCKS_SITE = http://luarocks.org/releases/
 LUAROCKS_LICENSE = MIT
 LUAROCKS_LICENSE_FILES = COPYING
 
-HOST_LUAROCKS_DEPENDENCIES = host-lua
+HOST_LUAROCKS_DEPENDENCIES = host-luainterpreter
 
 LUAROCKS_CONFIG_DIR  = $(HOST_DIR)/usr/etc/luarocks
 LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/config-$(LUAINTERPRETER_ABIVER).lua
 
+HOST_LUAROCKS_CONF_OPT = \
+	--prefix=$(HOST_DIR)/usr \
+	--sysconfdir=$(LUAROCKS_CONFIG_DIR) \
+	--with-lua=$(HOST_DIR)/usr
+
+ifeq ($(BR2_PACKAGE_LUAJIT),y)
+HOST_LUAROCKS_CONF_OPT += --lua-suffix=jit
+endif
+
 define HOST_LUAROCKS_CONFIGURE_CMDS
-	cd $(@D) && ./configure \
-		--prefix=$(HOST_DIR)/usr \
-		--sysconfdir=$(LUAROCKS_CONFIG_DIR) \
-		--with-lua=$(HOST_DIR)/usr
+	cd $(@D) && ./configure $(HOST_LUAROCKS_CONF_OPT)
 endef
 
 define HOST_LUAROCKS_INSTALL_CMDS
@@ -43,4 +49,4 @@ endef
 $(eval $(host-generic-package))
 
 LUAROCKS_RUN = LUA_PATH="$(HOST_DIR)/usr/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua" \
-	$(HOST_DIR)/usr/bin/lua $(HOST_DIR)/usr/bin/luarocks
+	$(LUA_RUN) $(HOST_DIR)/usr/bin/luarocks
Signature · 1 line
1.9.1
#4 lore raw

PATCH v4 4/4 lua-iconv: new package

In reply to Francois Perrad
---
 package/Config.in              |  1 +
 package/lua-iconv/Config.in    |  8 ++++++++
 package/lua-iconv/lua-iconv.mk | 14 ++++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 package/lua-iconv/Config.in
 create mode 100644 package/lua-iconv/lua-iconv.mk
package/Config.in +1 -0
index db2d114..55265f1 100644
@@ -404,6 +404,7 @@ menu "Lua libraries/modules"
 	source "package/lua-coatpersistent/Config.in"
 	source "package/lua-csnappy/Config.in"
 	source "package/lua-ev/Config.in"
+	source "package/lua-iconv/Config.in"
 	source "package/lua-messagepack/Config.in"
 	source "package/lua-msgpack-native/Config.in"
 	source "package/lua-testmore/Config.in"
package/lua-iconv/Config.in new file +8 -0
new file mode 100644
index 0000000..cad7c7c
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_LUA_ICONV
+	bool "lua-iconv"
+	select BR2_PACKAGE_LIBICONV
+	depends on !BR2_ENABLE_LOCALE
+	help
+	  Lua binding to the POSIX 'iconv' library
+
+	  http://ittner.github.io/lua-iconv/
package/lua-iconv/lua-iconv.mk new file +14 -0
new file mode 100644
index 0000000..22f66de
@@ -0,0 +1,14 @@
+################################################################################
+#
+# lua-iconv
+#
+################################################################################
+
+LUA_ICONV_VERSION_UPSTREAM = 7
+LUA_ICONV_VERSION = $(LUA_ICONV_VERSION_UPSTREAM)-1
+LUA_ICONV_SUBDIR  = lua-iconv-$(LUA_ICONV_VERSION_UPSTREAM)
+LUA_ICONV_DEPENDENCIES = luainterpreter libiconv
+LUA_ICONV_LICENSE = MIT
+LUA_ICONV_LICENSE_FILES = $(LUA_ICONV_SUBDIR)/COPYING
+
+$(eval $(luarocks-package))
Signature · 1 line
1.9.1
#5 lore raw

PATCH v4 4/4 lua-iconv: new package

Dear Francois Perrad,

package/lua-iconv/Config.in line 4

Quoted 10 lines · Francois Perrad
package/lua-iconv/Config.in new file +4 -0
new file mode 100644
index 0000000..cad7c7c
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_LUA_ICONV
+	bool "lua-iconv"
+	select BR2_PACKAGE_LIBICONV
+	depends on !BR2_ENABLE_LOCALE

As Arnout told you in February 2014, this needs to be:

select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE

Back then, you replied:

""
I don't think,
lua-iconv is binding of iconv, so iconv is not an optional dependency ""

But what you're missing is that when the toolchain has locale support, the iconv() function is provided by the C library itself. libiconv is only needed to provide iconv() for toolchains that don't have locale support.

So basically, if BR2_ENABLE_LOCALE=y, the C library provides iconv() and lua-iconv doesn't need any dependency on libiconv. However, when BR2_ENABLE_LOCALE is not set, the C library does *not* provide iconv(), and lua-iconv needs to depend on libiconv.

Quoted 6 lines
package/lua-iconv/lua-iconv.mk new file +0 -0
new file mode 100644
index 0000000..22f66de

package/lua-iconv/lua-iconv.mk line 9

Quoted 9 lines
package/lua-iconv/lua-iconv.mk new file +9 -0
@@ -0,0 +1,14 @@
+################################################################################
+#
+# lua-iconv
+#
+################################################################################
+
+LUA_ICONV_VERSION_UPSTREAM = 7
+LUA_ICONV_VERSION = $(LUA_ICONV_VERSION_UPSTREAM)-1
+LUA_ICONV_SUBDIR  = lua-iconv-$(LUA_ICONV_VERSION_UPSTREAM)

Remove redundant space before =. However, isn't this SUBDIR thing already handled by the luarocks-package infrastructure?

package/lua-iconv/lua-iconv.mk line 10

Quoted 1 line
package/lua-iconv/lua-iconv.mk new file +1 -0
+LUA_ICONV_DEPENDENCIES = luainterpreter libiconv

The dependency on libiconv should be:

	$(if $(BR2_PACKAGE_LIBICONV),libiconv)

as already suggested by Arnout. And the luainterpreter dependency is also already handled by the luarocks-package infra.

Could you fix those issues and resend? In the mean time, we'll mark your patch as Changes Requested.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

v4 cover lua

In reply to Francois Perrad

Dear Francois Perrad,

Quoted 7 lines · Francois Perrad

delta V4 vs V3 (remaining)
- refactor with the host-virtual-package infrastructure

Francois Perrad (4):
luajit: add host variant
luainterpreter: add host variant
luarocks: allow to work with host-luainterpreter

Those three patches have been applied, thanks!

Quoted 1 line

lua-iconv: new package

This one remains in the queue for now.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com