diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-05-19 02:18:28 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-05-19 02:18:28 +0000 |
commit | 7bf803250be75dac62c6e048fa675c93c9093b9a (patch) | |
tree | f84bb33ebc6ba26e2fc2a2b19e9f8e537de61a62 | |
parent | 2d0ead91d7e4a6ccdbf3029baf3aca66a7729b9b (diff) |
build: integrate po files in the build system
36 files changed, 122 insertions, 44 deletions
@@ -14,8 +14,12 @@ build: gccbuild luabuild gccbuild: for i in $(MODULES); do make -C$$i compile; done -luabuild: - for i in $(MODULES); do make -C$$i luabuild; done +luabuild: i18nbuild + for i in $(MODULES); do HOST=$(realpath host) make -C$$i luabuild; done + +i18nbuild: + mkdir -p host/lua-po + ./build/i18n-po2lua.pl ./po host/lua-po clean: rm -rf docs diff --git a/applications/luci-asterisk/Makefile b/applications/luci-asterisk/Makefile index 81a96f6a8..1b8cf53cd 100644 --- a/applications/luci-asterisk/Makefile +++ b/applications/luci-asterisk/Makefile @@ -1,2 +1,4 @@ +PO = asterisk + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-coovachilli/Makefile b/applications/luci-coovachilli/Makefile index 81a96f6a8..a98ccb847 100644 --- a/applications/luci-coovachilli/Makefile +++ b/applications/luci-coovachilli/Makefile @@ -1,2 +1,4 @@ +PO = coovachilli + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-ddns/Makefile b/applications/luci-ddns/Makefile index 81a96f6a8..3f57d63c6 100644 --- a/applications/luci-ddns/Makefile +++ b/applications/luci-ddns/Makefile @@ -1,2 +1,4 @@ +PO = ddns + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-ffwizard-leipzig/Makefile b/applications/luci-ffwizard-leipzig/Makefile index 81a96f6a8..a4f7c76ef 100644 --- a/applications/luci-ffwizard-leipzig/Makefile +++ b/applications/luci-ffwizard-leipzig/Makefile @@ -1,2 +1,4 @@ +PO = + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-fw/Makefile b/applications/luci-fw/Makefile index 81a96f6a8..87e881d95 100644 --- a/applications/luci-fw/Makefile +++ b/applications/luci-fw/Makefile @@ -1,2 +1,4 @@ +PO = luci-fw + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-hd_idle/Makefile b/applications/luci-hd_idle/Makefile index 81a96f6a8..d70bb8789 100644 --- a/applications/luci-hd_idle/Makefile +++ b/applications/luci-hd_idle/Makefile @@ -1,2 +1,4 @@ +PO = hd_idle + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-initmgr/Makefile b/applications/luci-initmgr/Makefile index 81a96f6a8..5e05cb742 100644 --- a/applications/luci-initmgr/Makefile +++ b/applications/luci-initmgr/Makefile @@ -1,2 +1,4 @@ +PO = initmgr + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-livestats/Makefile b/applications/luci-livestats/Makefile index 81a96f6a8..9ee051cd7 100644 --- a/applications/luci-livestats/Makefile +++ b/applications/luci-livestats/Makefile @@ -1,2 +1,4 @@ +PO = livestats + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-mmc_over_gpio/Makefile b/applications/luci-mmc_over_gpio/Makefile index f7fac7740..3f031cb71 100644 --- a/applications/luci-mmc_over_gpio/Makefile +++ b/applications/luci-mmc_over_gpio/Makefile @@ -1,2 +1,4 @@ +PO = mmc_over_gpio + include ../../build/config.mk include ../../build/module.mk diff --git a/applications/luci-ntpc/Makefile b/applications/luci-ntpc/Makefile index 81a96f6a8..392e8fed1 100644 --- a/applications/luci-ntpc/Makefile +++ b/applications/luci-ntpc/Makefile @@ -1,2 +1,4 @@ +PO = ntpc + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-olsr/Makefile b/applications/luci-olsr/Makefile index 81a96f6a8..119cffc91 100644 --- a/applications/luci-olsr/Makefile +++ b/applications/luci-olsr/Makefile @@ -1,2 +1,4 @@ +PO = olsr + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-openvpn/Makefile b/applications/luci-openvpn/Makefile index 81a96f6a8..f394a8172 100644 --- a/applications/luci-openvpn/Makefile +++ b/applications/luci-openvpn/Makefile @@ -1,2 +1,4 @@ +PO = openvpn + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-p910nd/Makefile b/applications/luci-p910nd/Makefile index f7fac7740..30073fbd5 100644 --- a/applications/luci-p910nd/Makefile +++ b/applications/luci-p910nd/Makefile @@ -1,2 +1,4 @@ +PO = p910nd + include ../../build/config.mk include ../../build/module.mk diff --git a/applications/luci-polipo/Makefile b/applications/luci-polipo/Makefile index f7fac7740..4f5743f44 100644 --- a/applications/luci-polipo/Makefile +++ b/applications/luci-polipo/Makefile @@ -1,2 +1,4 @@ +PO = polipo + include ../../build/config.mk include ../../build/module.mk diff --git a/applications/luci-qos/Makefile b/applications/luci-qos/Makefile index 81a96f6a8..ef79869a3 100644 --- a/applications/luci-qos/Makefile +++ b/applications/luci-qos/Makefile @@ -1,2 +1,4 @@ +PO = qos + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-samba/Makefile b/applications/luci-samba/Makefile index 81a96f6a8..e91079bb0 100644 --- a/applications/luci-samba/Makefile +++ b/applications/luci-samba/Makefile @@ -1,2 +1,4 @@ +PO = samba + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-siitwizard/Makefile b/applications/luci-siitwizard/Makefile index 81a96f6a8..a4f7c76ef 100644 --- a/applications/luci-siitwizard/Makefile +++ b/applications/luci-siitwizard/Makefile @@ -1,2 +1,4 @@ +PO = + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-splash/Makefile b/applications/luci-splash/Makefile index 81a96f6a8..a4f7c76ef 100644 --- a/applications/luci-splash/Makefile +++ b/applications/luci-splash/Makefile @@ -1,2 +1,4 @@ +PO = + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-statistics/Makefile b/applications/luci-statistics/Makefile index 81a96f6a8..ff3d67021 100644 --- a/applications/luci-statistics/Makefile +++ b/applications/luci-statistics/Makefile @@ -1,2 +1,4 @@ +PO = statistics rrdtool + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-tinyproxy/Makefile b/applications/luci-tinyproxy/Makefile index 81a96f6a8..0123c164b 100644 --- a/applications/luci-tinyproxy/Makefile +++ b/applications/luci-tinyproxy/Makefile @@ -1,2 +1,4 @@ +PO = tinyproxy + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-upnp/Makefile b/applications/luci-upnp/Makefile index 81a96f6a8..2f850c618 100644 --- a/applications/luci-upnp/Makefile +++ b/applications/luci-upnp/Makefile @@ -1,2 +1,4 @@ +PO = upnp + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/applications/luci-ushare/Makefile b/applications/luci-ushare/Makefile index f7fac7740..9b0a6e4ab 100644 --- a/applications/luci-ushare/Makefile +++ b/applications/luci-ushare/Makefile @@ -1,2 +1,4 @@ +PO = ushare + include ../../build/config.mk include ../../build/module.mk diff --git a/applications/luci-uvc_streamer/Makefile b/applications/luci-uvc_streamer/Makefile index 81a96f6a8..eb78c9382 100644 --- a/applications/luci-uvc_streamer/Makefile +++ b/applications/luci-uvc_streamer/Makefile @@ -1,2 +1,4 @@ +PO = uvc_streamer + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/build/i18n-po2lua.pl b/build/i18n-po2lua.pl index 38e6529bb..8466fd989 100755 --- a/build/i18n-po2lua.pl +++ b/build/i18n-po2lua.pl @@ -20,11 +20,14 @@ if( open F, "find $source_dir -type f -name '*.po' |" ) { if( open L, "< $file" ) { - my ( $basename ) = $file =~ m{.+/([^/]+\.[\w\-]+)\.po$}; - - if( open D, "> $target_dir/$basename.lua" ) + my $content = 0; + my ( $lang, $basename ) = $file =~ m{.+/(\w+)/([^/]+)\.po$}; + $lang = lc $lang; + $lang =~ s/_/-/g; + + if( open D, "> $target_dir/$basename.$lang.lua" ) { - printf "Generating %-40s ", "$target_dir/$basename.lua"; + printf "Generating %-40s ", "$target_dir/$basename.$lang.lua"; my ( $k, $v ); @@ -44,21 +47,26 @@ if( open F, "find $source_dir -type f -name '*.po' |" ) } else { - if( $k && defined($v) ) + if( $k && defined($v) && length($v) > 0 ) { $v =~ s/\\(['"\\])/$1/g; $v =~ s/(['\\])/\\$1/g; - printf D "%s%s='%s'\n", $v ? '' : '--', $k, $v; + printf D "%s='%s'\n", $k, $v; + $content++; } $k = $v = undef; } } - print "done\n"; + print $content ? "done ($content strings)\n" : "empty\n"; close D; + + + unlink("$target_dir/$basename.$lang.lua") + unless( $content > 0 ); } close L; diff --git a/build/module.mk b/build/module.mk index de86855be..6aeb9ba56 100644 --- a/build/module.mk +++ b/build/module.mk @@ -8,17 +8,13 @@ all: build build: luabuild gccbuild -luabuild: i18n lua$(LUA_TARGET) +luabuild: lua$(LUA_TARGET) gccbuild: compile compile: clean: luaclean -i18n: - [ -n "$(XSLTPROC)" ] && for i in luasrc/i18n/*.xml; do [ "$$i" -nt "$${i%%[.]xml}.lua" ]\ - && $(XSLTPROC) $(MAKEPATH)i18n-lua-xhtml1.xsl $$i > $${i%%[.]xml}.lua; done || true - luasource: mkdir -p dist$(LUA_MODULEDIR) mkdir -p dist$(LUCI_MODULEDIR) @@ -28,7 +24,11 @@ luasource: cp -pR lua/* dist$(LUA_MODULEDIR) 2>/dev/null || true cp -pR htdocs/* dist$(HTDOCS) 2>/dev/null || true for i in $$(find dist -name .svn -or -name .gitignore); do rm -rf $$i || true; done - for i in dist$(LUCI_MODULEDIR)/i18n/*.xml; do [ -f "$$i" ] && rm $$i; done || true + ifneq ($(PO),) + for file in $(PO); do \ + cp $(HOST)/lua-po/$$file.*.lua dist$(LUCI_MODULEDIR)/i18n/; \ + done + endif luastrip: luasource diff --git a/i18n/english/Makefile b/i18n/english/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/english/Makefile +++ b/i18n/english/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/i18n/french/Makefile b/i18n/french/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/french/Makefile +++ b/i18n/french/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/i18n/german/Makefile b/i18n/german/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/german/Makefile +++ b/i18n/german/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/i18n/greek/Makefile b/i18n/greek/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/greek/Makefile +++ b/i18n/greek/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/i18n/italian/Makefile b/i18n/italian/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/italian/Makefile +++ b/i18n/italian/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/i18n/japanese/Makefile b/i18n/japanese/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/japanese/Makefile +++ b/i18n/japanese/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/i18n/portuguese_brazilian/Makefile b/i18n/portuguese_brazilian/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/portuguese_brazilian/Makefile +++ b/i18n/portuguese_brazilian/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/i18n/russian/Makefile b/i18n/russian/Makefile index 81a96f6a8..7e4c710f7 100644 --- a/i18n/russian/Makefile +++ b/i18n/russian/Makefile @@ -1,2 +1,4 @@ +PO = default cbi admin-core sysauth wifi + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/libs/uvl/Makefile b/libs/uvl/Makefile index 81a96f6a8..7901e229b 100644 --- a/libs/uvl/Makefile +++ b/libs/uvl/Makefile @@ -1,2 +1,4 @@ +PO = uvl + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk diff --git a/modules/freifunk/Makefile b/modules/freifunk/Makefile index 81a96f6a8..82c5b1324 100644 --- a/modules/freifunk/Makefile +++ b/modules/freifunk/Makefile @@ -1,2 +1,4 @@ +PO = freifunk + include ../../build/config.mk -include ../../build/module.mk
\ No newline at end of file +include ../../build/module.mk |