3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
13 if($ARGV[0] eq "-r") {
20 if($ARGV[0] eq "-v") {
25 my $firmdir="$ROOT/firmware";
27 my $target = $ARGV[0];
34 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
35 $atime,$mtime,$ctime,$blksize,$blocks)
42 my $dir = "$ROOT/apps/lang";
44 my @files = grep { /\.lang$/ } readdir(DIR
);
49 $output =~ s/(.*)\.lang/$1.lng/;
50 print "lang $_\n" if($verbose);
51 system ("$ROOT/tools/binlang $dir/english.lang $dir/$_ $outputlang/$output >/dev/null 2>&1");
56 my ($zip, $image, $notplayer)=@_;
61 mkdir ".rockbox", 0777;
62 mkdir ".rockbox/langs", 0777;
63 mkdir ".rockbox/rocks", 0777;
64 mkdir ".rockbox/codecs", 0777;
65 mkdir ".rockbox/wps", 0777;
67 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \;';
70 my @call = `find .rockbox/codecs -type f`;
72 # no codec was copied, remove directory again
73 rmdir(".rockbox/codecs");
77 $c= 'find apps "(" -name "*.rock" -o -name "*.ovl" ")" ! -empty -exec cp {} .rockbox/rocks/ \;';
80 open VIEWERS
, "$ROOT/apps/plugins/viewers.config" or
81 die "can't open viewers.config";
85 open VIEWERS
, ">.rockbox/viewers.config" or
86 die "can't create .rockbox/viewers.config";
87 mkdir ".rockbox/viewers", 0777;
88 foreach my $line (@viewers) {
89 if ($line =~ /([^,]*),([^,]*),/) {
90 my ($ext, $plugin)=($1, $2);
91 my $r = "${plugin}.rock";
97 # strip off the last slash and file name part
98 $dir =~ s/(.*)\/(.*)/$1/;
99 # store the file name part
102 # get .ovl name (file part only)
104 $oname =~ s/\.rock$/.ovl/;
106 # print STDERR "$ext $plugin $dir $name $r\n";
108 if(-e
".rockbox/rocks/$name") {
109 if($dir ne "rocks") {
110 # target is not 'rocks' but the plugins are always in that
112 `mv .rockbox/rocks/$name .rockbox/$r`;
116 elsif(-e
".rockbox/$r") {
117 # in case the same plugin works for multiple extensions, it
118 # was already moved to the viewers dir
122 if(-e
".rockbox/rocks/$oname") {
123 # if there's an "overlay" file for the .rock, move that as
125 `mv .rockbox/rocks/$oname .rockbox/$dir`;
132 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels
133 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels
135 mkdir ".rockbox/fonts", 0777;
137 opendir(DIR
, "$ROOT/fonts") || die "can't open dir fonts";
138 my @fonts = grep { /\.bdf$/ && -f
"$ROOT/fonts/$_" } readdir(DIR
);
143 open(SIZE
, ">ziptemp");
146 Font Size We Want: MAX_FONT_SIZE
150 my $c="cat ziptemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
151 # print STDERR "C: $c\n";
152 open(GETSIZE
, "$c|");
155 if($_ =~ /^Font Size We Want: (\d*)/) {
162 die "no decent max font size" if ($maxfont < 2000);
167 print "FONT: $f\n" if($verbose);
169 $o =~ s/\.bdf/\.fnt/;
170 my $cmd ="$ROOT/tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"$ROOT/fonts/$f\" >/dev/null 2>&1";
171 print "CMD: $cmd\n" if($verbose);
174 # no need to add fonts we cannot load anyway
175 my $fontsize = filesize
(".rockbox/fonts/$o");
176 if($fontsize > $maxfont) {
177 unlink(".rockbox/fonts/$o");
184 # image is blank when this is a simulator
185 if( filesize
("rockbox.ucl") > 1000 ) {
186 `cp rockbox.ucl .rockbox/`; # UCL for flashing
188 if( filesize
("rombox.ucl") > 1000) {
189 `cp rombox.ucl .rockbox/`; # UCL for flashing
193 mkdir ".rockbox/docs", 0777;
200 `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`;
203 # Now do the WPS dance
205 system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
208 print STDERR
"No wps module present, can't do the WPS magic!\n";
211 # now copy the file made for reading on the unit:
213 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
216 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
219 buildlangs
(".rockbox/langs");
222 `find .rockbox | zip $zip -@ >/dev/null`;
228 # remove the .rockbox afterwards
232 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
238 $date=sprintf("%04d%02d%02d", $year,$mon, $mday);
239 $shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
241 # made once for all targets
243 my ($type, $target)=@_;
245 # build a full install zip file
246 buildzip
("rockbox.zip", $target,
247 ($type eq "player")?
0:1);
251 # not specified, guess!
252 if($target =~ /(recorder|ondio)/i) {
255 elsif($target =~ /iriver/i) {
256 $exe = "rockbox.iriver";
258 elsif($target =~ /gmini/i) {
259 $exe = "rockbox.gmini";
265 elsif($exe =~ /rockboxui/) {
266 # simulator, exclude the exe file
270 if($target =~ /player/i) {
271 runone
("player", $exe);
274 runone
("recorder", $exe);