package/luarocks: now luajit is dynamically detected by luarocks
PATCH v2 1/5 package/luarocks: now luajit is dynamically detected by luarocks
--- package/luarocks/luarocks.mk | 7 ------- 1 file changed, 7 deletions(-)
package/luarocks/luarocks.mk +0 -7
@@ -33,17 +33,10 @@ define HOST_LUAROCKS_CONFIGURE_CMDS cd $(@D) && ./configure $(HOST_LUAROCKS_CONF_OPTS) endef -ifeq ($(BR2_PACKAGE_LUAJIT),y) -define LUAROCKS_CONFIGURE_INTERPRETER_LUAJIT - echo "lua_interpreter = [[luajit]]" >> $(LUAROCKS_CONFIG_FILE) -endef -endif - define HOST_LUAROCKS_INSTALL_CMDS rm -f $(LUAROCKS_CONFIG_FILE) $(MAKE1) -C $(@D) install cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua >> $(LUAROCKS_CONFIG_FILE) - $(LUAROCKS_CONFIGURE_INTERPRETER_LUAJIT) endef $(eval $(host-generic-package))
Signature · 1 line
2.20.1
PATCH v2 2/5 pkg-luarocks: refactor infra
move stuff from luarocks.mk and luarocks-br-config.lua to pkg-luarocks.mk
--- package/luarocks/luarocks-br-config.lua | 8 -------- package/luarocks/luarocks.mk | 11 ----------- package/pkg-luarocks.mk | 20 +++++++++++++++++--- 3 files changed, 17 insertions(+), 22 deletions(-)
package/luarocks/luarocks-br-config.lua +0 -8
@@ -1,13 +1,5 @@ -- BR cross-compilation local function getenv (name) return os_getenv(name) or '' end -variables.LUA_INCDIR = getenv('STAGING_DIR') .. [[/usr/include]] -variables.LUA_LIBDIR = getenv('STAGING_DIR') .. [[/usr/lib]] -variables.CC = getenv('TARGET_CC') -variables.LD = getenv('TARGET_CC') -variables.CFLAGS = getenv('TARGET_CFLAGS') -variables.LIBFLAG = [[-shared ]] .. getenv('TARGET_LDFLAGS') external_deps_dirs = { getenv('STAGING_DIR') .. [[/usr]] } gcc_rpath = false -rocks_trees = { getenv('TARGET_DIR') .. [[/usr]] } wrap_bin_scripts = false -deps_mode = [[none]]
package/luarocks/luarocks.mk +0 -11
@@ -13,10 +13,6 @@ HOST_LUAROCKS_DEPENDENCIES = host-luainterpreter LUAROCKS_CONFIG_DIR = $(HOST_DIR)/etc LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/luarocks/config-$(LUAINTERPRETER_ABIVER).lua -LUAROCKS_CFLAGS = $(TARGET_CFLAGS) -fPIC -ifeq ($(BR2_PACKAGE_LUA_5_3),y) -LUAROCKS_CFLAGS += -DLUA_COMPAT_5_2 -endif define LUAROCKS_ADDON_EXTRACT mkdir $(@D)/src/luarocks/cmd/external
@@ -41,13 +37,6 @@ endef $(eval $(host-generic-package)) -LUAROCKS_RUN_ENV = \ - LUA_PATH="$(HOST_DIR)/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua" \ - TARGET_CC="$(TARGET_CC)" \ - TARGET_CFLAGS="$(LUAROCKS_CFLAGS)" \ - TARGET_LDFLAGS="$(TARGET_LDFLAGS)" -LUAROCKS_RUN_CMD = $(LUA_RUN) $(HOST_DIR)/bin/luarocks - define LUAROCKS_FINALIZE_TARGET rm -rf $(TARGET_DIR)/usr/lib/luarocks endef
package/pkg-luarocks.mk +17 -3
@@ -17,6 +17,12 @@ # ################################################################################ +LUAROCKS_RUN_CMD = $(HOST_DIR)/bin/luarocks +LUAROCKS_CFLAGS = $(TARGET_CFLAGS) -fPIC +ifeq ($(BR2_PACKAGE_LUA_5_3),y) +LUAROCKS_CFLAGS += -DLUA_COMPAT_5_2 +endif + ################################################################################ # inner-luarocks-package -- defines how the configuration, compilation and # installation of a LuaRocks package should be done, implements a few hooks to
@@ -53,7 +59,7 @@ ifndef $(2)_EXTRACT_CMDS define $(2)_EXTRACT_CMDS mkdir -p $$($(2)_DIR)/luarocks-extract cd $$($(2)_DIR)/luarocks-extract && \ - $$(LUAROCKS_RUN_ENV) $$(LUAROCKS_RUN_CMD) unpack --force $$($(2)_DL_DIR)/$$($(2)_SOURCE) + $$(LUAROCKS_RUN_CMD) unpack --force $$($(2)_DL_DIR)/$$($(2)_SOURCE) mv $$($(2)_DIR)/luarocks-extract/*/* $$($(2)_DIR) endef endif
@@ -63,8 +69,16 @@ endif # ifndef $(2)_INSTALL_TARGET_CMDS define $(2)_INSTALL_TARGET_CMDS - cd $$($(2)_SRCDIR) && $$(LUAROCKS_RUN_ENV) \ - $$(LUAROCKS_RUN_CMD) make --keep $$($(2)_ROCKSPEC) $$($(2)_BUILD_OPTS) + cd $$($(2)_SRCDIR) && \ + $$(LUAROCKS_RUN_CMD) make --keep --deps-mode none \ + --tree "$$(TARGET_DIR)/usr" \ + LUA_INCDIR="$$(STAGING_DIR)/usr/include" \ + LUA_LIBDIR="$$(STAGING_DIR)/usr/lib" \ + CC=$$(TARGET_CC) \ + LD=$$(TARGET_CC) \ + CFLAGS="$$(LUAROCKS_CFLAGS)" \ + LIBFLAG="-shared $$(TARGET_LDFLAGS)" \ + $$($(2)_BUILD_OPTS) $$($(2)_ROCKSPEC) endef endif
Signature · 1 line
2.20.1
Thomas Petazzoni
AppliedPATCH v2 2/5 pkg-luarocks: refactor infra
Quoted 9 lines · On Sun, 22 Mar 2020 09:07:03 +0100 Francois Perrad <[email protected]> wrote:
move stuff from luarocks.mk and luarocks-br-config.lua to pkg-luarocks.mk
Signed-off-by Francois Perrad <[email protected]>--- package/luarocks/luarocks-br-config.lua | 8 -------- package/luarocks/luarocks.mk | 11 ----------- package/pkg-luarocks.mk | 20 +++++++++++++++++--- 3 files changed, 17 insertions(+), 22 deletions(-)
I have applied, but after extending the commit log to give more details about what is happening:
https://git.buildroot.org/buildroot/commit/?id=052629291449147ff18dc6ff63a94f043ea4aadf
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 3/5 pkg-luarocks: add support of host-luarocks-package
In reply to Francois Perrad--- docs/manual/adding-packages-luarocks.txt | 4 +- package/luarocks/luarocks-br-host-config.lua | 3 + package/luarocks/luarocks.mk | 10 ++- package/pkg-luarocks.mk | 68 +++++++++++++++++--- 4 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 package/luarocks/luarocks-br-host-config.lua
docs/manual/adding-packages-luarocks.txt +1 -3
@@ -73,9 +73,7 @@ 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 -metadata information 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. +metadata information about the package, and then calling +luarocks-package+. Just like the generic infrastructure, the LuaRocks infrastructure works by defining a number of variables before calling the +luarocks-package+
package/luarocks/luarocks-br-host-config.lua new file +3 -0
@@ -0,0 +1,3 @@ +-- BR host compilation +local function getenv (name) return os_getenv(name) or '' end +external_deps_dirs = { getenv('HOST_DIR') }
package/luarocks/luarocks.mk +8 -2
@@ -12,7 +12,9 @@ LUAROCKS_LICENSE_FILES = COPYING HOST_LUAROCKS_DEPENDENCIES = host-luainterpreter LUAROCKS_CONFIG_DIR = $(HOST_DIR)/etc -LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/luarocks/config-$(LUAINTERPRETER_ABIVER).lua +LUAROCKS_CONFIG_FILE_DEFAULT = $(LUAROCKS_CONFIG_DIR)/luarocks/config-$(LUAINTERPRETER_ABIVER).lua +LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/luarocks/config.lua +HOST_LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/luarocks/host-config.lua define LUAROCKS_ADDON_EXTRACT mkdir $(@D)/src/luarocks/cmd/external
@@ -30,9 +32,13 @@ define HOST_LUAROCKS_CONFIGURE_CMDS endef define HOST_LUAROCKS_INSTALL_CMDS - rm -f $(LUAROCKS_CONFIG_FILE) + rm -f $(LUAROCKS_CONFIG_FILE_DEFAULT) $(MAKE1) -C $(@D) install + cp $(LUAROCKS_CONFIG_FILE_DEFAULT) $(LUAROCKS_CONFIG_FILE) cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua >> $(LUAROCKS_CONFIG_FILE) + cp $(LUAROCKS_CONFIG_FILE_DEFAULT) $(HOST_LUAROCKS_CONFIG_FILE) + cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-host-config.lua >> $(HOST_LUAROCKS_CONFIG_FILE) + rm -f $(LUAROCKS_CONFIG_FILE_DEFAULT) endef $(eval $(host-generic-package))
package/pkg-luarocks.mk +58 -10
98 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v2 3/5 pkg-luarocks: add support of host-luarocks-package
Hello,
Quoted 1 line · On Sun, 22 Mar 2020 09:07:04 +0100 Francois Perrad <[email protected]> wrote:
Signed-off-by Francois Perrad <[email protected]>
So I have applied, but after splitting this into two patches. See below.
package/luarocks/luarocks.mk LUAROCKS_LICENSE_FILES = COPYING · line 17
Quoted 5 lines
LUAROCKS_CONFIG_DIR= $(HOST_DIR)/etcpackage/luarocks/luarocks.mk +3
-1-LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/luarocks/config-$(LUAINTERPRETER_ABIVER).lua +LUAROCKS_CONFIG_FILE_DEFAULT = $(LUAROCKS_CONFIG_DIR)/luarocks/config-$(LUAINTERPRETER_ABIVER).lua +LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/luarocks/config.lua +HOST_LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/luarocks/host-config.lua
I've split out the fact that we use a different configuration file for the target into a separate commit.
package/luarocks/luarocks.mk define HOST_LUAROCKS_CONFIGURE_CMDS · line 38
Quoted 6 lines
define
HOST_LUAROCKS_INSTALL_CMDSpackage/luarocks/luarocks.mk +2
-1- rm -f $(LUAROCKS_CONFIG_FILE) + rm -f $(LUAROCKS_CONFIG_FILE_DEFAULT) $(MAKE1) -C $(@D) install + cp $(LUAROCKS_CONFIG_FILE_DEFAULT) $(LUAROCKS_CONFIG_FILE) cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua >> $(LUAROCKS_CONFIG_FILE)
I've used:
cat foo1 foo2 > foo
instead of:
cp foo1 foo
cat foo2 >> foo
But, can't we instead use some Lua statement/directive to have the common config file included by both the host and target configuration files ? That would be a bit nicer than having to concatenate them here.
See the two final commits:
https://git.buildroot.org/buildroot/commit/?id=a850cdce5373408890a2b35de31db04963870143
https://git.buildroot.org/buildroot/commit/?id=060eb0e7e4fe67f86f0027383c6f74ee46eb3aa0
Could you submit a patch that adds a host luarocks package, so at least this feature is used by one package in the tree ?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 4/5 package/lua: allows to load native modules from host-lua
In reply to Francois Perradso, we need a liblua.so
and some modules require Lua 5.2 functions
--- package/lua/lua.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
package/lua/lua.mk +4 -1
@@ -55,6 +55,9 @@ LUA_POST_PATCH_HOOKS += LUA_32BITS_LUACONF endif HOST_LUA_CFLAGS = -Wall -fPIC -DLUA_USE_DLOPEN -DLUA_USE_POSIX +ifeq ($(BR2_PACKAGE_LUA_5_3),y) +HOST_LUA_CFLAGS += -DLUA_COMPAT_5_2 +endif HOST_LUA_MYLIBS = -ldl define LUA_BUILD_CMDS
@@ -74,7 +77,7 @@ define HOST_LUA_BUILD_CMDS CFLAGS="$(HOST_LUA_CFLAGS)" \ MYLDFLAGS="$(HOST_LDFLAGS)" \ MYLIBS="$(HOST_LUA_MYLIBS)" \ - BUILDMODE=static \ + BUILDMODE=dynamic \ PKG_VERSION=$(LUA_VERSION) -C $(@D)/src all sed -e "s/@VERSION@/$(LUA_VERSION)/;s/@ABI@/$(LUAINTERPRETER_ABIVER)/;s/@MYLIBS@/$(HOST_LUA_MYLIBS)/" \ package/lua/lua.pc.in > $(@D)/lua.pc
Signature · 1 line
2.20.1
Thomas Petazzoni
AppliedPATCH v2 4/5 package/lua: allows to load native modules from host-lua
Quoted 7 lines · On Sun, 22 Mar 2020 09:07:05 +0100 Francois Perrad <[email protected]> wrote:
so, we need a liblua.so
and some modules require Lua 5.2 functionsSigned-off-by Francois Perrad <[email protected]>--- package/lua/lua.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Applied to master with an improved commit log.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 5/5 package/lua: allows host-lua to find installed modules
In reply to Francois Perrad--- package/lua/lua.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/lua/lua.mk +6 -0
@@ -54,6 +54,12 @@ endef LUA_POST_PATCH_HOOKS += LUA_32BITS_LUACONF endif +define HOST_LUA_LUACONF + $(SED) 's|#define LUA_ROOT.*|#define LUA_ROOT "$(HOST_DIR)/usr/"|' $(@D)/src/luaconf.h +endef + +HOST_LUA_POST_PATCH_HOOKS += HOST_LUA_LUACONF + HOST_LUA_CFLAGS = -Wall -fPIC -DLUA_USE_DLOPEN -DLUA_USE_POSIX ifeq ($(BR2_PACKAGE_LUA_5_3),y) HOST_LUA_CFLAGS += -DLUA_COMPAT_5_2
Signature · 1 line
2.20.1
Thomas Petazzoni
AppliedPATCH v2 5/5 package/lua: allows host-lua to find installed modules
Quoted 4 lines · On Sun, 22 Mar 2020 09:07:06 +0100 Francois Perrad <[email protected]> wrote:
Signed-off-by Francois Perrad <[email protected]>--- package/lua/lua.mk | 6 ++++++ 1 file changed, 6 insertions(+)
Applied to master with an improved commit log. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 1/5 package/luarocks: now luajit is dynamically detected by luarocks
In reply to Francois PerradQuoted 4 lines · On Sun, 22 Mar 2020 09:07:02 +0100 Francois Perrad <[email protected]> wrote:
Signed-off-by Francois Perrad <[email protected]>--- package/luarocks/luarocks.mk | 7 ------- 1 file changed, 7 deletions(-)
Why no commit log? Come on Fran?ois, we've asked you many, many, many, many times to have more details in your commit log. So an empty commit should definitely be a sign that the patch is not good.
So, I've taken the time to extend the commit log by doing some research in the Luarocks Git commit history. See:
https://git.buildroot.org/buildroot/commit/?id=a27d01cde157ea0534ba66fecc3e8fb82cde9155
It would really be nice if you could help us by providing more detailed commit logs.
Thanks for your help.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com