buildrootschalter/package/luarocks/luarocks.mk
Francois Perrad 7669aab6b4 luarocks: remove luainterpreter dependency
All packages using the luarocks infrastructure need a dependency on
luainterpreter, because having the Lua interpreter for the target is
needed to built native Lua modules. This dependency is already taken
care of in pkg-luarocks.mk.

However, host-luarocks, which is built as a dependency of the extract
step of any luarocks package, also had a dependency on
luainterpreter. Not only this was not necessary, but it was causing
problems with 'make legal-info'. Since 'make legal-info' triggers the
extraction of all packages, as soon as a luarocks package was enabled,
it would trigger the build of host-luarocks, itself triggering the
build of luainterpreter and therefore its dependencies, amongst which
the entire cross-compilation toolchain.

[Thomas: reword commit log to include more detailed explanations.]

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-03-01 23:47:40 +01:00

47 lines
2.0 KiB
Makefile

################################################################################
#
# luarocks
#
################################################################################
LUAROCKS_VERSION = 2.1.2
LUAROCKS_SITE = http://luarocks.org/releases/
LUAROCKS_LICENSE = MIT
LUAROCKS_LICENSE_FILES = COPYING
HOST_LUAROCKS_DEPENDENCIES = host-lua
LUAROCKS_CONFIG_DIR = $(HOST_DIR)/usr/etc/luarocks
LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/config-$(LUAINTERPRETER_ABIVER).lua
define HOST_LUAROCKS_CONFIGURE_CMDS
cd $(@D) && ./configure \
--prefix=$(HOST_DIR)/usr \
--sysconfdir=$(LUAROCKS_CONFIG_DIR) \
--with-lua=$(HOST_DIR)/usr
endef
define HOST_LUAROCKS_INSTALL_CMDS
rm -f $(LUAROCKS_CONFIG_FILE)
$(MAKE1) -C $(@D) install \
PREFIX=$(HOST_DIR)/usr
echo "-- BR cross-compilation" >> $(LUAROCKS_CONFIG_FILE)
echo "variables = {" >> $(LUAROCKS_CONFIG_FILE)
echo " LUA_INCDIR = [[$(STAGING_DIR)/usr/include]]," >> $(LUAROCKS_CONFIG_FILE)
echo " LUA_LIBDIR = [[$(STAGING_DIR)/usr/lib]]," >> $(LUAROCKS_CONFIG_FILE)
echo " CC = [[$(TARGET_CC)]]," >> $(LUAROCKS_CONFIG_FILE)
echo " LD = [[$(TARGET_CC)]]," >> $(LUAROCKS_CONFIG_FILE)
echo " CFLAGS = [[$(TARGET_CFLAGS) -fPIC]]," >> $(LUAROCKS_CONFIG_FILE)
echo " LIBFLAG = [[-shared $(TARGET_LDFLAGS)]]," >> $(LUAROCKS_CONFIG_FILE)
echo "}" >> $(LUAROCKS_CONFIG_FILE)
echo "external_deps_dirs = { [[$(STAGING_DIR)/usr]] }" >> $(LUAROCKS_CONFIG_FILE)
echo "gcc_rpath = false" >> $(LUAROCKS_CONFIG_FILE)
echo "rocks_trees = { [[$(TARGET_DIR)/usr]] }" >> $(LUAROCKS_CONFIG_FILE)
echo "wrap_bin_scripts = false" >> $(LUAROCKS_CONFIG_FILE)
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