Hi,
This patch makes able to minify lua code sequential inside directories. Here is an example how do can call it in package Makefiles:
First of all you need the host dependencies. PKG_BUILD_DEPENDS += luci-base/host lua/host
Then you muss have to include the gluon spesific package.mk. include $(GLUONDIR)/include/package.mk
After the all abouve just call the following command inside the package compile define. $(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
luasrc can have subdirectorys there will also created inside luadest including its minifyed files.
As an example how good it will woke. I minifyed the Nordwest Freifunk hoodselector. This lua file have currently around 680 lines and a size of 22042 Bytes after minifying it has just 9480 Bytes.
Here is a table of the minifying process:
-------------------------------------------------------------------- Lexical Input Input Input Output Output Output Elements Count Bytes Average Count Bytes Average -------------------------------------------------------------------- TK_KEYWORD 526 1958 3.72 526 1958 3.72 TK_NAME 813 5506 6.77 813 1984 2.44 TK_NUMBER 35 36 1.03 35 36 1.03 TK_STRING 246 3379 13.74 246 3379 13.74 TK_LSTRING 0 0 0.00 0 0 0.00 TK_OP 1276 1356 1.06 1276 1356 1.06 TK_EOS 1 0 0.00 1 0 0.00 -------------------------------------------------------------------- TK_COMMENT 137 6982 50.96 1 14 14.00 TK_LCOMMENT 0 0 0.00 0 0 0.00 TK_EOL 676 676 1.00 466 466 1.00 TK_SPACE 1187 2149 1.81 287 287 1.00 -------------------------------------------------------------------- Total Elements 4897 22042 4.50 3651 9480 2.60 -------------------------------------------------------------------- Total Tokens 2897 12235 4.22 2897 8713 3.01 --------------------------------------------------------------------
Patches for preparing all gluon spesific packages that includes lua code will follow soon.
cheers Tarek
Jan-Tarek Butt (1): add luaSrcDiet call define to package.mk
include/package.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)