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 my $c = 'find apps -name "*.codec" ! -empty -exec cp {} .rockbox/codecs/ \; 2>/dev/null';
136 system("$ROOT/tools/codepages");
137 my $c = 'find . -name "*.cp" ! -empty -exec mv {} .rockbox/codepages/ \; >/dev/null 2>&1';
140 my @call = `find .rockbox/codecs -type f 2>/dev/null`;
142 # no codec was copied, remove directory again
143 rmdir(".rockbox/codecs");
148 $c= 'find apps "(" -name "*.rock" -o -name "*.ovl" ")" ! -empty -exec cp {} .rockbox/rocks/ \;';
151 open VIEWERS
, "$ROOT/apps/plugins/viewers.config" or
152 die "can't open viewers.config";
153 @viewers = <VIEWERS
>;
156 open VIEWERS
, ">.rockbox/viewers.config" or
157 die "can't create .rockbox/viewers.config";
158 mkdir ".rockbox/viewers", 0777;
159 foreach my $line (@viewers) {
160 if ($line =~ /([^,]*),([^,]*),/) {
161 my ($ext, $plugin)=($1, $2);
162 my $r = "${plugin}.rock";
168 # strip off the last slash and file name part
169 $dir =~ s/(.*)\/(.*)/$1/;
170 # store the file name part
173 # get .ovl name (file part only)
175 $oname =~ s/\.rock$/.ovl/;
177 # print STDERR "$ext $plugin $dir $name $r\n";
179 if(-e
".rockbox/rocks/$name") {
180 if($dir ne "rocks") {
181 # target is not 'rocks' but the plugins are always in that
183 `mv .rockbox/rocks/$name .rockbox/$r`;
187 elsif(-e
".rockbox/$r") {
188 # in case the same plugin works for multiple extensions, it
189 # was already moved to the viewers dir
193 if(-e
".rockbox/rocks/$oname") {
194 # if there's an "overlay" file for the .rock, move that as
196 `mv .rockbox/rocks/$oname .rockbox/$dir`;
202 `cp $ROOT/apps/tagnavi.config .rockbox/`;
205 `cp $ROOT/apps/plugins/sokoban.levels .rockbox/rocks/`; # sokoban levels
206 `cp $ROOT/apps/plugins/snake2.levels .rockbox/rocks/`; # snake2 levels
210 # image is blank when this is a simulator
211 if( filesize
("rockbox.ucl") > 1000 ) {
212 `cp rockbox.ucl .rockbox/`; # UCL for flashing
214 if( filesize
("rombox.ucl") > 1000) {
215 `cp rombox.ucl .rockbox/`; # UCL for flashing
219 mkdir ".rockbox/docs", 0777;
223 `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`;
226 # Now do the WPS dance
228 system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
231 print STDERR
"No wps module present, can't do the WPS magic!\n";
234 # now copy the file made for reading on the unit:
236 # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`;
239 # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`;
242 buildlangs
(".rockbox/langs");
246 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
252 $date=sprintf("%04d%02d%02d", $year,$mon, $mday);
253 $shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday);
255 # made once for all targets
257 my ($type, $target, $fonts)=@_;
259 # build a full install .rockbox directory
260 buildzip
($output, $target,
261 ($type eq "player")?
0:1, $fonts);
263 # create a zip file from the .rockbox dfir
267 print "find .rockbox | xargs $ziptool $output >/dev/null\n";
269 `find .rockbox | xargs $ziptool $output >/dev/null`;
271 if($target && ($fonts != 1)) {
273 print "$ziptool $output $target\n";
275 `$ziptool $output $target`;
278 # remove the .rockbox afterwards
283 # not specified, guess!
284 if($target =~ /(recorder|ondio)/i) {
287 elsif($target =~ /iriver/i) {
288 $exe = "rockbox.iriver";
290 elsif($target =~ /gmini/i) {
291 $exe = "rockbox.gmini";
297 elsif($exe =~ /rockboxui/) {
298 # simulator, exclude the exe file
302 if($target =~ /player/i) {
303 runone
("player", $exe, 0);
306 runone
("recorder", $exe, $incfonts);