Bug 1017490 - rewrite clock build script in javascrip

I think it would help for chinese characters, but actually I don't know :-/