blob: fa967b1b28937f1d79fcb64f0d181603c82c1eb5 [file] [log] [blame]
Daniel Stenberg760b7b92004-05-21 19:05:27 +00001#!/usr/bin/perl
2
3sub 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
18sub 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
Björn Stenberg0d53b482004-05-21 21:01:20 +000032 open VIEWERS, "../apps/plugins/viewers.config" or
33 die "can't open viewers.config";
34 @viewers = <VIEWERS>;
35 close VIEWERS;
36 `cp ../apps/plugins/viewers.config .rockbox`;
37 mkdir ".rockbox/viewers";
38 for (@viewers) {
39 if (/,(.+),/) {
40 `mv .rockbox/rocks/$1 .rockbox/viewers`;
41 }
42 }
43
Daniel Stenberg760b7b92004-05-21 19:05:27 +000044 mkdir ".rockbox/fonts", 0777;
45
46 opendir(DIR, "../fonts") || die "can't open dir fonts";
47 my @fonts = grep { /\.bdf$/ && -f "../fonts/$_" } readdir(DIR);
48 closedir DIR;
49
50 for(@fonts) {
51 my $f = $_;
52
53 print "FONT: $f\n" if($verbose);
54 my $o = $f;
55 $o =~ s/\.bdf/\.fnt/;
56 my $cmd ="../tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"../fonts/$f\" >/dev/null 2>&1";
57 print "CMD: $cmd\n" if($verbose);
58 `$cmd`;
59 }
60
Daniel Stenbergb1563522004-06-14 15:04:46 +000061 if($image) {
62 # image is blank when this is a simulator
63 `cp rockbox.ucl .rockbox/`; # UCL for flashing
64 }
Daniel Stenberg760b7b92004-05-21 19:05:27 +000065 }
66
67 mkdir ".rockbox/docs", 0777;
68 for(("BATTERY-FAQ",
69 "CUSTOM_CFG_FORMAT",
70 "CUSTOM_WPS_FORMAT",
71 "FAQ",
72 "NODO",
73 "TECH")) {
74 `cp ../docs/$_ .rockbox/docs/$_.txt`;
75 }
76
77 # now copy the file made for reading on the unit:
78 #if($notplayer) {
79 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
80 #}
81 #else {
82 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
83 #}
84
85 buildlangs(".rockbox/langs");
86
87 `find .rockbox | zip $zip -@ >/dev/null`;
88
Daniel Stenbergb1563522004-06-14 15:04:46 +000089 if($image) {
90 `zip $zip $image`;
91 }
Daniel Stenberg760b7b92004-05-21 19:05:27 +000092
93 # remove the .rockbox afterwards
94 `rm -rf .rockbox`;
Daniel Stenberg760b7b92004-05-21 19:05:27 +000095}
96
97my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
98 localtime(time);
99
100$mon+=1;
101$year+=1900;
102
103$date=sprintf("%04d%02d%02d", $year,$mon, $mday);
104$shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
105
106my $verbose;
107if($ARGV[0] eq "-v") {
108 $verbose =1;
109 shift @ARGV;
110}
111
112# made once for all targets
113sub runone {
114 my ($type, $target)=@_;
115
116 # build a full install zip file
117 buildzip("rockbox.zip", $target,
118 ($type eq "player")?0:1);
119};
120
Daniel Stenbergb1563522004-06-14 15:04:46 +0000121my $target = $ARGV[0];
122
123my $exe = "";
124
125if($target !~ /sim/i) {
126 # not a simulator
127 if($target =~ /recorder/i) {
128 $exe = "ajbrec.ajz";
129 }
130 else {
131 $exe = "archos.mod";
132 }
133}
134
135if($target =~ /recorder/i) {
136 runone("recorder", $exe);
Daniel Stenberg760b7b92004-05-21 19:05:27 +0000137}
138else {
Daniel Stenbergb1563522004-06-14 15:04:46 +0000139 runone("player", $exe);
Daniel Stenberg760b7b92004-05-21 19:05:27 +0000140}
141