MPEGPlayer: Skip to next file when there is a problem with a video file in all-play...
[kugel-rb.git] / tools / buildzip.pl
blobde7fd90e798b731a4b2a87b0e18131764e3529ce
1 #!/usr/bin/perl
2 # __________ __ ___.
3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 # \/ \/ \/ \/ \/
8 # $Id$
11 use strict;
13 use File::Copy; # For move() and copy()
14 use File::Find; # For find()
15 use File::Path qw(mkpath rmtree); # For rmtree()
16 use Cwd 'abs_path';
17 use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
19 my $ROOT="..";
21 my $ziptool;
22 my $output;
23 my $verbose;
24 my $install;
25 my $exe;
26 my $target;
27 my $modelname;
28 my $incfonts;
29 my $target_id; # passed in, not currently used
30 my $rbdir; # can be non-.rockbox for special builds
31 my $app;
33 sub glob_mkdir {
34 my ($dir) = @_;
35 mkpath ($dir, $verbose, 0777);
36 return 1;
39 sub glob_install {
40 my ($_src, $dest, $opts) = @_;
42 unless ($opts) {
43 $opts = "-m 0664";
46 foreach my $src (glob($_src)) {
47 unless ( -d $src || !(-e $src)) {
48 system("install $opts \"$src\" \"$dest\"");
49 print "install $opts \"$src\" -> \"$dest\"\n" if $verbose;
52 return 1;
55 sub glob_copy {
56 my ($pattern, $destination) = @_;
57 print "glob_copy: $pattern -> $destination\n" if $verbose;
58 foreach my $path (glob($pattern)) {
59 copy($path, $destination);
63 sub glob_move {
64 my ($pattern, $destination) = @_;
65 print "glob_move: $pattern -> $destination\n" if $verbose;
66 foreach my $path (glob($pattern)) {
67 move($path, $destination);
71 sub glob_unlink {
72 my ($pattern) = @_;
73 print "glob_unlink: $pattern\n" if $verbose;
74 foreach my $path (glob($pattern)) {
75 unlink($path);
79 sub find_copyfile {
80 my ($pattern, $destination) = @_;
81 print "find_copyfile: $pattern -> $destination\n" if $verbose;
82 return sub {
83 my $path = $_;
84 if ($path =~ $pattern && filesize($path) > 0 && !($path =~ /$rbdir/)) {
85 copy($path, $destination);
86 print "cp $path $destination\n" if $verbose;
87 chmod(0755, $destination.'/'.$path);
92 sub find_installfile {
93 my ($pattern, $destination) = @_;
94 print "find_installfile: $pattern -> $destination\n" if $verbose;
95 return sub {
96 my $path = $_;
97 if ($path =~ $pattern) {
98 print "FIND_INSTALLFILE: $path\n";
99 glob_install($path, $destination);
105 sub make_install {
106 my ($src, $dest) = @_;
108 my $bindir = $dest;
109 my $libdir = $dest;
110 my $userdir = $dest;
112 my @plugins = ( "games", "apps", "demos", "viewers" );
113 my @userstuff = ( "backdrops", "codepages", "docs", "fonts", "langs", "themes", "wps", "eqs", "icons" );
114 my @files = ();
116 if ($app) {
117 $bindir .= "/bin";
118 $libdir .= "/lib/rockbox";
119 $userdir .= "/share/rockbox";
120 } else {
121 # for non-app builds we expect the prefix to be the dir above .rockbox
122 $bindir .= "/$rbdir";
123 $libdir = $userdir = $bindir;
125 if ($dest =~ /\/dev\/null/) {
126 die "ERROR: No PREFIX given\n"
129 if ((!$app) && -e $bindir && -e $src && (abs_path($bindir) eq abs_path($src))) {
130 return 1;
133 # binary
134 unless ($exe eq "") {
135 unless (glob_mkdir($bindir)) {
136 return 0;
138 glob_install($exe, $bindir, "-m 0775");
141 # codecs
142 unless (glob_mkdir("$libdir/codecs")) {
143 return 0;
145 glob_install("$src/codecs/*", "$libdir/codecs", "-m 0755");
147 # plugins
148 unless (glob_mkdir("$libdir/rocks")) {
149 return 0;
151 foreach my $t (@plugins) {
152 unless (glob_mkdir("$libdir/rocks/$t")) {
153 return 0;
155 glob_install("$src/rocks/$t/*", "$libdir/rocks/$t", "-m 0755");
158 # rocks/viewers/lua
159 unless (glob_mkdir("$libdir/rocks/viewers/lua")) {
160 return 0;
162 glob_install("$src/rocks/viewers/lua/*", "$libdir/rocks/viewers/lua");
164 # all the rest directories
165 foreach my $t (@userstuff) {
166 unless (glob_mkdir("$userdir/$t")) {
167 return 0;
169 glob_install("$src/$t/*", "$userdir/$t");
172 # wps/ subfolders and bitmaps
173 opendir(DIR, $src . "/wps");
174 @files = readdir(DIR);
175 closedir(DIR);
177 foreach my $_dir (@files) {
178 my $dir = "wps/" . $_dir;
179 if ( -d "$src/$dir" && $_dir !~ /\.\.?/) {
180 unless (glob_mkdir("$userdir/$dir")) {
181 return 0;
183 glob_install("$src/$dir/*", "$userdir/$dir");
187 # rest of the files, excluding the binary
188 opendir(DIR,$src);
189 @files = readdir(DIR);
190 closedir(DIR);
192 foreach my $file (grep (/[a-zA-Z]+\.(txt|config|ignnore)/,@files)) {
193 glob_install("$src/$file", "$userdir/");
195 return 1;
198 # Get options
199 GetOptions ( 'r|root=s' => \$ROOT,
200 'z|ziptool:s' => \$ziptool,
201 'm|modelname=s' => \$modelname, # The model name as used in ARCHOS in the root makefile
202 'i|id=s' => \$target_id, # The target id name as used in TARGET_ID in the root makefile
203 'o|output:s' => \$output,
204 'f|fonts=s' => \$incfonts, # 0 - no fonts, 1 - fonts only 2 - fonts and package
205 'v|verbose' => \$verbose,
206 'install=s' => \$install, # install destination
207 'rbdir:s' => \$rbdir, # If we want to put in a different directory
210 # GetOptions() doesn't remove the params from @ARGV if their value was ""
211 # Thus we use the ":" for those for which we use a default value in case of ""
212 # and assign the default value afterwards
213 if ($ziptool eq '') {
214 $ziptool = "zip -r9";
216 if ($output eq '') {
217 $output = "rockbox.zip"
219 if ($rbdir eq '') {
220 $rbdir = ".rockbox";
223 # Now @ARGV shuold be free of any left-overs GetOptions left
224 ($target, $exe) = @ARGV;
226 my $firmdir="$ROOT/firmware";
227 my $appsdir="$ROOT/apps";
228 my $viewer_bmpdir="$ROOT/apps/plugins/bitmaps/viewer_defaults";
230 my $cppdef = $target;
232 sub gettargetinfo {
233 open(GCC, ">gcctemp");
234 # Get the LCD screen depth and graphical status
235 print GCC <<STOP
236 \#include "config.h"
237 #ifdef HAVE_LCD_BITMAP
238 Bitmap: yes
239 Depth: LCD_DEPTH
240 LCD Width: LCD_WIDTH
241 LCD Height: LCD_HEIGHT
242 Icon Width: CONFIG_DEFAULT_ICON_WIDTH
243 Icon Height: CONFIG_DEFAULT_ICON_HEIGHT
244 #endif
245 Codec: CONFIG_CODEC
246 #ifdef HAVE_REMOTE_LCD
247 Remote Depth: LCD_REMOTE_DEPTH
248 Remote Icon Width: CONFIG_REMOTE_DEFAULT_ICON_WIDTH
249 Remote Icon Height: CONFIG_REMOTE_DEFAULT_ICON_HEIGHT
250 #else
251 Remote Depth: 0
252 #endif
253 #ifdef HAVE_RECORDING
254 Recording: yes
255 #endif
256 STOP
258 close(GCC);
260 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
262 # print STDERR "CMD $c\n";
264 open(TARGET, "$c|");
266 my ($bitmap, $width, $height, $depth, $swcodec, $icon_h, $icon_w);
267 my ($remote_depth, $remote_icon_h, $remote_icon_w);
268 my ($recording);
269 my $icon_count = 1;
270 while(<TARGET>) {
271 # print STDERR "DATA: $_";
272 if($_ =~ /^Bitmap: (.*)/) {
273 $bitmap = $1;
275 elsif($_ =~ /^Depth: (\d*)/) {
276 $depth = $1;
278 elsif($_ =~ /^LCD Width: (\d*)/) {
279 $width = $1;
281 elsif($_ =~ /^LCD Height: (\d*)/) {
282 $height = $1;
284 elsif($_ =~ /^Icon Width: (\d*)/) {
285 $icon_w = $1;
287 elsif($_ =~ /^Icon Height: (\d*)/) {
288 $icon_h = $1;
290 elsif($_ =~ /^Codec: (\d*)/) {
291 # SWCODEC is 1, the others are HWCODEC
292 $swcodec = ($1 == 1);
294 elsif($_ =~ /^Remote Depth: (\d*)/) {
295 $remote_depth = $1;
297 elsif($_ =~ /^Remote Icon Width: (\d*)/) {
298 $remote_icon_w = $1;
300 elsif($_ =~ /^Remote Icon Height: (\d*)/) {
301 $remote_icon_h = $1;
303 if($_ =~ /^Recording: (.*)/) {
304 $recording = $1;
307 close(TARGET);
308 unlink("gcctemp");
310 return ($bitmap, $depth, $width, $height, $icon_w, $icon_h, $recording,
311 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h);
314 sub filesize {
315 my ($filename)=@_;
316 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
317 $atime,$mtime,$ctime,$blksize,$blocks)
318 = stat($filename);
319 return $size;
322 sub create_failsafefiles {
323 my ($dir, $remote_depth) = @_;
324 my $text = "# Dummy file to allow Rockbox to reset to the default skin config.
325 # Do not edit this file. It's never actually loaded by Rockbox.";
326 open (FOO, ">$dir/wps/rockbox_failsafe.wps");
327 print FOO $text;
328 close(FOO);
329 open (FOO, ">$dir/wps/rockbox_failsafe.sbs");
330 print FOO $text;
331 close(FOO);
332 open (FOO, ">$dir/wps/rockbox_failsafe.fms");
333 print FOO $text;
334 close(FOO);
335 if ($remote_depth) {
336 open (FOO, ">$dir/wps/rockbox_failsafe.rwps");
337 print FOO $text;
338 close(FOO);
339 open (FOO, ">$dir/wps/rockbox_failsafe.rsbs");
340 print FOO $text;
341 close(FOO);
342 open (FOO, ">$dir/wps/rockbox_failsafe.rfms");
343 print FOO $text;
344 close(FOO);
346 open (FOO, ">$dir/themes/rockbox_failsafe.cfg");
347 print FOO <<STOP
348 # This config has been autogenerated to reload the failsafe setup
349 wps: $dir/wps/rockbox_failsafe.wps
350 sbs: $dir/wps/rockbox_failsafe.sbs
351 fms: $dir/wps/rockbox_failsafe.fms
352 STOP
354 if ($remote_depth) {
355 print FOO <<STOP
356 rwps: $dir/wps/rockbox_failsafe.rwps
357 rsbs: $dir/wps/rockbox_failsafe.rsbs
358 rfms: $dir/wps/rockbox_failsafe.rfms
359 STOP
362 print FOO <<STOP
363 statusbar: top
364 font: 08-Schumacher-Clean.fnt
365 foreground color: 000000
366 background color: B6C6E5
367 selector type: bar (inverse)
368 STOP
370 close(FOO);
373 sub buildzip {
374 my ($image, $fonts)=@_;
375 my $libdir = $install;
376 my $temp_dir = ".rockbox";
378 print "buildzip: image=$image fonts=$fonts\n" if $verbose;
380 my ($bitmap, $depth, $width, $height, $icon_w, $icon_h, $recording,
381 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h) =
382 &gettargetinfo();
384 # print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
386 # remove old traces
387 rmtree($temp_dir);
389 glob_mkdir($temp_dir);
391 if(!$bitmap) {
392 # always disable fonts on non-bitmap targets
393 $fonts = 0;
395 if($fonts) {
396 glob_mkdir("$temp_dir/fonts");
397 chdir "$temp_dir/fonts";
398 my $cmd = "$ROOT/tools/convbdf -f $ROOT/fonts/*bdf >/dev/null 2>&1";
399 print($cmd."\n") if $verbose;
400 system($cmd);
401 chdir("../../");
403 if($fonts < 2) {
404 # fonts-only package, return
405 return;
409 # create the file so the database does not try indexing a folder
410 open(IGNORE, ">$temp_dir/database.ignore") || die "can't open database.ignore";
411 close(IGNORE);
413 glob_mkdir("$temp_dir/langs");
414 glob_mkdir("$temp_dir/rocks");
415 glob_mkdir("$temp_dir/rocks/games");
416 glob_mkdir("$temp_dir/rocks/apps");
417 glob_mkdir("$temp_dir/rocks/demos");
418 glob_mkdir("$temp_dir/rocks/viewers");
420 if ($recording) {
421 glob_mkdir("$temp_dir/recpresets");
424 if($swcodec) {
425 glob_mkdir("$temp_dir/eqs");
427 glob_copy("$ROOT/apps/eqs/*.cfg", "$temp_dir/eqs/"); # equalizer presets
430 glob_mkdir("$temp_dir/wps");
431 glob_mkdir("$temp_dir/themes");
432 if ($bitmap) {
433 open(THEME, ">$temp_dir/themes/rockbox_default_icons.cfg");
434 print THEME <<STOP
435 # this config file was auto-generated to make it
436 # easy to reset the icons back to default
437 iconset: -
438 # taken from apps/gui/icon.c
439 viewers iconset: /$rbdir/icons/viewers.bmp
440 remote iconset: -
441 # taken from apps/gui/icon.c
442 remote viewers iconset: /$rbdir/icons/remote_viewers.bmp
444 STOP
446 close(THEME);
449 glob_mkdir("$temp_dir/codepages");
451 if($bitmap) {
452 system("$ROOT/tools/codepages");
454 else {
455 system("$ROOT/tools/codepages -m");
458 glob_move('*.cp', "$temp_dir/codepages/");
460 if($bitmap && $depth > 1) {
461 glob_mkdir("$temp_dir/backdrops");
464 glob_mkdir("$temp_dir/codecs");
466 find(find_copyfile(qr/.*\.codec/, abs_path("$temp_dir/codecs/")), 'apps/codecs');
468 # remove directory again if no codec was copied
469 rmdir("$temp_dir/codecs");
471 find(find_copyfile(qr/\.(rock|ovl|lua)/, abs_path("$temp_dir/rocks/")), 'apps/plugins');
473 # exclude entries for the image file types not supported by the imageviewer for the target.
474 my $viewers = "$ROOT/apps/plugins/viewers.config";
475 my $c="cat $viewers | gcc $cppdef -I. -I$firmdir/export -E -P -include config.h -";
477 open VIEWERS, "$c|" or die "can't open viewers.config";
478 my @viewers = <VIEWERS>;
479 close VIEWERS;
481 open VIEWERS, ">$temp_dir/viewers.config" or
482 die "can't create $temp_dir/viewers.config";
484 foreach my $line (@viewers) {
485 if ($line =~ /([^,]*),([^,]*),/) {
486 my ($ext, $plugin)=($1, $2);
487 my $r = "${plugin}.rock";
488 my $oname;
490 my $dir = $r;
491 my $name;
493 # strip off the last slash and file name part
494 $dir =~ s/(.*)\/(.*)/$1/;
495 # store the file name part
496 $name = $2;
498 # get .ovl name (file part only)
499 $oname = $name;
500 $oname =~ s/\.rock$/.ovl/;
502 # print STDERR "$ext $plugin $dir $name $r\n";
504 if(-e "$temp_dir/rocks/$name") {
505 if($dir ne "rocks") {
506 # target is not 'rocks' but the plugins are always in that
507 # dir at first!
508 move("$temp_dir/rocks/$name", "$temp_dir/rocks/$r");
510 print VIEWERS $line;
512 elsif(-e "$temp_dir/rocks/$r") {
513 # in case the same plugin works for multiple extensions, it
514 # was already moved to the viewers dir
515 print VIEWERS $line;
518 if(-e "$temp_dir/rocks/$oname") {
519 # if there's an "overlay" file for the .rock, move that as
520 # well
521 move("$temp_dir/rocks/$oname", "$temp_dir/rocks/$dir");
525 close VIEWERS;
527 open CATEGORIES, "$ROOT/apps/plugins/CATEGORIES" or
528 die "can't open CATEGORIES";
529 my @rock_targetdirs = <CATEGORIES>;
530 close CATEGORIES;
531 foreach my $line (@rock_targetdirs) {
532 if ($line =~ /([^,]*),(.*)/) {
533 my ($plugin, $dir)=($1, $2);
534 move("$temp_dir/rocks/${plugin}.rock", "$temp_dir/rocks/$dir/${plugin}.rock");
535 if(-e "$temp_dir/rocks/${plugin}.ovl") {
536 # if there's an "overlay" file for the .rock, move that as
537 # well
538 move("$temp_dir/rocks/${plugin}.ovl", "$temp_dir/rocks/$dir");
540 if(-e "$temp_dir/rocks/${plugin}.lua") {
541 # if this is a lua script, move it to the appropriate dir
542 move("$temp_dir/rocks/${plugin}.lua", "$temp_dir/rocks/$dir/");
547 glob_unlink("$temp_dir/rocks/*.lua"); # Clean up unwanted *.lua files (e.g. actions.lua, buttons.lua)
549 if ($bitmap) {
550 glob_mkdir("$temp_dir/icons");
551 copy("$viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp", "$temp_dir/icons/viewers.bmp");
552 if ($remote_depth) {
553 copy("$viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp", "$temp_dir/icons/remote_viewers.bmp");
557 copy("$ROOT/apps/tagnavi.config", "$temp_dir/");
558 copy("$ROOT/apps/plugins/disktidy.config", "$temp_dir/rocks/apps/");
560 if($bitmap) {
561 copy("$ROOT/apps/plugins/sokoban.levels", "$temp_dir/rocks/games/sokoban.levels"); # sokoban levels
562 copy("$ROOT/apps/plugins/snake2.levels", "$temp_dir/rocks/games/snake2.levels"); # snake2 levels
563 copy("$ROOT/apps/plugins/rockbox-fonts.config", "$temp_dir/rocks/viewers/");
566 if(-e "$temp_dir/rocks/demos/pictureflow.rock") {
567 copy("$ROOT/apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp",
568 "$temp_dir/rocks/demos/pictureflow_emptyslide.bmp");
569 my ($pf_logo);
570 if ($width < 200) {
571 $pf_logo = "pictureflow_logo.100x18x16.bmp";
572 } else {
573 $pf_logo = "pictureflow_logo.193x34x16.bmp";
575 copy("$ROOT/apps/plugins/bitmaps/native/$pf_logo",
576 "$temp_dir/rocks/demos/pictureflow_splash.bmp");
579 create_failsafefiles($temp_dir, $remote_depth);
581 if($image) {
582 # image is blank when this is a simulator
583 if( filesize("rockbox.ucl") > 1000 ) {
584 copy("rockbox.ucl", "$temp_dir/rockbox.ucl"); # UCL for flashing
586 if( filesize("rombox.ucl") > 1000) {
587 copy("rombox.ucl", "$temp_dir/rombox.ucl"); # UCL for flashing
590 # Check for rombox.target
591 if ($image=~/(.*)\.(\w+)$/)
593 my $romfile = "rombox.$2";
594 if (filesize($romfile) > 1000)
596 copy($romfile, "$temp_dir/$romfile");
601 glob_mkdir("$temp_dir/docs");
602 for(("COPYING",
603 "LICENSES",
604 "KNOWN_ISSUES"
605 )) {
606 copy("$ROOT/docs/$_", "$temp_dir/docs/$_.txt");
608 if ($fonts) {
609 copy("$ROOT/docs/profontdoc.txt", "$temp_dir/docs/profontdoc.txt");
611 for(("sample.colours",
612 "sample.icons"
613 )) {
614 copy("$ROOT/docs/$_", "$temp_dir/docs/$_");
617 # Now do the WPS dance
618 if(-d "$ROOT/wps") {
619 my $wps_build_cmd="perl $ROOT/wps/wpsbuild.pl ";
620 $wps_build_cmd=$wps_build_cmd."-v " if $verbose;
621 $wps_build_cmd=$wps_build_cmd." --tempdir=$temp_dir --rbdir=$rbdir -r $ROOT -m $modelname $ROOT/wps/WPSLIST $target";
622 print "wpsbuild: $wps_build_cmd\n" if $verbose;
623 system("$wps_build_cmd");
624 print "wps_build_cmd: done\n" if $verbose;
626 else {
627 print STDERR "No wps module present, can't do the WPS magic!\n";
630 # until buildwps.pl is fixed, manually copy the classic_statusbar theme across
631 mkdir "$temp_dir/wps/classic_statusbar", 0777;
632 glob_copy("$ROOT/wps/classic_statusbar/*.bmp", "$temp_dir/wps/classic_statusbar");
633 if ($swcodec) {
634 if ($depth == 16) {
635 copy("$ROOT/wps/classic_statusbar.sbs", "$temp_dir/wps");
636 } elsif ($depth > 1) {
637 copy("$ROOT/wps/classic_statusbar.grey.sbs", "$temp_dir/wps/classic_statusbar.sbs");
638 } else {
639 copy("$ROOT/wps/classic_statusbar.mono.sbs", "$temp_dir/wps/classic_statusbar.sbs");
641 } else {
642 copy("$ROOT/wps/classic_statusbar.112x64x1.sbs", "$temp_dir/wps/classic_statusbar.sbs");
644 if ($remote_depth != $depth) {
645 copy("$ROOT/wps/classic_statusbar.mono.sbs", "$temp_dir/wps/classic_statusbar.rsbs");
646 } else {
647 copy("$temp_dir/wps/classic_statusbar.sbs", "$temp_dir/wps/classic_statusbar.rsbs");
649 copy("$temp_dir/wps/rockbox_none.sbs", "$temp_dir/wps/rockbox_none.rsbs");
651 # and the info file
652 copy("rockbox-info.txt", "$temp_dir/rockbox-info.txt");
654 # copy the already built lng files
655 glob_copy('apps/lang/*lng', "$temp_dir/langs/");
657 # copy the .lua files
658 glob_mkdir("$temp_dir/rocks/viewers/lua/");
659 glob_copy('apps/plugins/lua/*.lua', "$temp_dir/rocks/viewers/lua/");
662 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
663 localtime(time);
665 $mon+=1;
666 $year+=1900;
668 #$date=sprintf("%04d%02d%02d", $year,$mon, $mday);
669 #$shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
671 # made once for all targets
672 sub runone {
673 my ($target, $fonts)=@_;
675 # in the app the the layout is different (no .rockbox, but bin/lib/share)
676 $app = ($modelname eq "application");
677 unless ($app) {
678 #rbdir starts with '/', strip it
679 $rbdir = substr($rbdir, 1);
682 # build a full install .rockbox ($rbdir) directory
683 buildzip($target, $fonts);
685 unlink($output);
687 if($fonts == 1) {
688 # Don't include image file in fonts-only package
689 undef $target;
691 if($target && ($target !~ /(mod|ajz|wma)\z/i)) {
692 # On some targets, the image goes into .rockbox.
693 copy("$target", ".rockbox/$target");
694 undef $target;
697 if($install) {
698 make_install(".rockbox", $install) or die "MKDIRFAILED\n";
699 rmtree(".rockbox");
700 print "rm .rockbox\n" if $verbose;
702 else {
703 unless (".rockbox" eq $rbdir) {
704 mkpath($rbdir);
705 rmtree($rbdir);
706 move(".rockbox", $rbdir);
707 print "mv .rockbox $rbdir\n" if $verbose;
709 system("$ziptool $output $rbdir $target >/dev/null");
710 print "$ziptool $output $rbdir $target >/dev/null\n" if $verbose;
711 rmtree("$rbdir");
712 print "rm $rbdir\n" if $verbose;
716 if(!$exe) {
717 # not specified, guess!
718 if($target =~ /(recorder|ondio)/i) {
719 $exe = "ajbrec.ajz";
721 elsif($target =~ /iriver/i) {
722 $exe = "rockbox.iriver";
724 else {
725 $exe = "archos.mod";
728 elsif(($exe =~ /rockboxui/)) {
729 # simulator, exclude the exe file
730 $exe = "";
732 elsif($exe eq "librockbox.so") {
733 # android, exclude the binary
734 $exe="";
737 runone($exe, $incfonts);