819e2b9c34
Currently, luarocks.mk generates a configuration file with hardcoded STAGING_DIR, TARGET_DIR, TARGET_CC, LUAROCKS_CFLAGS and TARGET_LDFLAGS values. This is not compatible with per-package directories, where the value of STAGING_DIR, TARGET_DIR, TARGET_CC and possibly TARGET_CFLAGS/TARGET_LDFLAGS may be different from one package to the other. Based on input from François Perrad, this commit: - Changes the Luarocks configuration file to use os_getenv() for the appropriate variables. Since the contents of this file is not fixed, it is no longer generated by luarocks.mk using a series of 'echo' but simply concatenated with the rest of the Luarocks configuration file. - Adjusts LUAROCKS_RUNV_ENV so that the necessary environment variables are now passed. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Acked-by: Francois Perrad <francois.perrad@gadz.org> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
53 lines
1.5 KiB
Makefile
53 lines
1.5 KiB
Makefile
################################################################################
|
|
#
|
|
# luarocks
|
|
#
|
|
################################################################################
|
|
|
|
LUAROCKS_VERSION = 3.0.4
|
|
LUAROCKS_SITE = http://luarocks.org/releases
|
|
LUAROCKS_LICENSE = MIT
|
|
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_CFLAGS = $(TARGET_CFLAGS) -fPIC
|
|
ifeq ($(BR2_PACKAGE_LUA_5_3),y)
|
|
LUAROCKS_CFLAGS += -DLUA_COMPAT_5_2
|
|
endif
|
|
|
|
HOST_LUAROCKS_CONF_OPTS = \
|
|
--prefix=$(HOST_DIR) \
|
|
--sysconfdir=$(LUAROCKS_CONFIG_DIR) \
|
|
--with-lua=$(HOST_DIR)
|
|
|
|
define HOST_LUAROCKS_CONFIGURE_CMDS
|
|
cd $(@D) && ./configure $(HOST_LUAROCKS_CONF_OPTS)
|
|
endef
|
|
|
|
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)
|
|
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
|
|
|
|
# Apply to global variable directly, as pkg-generic does not
|
|
ifneq ($(BR2_PACKAGE_LUAJIT)$(BR2_PACKAGE_LUA),)
|
|
TARGET_FINALIZE_HOOKS += LUAROCKS_FINALIZE_TARGET
|
|
endif
|