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";
68 open(GCC
, ">gcctemp");
69 # Get the LCD screen depth and graphical status
72 #ifdef HAVE_LCD_BITMAP
81 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
83 # print STDERR "CMD $c\n";
87 my ($bitmap, $depth, $swcodec);
89 # print STDERR "DATA: $_";
90 if($_ =~ /^Bitmap: (.*)/) {
93 elsif($_ =~ /^Depth: (\d*)/) {
96 elsif($_ =~ /^Codec: (\d*)/) {
97 # SWCODEC is 1, the others are HWCODEC
104 return ($bitmap, $depth, $swcodec);
109 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
110 $atime,$mtime,$ctime,$blksize,$blocks)
117 my $dir = "$ROOT/apps/lang";
119 my @files = grep { /\.lang$/ } readdir(DIR
);
124 $output =~ s/(.*)\.lang/$1.lng/;
125 print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_\n" if($verbose);
126 system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_ >/dev/null 2>&1");
131 my ($zip, $image, $fonts)=@_;
133 my ($bitmap, $depth, $swcodec) = &gettargetinfo
();
135 print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
140 mkdir ".rockbox", 0777;
143 # always disable fonts on non-bitmap targets
148 mkdir ".rockbox/fonts", 0777;
150 opendir(DIR
, "$ROOT/fonts") || die "can't open dir fonts";
151 my @fonts = grep { /\.bdf$/ && -f
"$ROOT/fonts/$_" } readdir(DIR
);
157 print "FONT: $f\n" if($verbose);
159 $o =~ s/\.bdf/\.fnt/;
160 my $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$o\" \"$ROOT/fonts/$f\" >/dev/null 2>&1";
161 print "CMD: $cmd\n" if($verbose);
166 # fonts-only package, return
171 mkdir ".rockbox/langs", 0777;
172 mkdir ".rockbox/rocks", 0777;
175 mkdir ".rockbox/eqs", 0777;
177 `cp $ROOT/apps/eqs/*.cfg .rockbox/eqs/`; # equalizer presets
180 mkdir ".rockbox/wps", 0777;
183 mkdir ".rockbox/codepages", 0777;
184 mkdir ".rockbox/codecs", 0777;
185 mkdir ".rockbox/themes", 0777;
187 mkdir ".rockbox/backdrops", 0777;
190 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null';
193 system("$ROOT/tools/codepages");
194 $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
197 my @call = `find .rockbox/codecs -type f 2>/dev/null`;
199 # no codec was copied, remove directory again
200 rmdir(".rockbox/codecs");
205 $c= 'find apps "(" -name "*.rock" -o -name "*.ovl" ")" ! -empty -exec cp {} .rockbox/rocks/ \;';
208 open VIEWERS
, "$ROOT/apps/plugins/viewers.config" or
209 die "can't open viewers.config";
210 @viewers = <VIEWERS
>;
213 open VIEWERS
, ">.rockbox/viewers.config" or
214 die "can't create .rockbox/viewers.config";
215 mkdir ".rockbox/viewers", 0777;
216 foreach my $line (@viewers) {
217 if ($line =~ /([^,]*),([^,]*),/) {
218 my ($ext, $plugin)=($1, $2);
219 my $r = "${plugin}.rock";
225 # strip off the last slash and file name part
226 $dir =~ s/(.*)\/(.*)/$1/;
227 # store the file name part
230 # get .ovl name (file part only)
232 $oname =~ s/\.rock$/.ovl/;
234 # print STDERR "$ext $plugin $dir $name $r\n";
236 if(-e
".rockbox/rocks/$name") {
237 if($dir ne "rocks") {
238 # target is not 'rocks' but the plugins are always in that
240 `mv .rockbox/rocks/$name .rockbox/$r`;
244 elsif(-e
".rockbox/$r") {
245 # in case the same plugin works for multiple extensions, it
246 # was already moved to the viewers dir
250 if(-e
".rockbox/rocks/$oname") {
251 # if there's an "overlay" file for the .rock, move that as
253 `mv .rockbox/rocks/$oname .rockbox/$dir`;
259 `cp $ROOT/apps/tagnavi.config .rockbox/`;
262 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels
263 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels
267 # image is blank when this is a simulator
268 if( filesize
("rockbox.ucl") > 1000 ) {
269 `cp rockbox.ucl .rockbox/`; # UCL for flashing
271 if( filesize
("rombox.ucl") > 1000) {
272 `cp rombox.ucl .rockbox/`; # UCL for flashing
275 # Check for rombox.target
276 if ($image=~/(.*)\.(\w+)$/)
278 my $romfile = "rombox.$2";
279 if (filesize
($romfile) > 1000)
281 `cp $romfile .rockbox/`;
286 mkdir ".rockbox/docs", 0777;
290 `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`;
293 # Now do the WPS dance
295 system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
298 print STDERR
"No wps module present, can't do the WPS magic!\n";
301 # now copy the file made for reading on the unit:
303 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
306 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
309 buildlangs
(".rockbox/langs");
313 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
319 #$date=sprintf("%04d%02d%02d", $year,$mon, $mday);
320 #$shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
322 # made once for all targets
324 my ($target, $fonts)=@_;
326 # build a full install .rockbox directory
327 buildzip
($output, $target, $fonts);
329 # create a zip file from the .rockbox dfir
333 print "find .rockbox | xargs $ziptool $output >/dev/null\n";
335 `find .rockbox | xargs $ziptool $output >/dev/null`;
337 if($target && ($fonts != 1)) {
339 print "$ziptool $output $target\n";
341 `$ziptool $output $target`;
344 # remove the .rockbox afterwards
349 # not specified, guess!
350 if($target =~ /(recorder|ondio)/i) {
353 elsif($target =~ /iriver/i) {
354 $exe = "rockbox.iriver";
360 elsif($exe =~ /rockboxui/) {
361 # simulator, exclude the exe file
365 runone
($exe, $incfonts);