lua: add 5.3.x serie
[buildroot-gz.git] / package / luarocks / luarocks.mk
blob40fdc9122a4fd55ca5fc5bb7767bc45a7f6fb12e
1 ################################################################################
3 # luarocks
5 ################################################################################
7 LUAROCKS_VERSION = 2.2.0
8 LUAROCKS_SITE = http://luarocks.org/releases
9 LUAROCKS_LICENSE = MIT
10 LUAROCKS_LICENSE_FILES = COPYING
12 HOST_LUAROCKS_DEPENDENCIES = host-luainterpreter
14 LUAROCKS_CONFIG_DIR = $(HOST_DIR)/usr/etc/luarocks
15 LUAROCKS_CONFIG_FILE = $(LUAROCKS_CONFIG_DIR)/config-$(LUAINTERPRETER_ABIVER).lua
16 LUAROCKS_CFLAGS = $(TARGET_CFLAGS) -fPIC
17 ifeq ($(BR2_PACKAGE_LUA_5_3),y)
18 LUAROCKS_CFLAGS += -DLUA_COMPAT_5_2
19 endif
21 HOST_LUAROCKS_CONF_OPTS = \
22 --prefix=$(HOST_DIR)/usr \
23 --sysconfdir=$(LUAROCKS_CONFIG_DIR) \
24 --with-lua=$(HOST_DIR)/usr
26 ifeq ($(BR2_PACKAGE_LUAJIT),y)
27 HOST_LUAROCKS_CONF_OPTS += --lua-suffix=jit
28 endif
30 define HOST_LUAROCKS_CONFIGURE_CMDS
31 cd $(@D) && ./configure $(HOST_LUAROCKS_CONF_OPTS)
32 endef
34 define HOST_LUAROCKS_INSTALL_CMDS
35 rm -f $(LUAROCKS_CONFIG_FILE)
36 $(MAKE1) -C $(@D) install \
37 PREFIX=$(HOST_DIR)/usr
38 echo "-- BR cross-compilation" >> $(LUAROCKS_CONFIG_FILE)
39 echo "variables = {" >> $(LUAROCKS_CONFIG_FILE)
40 echo " LUA_INCDIR = [[$(STAGING_DIR)/usr/include]]," >> $(LUAROCKS_CONFIG_FILE)
41 echo " LUA_LIBDIR = [[$(STAGING_DIR)/usr/lib]]," >> $(LUAROCKS_CONFIG_FILE)
42 echo " CC = [[$(TARGET_CC)]]," >> $(LUAROCKS_CONFIG_FILE)
43 echo " LD = [[$(TARGET_CC)]]," >> $(LUAROCKS_CONFIG_FILE)
44 echo " CFLAGS = [[$(LUAROCKS_CFLAGS)]]," >> $(LUAROCKS_CONFIG_FILE)
45 echo " LIBFLAG = [[-shared $(TARGET_LDFLAGS)]]," >> $(LUAROCKS_CONFIG_FILE)
46 echo "}" >> $(LUAROCKS_CONFIG_FILE)
47 echo "external_deps_dirs = { [[$(STAGING_DIR)/usr]] }" >> $(LUAROCKS_CONFIG_FILE)
48 echo "gcc_rpath = false" >> $(LUAROCKS_CONFIG_FILE)
49 echo "rocks_trees = { [[$(TARGET_DIR)/usr]] }" >> $(LUAROCKS_CONFIG_FILE)
50 echo "wrap_bin_scripts = false" >> $(LUAROCKS_CONFIG_FILE)
51 echo "deps_mode = [[none]]" >> $(LUAROCKS_CONFIG_FILE)
52 endef
54 $(eval $(host-generic-package))
56 LUAROCKS_RUN = LUA_PATH="$(HOST_DIR)/usr/share/lua/$(LUAINTERPRETER_ABIVER)/?.lua" \
57 $(LUA_RUN) $(HOST_DIR)/usr/bin/luarocks
59 define LUAROCKS_FINALIZE_TARGET
60 rm -rf $(TARGET_DIR)/usr/lib/luarocks
61 endef
63 TARGET_FINALIZE_HOOKS += LUAROCKS_FINALIZE_TARGET