Skip to contentSkip to conversation

lua: always use host-lua for host-luainterpreter

RFC In review Peter Korsgaard 3 participants 3 messages Oct 21, 2017 – Mar 31, 2018

lore
Share & tools
lore
#0 lore raw

RFC 1/1 lua: always use host-lua for host-luainterpreter

Similar to how we do for openssl.

host-luainterpreter is only used by the luarocks infrastructure, and there is afaik no specific reason why the host lua variant must match the target one.

Luajit only supports a limited number of architectures, so building it for the host limits the architectures Buildroot can be used on (E.G. powerpc64 autobuilders).

To fix this, always use host-lua. Slightly rework lua.mk to ensure host-lua-5.1 is used when luajit is selected, and drop the logic for using host-luajit.

---
 package/lua/lua.mk                       | 6 +++---
 package/luainterpreter/Config.in         | 4 ++++
 package/luainterpreter/luainterpreter.mk | 2 +-
 package/luarocks/luarocks.mk             | 4 ----
 4 files changed, 8 insertions(+), 8 deletions(-)
package/lua/lua.mk +3 -3
index 0ac2e0e25d..851dc8f734 100644
@@ -16,10 +16,10 @@ endif
 LUA_SITE = http://www.lua.org/ftp
 LUA_INSTALL_STAGING = YES
 LUA_LICENSE = MIT
-ifeq ($(BR2_PACKAGE_LUA_5_1),y)
-LUA_LICENSE_FILES = COPYRIGHT
-else
+ifeq ($(BR2_PACKAGE_LUA_5_2)$(BR2_PACKAGE_LUA_5_3),y)
 LUA_LICENSE_FILES = doc/readme.html
+else
+LUA_LICENSE_FILES = COPYRIGHT
 endif
 
 LUA_PROVIDES = luainterpreter
package/luainterpreter/Config.in +4 -0
index e89a9b84d2..7bc54d862f 100644
@@ -7,3 +7,7 @@ config BR2_PACKAGE_PROVIDES_LUAINTERPRETER
 
 config BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION
 	string
+
+config BR2_PACKAGE_PROVIDES_HOST_LUAINTERPRETER
+	string
+	default "host-lua"
package/luainterpreter/luainterpreter.mk +1 -1
index cb1d5dde18..58d421b183 100644
@@ -20,4 +20,4 @@ endif
 $(eval $(virtual-package))
 $(eval $(host-virtual-package))
 
-LUA_RUN = $(HOST_DIR)/bin/$(call qstrip,$(BR2_PACKAGE_PROVIDES_LUAINTERPRETER))
+LUA_RUN = $(HOST_DIR)/bin/lua
package/luarocks/luarocks.mk +0 -4
index e050cb553c..ea57530633 100644
@@ -23,10 +23,6 @@ HOST_LUAROCKS_CONF_OPTS = \
 	--sysconfdir=$(LUAROCKS_CONFIG_DIR) \
 	--with-lua=$(HOST_DIR)
 
-ifeq ($(BR2_PACKAGE_LUAJIT),y)
-HOST_LUAROCKS_CONF_OPTS += --lua-suffix=jit
-endif
-
 define HOST_LUAROCKS_CONFIGURE_CMDS
 	cd $(@D) && ./configure $(HOST_LUAROCKS_CONF_OPTS)
 endef
Signature · 1 line
2.11.0
#1 lore raw

Fran?ois,

Could you comment on this patch that touches Lua packaging in Buildroot?

It's been there for a bit more than 2 months, so unless you reply to say that you disagree, I'll apply this patch in the next days.

Thanks!

Thomas

Quoted 76 lines · Peter Korsgaard

Similar to how we do for openssl.

host-luainterpreter is only used by the luarocks infrastructure, and there is afaik no specific reason why the host lua variant must match the target one.

Luajit only supports a limited number of architectures, so building it for the host limits the architectures Buildroot can be used on (E.G. powerpc64 autobuilders).

