diff --git a/Makefile b/Makefile
index a9e5e1eb23..558ee352bf 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ gccbuild:
for i in $(MODULES); do make -C$$i compile; done
luabuild:
- for i in $(MODULES); do make -C$$i lua$(LUA_TARGET); done
+ for i in $(MODULES); do make -C$$i luabuild; done
clean:
rm -rf docs
diff --git a/build/config.mk b/build/config.mk
index 5a8f22f899..6f54ce591e 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -1,6 +1,6 @@
LUAC = luac
LUAC_OPTIONS = -s
-LUA_TARGET = source
+LUA_TARGET ?= source
LUA_MODULEDIR = /usr/lib/lua
LUA_LIBRARYDIR = /usr/lib/lua
@@ -10,3 +10,4 @@ LUCI_LIBRARYDIR = $(LUA_LIBRARYDIR)/luci
HTDOCS = /www
+XSLTPROC=$(shell which xsltproc)
diff --git a/build/i18n-lua-xhtml1.xsl b/build/i18n-lua-xhtml1.xsl
new file mode 100644
index 0000000000..82dc604b01
--- /dev/null
+++ b/build/i18n-lua-xhtml1.xsl
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = [[
+
+ ]]
+
+
+
+
+
+
+ <
+
+
+ >
+
+ </
+
+ >
+
+
+
+ <span class="
+
+ "
+
+ >
+
+ </span>
+
+
+
+ <br
+
+ />
+
+
+
+ <img
+
+ />
+
+
+
+
+
+
+
+ xml:
+
+
+ ="
+
+
+
+
+
+
+ "
+
+
+
+
+
+
+
+
+
+
+ xml:lang="
+
+ "
+ lang="
+
+ "
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build/module.mk b/build/module.mk
index 20fdb43767..3a947546b0 100644
--- a/build/module.mk
+++ b/build/module.mk
@@ -1,16 +1,24 @@
+MAKEPATH:=$(dir $(lastword $(MAKEFILE_LIST)))
+-include $(MAKEPATH)config.mk
+-include $(MAKEPATH)gccconfig.mk
+
.PHONY: all build compile luacompile luasource clean luaclean
all: build
build: luabuild gccbuild
-luabuild: lua$(LUA_TARGET)
+luabuild: lua$(LUA_TARGET) i18n
gccbuild: compile
compile:
clean: luaclean
+i18n: luasource
+ [ -n "$(XSLTPROC)" ] && for i in dist$(LUCI_MODULEDIR)/i18n/*.xml; do [ -f "$$i" ]\
+ && { $(XSLTPROC) $(MAKEPATH)i18n-lua-xhtml1.xsl $$i > $${i/.xml/.lua}; rm $$i; }; done || true
+
luasource:
mkdir -p dist$(LUA_MODULEDIR)
mkdir -p dist$(LUCI_MODULEDIR)
@@ -19,7 +27,8 @@ luasource:
cp -a luasrc/* dist$(LUCI_MODULEDIR) -R 2>/dev/null || true
cp -a lua/* dist$(LUA_MODULEDIR) -R 2>/dev/null || true
cp -a htdocs/* dist$(HTDOCS) -R 2>/dev/null || true
- for i in $$(find dist -name .svn); do rm $$i -rf; done
+ for i in $$(find dist -name .svn); do rm $$i -rf || true; done
+
luastrip: luasource
for i in $$(find dist -type f -name '*.lua'); do perl -e 'undef $$/; open( F, "< $$ARGV[0]" ) || die $$!; $$src = ; close F; $$src =~ s/--\[\[.*?\]\](--)?//gs; $$src =~ s/^\s*--.*?\n//gm; open( F, "> $$ARGV[0]" ) || die $$!; print F $$src; close F' $$i; done