package/pkg-luarocks.mk: use custom luarocks config file

In preparation for the addition of the support for host-luarocks
packages, this commit changes the luarocks logic to use a custom
configuration file in $(HOST_DIR)/etc/luarocks/config.lua instead of
the default
$(HOST_DIR)/etc/luarocks/config-$(LUAINTERPRETER_ABIVER).lua.

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
[Thomas: extracted from a larger patch from François]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Francois Perrad 2020-04-12 14:00:43 +02:00 committed by Thomas Petazzoni
parent b522710337
commit a850cdce53
2 changed files with 7 additions and 3 deletions

View File

@ -12,7 +12,8 @@ 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
define LUAROCKS_ADDON_EXTRACT
mkdir $(@D)/src/luarocks/cmd/external
@ -30,9 +31,11 @@ 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
cat $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua >> $(LUAROCKS_CONFIG_FILE)
cat $(LUAROCKS_CONFIG_FILE_DEFAULT) $(HOST_LUAROCKS_PKGDIR)/luarocks-br-config.lua \
> $(LUAROCKS_CONFIG_FILE)a
rm -f $(LUAROCKS_CONFIG_FILE_DEFAULT)
endef
$(eval $(host-generic-package))

View File

@ -70,6 +70,7 @@ endif
ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
cd $$($(2)_SRCDIR) && \
LUAROCKS_CONFIG=$$(LUAROCKS_CONFIG_FILE) \
$$(LUAROCKS_RUN_CMD) make --keep --deps-mode none \
--tree "$$(TARGET_DIR)/usr" \
LUA_INCDIR="$$(STAGING_DIR)/usr/include" \