luarocks: allow to work with host-luainterpreter
authorFrancois Perrad <fperrad@gmail.com>
Sat, 19 Jul 2014 14:38:57 +0000 (16:38 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 27 Jul 2014 08:44:50 +0000 (10:44 +0200)
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.

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/luainterpreter/luainterpreter.mk
package/luarocks/luarocks.mk

index 4ef0a45c7f557a2a421e54f53a1ec437060e9917..a6c98ab99286e59ba4d86e2651620dda59278d83 100644 (file)
@@ -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))
index 5f7f3952e7b4ed57bcd31b12a7aa7d548bfed2d4..80b9e9fb68eecd3e424b7a91adfb8148ede3f5af 100644 (file)
@@ -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
@@ -44,4 +50,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