[LEDE-DEV] [PATCH] luarocks: allow building for the host

Enrico Mioso mrkiko.rs at gmail.com
Thu Nov 9 16:12:36 PST 2017


Allow building luarocks for the host-side, thus making luarocks-based LUA
modules packging easier. Given the extensive use of LUA in LEDE/OpenWRT,
I think it's worth having the luarocks tool available.

Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
 lang/luarocks/Makefile | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lang/luarocks/Makefile b/lang/luarocks/Makefile
index a0943fc3..c37a3bae 100644
--- a/lang/luarocks/Makefile
+++ b/lang/luarocks/Makefile
@@ -21,8 +21,11 @@ PKG_SOURCE_VERSION:=v$(PKG_VERSION)
 PKG_MAINTAINER:=Amr Hassan <amr.hassan at gmail.com>
 PKG_INSTALL=1
 PKG_BUILD_DEPENDS:=lua/host luac/host
+HOST_BUILD_DEPENDS:=$(PKG_BUILD_DEPENDS)
 PKG_LICENSE=GPL
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
 
+include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 
 define Package/luarocks
@@ -44,6 +47,11 @@ CONFIGURE_ARGS = \
     --sysconfdir=/etc \
     --with-lua=$(STAGING_DIR_HOSTPKG)
 
+HOST_CONFIGURE_ARGS= \
+    --prefix=$(STAGING_DIR_HOSTPKG) \
+    --sysconfdir=$(STAGING_DIR_HOSTPKG)/etc \
+    --with-lua=$(STAGING_DIR_HOSTPKG)
+
 CONFIGURE_VARS = \
 	LUAROCKS_UNAME_S="Linux" \
 	LUAROCKS_UNAME_M="$(ARCH)"
@@ -52,6 +60,10 @@ define Build/Compile
 	$(call Build/Compile/Default,build)
 endef
 
+define Host/Compile
+  $(call Host/Compile/Default,build)
+endef
+
 define Package/luarocks/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/luarocks-5.1 $(1)/usr/bin/luarocks
@@ -60,4 +72,10 @@ define Package/luarocks/install
 	$(CP) $(PKG_INSTALL_DIR)/etc $(1)/etc
 endef
 
+define Host/Install
+  $(MAKE) -C $(HOST_BUILD_DIR) install
+endef
+
 $(eval $(call BuildPackage,luarocks))
+
+$(eval $(call HostBuild))
-- 
2.15.0




More information about the Lede-dev mailing list