To fix this, always use host-lua. Slightly rework lua.mk to ensure host-lua-5.1 is used when luajit is selected, and drop the logic for using host-luajit.

---
 package/lua/lua.mk                       | 6 +++---
 package/luainterpreter/Config.in         | 4 ++++
 package/luainterpreter/luainterpreter.mk | 2 +-
 package/luarocks/luarocks.mk             | 4 ----
 4 files changed, 8 insertions(+), 8 deletions(-)
package/lua/lua.mk +3 -3
index 0ac2e0e25d..851dc8f734 100644
@@ -16,10 +16,10 @@ endif
 LUA_SITE = http://www.lua.org/ftp
 LUA_INSTALL_STAGING = YES
 LUA_LICENSE = MIT
-ifeq ($(BR2_PACKAGE_LUA_5_1),y)
-LUA_LICENSE_FILES = COPYRIGHT
-else
+ifeq ($(BR2_PACKAGE_LUA_5_2)$(BR2_PACKAGE_LUA_5_3),y)
 LUA_LICENSE_FILES = doc/readme.html
+else
+LUA_LICENSE_FILES = COPYRIGHT
 endif
 
 LUA_PROVIDES = luainterpreter
package/luainterpreter/Config.in +4 -0
index e89a9b84d2..7bc54d862f 100644
@@ -7,3 +7,7 @@ config BR2_PACKAGE_PROVIDES_LUAINTERPRETER
 
 config BR2_PACKAGE_LUAINTERPRETER_ABI_VERSION
 	string
+
+config BR2_PACKAGE_PROVIDES_HOST_LUAINTERPRETER
+	string
+	default "host-lua"
package/luainterpreter/luainterpreter.mk +1 -1
index cb1d5dde18..58d421b183 100644
@@ -20,4 +20,4 @@ endif
 $(eval $(virtual-package))
 $(eval $(host-virtual-package))
 
-LUA_RUN = $(HOST_DIR)/bin/$(call qstrip,$(BR2_PACKAGE_PROVIDES_LUAINTERPRETER))
+LUA_RUN = $(HOST_DIR)/bin/lua
package/luarocks/luarocks.mk +0 -4
index e050cb553c..ea57530633 100644
@@ -23,10 +23,6 @@ HOST_LUAROCKS_CONF_OPTS = \
 	--sysconfdir=$(LUAROCKS_CONFIG_DIR) \
 	--with-lua=$(HOST_DIR)
 
-ifeq ($(BR2_PACKAGE_LUAJIT),y)
-HOST_LUAROCKS_CONF_OPTS += --lua-suffix=jit
-endif
-
 define HOST_LUAROCKS_CONFIGURE_CMDS
 	cd $(@D) && ./configure $(HOST_LUAROCKS_CONF_OPTS)
 endef
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw
In reply to Peter Korsgaard

Hello,

Quoted 9 lines · Peter Korsgaard

Similar to how we do for openssl.

host-luainterpreter is only used by the luarocks infrastructure, and there is afaik no specific reason why the host lua variant must match the target one.

Luajit only supports a limited number of architectures, so building it for the host limits the architectures Buildroot can be used on (E.G. powerpc64 autobuilders).

Quoted 5 lines

To fix this, always use host-lua. Slightly rework lua.mk to ensure host-lua-5.1 is used when luajit is selected, and drop the logic for using host-luajit.

This patch was from October 2017, I pinged Fran?ois on January 2018, and got no feedback. I did a final test with the following defconfig:

BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2017.11-rc1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_10=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_LUAJIT=y
BR2_PACKAGE_COXPCALL=y
BR2_PACKAGE_LUA_DATAFILE=y
BR2_PACKAGE_LUAJSON=y
BR2_PACKAGE_RINGS=y
BR2_PACKAGE_PROSODY=y
# BR2_TARGET_ROOTFS_TAR is not set

Which exercises the two places where host-luainterpreter is used:

- The prosody package
- The luarocks package infrastructure

And the build was successful.

So I've applied this patch.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com