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 "-o") {
45 elsif($ARGV[0] eq "-f") {
46 $incfonts=$ARGV[1]; # 0 - no fonts, 1 - fonts only 2 - fonts and package
51 elsif($ARGV[0] eq "-v") {
63 my $firmdir="$ROOT/firmware";
64 my $appsdir="$ROOT/apps";
65 my $viewer_bmpdir="$ROOT/apps/plugins/bitmaps/viewer_defaults";
70 open(GCC
, ">gcctemp");
71 # Get the LCD screen depth and graphical status
74 #ifdef HAVE_LCD_BITMAP
77 Icon Width: CONFIG_DEFAULT_ICON_WIDTH
78 Icon Height: CONFIG_DEFAULT_ICON_HEIGHT
81 #ifdef HAVE_REMOTE_LCD
82 Remote Depth: LCD_REMOTE_DEPTH
83 Remote Icon Width: CONFIG_REMOTE_DEFAULT_ICON_WIDTH
84 Remote Icon Height: CONFIG_REMOTE_DEFAULT_ICON_HEIGHT
95 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
97 # print STDERR "CMD $c\n";
101 my ($bitmap, $depth, $swcodec, $icon_h, $icon_w);
102 my ($remote_depth, $remote_icon_h, $remote_icon_w);
106 # print STDERR "DATA: $_";
107 if($_ =~ /^Bitmap: (.*)/) {
110 elsif($_ =~ /^Depth: (\d*)/) {
113 elsif($_ =~ /^Icon Width: (\d*)/) {
116 elsif($_ =~ /^Icon Height: (\d*)/) {
119 elsif($_ =~ /^Codec: (\d*)/) {
120 # SWCODEC is 1, the others are HWCODEC
121 $swcodec = ($1 == 1);
123 elsif($_ =~ /^Remote Depth: (\d*)/) {
126 elsif($_ =~ /^Remote Icon Width: (\d*)/) {
129 elsif($_ =~ /^Remote Icon Height: (\d*)/) {
132 if($_ =~ /^Recording: (.*)/) {
139 return ($bitmap, $depth, $icon_w, $icon_h, $recording,
140 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h);
145 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
146 $atime,$mtime,$ctime,$blksize,$blocks)
153 my $dir = "$ROOT/apps/lang";
155 my @files = grep { /\.lang$/ } readdir(DIR
);
160 $output =~ s/(.*)\.lang/$1.lng/;
161 print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_\n" if($verbose);
162 system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_ >/dev/null 2>&1");
167 my ($zip, $image, $fonts)=@_;
169 my ($bitmap, $depth, $icon_w, $icon_h, $recording, $swcodec,
170 $remote_depth, $remote_icon_w, $remote_icon_h) = &gettargetinfo
();
172 # print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
177 mkdir ".rockbox", 0777;
180 # always disable fonts on non-bitmap targets
185 mkdir ".rockbox/fonts", 0777;
187 opendir(DIR
, "$ROOT/fonts") || die "can't open dir fonts";
188 my @fonts = grep { /\.bdf$/ && -f
"$ROOT/fonts/$_" } readdir(DIR
);
194 print "FONT: $f\n" if($verbose);
196 $o =~ s/\.bdf/\.fnt/;
197 my $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$o\" \"$ROOT/fonts/$f\" >/dev/null 2>&1";
198 print "CMD: $cmd\n" if($verbose);
203 # fonts-only package, return
208 mkdir ".rockbox/langs", 0777;
209 mkdir ".rockbox/rocks", 0777;
211 mkdir ".rockbox/recpresets", 0777;
215 mkdir ".rockbox/eqs", 0777;
217 `cp $ROOT/apps/eqs/*.cfg .rockbox/eqs/`; # equalizer presets
220 mkdir ".rockbox/wps", 0777;
221 mkdir ".rockbox/themes", 0777;
223 open(THEME
, ">.rockbox/themes/rockbox_default_icons.cfg");
225 # this config file was auto-generated to make it
226 # easy to reset the icons back to default
228 # taken from apps/gui/icon.c
229 viewers iconset: /.rockbox/icons/viewers.bmp
231 # taken from apps/gui/icon.c
232 remote viewers iconset: /.rockbox/icons/remote_viewers.bmp
239 mkdir ".rockbox/codepages", 0777;
242 system("$ROOT/tools/codepages");
245 system("$ROOT/tools/codepages -m");
247 $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
251 mkdir ".rockbox/codecs", 0777;
253 mkdir ".rockbox/backdrops", 0777;
256 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null';
259 my @call = `find .rockbox/codecs -type f 2>/dev/null`;
261 # no codec was copied, remove directory again
262 rmdir(".rockbox/codecs");
267 $c= 'find apps "(" -name "*.rock" -o -name "*.ovl" ")" ! -empty -exec cp {} .rockbox/rocks/ \;';
270 open VIEWERS
, "$ROOT/apps/plugins/viewers.config" or
271 die "can't open viewers.config";
272 @viewers = <VIEWERS
>;
275 open VIEWERS
, ">.rockbox/viewers.config" or
276 die "can't create .rockbox/viewers.config";
277 mkdir ".rockbox/viewers", 0777;
278 foreach my $line (@viewers) {
279 if ($line =~ /([^,]*),([^,]*),/) {
280 my ($ext, $plugin)=($1, $2);
281 my $r = "${plugin}.rock";
287 # strip off the last slash and file name part
288 $dir =~ s/(.*)\/(.*)/$1/;
289 # store the file name part
292 # get .ovl name (file part only)
294 $oname =~ s/\.rock$/.ovl/;
296 # print STDERR "$ext $plugin $dir $name $r\n";
298 if(-e
".rockbox/rocks/$name") {
299 if($dir ne "rocks") {
300 # target is not 'rocks' but the plugins are always in that
302 `mv .rockbox/rocks/$name .rockbox/$r`;
306 elsif(-e
".rockbox/$r") {
307 # in case the same plugin works for multiple extensions, it
308 # was already moved to the viewers dir
312 if(-e
".rockbox/rocks/$oname") {
313 # if there's an "overlay" file for the .rock, move that as
315 `mv .rockbox/rocks/$oname .rockbox/$dir`;
322 mkdir ".rockbox/icons", 0777;
323 `cp $viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp .rockbox/icons/viewers.bmp`;
325 `cp $viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp .rockbox/icons/remote_viewers.bmp`;
329 `cp $ROOT/apps/tagnavi.config .rockbox/`;
332 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels
333 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels
337 # image is blank when this is a simulator
338 if( filesize
("rockbox.ucl") > 1000 ) {
339 `cp rockbox.ucl .rockbox/`; # UCL for flashing
341 if( filesize
("rombox.ucl") > 1000) {
342 `cp rombox.ucl .rockbox/`; # UCL for flashing
345 # Check for rombox.target
346 if ($image=~/(.*)\.(\w+)$/)
348 my $romfile = "rombox.$2";
349 if (filesize
($romfile) > 1000)
351 `cp $romfile .rockbox/`;
356 mkdir ".rockbox/docs", 0777;
361 `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`;
364 `cp $ROOT/docs/profontdoc.txt .rockbox/docs/`;
366 for(("sample.colours",
369 `cp $ROOT/docs/$_ .rockbox/docs/`;
372 # Now do the WPS dance
374 system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
377 print STDERR
"No wps module present, can't do the WPS magic!\n";
381 system("cp rockbox-info.txt .rockbox/");
383 # now copy the file made for reading on the unit:
385 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
388 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
391 buildlangs
(".rockbox/langs");
395 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
401 #$date=sprintf("%04d%02d%02d", $year,$mon, $mday);
402 #$shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
404 # made once for all targets
406 my ($target, $fonts)=@_;
408 # build a full install .rockbox directory
409 buildzip
($output, $target, $fonts);
411 # create a zip file from the .rockbox dfir
415 print "find .rockbox | xargs $ziptool $output >/dev/null\n";
417 `find .rockbox | xargs $ziptool $output >/dev/null`;
419 if($target && ($fonts != 1)) {
420 # On some targets, rockbox.* is inside .rockbox
421 if($target !~ /(mod|ajz|wma)\z/i) {
422 `cp $target .rockbox/$target`;
423 $target = ".rockbox/".$target;
427 print "$ziptool $output $target\n";
429 `$ziptool $output $target`;
432 # remove the .rockbox afterwards
437 # not specified, guess!
438 if($target =~ /(recorder|ondio)/i) {
441 elsif($target =~ /iriver/i) {
442 $exe = "rockbox.iriver";
448 elsif($exe =~ /rockboxui/) {
449 # simulator, exclude the exe file
453 runone
($exe, $incfonts);