diff options
Diffstat (limited to 'tools/buildzip.pl')
-rwxr-xr-x | tools/buildzip.pl | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/tools/buildzip.pl b/tools/buildzip.pl new file mode 100755 index 0000000000..a1edb4eed6 --- /dev/null +++ b/tools/buildzip.pl | |||
@@ -0,0 +1,112 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | sub buildlangs { | ||
4 | my ($outputlang)=@_; | ||
5 | my $dir = "../apps/lang"; | ||
6 | opendir(DIR, $dir); | ||
7 | my @files = grep { /\.lang$/ } readdir(DIR); | ||
8 | closedir(DIR); | ||
9 | |||
10 | for(@files) { | ||
11 | my $output = $_; | ||
12 | $output =~ s/(.*)\.lang/$1.lng/; | ||
13 | print "lang $_\n" if($verbose); | ||
14 | system ("../tools/binlang $dir/english.lang $dir/$_ $outputlang/$output >/dev/null 2>&1"); | ||
15 | } | ||
16 | } | ||
17 | |||
18 | sub buildzip { | ||
19 | my ($zip, $image, $notplayer)=@_; | ||
20 | |||
21 | # remove old traces | ||
22 | `rm -rf .rockbox`; | ||
23 | |||
24 | mkdir ".rockbox", 0777; | ||
25 | mkdir ".rockbox/langs", 0777; | ||
26 | mkdir ".rockbox/rocks", 0777; | ||
27 | `find . -name "*.rock" ! -empty | xargs --replace=foo cp foo .rockbox/rocks/`; | ||
28 | |||
29 | if($notplayer) { | ||
30 | `cp ../apps/plugins/sokoban.levels .rockbox/`; # sokoban levels | ||
31 | |||
32 | mkdir ".rockbox/fonts", 0777; | ||
33 | |||
34 | opendir(DIR, "../fonts") || die "can't open dir fonts"; | ||
35 | my @fonts = grep { /\.bdf$/ && -f "../fonts/$_" } readdir(DIR); | ||
36 | closedir DIR; | ||
37 | |||
38 | for(@fonts) { | ||
39 | my $f = $_; | ||
40 | |||
41 | print "FONT: $f\n" if($verbose); | ||
42 | my $o = $f; | ||
43 | $o =~ s/\.bdf/\.fnt/; | ||
44 | my $cmd ="../tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"../fonts/$f\" >/dev/null 2>&1"; | ||
45 | print "CMD: $cmd\n" if($verbose); | ||
46 | `$cmd`; | ||
47 | } | ||
48 | |||
49 | `cp rockbox.ucl .rockbox/`; # UCL for flashing | ||
50 | } | ||
51 | |||
52 | mkdir ".rockbox/docs", 0777; | ||
53 | for(("BATTERY-FAQ", | ||
54 | "CUSTOM_CFG_FORMAT", | ||
55 | "CUSTOM_WPS_FORMAT", | ||
56 | "FAQ", | ||
57 | "NODO", | ||
58 | "TECH")) { | ||
59 | `cp ../docs/$_ .rockbox/docs/$_.txt`; | ||
60 | } | ||
61 | |||
62 | # now copy the file made for reading on the unit: | ||
63 | #if($notplayer) { | ||
64 | # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`; | ||
65 | #} | ||
66 | #else { | ||
67 | # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`; | ||
68 | #} | ||
69 | |||
70 | buildlangs(".rockbox/langs"); | ||
71 | |||
72 | `find .rockbox | zip $zip -@ >/dev/null`; | ||
73 | |||
74 | `zip $zip $image`; | ||
75 | |||
76 | # remove the .rockbox afterwards | ||
77 | `rm -rf .rockbox`; | ||
78 | |||
79 | print "Created $zip\n"; | ||
80 | } | ||
81 | |||
82 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = | ||
83 | localtime(time); | ||
84 | |||
85 | $mon+=1; | ||
86 | $year+=1900; | ||
87 | |||
88 | $date=sprintf("%04d%02d%02d", $year,$mon, $mday); | ||
89 | $shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday); | ||
90 | |||
91 | my $verbose; | ||
92 | if($ARGV[0] eq "-v") { | ||
93 | $verbose =1; | ||
94 | shift @ARGV; | ||
95 | } | ||
96 | |||
97 | # made once for all targets | ||
98 | sub runone { | ||
99 | my ($type, $target)=@_; | ||
100 | |||
101 | # build a full install zip file | ||
102 | buildzip("rockbox.zip", $target, | ||
103 | ($type eq "player")?0:1); | ||
104 | }; | ||
105 | |||
106 | if($ARGV[0] !~ /player/i) { | ||
107 | runone("recorder", "ajbrec.ajz"); | ||
108 | } | ||
109 | else { | ||
110 | runone("player", "archos.mod"); | ||
111 | } | ||
112 | |||