[LEDE-DEV] [PATCH] add luaSrcDiet call define to package.mk

Jan-Tarek Butt tarek at ring0.de
Sun Oct 2 13:37:36 PDT 2016


---
 include/package.mk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/package.mk b/include/package.mk
index fa5c4e7..fb76057 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -5,6 +5,8 @@
 # See /LICENSE for more information.
 #
 
+# Dependencies for LuaSrcDiet
+PKG_BUILD_DEPENDS += luci-base/host lua/host
 __package_mk:=1
 
 all: $(if $(DUMP),dumpinfo,compile)
@@ -238,6 +240,19 @@ define Build/IncludeOverlay
   endef
 endef
 
+define LuaSrcDiet
+	rm -rf $(2)
+	$(CP) $(1) $(2)
+	$(FIND) $(2) -type f | while read src; do \
+		if $(STAGING_DIR_HOST)/bin/lua $(STAGING_DIR_HOST)/bin/LuaSrcDiet \
+			--noopt-binequiv -o "$$$$src.o" "$$$$src"; \
+		then \
+			chmod $$$$(stat -c%a "$$$$src") "$$$$src.o"; \
+			mv "$$$$src.o" "$$$$src"; \
+		fi; \
+	done
+endef
+
 define BuildPackage
   $(Build/IncludeOverlay)
   $(eval $(Package/Default))
@@ -298,7 +313,7 @@ prepare-package-install:
 
 $(PACKAGE_DIR):
 	mkdir -p $@
-	
+
 dumpinfo:
 download:
 prepare:
-- 
2.10.0




More information about the Lede-dev mailing list