3 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
13 if($ARGV[0] eq "-r") {
20 if($ARGV[0] eq "-v") {
25 my $firmdir="$ROOT/firmware";
29 my $target = $ARGV[1];
31 my @depthlist = ( 16, 8, 4, 2, 1 );
34 print "Usage: wpsbuilds.pl <WPSLIST> <target>\n",
35 "Run this script in the root of the target build, and it will put all the\n",
36 "stuff in .rockbox/wps/\n";
43 open(GCC
, ">gcctemp");
45 # Get the remote LCD screen size
48 #ifdef HAVE_REMOTE_LCD
49 Height: LCD_REMOTE_HEIGHT
50 Width: LCD_REMOTE_WIDTH
51 Depth: LCD_REMOTE_DEPTH
67 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
75 if($_ =~ /^Height: (\d*)/) {
78 elsif($_ =~ /^Width: (\d*)/) {
81 elsif($_ =~ /^Depth: (\d*)/) {
84 if($height && $width && $depth) {
91 return ($height, $width, $depth);
96 $wpsdir =~ s/\.(r|)wps//;
97 mkdir ".rockbox/wps", 0777;
98 mkdir ".rockbox/themes", 0777;
100 if( -d
".rockbox/wps/$wpsdir") {
101 #print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n";
105 mkdir ".rockbox/wps/$wpsdir", 0777;
110 #copy the backdrop file into the build dir
112 $backdrop =~ /\/(.*backdrops\
/(.*))/i;
113 `cp $ROOT/backdrops/$2 $1`;
117 # we assume that we copy the WPS files from the same dir the WPSLIST
123 if($wpslist =~ /(.*)WPSLIST/) {
125 # system("cp $dir/$wps .rockbox/wps/");
126 # print "$req_t_wps $req_g_wps\n";
128 if (-e
"$dir/$req_t_wps" ) {
129 system("cp $dir/$req_t_wps .rockbox/wps/$wps");
131 } elsif (-e
"$dir/$req_g_wps") {
132 system("cp $dir/$req_g_wps .rockbox/wps/$wps");
134 open(WPSFILE
, "$dir/$req_g_wps");
136 $filelist[$#filelist + 1] = $1 if (/\|([^|]*?.bmp)\|/);
140 if ($#filelist >= 0) {
141 if (-e
"$dir/$wps_prefix/$req_g") {
142 foreach $file (@filelist) {
143 system("cp $dir/$wps_prefix/$req_g/$file .rockbox/wps/$wps_prefix/");
146 elsif (-e
"$dir/$wps_prefix") {
147 foreach $file (@filelist) {
148 system("cp $dir/$wps_prefix/$file .rockbox/wps/$wps_prefix/");
152 print STDERR
"beep, no dir to copy WPS from!\n";
157 print STDERR
"Skipping $wps - no matching resolution.\n";
160 print STDERR
"No source directory!\n";
168 $cfg =~ s/\.(r|)wps/.cfg/;
172 \# $cfg generated by wpsbuild.pl
173 \# $wps is made by $author
175 wps: /.rockbox/wps/$wps
179 push @out, "font: /.rockbox/fonts/$font\n";
182 push @out, "foreground color: $fgcolor\n";
185 push @out, "background color: $bgcolor\n";
188 push @out, "statusbar: $statusbar\n";
191 push @out, "backdrop: $backdrop\n";
193 if($lineselectstart) {
194 push @out, "line selector start color: $lineselectstart\n";
197 push @out, "line selector end color: $lineselectend\n";
200 push @out, "selector type: $selecttype\n";
203 push @out, "iconset: $iconset\n";
206 push @out, "viewers iconset: $viewericon\n";
208 if($lineselecttextcolor) {
209 push @out, "line selector text color: $lineselecttextcolor\n";
212 push @out, "filetype colours: $filetylecolor\n";
214 if($rwps && $has_remote ) {
215 push @out, "rwps: /.rockbox/wps/$rwps\n";
217 if(-f
".rockbox/wps/$cfg") {
218 print STDERR
"wpsbuild warning: wps/$cfg already exists!\n";
221 open(CFG
, ">.rockbox/themes/$cfg");
227 # Get the LCD sizes first
228 my ($main_height, $main_width, $main_depth) = getlcdsizes
();
229 my ($remote_height, $remote_width, $remote_depth) = getlcdsizes
(1);
231 #print "LCD: ${main_height}x${main_width}x${main_depth}\n";
232 $has_remote = 1 if ($remote_height && $remote_width && remote_depth
);
234 open(WPS
, "<$wpslist");
241 if($l =~ /^ *<(r|)wps>/i) {
244 # undef is a unary operator (!)
258 undef $lineselectstart;
259 undef $lineselectend;
263 undef $lineselecttextcolor;
264 undef $filetylecolor;
269 if($l =~ /^ *<\/${isrwps
}wps
>/i
) {
270 # Get the required width and height
271 my ($rheight, $rwidth, $rdepth);
273 ($rheight, $rwidth, $rdepth) =
274 ($remote_height, $remote_width, $remote_depth);
277 ($rheight, $rwidth, $rdepth) =
278 ($main_height, $main_width, $main_depth);
281 if(!$rheight || !$rwidth) {
282 #printf STDERR "wpsbuild notice: No %sLCD size, skipping $wps\n",
283 #$isrwps?"remote ":"";
287 $wpslist =~ /(.*)WPSLIST/;
289 # If this WPS installable on this platform, one of the following
290 # two files will be present
291 foreach $d (@depthlist) {
292 next if ($d > $rdepth);
294 $req_g = $rwidth . "x" . $rheight . "x" . $d;
296 $req_g_wps = $wps_prefix . "." . $req_g . ".wps";
297 last if (-e
"$wpsdir/$req_g_wps");
300 $req_g = $req_g . "." . $main_width . "x" . $main_height . "x" . "$main_depth";
302 $req_g_wps = $wps_prefix . "." . $req_g . ".wps";
303 last if (-e
"$wpsdir/$req_g_wps");
306 $req_t_wps = $wps_prefix . ".txt" . ".wps";
308 #print "LCD: $wps wants $height x $width\n";
309 #print "LCD: is $rheight x $rwidth\n";
311 #print "gwps: $wpsdir/$req_g_wps" . "\n";
312 if (-e
"$wpsdir/$req_g_wps" || -e
"$wpsdir/$req_t_wps" ) {
314 # The target model has an LCD that is suitable for this
317 #print "Size requirement is fine!\n";
318 mkdirs
() if (-e
"$wpsdir/$req_g_wps");
320 # We only make .cfg files for <wps> sections:
326 #print "(${wps_prefix}-${rwidth}x${rheight}x$rdepth) ";
327 #print "Skip $wps due to size restraints\n";
331 elsif($l =~ /^Name: (.*)/i) {
332 # Note that in the case this is within <rwps>, $wps will contain the
333 # name of the rwps. Use $isrwps to figure out what type it is.
334 $wps = $wps_prefix = $1;
335 $wps_prefix =~ s/\.(r|)wps//;
336 # print $wps_prefix . "\n";
338 elsif($l =~ /^RWPS: (.*)/i) {
341 elsif($l =~ /^RWPS\.${main_width}x${main_height}x$main_depth: (.*)/i) {
344 elsif($l =~ /^Author: (.*)/i) {
347 elsif($l =~ /^Width: (.*)/i) {
350 elsif($l =~ /^Width\.${main_width}x${main_height}x$main_depth: (.*)/i) {
353 elsif($l =~ /^Height: (.*)/i) {
356 elsif($l =~ /^Height\.${main_width}x${main_height}x$main_depth: (.*)/i) {
359 elsif($l =~ /^Font: (.*)/i) {
362 elsif($l =~ /^Foreground Color: (.*)/i) {
365 elsif($l =~ /^Background Color: (.*)/i) {
368 elsif($l =~ /^Font\.${main_width}x${main_height}x$main_depth: (.*)/i) {
371 elsif($l =~ /^Statusbar: (.*)/i) {
374 elsif($l =~ /^Statusbar\.${main_width}x${main_height}x$main_depth: (.*)/i) {
377 elsif($l =~ /^Backdrop: (.*)/i) {
381 elsif($l =~ /^Backdrop\.${main_width}x${main_height}x$main_depth: (.*)/i) {
385 elsif($l =~ /^line selector start color: (.*)/i) {
386 $lineselectstart = $1;
388 elsif($l =~ /^line selector end color: (.*)/i) {
391 elsif($l =~ /^selector type: (.*)/i) {
394 elsif($l =~ /^iconset: (.*)/i) {
397 elsif($l =~ /^viewers iconset: (.*)/i) {
400 elsif($l =~ /^line selector text color: (.*)/i) {
401 $lineselecttextcolor = $1;
403 elsif($l =~ /^filetype colours: (.*)/i) {
407 #print "Unknown line: $l!\n";