Sansa clip+: do not set GPIO B7 in the display driver, it's already used for FM radio I2C
[kugel-rb.git] / tools / buildzip.pl
blob2337dbe729854f151121b5b8b7006a4dfaf991fd
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;
17 use Cwd 'abs_path';
18 use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
20 my $ROOT="..";
22 my $ziptool;
23 my $output;
24 my $verbose;
25 my $install;
26 my $exe;
27 my $target;
28 my $modelname;
29 my $incfonts;
30 my $target_id; # passed in, not currently used
31 my $rbdir; # can be non-.rockbox for special builds
32 my $app;
33 my $mklinks;
35 sub glob_mkdir {
36 my ($dir) = @_;
37 mkpath ($dir, $verbose, 0777);
38 return 1;
41 sub glob_install {
42 my ($_src, $dest, $opts) = @_;
44 unless ($opts) {
45 $opts = "-m 0664";
48 foreach my $src (glob($_src)) {
49 unless ( -d $src || !(-e $src)) {
50 system("install $opts \"$src\" \"$dest\"");
51 print "install $opts \"$src\" -> \"$dest\"\n" if $verbose;
54 return 1;
57 sub glob_copy {
58 my ($pattern, $destination) = @_;
59 print "glob_copy: $pattern -> $destination\n" if $verbose;
60 foreach my $path (glob($pattern)) {
61 copy($path, $destination);
65 sub glob_move {
66 my ($pattern, $destination) = @_;
67 print "glob_move: $pattern -> $destination\n" if $verbose;
68 foreach my $path (glob($pattern)) {
69 move($path, $destination);
73 sub glob_unlink {
74 my ($pattern) = @_;
75 print "glob_unlink: $pattern\n" if $verbose;
76 foreach my $path (glob($pattern)) {
77 unlink($path);
81 sub find_copyfile {
82 my ($pattern, $destination) = @_;
83 print "find_copyfile: $pattern -> $destination\n" if $verbose;
84 return sub {
85 my $path = $_;
86 my $source = getcwd();
87 if ($path =~ $pattern && filesize($path) > 0 && !($path =~ /$rbdir/)) {
88 if($mklinks) {
89 print "link $path $destination\n" if $verbose;
90 symlink($source.'/'.$path, $destination.'/'.$path);
91 } else {
92 print "cp $path $destination\n" if $verbose;
93 copy($path, $destination);
94 chmod(0755, $destination.'/'.$path);
100 sub find_installfile {
101 my ($pattern, $destination) = @_;
102 print "find_installfile: $pattern -> $destination\n" if $verbose;
103 return sub {
104 my $path = $_;
105 if ($path =~ $pattern) {
106 print "FIND_INSTALLFILE: $path\n";
107 glob_install($path, $destination);
113 sub make_install {
114 my ($src, $dest) = @_;
116 my $bindir = $dest;
117 my $libdir = $dest;
118 my $userdir = $dest;
120 my @plugins = ( "games", "apps", "demos", "viewers" );
121 my @userstuff = ( "backdrops", "codepages", "docs", "fonts", "langs", "themes", "wps", "eqs", "icons" );
122 my @files = ();
124 if ($app) {
125 $bindir .= "/bin";
126 $libdir .= "/lib/rockbox";
127 $userdir .= "/share/rockbox";
128 } else {
129 # for non-app builds we expect the prefix to be the dir above .rockbox
130 $bindir .= "/$rbdir";
131 $libdir = $userdir = $bindir;
133 if ($dest =~ /\/dev\/null/) {
134 die "ERROR: No PREFIX given\n"
137 if ((!$app) && -e $bindir && -e $src && (abs_path($bindir) eq abs_path($src))) {
138 return 1;
141 # binary
142 unless ($exe eq "") {
143 unless (glob_mkdir($bindir)) {
144 return 0;
146 glob_install($exe, $bindir, "-m 0775");
149 # codecs
150 unless (glob_mkdir("$libdir/codecs")) {
151 return 0;
153 glob_install("$src/codecs/*", "$libdir/codecs", "-m 0755");
155 # plugins
156 unless (glob_mkdir("$libdir/rocks")) {
157 return 0;
159 foreach my $t (@plugins) {
160 unless (glob_mkdir("$libdir/rocks/$t")) {
161 return 0;
163 glob_install("$src/rocks/$t/*", "$libdir/rocks/$t", "-m 0755");
166 # rocks/viewers/lua
167 unless (glob_mkdir("$libdir/rocks/viewers/lua")) {
168 return 0;
170 glob_install("$src/rocks/viewers/lua/*", "$libdir/rocks/viewers/lua");
172 # all the rest directories
173 foreach my $t (@userstuff) {
174 unless (glob_mkdir("$userdir/$t")) {
175 return 0;
177 glob_install("$src/$t/*", "$userdir/$t");
180 # wps/ subfolders and bitmaps
181 opendir(DIR, $src . "/wps");
182 @files = readdir(DIR);
183 closedir(DIR);
185 foreach my $_dir (@files) {
186 my $dir = "wps/" . $_dir;
187 if ( -d "$src/$dir" && $_dir !~ /\.\.?/) {
188 unless (glob_mkdir("$userdir/$dir")) {
189 return 0;
191 glob_install("$src/$dir/*", "$userdir/$dir");
195 # rest of the files, excluding the binary
196 opendir(DIR,$src);
197 @files = readdir(DIR);
198 closedir(DIR);
200 foreach my $file (grep (/[a-zA-Z]+\.(txt|config|ignnore)/,@files)) {
201 glob_install("$src/$file", "$userdir/");
203 return 1;
206 # Get options
207 GetOptions ( 'r|root=s' => \$ROOT,
208 'z|ziptool:s' => \$ziptool,
209 'm|modelname=s' => \$modelname, # The model name as used in ARCHOS in the root makefile
210 'i|id=s' => \$target_id, # The target id name as used in TARGET_ID in the root makefile
211 'o|output:s' => \$output,
212 'f|fonts=s' => \$incfonts, # 0 - no fonts, 1 - fonts only 2 - fonts and package
213 'v|verbose' => \$verbose,
214 'install=s' => \$install, # install destination
215 'rbdir:s' => \$rbdir, # If we want to put in a different directory
216 'l|link' => \$mklinks, # If we want to create links instead of copying files
217 'a|app:s' => \$app, # Is this an Application build?
220 # GetOptions() doesn't remove the params from @ARGV if their value was ""
221 # Thus we use the ":" for those for which we use a default value in case of ""
222 # and assign the default value afterwards
223 if ($ziptool eq '') {
224 $ziptool = "zip -r9";
226 if ($output eq '') {
227 $output = "rockbox.zip"
229 if ($rbdir eq '') {
230 $rbdir = ".rockbox";
233 # Now @ARGV shuold be free of any left-overs GetOptions left
234 ($target, $exe) = @ARGV;
236 my $firmdir="$ROOT/firmware";
237 my $appsdir="$ROOT/apps";
238 my $viewer_bmpdir="$ROOT/apps/plugins/bitmaps/viewer_defaults";
240 my $cppdef = $target;
242 sub gettargetinfo {
243 open(GCC, ">gcctemp");
244 # Get the LCD screen depth and graphical status
245 print GCC <<STOP
246 \#include "config.h"
247 #ifdef HAVE_LCD_BITMAP
248 Bitmap: yes
249 Depth: LCD_DEPTH
250 LCD Width: LCD_WIDTH
251 LCD Height: LCD_HEIGHT
252 Icon Width: CONFIG_DEFAULT_ICON_WIDTH
253 Icon Height: CONFIG_DEFAULT_ICON_HEIGHT
254 #endif
255 Codec: CONFIG_CODEC
256 #ifdef HAVE_REMOTE_LCD
257 Remote Depth: LCD_REMOTE_DEPTH
258 Remote Icon Width: CONFIG_REMOTE_DEFAULT_ICON_WIDTH
259 Remote Icon Height: CONFIG_REMOTE_DEFAULT_ICON_HEIGHT
260 #else
261 Remote Depth: 0
262 #endif
263 #ifdef HAVE_RECORDING
264 Recording: yes
265 #endif
266 STOP
268 close(GCC);
270 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
272 # print STDERR "CMD $c\n";
274 open(TARGET, "$c|");
276 my ($bitmap, $width, $height, $depth, $swcodec, $icon_h, $icon_w);
277 my ($remote_depth, $remote_icon_h, $remote_icon_w);
278 my ($recording);
279 my $icon_count = 1;
280 while(<TARGET>) {
281 # print STDERR "DATA: $_";
282 if($_ =~ /^Bitmap: (.*)/) {
283 $bitmap = $1;
285 elsif($_ =~ /^Depth: (\d*)/) {
286 $depth = $1;
288 elsif($_ =~ /^LCD Width: (\d*)/) {
289 $width = $1;
291 elsif($_ =~ /^LCD Height: (\d*)/) {
292 $height = $1;
294 elsif($_ =~ /^Icon Width: (\d*)/) {
295 $icon_w = $1;
297 elsif($_ =~ /^Icon Height: (\d*)/) {
298 $icon_h = $1;
300 elsif($_ =~ /^Codec: (\d*)/) {
301 # SWCODEC is 1, the others are HWCODEC
302 $swcodec = ($1 == 1);
304 elsif($_ =~ /^Remote Depth: (\d*)/) {
305 $remote_depth = $1;
307 elsif($_ =~ /^Remote Icon Width: (\d*)/) {
308 $remote_icon_w = $1;
310 elsif($_ =~ /^Remote Icon Height: (\d*)/) {
311 $remote_icon_h = $1;
313 if($_ =~ /^Recording: (.*)/) {
314 $recording = $1;
317 close(TARGET);
318 unlink("gcctemp");
320 return ($bitmap, $depth, $width, $height, $icon_w, $icon_h, $recording,
321 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h);
324 sub filesize {
325 my ($filename)=@_;
326 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
327 $atime,$mtime,$ctime,$blksize,$blocks)
328 = stat($filename);
329 return $size;
332 sub create_failsafefiles {
333 my ($dir, $remote_depth) = @_;
334 my $text = "# Dummy file to allow Rockbox to reset to the default skin config.
335 # Do not edit this file. It's never actually loaded by Rockbox.";
336 open (FOO, ">$dir/wps/rockbox_failsafe.wps");
337 print FOO $text;
338 close(FOO);
339 open (FOO, ">$dir/wps/rockbox_failsafe.sbs");
340 print FOO $text;
341 close(FOO);
342 open (FOO, ">$dir/wps/rockbox_failsafe.fms");
343 print FOO $text;
344 close(FOO);
345 if ($remote_depth) {
346 open (FOO, ">$dir/wps/rockbox_failsafe.rwps");
347 print FOO $text;
348 close(FOO);
349 open (FOO, ">$dir/wps/rockbox_failsafe.rsbs");
350 print FOO $text;
351 close(FOO);
352 open (FOO, ">$dir/wps/rockbox_failsafe.rfms");
353 print FOO $text;
354 close(FOO);
356 open (FOO, ">$dir/themes/rockbox_failsafe.cfg");
357 print FOO <<STOP
358 # This config has been autogenerated to reload the failsafe setup
359 wps: $dir/wps/rockbox_failsafe.wps
360 sbs: $dir/wps/rockbox_failsafe.sbs
361 fms: $dir/wps/rockbox_failsafe.fms
362 STOP
364 if ($remote_depth) {
365 print FOO <<STOP
366 rwps: $dir/wps/rockbox_failsafe.rwps
367 rsbs: $dir/wps/rockbox_failsafe.rsbs
368 rfms: $dir/wps/rockbox_failsafe.rfms
369 STOP
372 print FOO <<STOP
373 statusbar: top
374 font: 08-Schumacher-Clean.fnt
375 foreground color: 000000
376 background color: B6C6E5
377 selector type: bar (inverse)
378 STOP
380 close(FOO);
383 sub buildzip {
384 my ($image, $fonts)=@_;
385 my $libdir = $install;
386 my $temp_dir = ".rockbox";
388 print "buildzip: image=$image fonts=$fonts\n" if $verbose;
390 my ($bitmap, $depth, $width, $height, $icon_w, $icon_h, $recording,
391 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h) =
392 &gettargetinfo();
394 # print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
396 # remove old traces
397 rmtree($temp_dir);
399 glob_mkdir($temp_dir);
401 if(!$bitmap) {
402 # always disable fonts on non-bitmap targets
403 $fonts = 0;
405 if($fonts) {
406 glob_mkdir("$temp_dir/fonts");
407 chdir "$temp_dir/fonts";
408 my $cmd = "$ROOT/tools/convbdf -f $ROOT/fonts/*bdf >/dev/null 2>&1";
409 print($cmd."\n") if $verbose;
410 system($cmd);
411 chdir("../../");
413 if($fonts < 2) {
414 # fonts-only package, return
415 return;
419 # create the file so the database does not try indexing a folder
420 open(IGNORE, ">$temp_dir/database.ignore") || die "can't open database.ignore";
421 close(IGNORE);
423 glob_mkdir("$temp_dir/langs");
424 glob_mkdir("$temp_dir/rocks");
425 glob_mkdir("$temp_dir/rocks/games");
426 glob_mkdir("$temp_dir/rocks/apps");
427 glob_mkdir("$temp_dir/rocks/demos");
428 glob_mkdir("$temp_dir/rocks/viewers");
430 if ($recording) {
431 glob_mkdir("$temp_dir/recpresets");
434 if($swcodec) {
435 glob_mkdir("$temp_dir/eqs");
437 glob_copy("$ROOT/apps/eqs/*.cfg", "$temp_dir/eqs/"); # equalizer presets
440 glob_mkdir("$temp_dir/wps");
441 glob_mkdir("$temp_dir/themes");
442 if ($bitmap) {
443 open(THEME, ">$temp_dir/themes/rockbox_default_icons.cfg");
444 print THEME <<STOP
445 # this config file was auto-generated to make it
446 # easy to reset the icons back to default
447 iconset: -
448 # taken from apps/gui/icon.c
449 viewers iconset: /$rbdir/icons/viewers.bmp
450 remote iconset: -
451 # taken from apps/gui/icon.c
452 remote viewers iconset: /$rbdir/icons/remote_viewers.bmp
454 STOP
456 close(THEME);
459 glob_mkdir("$temp_dir/codepages");
461 if($bitmap) {
462 system("$ROOT/tools/codepages");
464 else {
465 system("$ROOT/tools/codepages -m");
468 glob_move('*.cp', "$temp_dir/codepages/");
470 if($bitmap && $depth > 1) {
471 glob_mkdir("$temp_dir/backdrops");
474 glob_mkdir("$temp_dir/codecs");
476 find(find_copyfile(qr/.*\.codec/, abs_path("$temp_dir/codecs/")), 'apps/codecs');
478 # remove directory again if no codec was copied
479 rmdir("$temp_dir/codecs");
481 find(find_copyfile(qr/\.(rock|ovl|lua)/, abs_path("$temp_dir/rocks/")), 'apps/plugins');
483 # exclude entries for the image file types not supported by the imageviewer for the target.
484 my $viewers = "$ROOT/apps/plugins/viewers.config";
485 my $c="cat $viewers | gcc $cppdef -I. -I$firmdir/export -E -P -include config.h -";
487 open VIEWERS, "$c|" or die "can't open viewers.config";
488 my @viewers = <VIEWERS>;
489 close VIEWERS;
491 open VIEWERS, ">$temp_dir/viewers.config" or
492 die "can't create $temp_dir/viewers.config";
494 foreach my $line (@viewers) {
495 if ($line =~ /([^,]*),([^,]*),/) {
496 my ($ext, $plugin)=($1, $2);
497 my $r = "${plugin}.rock";
498 my $oname;
500 my $dir = $r;
501 my $name;
503 # strip off the last slash and file name part
504 $dir =~ s/(.*)\/(.*)/$1/;
505 # store the file name part
506 $name = $2;
508 # get .ovl name (file part only)
509 $oname = $name;
510 $oname =~ s/\.rock$/.ovl/;
512 # print STDERR "$ext $plugin $dir $name $r\n";
514 if(-e "$temp_dir/rocks/$name") {
515 if($dir ne "rocks") {
516 # target is not 'rocks' but the plugins are always in that
517 # dir at first!
518 move("$temp_dir/rocks/$name", "$temp_dir/rocks/$r");
520 print VIEWERS $line;
522 elsif(-e "$temp_dir/rocks/$r") {
523 # in case the same plugin works for multiple extensions, it
524 # was already moved to the viewers dir
525 print VIEWERS $line;
528 if(-e "$temp_dir/rocks/$oname") {
529 # if there's an "overlay" file for the .rock, move that as
530 # well
531 move("$temp_dir/rocks/$oname", "$temp_dir/rocks/$dir");
535 close VIEWERS;
537 open CATEGORIES, "$ROOT/apps/plugins/CATEGORIES" or
538 die "can't open CATEGORIES";
539 my @rock_targetdirs = <CATEGORIES>;
540 close CATEGORIES;
541 foreach my $line (@rock_targetdirs) {
542 if ($line =~ /([^,]*),(.*)/) {
543 my ($plugin, $dir)=($1, $2);
544 move("$temp_dir/rocks/${plugin}.rock", "$temp_dir/rocks/$dir/${plugin}.rock");
545 if(-e "$temp_dir/rocks/${plugin}.ovl") {
546 # if there's an "overlay" file for the .rock, move that as
547 # well
548 move("$temp_dir/rocks/${plugin}.ovl", "$temp_dir/rocks/$dir");
550 if(-e "$temp_dir/rocks/${plugin}.lua") {
551 # if this is a lua script, move it to the appropriate dir
552 move("$temp_dir/rocks/${plugin}.lua", "$temp_dir/rocks/$dir/");
557 glob_unlink("$temp_dir/rocks/*.lua"); # Clean up unwanted *.lua files (e.g. actions.lua, buttons.lua)
559 if ($bitmap) {
560 glob_mkdir("$temp_dir/icons");
561 copy("$viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp", "$temp_dir/icons/viewers.bmp");
562 if ($remote_depth) {
563 copy("$viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp", "$temp_dir/icons/remote_viewers.bmp");
567 copy("$ROOT/apps/tagnavi.config", "$temp_dir/");
568 copy("$ROOT/apps/plugins/disktidy.config", "$temp_dir/rocks/apps/");
570 if($bitmap) {
571 copy("$ROOT/apps/plugins/sokoban.levels", "$temp_dir/rocks/games/sokoban.levels"); # sokoban levels
572 copy("$ROOT/apps/plugins/snake2.levels", "$temp_dir/rocks/games/snake2.levels"); # snake2 levels
573 copy("$ROOT/apps/plugins/rockbox-fonts.config", "$temp_dir/rocks/viewers/");
576 if(-e "$temp_dir/rocks/demos/pictureflow.rock") {
577 copy("$ROOT/apps/plugins/bitmaps/native/pictureflow_emptyslide.100x100x16.bmp",
578 "$temp_dir/rocks/demos/pictureflow_emptyslide.bmp");
579 my ($pf_logo);
580 if ($width < 200) {
581 $pf_logo = "pictureflow_logo.100x18x16.bmp";
582 } else {
583 $pf_logo = "pictureflow_logo.193x34x16.bmp";
585 copy("$ROOT/apps/plugins/bitmaps/native/$pf_logo",
586 "$temp_dir/rocks/demos/pictureflow_splash.bmp");
589 create_failsafefiles($temp_dir, $remote_depth);
591 if($image) {
592 # image is blank when this is a simulator
593 if( filesize("rockbox.ucl") > 1000 ) {
594 copy("rockbox.ucl", "$temp_dir/rockbox.ucl"); # UCL for flashing
596 if( filesize("rombox.ucl") > 1000) {
597 copy("rombox.ucl", "$temp_dir/rombox.ucl"); # UCL for flashing
600 # Check for rombox.target
601 if ($image=~/(.*)\.(\w+)$/)
603 my $romfile = "rombox.$2";
604 if (filesize($romfile) > 1000)
606 copy($romfile, "$temp_dir/$romfile");
611 glob_mkdir("$temp_dir/docs");
612 for(("COPYING",
613 "LICENSES",
614 "KNOWN_ISSUES"
615 )) {
616 copy("$ROOT/docs/$_", "$temp_dir/docs/$_.txt");
618 if ($fonts) {
619 copy("$ROOT/docs/profontdoc.txt", "$temp_dir/docs/profontdoc.txt");
621 for(("sample.colours",
622 "sample.icons"
623 )) {
624 copy("$ROOT/docs/$_", "$temp_dir/docs/$_");
627 # Now do the WPS dance
628 if(-d "$ROOT/wps") {
629 my $wps_build_cmd="perl $ROOT/wps/wpsbuild.pl ";
630 $wps_build_cmd=$wps_build_cmd."-v " if $verbose;
631 $wps_build_cmd=$wps_build_cmd." --tempdir=$temp_dir --rbdir=$rbdir -r $ROOT -m $modelname $ROOT/wps/WPSLIST $target";
632 print "wpsbuild: $wps_build_cmd\n" if $verbose;
633 system("$wps_build_cmd");
634 print "wps_build_cmd: done\n" if $verbose;
636 else {
637 print STDERR "No wps module present, can't do the WPS magic!\n";
640 # until buildwps.pl is fixed, manually copy the classic_statusbar theme across
641 mkdir "$temp_dir/wps/classic_statusbar", 0777;
642 glob_copy("$ROOT/wps/classic_statusbar/*.bmp", "$temp_dir/wps/classic_statusbar");
643 if ($swcodec) {
644 if ($depth == 16) {
645 copy("$ROOT/wps/classic_statusbar.sbs", "$temp_dir/wps");
646 } elsif ($depth > 1) {
647 copy("$ROOT/wps/classic_statusbar.grey.sbs", "$temp_dir/wps/classic_statusbar.sbs");
648 } else {
649 copy("$ROOT/wps/classic_statusbar.mono.sbs", "$temp_dir/wps/classic_statusbar.sbs");
651 } else {
652 copy("$ROOT/wps/classic_statusbar.112x64x1.sbs", "$temp_dir/wps/classic_statusbar.sbs");
654 if ($remote_depth != $depth) {
655 copy("$ROOT/wps/classic_statusbar.mono.sbs", "$temp_dir/wps/classic_statusbar.rsbs");
656 } else {
657 copy("$temp_dir/wps/classic_statusbar.sbs", "$temp_dir/wps/classic_statusbar.rsbs");
659 copy("$temp_dir/wps/rockbox_none.sbs", "$temp_dir/wps/rockbox_none.rsbs");
661 # and the info file
662 copy("rockbox-info.txt", "$temp_dir/rockbox-info.txt");
664 # copy the already built lng files
665 glob_copy('apps/lang/*lng', "$temp_dir/langs/");
667 # copy the .lua files
668 glob_mkdir("$temp_dir/rocks/viewers/lua/");
669 glob_copy('apps/plugins/lua/*.lua', "$temp_dir/rocks/viewers/lua/");
672 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
673 localtime(time);
675 $mon+=1;
676 $year+=1900;
678 #$date=sprintf("%04d%02d%02d", $year,$mon, $mday);
679 #$shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
681 # made once for all targets
682 sub runone {
683 my ($target, $fonts)=@_;
685 # Strip the leading / from $rbdir unless we are installing an application
686 # build - the layout is different (no .rockbox, but bin/lib/share)
687 unless ($app && $install) {
688 $rbdir = substr($rbdir, 1);
691 # build a full install .rockbox ($rbdir) directory
692 buildzip($target, $fonts);
694 unlink($output);
696 if($fonts == 1) {
697 # Don't include image file in fonts-only package
698 undef $target;
700 if($target && ($target !~ /(mod|ajz|wma)\z/i)) {
701 # On some targets, the image goes into .rockbox.
702 copy("$target", ".rockbox/$target");
703 undef $target;
706 if($install) {
707 if($mklinks) {
708 my $cwd = getcwd();
709 symlink("$cwd/.rockbox", "$install/.rockbox");
710 print "link .rockbox $install\n" if $verbose;
711 } else {
712 make_install(".rockbox", $install) or die "MKDIRFAILED\n";
713 rmtree(".rockbox");
714 print "rm .rockbox\n" if $verbose;
717 else {
718 unless (".rockbox" eq $rbdir) {
719 mkpath($rbdir);
720 rmtree($rbdir);
721 move(".rockbox", $rbdir);
722 print "mv .rockbox $rbdir\n" if $verbose;
724 system("$ziptool $output $rbdir $target >/dev/null");
725 print "$ziptool $output $rbdir $target >/dev/null\n" if $verbose;
726 rmtree("$rbdir");
727 print "rm $rbdir\n" if $verbose;
731 if(!$exe) {
732 # not specified, guess!
733 if($target =~ /(recorder|ondio)/i) {
734 $exe = "ajbrec.ajz";
736 elsif($target =~ /iriver/i) {
737 $exe = "rockbox.iriver";
739 else {
740 $exe = "archos.mod";
743 elsif(($exe =~ /rockboxui/)) {
744 # simulator, exclude the exe file
745 $exe = "";
747 elsif($exe eq "librockbox.so") {
748 # android, exclude the binary
749 $exe="";
752 runone($exe, $incfonts);