From 7bf803250be75dac62c6e048fa675c93c9093b9a Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 19 May 2009 02:18:28 +0000 Subject: build: integrate po files in the build system --- Makefile | 8 ++++++-- applications/luci-asterisk/Makefile | 4 +++- applications/luci-coovachilli/Makefile | 4 +++- applications/luci-ddns/Makefile | 4 +++- applications/luci-ffwizard-leipzig/Makefile | 4 +++- applications/luci-fw/Makefile | 4 +++- applications/luci-hd_idle/Makefile | 4 +++- applications/luci-initmgr/Makefile | 4 +++- applications/luci-livestats/Makefile | 4 +++- applications/luci-mmc_over_gpio/Makefile | 2 ++ applications/luci-ntpc/Makefile | 4 +++- applications/luci-olsr/Makefile | 4 +++- applications/luci-openvpn/Makefile | 4 +++- applications/luci-p910nd/Makefile | 2 ++ applications/luci-polipo/Makefile | 2 ++ applications/luci-qos/Makefile | 4 +++- applications/luci-samba/Makefile | 4 +++- applications/luci-siitwizard/Makefile | 4 +++- applications/luci-splash/Makefile | 4 +++- applications/luci-statistics/Makefile | 4 +++- applications/luci-tinyproxy/Makefile | 4 +++- applications/luci-upnp/Makefile | 4 +++- applications/luci-ushare/Makefile | 2 ++ applications/luci-uvc_streamer/Makefile | 4 +++- build/i18n-po2lua.pl | 22 +++++++++++++++------- build/module.mk | 12 ++++++------ i18n/english/Makefile | 4 +++- i18n/french/Makefile | 4 +++- i18n/german/Makefile | 4 +++- i18n/greek/Makefile | 4 +++- i18n/italian/Makefile | 4 +++- i18n/japanese/Makefile | 4 +++- i18n/portuguese_brazilian/Makefile | 4 +++- i18n/russian/Makefile | 4 +++- libs/uvl/Makefile | 4 +++- modules/freifunk/Makefile | 4 +++- 36 files changed, 122 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index 0f0d3aabc6..1b9e25916f 100644 --- a/Makefile +++ b/Makefile @@ -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 81a96f6a83..1b8cf53cd2 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 81a96f6a83..a98ccb8473 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 81a96f6a83..3f57d63c69 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 81a96f6a83..a4f7c76ef9 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 81a96f6a83..87e881d950 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 81a96f6a83..d70bb8789c 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 81a96f6a83..5e05cb7423 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 81a96f6a83..9ee051cd7b 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 f7fac7740e..3f031cb713 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 81a96f6a83..392e8fed10 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 81a96f6a83..119cffc919 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 81a96f6a83..f394a81725 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 f7fac7740e..30073fbd59 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 f7fac7740e..4f5743f443 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 81a96f6a83..ef79869a30 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 81a96f6a83..e91079bb0a 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 81a96f6a83..a4f7c76ef9 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 81a96f6a83..a4f7c76ef9 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 81a96f6a83..ff3d67021c 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 81a96f6a83..0123c164b0 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 81a96f6a83..2f850c618e 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 f7fac7740e..9b0a6e4abd 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 81a96f6a83..eb78c9382b 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 38e6529bb7..8466fd9890 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 de86855bea..6aeb9ba56e 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7e4c710f70 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 81a96f6a83..7901e229b1 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 81a96f6a83..82c5b1324e 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 -- cgit v1.2.3