Browse Source

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>
Francois Perrad 5 years ago
parent
commit
a850cdce53
2 changed files with 7 additions and 3 deletions
  1. 6 3
      package/luarocks/luarocks.mk
  2. 1 0
      package/pkg-luarocks.mk

+ 6 - 3
package/luarocks/luarocks.mk

@@ -12,7 +12,8 @@ LUAROCKS_LICENSE_FILES = COPYING
 HOST_LUAROCKS_DEPENDENCIES = host-luainterpreter
 HOST_LUAROCKS_DEPENDENCIES = host-luainterpreter
 
 
 LUAROCKS_CONFIG_DIR = $(HOST_DIR)/etc
 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
 define LUAROCKS_ADDON_EXTRACT
 	mkdir $(@D)/src/luarocks/cmd/external
 	mkdir $(@D)/src/luarocks/cmd/external
@@ -30,9 +31,11 @@ define HOST_LUAROCKS_CONFIGURE_CMDS
 endef
 endef
 
 
 define HOST_LUAROCKS_INSTALL_CMDS
 define HOST_LUAROCKS_INSTALL_CMDS
-	rm -f $(LUAROCKS_CONFIG_FILE)
+	rm -f $(LUAROCKS_CONFIG_FILE_DEFAULT)
 	$(MAKE1) -C $(@D) install
 	$(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
 endef
 
 
 $(eval $(host-generic-package))
 $(eval $(host-generic-package))

+ 1 - 0
package/pkg-luarocks.mk

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