luarocks: allow building for the host
authorEnrico Mioso <mrkiko.rs@gmail.com>
Mon, 6 Nov 2017 22:29:06 +0000 (23:29 +0100)
committerEnrico Mioso <mrkiko.rs@gmail.com>
Mon, 6 Nov 2017 22:29:06 +0000 (23:29 +0100)
Allow building luarocks for the host-side, thus making luarocks-based LUA
modules packging easier.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
lang/luarocks/Makefile

index a0943fc3f6ea35cc97c9e2ad815fdfeb1f2c0dc9..c37a3baebb03a67f6de969d41473fd6045b75aff 100644 (file)
@@ -21,8 +21,11 @@ PKG_SOURCE_VERSION:=v$(PKG_VERSION)
 PKG_MAINTAINER:=Amr Hassan <amr.hassan@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))