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";
70 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
71 $atime,$mtime,$ctime,$blksize,$blocks)
78 my $dir = "$ROOT/apps/lang";
80 my @files = grep { /\.lang$/ } readdir(DIR
);
85 $output =~ s/(.*)\.lang/$1.lng/;
86 print "$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_\n" if($verbose);
87 system ("$ROOT/tools/genlang -e=$dir/english.lang -t=$archos -b=$outputlang/$output $dir/$_ >/dev/null 2>&1");
92 my ($zip, $image, $notplayer, $fonts)=@_;
97 mkdir ".rockbox", 0777;
100 mkdir ".rockbox/fonts", 0777;
102 opendir(DIR
, "$ROOT/fonts") || die "can't open dir fonts";
103 my @fonts = grep { /\.bdf$/ && -f
"$ROOT/fonts/$_" } readdir(DIR
);
109 print "FONT: $f\n" if($verbose);
111 $o =~ s/\.bdf/\.fnt/;
112 my $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$o\" \"$ROOT/fonts/$f\" >/dev/null 2>&1";
113 print "CMD: $cmd\n" if($verbose);
118 # fonts-only package, return
123 mkdir ".rockbox/langs", 0777;
124 mkdir ".rockbox/rocks", 0777;
126 mkdir ".rockbox/codepages", 0777;
127 mkdir ".rockbox/codecs", 0777;
128 mkdir ".rockbox/wps", 0777;
129 mkdir ".rockbox/themes", 0777;
130 mkdir ".rockbox/backdrops", 0777;
131 mkdir ".rockbox/eqs", 0777;
133 `cp $ROOT/apps/eqs/*.cfg .rockbox/eqs/`; # equalizer presets
135 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null';
138 system("$ROOT/tools/codepages");
139 my $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
142 my @call = `find .rockbox/codecs -type f 2>/dev/null`;
144 # no codec was copied, remove directory again
145 rmdir(".rockbox/codecs");
150 $c= 'find apps "(" -name "*.rock" -o -name "*.ovl" ")" ! -empty -exec cp {} .rockbox/rocks/ \;';
153 open VIEWERS
, "$ROOT/apps/plugins/viewers.config" or
154 die "can't open viewers.config";
155 @viewers = <VIEWERS
>;
158 open VIEWERS
, ">.rockbox/viewers.config" or
159 die "can't create .rockbox/viewers.config";
160 mkdir ".rockbox/viewers", 0777;
161 foreach my $line (@viewers) {
162 if ($line =~ /([^,]*),([^,]*),/) {
163 my ($ext, $plugin)=($1, $2);
164 my $r = "${plugin}.rock";
170 # strip off the last slash and file name part
171 $dir =~ s/(.*)\/(.*)/$1/;
172 # store the file name part
175 # get .ovl name (file part only)
177 $oname =~ s/\.rock$/.ovl/;
179 # print STDERR "$ext $plugin $dir $name $r\n";
181 if(-e
".rockbox/rocks/$name") {
182 if($dir ne "rocks") {
183 # target is not 'rocks' but the plugins are always in that
185 `mv .rockbox/rocks/$name .rockbox/$r`;
189 elsif(-e
".rockbox/$r") {
190 # in case the same plugin works for multiple extensions, it
191 # was already moved to the viewers dir
195 if(-e
".rockbox/rocks/$oname") {
196 # if there's an "overlay" file for the .rock, move that as
198 `mv .rockbox/rocks/$oname .rockbox/$dir`;
204 `cp $ROOT/apps/tagnavi.config .rockbox/`;
207 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels
208 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels
212 # image is blank when this is a simulator
213 if( filesize
("rockbox.ucl") > 1000 ) {
214 `cp rockbox.ucl .rockbox/`; # UCL for flashing
216 if( filesize
("rombox.ucl") > 1000) {
217 `cp rombox.ucl .rockbox/`; # UCL for flashing
221 mkdir ".rockbox/docs", 0777;
225 `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`;
228 # Now do the WPS dance
230 system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
233 print STDERR
"No wps module present, can't do the WPS magic!\n";
236 # now copy the file made for reading on the unit:
238 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
241 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
244 buildlangs
(".rockbox/langs");
248 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
254 $date=sprintf("%04d%02d%02d", $year,$mon, $mday);
255 $shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
257 # made once for all targets
259 my ($type, $target, $fonts)=@_;
261 # build a full install .rockbox directory
262 buildzip
($output, $target,
263 ($type eq "player")?
0:1, $fonts);
265 # create a zip file from the .rockbox dfir
269 print "find .rockbox | xargs $ziptool $output >/dev/null\n";
271 `find .rockbox | xargs $ziptool $output >/dev/null`;
273 if($target && ($fonts != 1)) {
275 print "$ziptool $output $target\n";
277 `$ziptool $output $target`;
280 # remove the .rockbox afterwards
285 # not specified, guess!
286 if($target =~ /(recorder|ondio)/i) {
289 elsif($target =~ /iriver/i) {
290 $exe = "rockbox.iriver";
296 elsif($exe =~ /rockboxui/) {
297 # simulator, exclude the exe file
301 if($target =~ /player/i) {
302 runone
("player", $exe, 0);
305 runone
("recorder", $exe, $incfonts);