3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
14 my $output="rockbox.zip";
22 if($ARGV[0] eq "-r") {
28 elsif($ARGV[0] eq "-z") {
34 elsif($ARGV[0] eq "-t") {
35 # The target name as used in ARCHOS in the root makefile
40 elsif($ARGV[0] eq "-i") {
41 # The target id name as used in TARGET_ID in the root makefile
46 elsif($ARGV[0] eq "-o") {
51 elsif($ARGV[0] eq "-f") {
52 $incfonts=$ARGV[1]; # 0 - no fonts, 1 - fonts only 2 - fonts and package
57 elsif($ARGV[0] eq "-v") {
69 my $firmdir="$ROOT/firmware";
70 my $appsdir="$ROOT/apps";
71 my $viewer_bmpdir="$ROOT/apps/plugins/bitmaps/viewer_defaults";
76 open(GCC
, ">gcctemp");
77 # Get the LCD screen depth and graphical status
80 #ifdef HAVE_LCD_BITMAP
83 Icon Width: CONFIG_DEFAULT_ICON_WIDTH
84 Icon Height: CONFIG_DEFAULT_ICON_HEIGHT
87 #ifdef HAVE_REMOTE_LCD
88 Remote Depth: LCD_REMOTE_DEPTH
89 Remote Icon Width: CONFIG_REMOTE_DEFAULT_ICON_WIDTH
90 Remote Icon Height: CONFIG_REMOTE_DEFAULT_ICON_HEIGHT
101 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
103 # print STDERR "CMD $c\n";
107 my ($bitmap, $depth, $swcodec, $icon_h, $icon_w);
108 my ($remote_depth, $remote_icon_h, $remote_icon_w);
112 # print STDERR "DATA: $_";
113 if($_ =~ /^Bitmap: (.*)/) {
116 elsif($_ =~ /^Depth: (\d*)/) {
119 elsif($_ =~ /^Icon Width: (\d*)/) {
122 elsif($_ =~ /^Icon Height: (\d*)/) {
125 elsif($_ =~ /^Codec: (\d*)/) {
126 # SWCODEC is 1, the others are HWCODEC
127 $swcodec = ($1 == 1);
129 elsif($_ =~ /^Remote Depth: (\d*)/) {
132 elsif($_ =~ /^Remote Icon Width: (\d*)/) {
135 elsif($_ =~ /^Remote Icon Height: (\d*)/) {
138 if($_ =~ /^Recording: (.*)/) {
145 return ($bitmap, $depth, $icon_w, $icon_h, $recording,
146 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h);
151 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
152 $atime,$mtime,$ctime,$blksize,$blocks)
159 my $dir = "$ROOT/apps/lang";
161 my @files = grep { /\.lang$/ } readdir(DIR
);
166 $output =~ s/(.*)\.lang/$1.lng/;
167 print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -i=$target_id -b=$outputlang/$output $dir/$_\n" if($verbose);
168 system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -i=$target_id -b=$outputlang/$output $dir/$_ >/dev/null 2>&1");
173 my ($zip, $image, $fonts)=@_;
175 my ($bitmap, $depth, $icon_w, $icon_h, $recording, $swcodec,
176 $remote_depth, $remote_icon_w, $remote_icon_h) = &gettargetinfo
();
178 # print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
183 mkdir ".rockbox", 0777;
186 # always disable fonts on non-bitmap targets
189 # create the file so the database does not try indexing a folder
190 `touch .rockbox/database.ignore`;
193 mkdir ".rockbox/fonts", 0777;
195 opendir(DIR
, "$ROOT/fonts") || die "can't open dir fonts";
196 my @fonts = grep { /\.bdf$/ && -f
"$ROOT/fonts/$_" } readdir(DIR
);
202 print "FONT: $f\n" if($verbose);
204 $o =~ s/\.bdf/\.fnt/;
205 my $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$o\" \"$ROOT/fonts/$f\" >/dev/null 2>&1";
206 print "CMD: $cmd\n" if($verbose);
211 # fonts-only package, return
216 mkdir ".rockbox/langs", 0777;
217 mkdir ".rockbox/rocks", 0777;
218 mkdir ".rockbox/rocks/games", 0777;
219 mkdir ".rockbox/rocks/apps", 0777;
220 mkdir ".rockbox/rocks/demos", 0777;
221 mkdir ".rockbox/rocks/viewers", 0777;
224 mkdir ".rockbox/recpresets", 0777;
228 mkdir ".rockbox/eqs", 0777;
230 `cp $ROOT/apps/eqs/*.cfg .rockbox/eqs/`; # equalizer presets
233 mkdir ".rockbox/wps", 0777;
234 mkdir ".rockbox/themes", 0777;
236 open(THEME
, ">.rockbox/themes/rockbox_default_icons.cfg");
238 # this config file was auto-generated to make it
239 # easy to reset the icons back to default
241 # taken from apps/gui/icon.c
242 viewers iconset: /.rockbox/icons/viewers.bmp
244 # taken from apps/gui/icon.c
245 remote viewers iconset: /.rockbox/icons/remote_viewers.bmp
252 mkdir ".rockbox/codepages", 0777;
255 system("$ROOT/tools/codepages");
258 system("$ROOT/tools/codepages -m");
260 $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
264 mkdir ".rockbox/codecs", 0777;
266 mkdir ".rockbox/backdrops", 0777;
269 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null';
272 my @call = `find .rockbox/codecs -type f 2>/dev/null`;
274 # no codec was copied, remove directory again
275 rmdir(".rockbox/codecs");
280 $c= 'find apps "(" -name "*.rock" -o -name "*.ovl" ")" ! -empty -exec cp {} .rockbox/rocks/ \;';
283 open VIEWERS
, "$ROOT/apps/plugins/viewers.config" or
284 die "can't open viewers.config";
285 @viewers = <VIEWERS
>;
288 open VIEWERS
, ">.rockbox/viewers.config" or
289 die "can't create .rockbox/viewers.config";
291 foreach my $line (@viewers) {
292 if ($line =~ /([^,]*),([^,]*),/) {
293 my ($ext, $plugin)=($1, $2);
294 my $r = "${plugin}.rock";
300 # strip off the last slash and file name part
301 $dir =~ s/(.*)\/(.*)/$1/;
302 # store the file name part
305 # get .ovl name (file part only)
307 $oname =~ s/\.rock$/.ovl/;
309 # print STDERR "$ext $plugin $dir $name $r\n";
311 if(-e
".rockbox/rocks/$name") {
312 if($dir ne "rocks") {
313 # target is not 'rocks' but the plugins are always in that
315 `mv .rockbox/rocks/$name .rockbox/rocks/$r`;
319 elsif(-e
".rockbox/rocks/$r") {
320 # in case the same plugin works for multiple extensions, it
321 # was already moved to the viewers dir
325 if(-e
".rockbox/rocks/$oname") {
326 # if there's an "overlay" file for the .rock, move that as
328 `mv .rockbox/rocks/$oname .rockbox/rocks/$dir`;
334 open CATEGORIES
, "$ROOT/apps/plugins/CATEGORIES" or
335 die "can't open CATEGORIES";
336 @rock_targetdirs = <CATEGORIES
>;
338 foreach my $line (@rock_targetdirs) {
339 if ($line =~ /([^,]*),(.*)/) {
340 my ($plugin, $dir)=($1, $2);
341 `mv .rockbox/rocks/${plugin}.rock .rockbox/rocks/$dir 2> /dev/null`;
346 mkdir ".rockbox/icons", 0777;
347 `cp $viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp .rockbox/icons/viewers.bmp`;
349 `cp $viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp .rockbox/icons/remote_viewers.bmp`;
353 `cp $ROOT/apps/tagnavi.config .rockbox/`;
356 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/games/`; # sokoban levels
357 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/games/`; # snake2 levels
361 # image is blank when this is a simulator
362 if( filesize
("rockbox.ucl") > 1000 ) {
363 `cp rockbox.ucl .rockbox/`; # UCL for flashing
365 if( filesize
("rombox.ucl") > 1000) {
366 `cp rombox.ucl .rockbox/`; # UCL for flashing
369 # Check for rombox.target
370 if ($image=~/(.*)\.(\w+)$/)
372 my $romfile = "rombox.$2";
373 if (filesize
($romfile) > 1000)
375 `cp $romfile .rockbox/`;
380 mkdir ".rockbox/docs", 0777;
385 `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`;
388 `cp $ROOT/docs/profontdoc.txt .rockbox/docs/`;
390 for(("sample.colours",
393 `cp $ROOT/docs/$_ .rockbox/docs/`;
396 # Now do the WPS dance
398 system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
401 print STDERR
"No wps module present, can't do the WPS magic!\n";
405 system("cp rockbox-info.txt .rockbox/");
407 # now copy the file made for reading on the unit:
409 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
412 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
415 buildlangs
(".rockbox/langs");
419 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
425 #$date=sprintf("%04d%02d%02d", $year,$mon, $mday);
426 #$shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
428 # made once for all targets
430 my ($target, $fonts)=@_;
432 # build a full install .rockbox directory
433 buildzip
($output, $target, $fonts);
435 # create a zip file from the .rockbox dfir
439 print "find .rockbox | xargs $ziptool $output >/dev/null\n";
441 `find .rockbox | xargs $ziptool $output >/dev/null`;
443 if($target && ($fonts != 1)) {
444 # On some targets, rockbox.* is inside .rockbox
445 if($target !~ /(mod|ajz|wma)\z/i) {
446 `cp $target .rockbox/$target`;
447 $target = ".rockbox/".$target;
451 print "$ziptool $output $target\n";
453 `$ziptool $output $target`;
456 # remove the .rockbox afterwards
461 # not specified, guess!
462 if($target =~ /(recorder|ondio)/i) {
465 elsif($target =~ /iriver/i) {
466 $exe = "rockbox.iriver";
472 elsif($exe =~ /rockboxui/) {
473 # simulator, exclude the exe file
477 runone
($exe, $incfonts);