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
92 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
94 # print STDERR "CMD $c\n";
98 my ($bitmap, $depth, $swcodec, $icon_h, $icon_w);
99 my ($remote_depth, $remote_icon_h, $remote_icon_w);
102 # print STDERR "DATA: $_";
103 if($_ =~ /^Bitmap: (.*)/) {
106 elsif($_ =~ /^Depth: (\d*)/) {
109 elsif($_ =~ /^Icon Width: (\d*)/) {
112 elsif($_ =~ /^Icon Height: (\d*)/) {
115 elsif($_ =~ /^Codec: (\d*)/) {
116 # SWCODEC is 1, the others are HWCODEC
117 $swcodec = ($1 == 1);
119 elsif($_ =~ /^Remote Depth: (\d*)/) {
122 elsif($_ =~ /^Remote Icon Width: (\d*)/) {
125 elsif($_ =~ /^Remote Icon Height: (\d*)/) {
132 return ($bitmap, $depth, $icon_w, $icon_h,
133 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h);
138 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
139 $atime,$mtime,$ctime,$blksize,$blocks)
146 my $dir = "$ROOT/apps/lang";
148 my @files = grep { /\.lang$/ } readdir(DIR
);
153 $output =~ s/(.*)\.lang/$1.lng/;
154 print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_\n" if($verbose);
155 system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_ >/dev/null 2>&1");
160 my ($zip, $image, $fonts)=@_;
162 my ($bitmap, $depth, $icon_w, $icon_h, $swcodec,
163 $remote_depth, $remote_icon_w, $remote_icon_h) = &gettargetinfo
();
165 # print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
170 mkdir ".rockbox", 0777;
173 # always disable fonts on non-bitmap targets
178 mkdir ".rockbox/fonts", 0777;
180 opendir(DIR
, "$ROOT/fonts") || die "can't open dir fonts";
181 my @fonts = grep { /\.bdf$/ && -f
"$ROOT/fonts/$_" } readdir(DIR
);
187 print "FONT: $f\n" if($verbose);
189 $o =~ s/\.bdf/\.fnt/;
190 my $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$o\" \"$ROOT/fonts/$f\" >/dev/null 2>&1";
191 print "CMD: $cmd\n" if($verbose);
196 # fonts-only package, return
201 mkdir ".rockbox/langs", 0777;
202 mkdir ".rockbox/rocks", 0777;
205 mkdir ".rockbox/eqs", 0777;
207 `cp $ROOT/apps/eqs/*.cfg .rockbox/eqs/`; # equalizer presets
210 mkdir ".rockbox/wps", 0777;
211 mkdir ".rockbox/themes", 0777;
213 open(THEME
, ">.rockbox/themes/rockbox_default_icons.cfg");
215 # this config file was auto-generated to make it
216 # easy to reset the icons back to default
218 # taken from apps/gui/icon.c
219 viewers iconset: /.rockbox/icons/viewers.bmp
221 # taken from apps/gui/icon.c
222 remote viewers iconset: /.rockbox/icons/remote_viewers.bmp
229 mkdir ".rockbox/codepages", 0777;
232 system("$ROOT/tools/codepages");
235 system("$ROOT/tools/codepages -m");
237 $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
241 mkdir ".rockbox/codecs", 0777;
243 mkdir ".rockbox/backdrops", 0777;
246 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null';
249 my @call = `find .rockbox/codecs -type f 2>/dev/null`;
251 # no codec was copied, remove directory again
252 rmdir(".rockbox/codecs");
257 $c= 'find apps "(" -name "*.rock" -o -name "*.ovl" ")" ! -empty -exec cp {} .rockbox/rocks/ \;';
260 open VIEWERS
, "$ROOT/apps/plugins/viewers.config" or
261 die "can't open viewers.config";
262 @viewers = <VIEWERS
>;
265 open VIEWERS
, ">.rockbox/viewers.config" or
266 die "can't create .rockbox/viewers.config";
267 mkdir ".rockbox/viewers", 0777;
268 foreach my $line (@viewers) {
269 if ($line =~ /([^,]*),([^,]*),/) {
270 my ($ext, $plugin)=($1, $2);
271 my $r = "${plugin}.rock";
277 # strip off the last slash and file name part
278 $dir =~ s/(.*)\/(.*)/$1/;
279 # store the file name part
282 # get .ovl name (file part only)
284 $oname =~ s/\.rock$/.ovl/;
286 # print STDERR "$ext $plugin $dir $name $r\n";
288 if(-e
".rockbox/rocks/$name") {
289 if($dir ne "rocks") {
290 # target is not 'rocks' but the plugins are always in that
292 `mv .rockbox/rocks/$name .rockbox/$r`;
296 elsif(-e
".rockbox/$r") {
297 # in case the same plugin works for multiple extensions, it
298 # was already moved to the viewers dir
302 if(-e
".rockbox/rocks/$oname") {
303 # if there's an "overlay" file for the .rock, move that as
305 `mv .rockbox/rocks/$oname .rockbox/$dir`;
312 mkdir ".rockbox/icons", 0777;
313 `cp $viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp .rockbox/icons/viewers.bmp`;
315 `cp $viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp .rockbox/icons/remote_viewers.bmp`;
319 `cp $ROOT/apps/tagnavi.config .rockbox/`;
322 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels
323 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels
327 # image is blank when this is a simulator
328 if( filesize
("rockbox.ucl") > 1000 ) {
329 `cp rockbox.ucl .rockbox/`; # UCL for flashing
331 if( filesize
("rombox.ucl") > 1000) {
332 `cp rombox.ucl .rockbox/`; # UCL for flashing
335 # Check for rombox.target
336 if ($image=~/(.*)\.(\w+)$/)
338 my $romfile = "rombox.$2";
339 if (filesize
($romfile) > 1000)
341 `cp $romfile .rockbox/`;
346 mkdir ".rockbox/docs", 0777;
350 `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`;
353 # Now do the WPS dance
355 system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
358 print STDERR
"No wps module present, can't do the WPS magic!\n";
362 system("cp rockbox-info.txt .rockbox/");
364 # now copy the file made for reading on the unit:
366 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
369 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
372 buildlangs
(".rockbox/langs");
376 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
382 #$date=sprintf("%04d%02d%02d", $year,$mon, $mday);
383 #$shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
385 # made once for all targets
387 my ($target, $fonts)=@_;
389 # build a full install .rockbox directory
390 buildzip
($output, $target, $fonts);
392 # create a zip file from the .rockbox dfir
396 print "find .rockbox | xargs $ziptool $output >/dev/null\n";
398 `find .rockbox | xargs $ziptool $output >/dev/null`;
400 if($target && ($fonts != 1)) {
401 # On some targets, rockbox.* is inside .rockbox
402 if($target !~ /(mod|ajz|wma)\z/i) {
403 `cp $target .rockbox/$target`;
404 $target = ".rockbox/".$target;
408 print "$ziptool $output $target\n";
410 `$ziptool $output $target`;
413 # remove the .rockbox afterwards
418 # not specified, guess!
419 if($target =~ /(recorder|ondio)/i) {
422 elsif($target =~ /iriver/i) {
423 $exe = "rockbox.iriver";
429 elsif($exe =~ /rockboxui/) {
430 # simulator, exclude the exe file
434 runone
($exe, $incfonts);