diff options
-rwxr-xr-x | wps/wpsbuild.pl | 191 |
1 files changed, 97 insertions, 94 deletions
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl index bcabb234f8..6a963f9a7c 100755 --- a/wps/wpsbuild.pl +++ b/wps/wpsbuild.pl | |||
@@ -13,7 +13,7 @@ $ROOT=".."; | |||
13 | if($ARGV[0] eq "-r") { | 13 | if($ARGV[0] eq "-r") { |
14 | $ROOT=$ARGV[1]; | 14 | $ROOT=$ARGV[1]; |
15 | shift @ARGV; | 15 | shift @ARGV; |
16 | shift @ARGV; | 16 | shift @ARGV; |
17 | } | 17 | } |
18 | 18 | ||
19 | my $verbose; | 19 | my $verbose; |
@@ -27,7 +27,7 @@ my $firmdir="$ROOT/firmware"; | |||
27 | my $wpslist=$ARGV[0]; | 27 | my $wpslist=$ARGV[0]; |
28 | 28 | ||
29 | my $target = $ARGV[1]; | 29 | my $target = $ARGV[1]; |
30 | my $cppdef = $target; | 30 | my $cppdef = $target; |
31 | my @depthlist = ( 16, 8, 4, 2, 1 ); | 31 | my @depthlist = ( 16, 8, 4, 2, 1 ); |
32 | 32 | ||
33 | if(!$wpslist) { | 33 | if(!$wpslist) { |
@@ -37,7 +37,8 @@ if(!$wpslist) { | |||
37 | exit; | 37 | exit; |
38 | } | 38 | } |
39 | 39 | ||
40 | sub getlcdsizes { | 40 | sub getlcdsizes |
41 | { | ||
41 | my ($remote) = @_; | 42 | my ($remote) = @_; |
42 | 43 | ||
43 | open(GCC, ">gcctemp"); | 44 | open(GCC, ">gcctemp"); |
@@ -65,7 +66,7 @@ STOP | |||
65 | close(GCC); | 66 | close(GCC); |
66 | 67 | ||
67 | my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -"; | 68 | my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -"; |
68 | 69 | ||
69 | #print "CMD $c\n"; | 70 | #print "CMD $c\n"; |
70 | 71 | ||
71 | open(GETSIZE, "$c|"); | 72 | open(GETSIZE, "$c|"); |
@@ -91,7 +92,8 @@ STOP | |||
91 | return ($height, $width, $depth); | 92 | return ($height, $width, $depth); |
92 | } | 93 | } |
93 | 94 | ||
94 | sub mkdirs { | 95 | sub mkdirs |
96 | { | ||
95 | my $wpsdir = $wps; | 97 | my $wpsdir = $wps; |
96 | $wpsdir =~ s/\.(r|)wps//; | 98 | $wpsdir =~ s/\.(r|)wps//; |
97 | mkdir ".rockbox/wps", 0777; | 99 | mkdir ".rockbox/wps", 0777; |
@@ -106,40 +108,44 @@ sub mkdirs { | |||
106 | } | 108 | } |
107 | } | 109 | } |
108 | 110 | ||
109 | sub copybackdrop { | 111 | sub copybackdrop |
110 | #copy the backdrop file into the build dir | 112 | { |
111 | $dst = $backdrop; | 113 | #copy the backdrop file into the build dir |
112 | $dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; | 114 | $dst = $backdrop; |
113 | $cmd = "cp $ROOT/$backdrop .rockbox/$dst"; | 115 | $dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; |
114 | `$cmd`; | 116 | $cmd = "cp $ROOT/$backdrop .rockbox/$dst"; |
117 | `$cmd`; | ||
115 | } | 118 | } |
116 | 119 | ||
117 | sub copythemefont { | 120 | sub copythemefont |
118 | #copy the font specified by the theme | 121 | { |
119 | 122 | #copy the font specified by the theme | |
120 | $o=$font; | ||
121 | $o =~ s/\.fnt/\.bdf/; | ||
122 | `mkdir .rockbox/fonts/ >/dev/null 2>&1`; | ||
123 | $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$font\" \"$ROOT/fonts/$o\" "; | ||
124 | `$cmd`; | ||
125 | } | ||
126 | 123 | ||
127 | sub copythemeicon { | 124 | $o=$font; |
128 | #copy the icon specified by the theme | 125 | $o =~ s/\.fnt/\.bdf/; |
129 | 126 | `mkdir .rockbox/fonts/ >/dev/null 2>&1`; | |
130 | $iconset =~ /\/(.*icons\/(.*))/i; | 127 | $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$font\" \"$ROOT/fonts/$o\" "; |
131 | `cp $ROOT/icons/$2 $1`; | 128 | `$cmd`; |
132 | } | 129 | } |
133 | 130 | ||
134 | sub copythemeviewericon { | 131 | sub copythemeicon |
135 | #copy the viewer icon specified by the theme | 132 | { |
136 | 133 | #copy the icon specified by the theme | |
137 | $viewericon =~ /\/(.*icons\/(.*))/i; | 134 | |
138 | `cp $ROOT/icons/$2 $1`; | 135 | $iconset =~ /\/(.*icons\/(.*))/i; |
136 | `cp $ROOT/icons/$2 $1`; | ||
139 | } | 137 | } |
140 | 138 | ||
139 | sub copythemeviewericon | ||
140 | { | ||
141 | #copy the viewer icon specified by the theme | ||
141 | 142 | ||
142 | sub copywps { | 143 | $viewericon =~ /\/(.*icons\/(.*))/i; |
144 | `cp $ROOT/icons/$2 $1`; | ||
145 | } | ||
146 | |||
147 | sub copywps | ||
148 | { | ||
143 | # we assume that we copy the WPS files from the same dir the WPSLIST | 149 | # we assume that we copy the WPS files from the same dir the WPSLIST |
144 | # file is located in | 150 | # file is located in |
145 | my $dir; | 151 | my $dir; |
@@ -214,10 +220,10 @@ MOO | |||
214 | push @out, "statusbar: $statusbar\n"; | 220 | push @out, "statusbar: $statusbar\n"; |
215 | } | 221 | } |
216 | if($backdrop) { | 222 | if($backdrop) { |
217 | #clip resolution from filename | 223 | # clip resolution from filename |
218 | $backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; | 224 | $backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; |
219 | push @out, "backdrop: /.rockbox/$backdrop\n"; | 225 | push @out, "backdrop: /.rockbox/$backdrop\n"; |
220 | } | 226 | } |
221 | if($lineselectstart && $main_depth > 2) { | 227 | if($lineselectstart && $main_depth > 2) { |
222 | push @out, "line selector start color: $lineselectstart\n"; | 228 | push @out, "line selector start color: $lineselectstart\n"; |
223 | } | 229 | } |
@@ -273,7 +279,7 @@ while(<WPS>) { | |||
273 | undef $wps; | 279 | undef $wps; |
274 | undef $wps_prefix; | 280 | undef $wps_prefix; |
275 | undef $rwps; | 281 | undef $rwps; |
276 | undef $width; | 282 | undef $width; |
277 | undef $height; | 283 | undef $height; |
278 | undef $font; | 284 | undef $font; |
279 | undef $fgcolor; | 285 | undef $fgcolor; |
@@ -290,7 +296,7 @@ while(<WPS>) { | |||
290 | undef $viewericon; | 296 | undef $viewericon; |
291 | undef $lineselecttextcolor; | 297 | undef $lineselecttextcolor; |
292 | undef $filetylecolor; | 298 | undef $filetylecolor; |
293 | 299 | ||
294 | next; | 300 | next; |
295 | } | 301 | } |
296 | if($within) { | 302 | if($within) { |
@@ -298,11 +304,11 @@ while(<WPS>) { | |||
298 | # Get the required width and height | 304 | # Get the required width and height |
299 | my ($rheight, $rwidth, $rdepth); | 305 | my ($rheight, $rwidth, $rdepth); |
300 | if($isrwps) { | 306 | if($isrwps) { |
301 | ($rheight, $rwidth, $rdepth) = | 307 | ($rheight, $rwidth, $rdepth) = |
302 | ($remote_height, $remote_width, $remote_depth); | 308 | ($remote_height, $remote_width, $remote_depth); |
303 | } | 309 | } |
304 | else { | 310 | else { |
305 | ($rheight, $rwidth, $rdepth) = | 311 | ($rheight, $rwidth, $rdepth) = |
306 | ($main_height, $main_width, $main_depth); | 312 | ($main_height, $main_width, $main_depth); |
307 | } | 313 | } |
308 | 314 | ||
@@ -317,7 +323,7 @@ while(<WPS>) { | |||
317 | # If this WPS installable on this platform, one of the following | 323 | # If this WPS installable on this platform, one of the following |
318 | # two files will be present | 324 | # two files will be present |
319 | foreach $d (@depthlist) { | 325 | foreach $d (@depthlist) { |
320 | next if ($d > $rdepth); | 326 | next if ($d > $rdepth); |
321 | 327 | ||
322 | $req_g = $rwidth . "x" . $rheight . "x" . $d; | 328 | $req_g = $rwidth . "x" . $rheight . "x" . $d; |
323 | 329 | ||
@@ -328,16 +334,16 @@ while(<WPS>) { | |||
328 | $req_g = $req_g . "." . $main_width . "x" . $main_height . "x" . "$main_depth"; | 334 | $req_g = $req_g . "." . $main_width . "x" . $main_height . "x" . "$main_depth"; |
329 | 335 | ||
330 | $req_g_wps = $wps_prefix . "." . $req_g . ".wps"; | 336 | $req_g_wps = $wps_prefix . "." . $req_g . ".wps"; |
331 | last if (-e "$wpsdir/$req_g_wps"); | 337 | last if (-e "$wpsdir/$req_g_wps"); |
332 | } | 338 | } |
333 | } | 339 | } |
334 | $req_t_wps = $wps_prefix . ".txt" . ".wps"; | 340 | $req_t_wps = $wps_prefix . ".txt" . ".wps"; |
335 | 341 | ||
336 | #print "LCD: $wps wants $height x $width\n"; | 342 | #print "LCD: $wps wants $height x $width\n"; |
337 | #print "LCD: is $rheight x $rwidth\n"; | 343 | #print "LCD: is $rheight x $rwidth\n"; |
338 | 344 | ||
339 | #print "gwps: $wpsdir/$req_g_wps" . "\n"; | 345 | #print "gwps: $wpsdir/$req_g_wps" . "\n"; |
340 | if (-e "$wpsdir/$req_g_wps" || -e "$wpsdir/$req_t_wps" ) { | 346 | if (-e "$wpsdir/$req_g_wps" || -e "$wpsdir/$req_t_wps" ) { |
341 | # | 347 | # |
342 | # The target model has an LCD that is suitable for this | 348 | # The target model has an LCD that is suitable for this |
343 | # WPS | 349 | # WPS |
@@ -351,7 +357,7 @@ while(<WPS>) { | |||
351 | copywps(); | 357 | copywps(); |
352 | } | 358 | } |
353 | else { | 359 | else { |
354 | #print "(${wps_prefix}-${rwidth}x${rheight}x$rdepth) "; | 360 | #print "(${wps_prefix}-${rwidth}x${rheight}x$rdepth) "; |
355 | #print "Skip $wps due to size restraints\n"; | 361 | #print "Skip $wps due to size restraints\n"; |
356 | } | 362 | } |
357 | $within = 0; | 363 | $within = 0; |
@@ -377,13 +383,13 @@ while(<WPS>) { | |||
377 | } | 383 | } |
378 | elsif($l =~ /^Width\.${main_width}x${main_height}x$main_depth: (.*)/i) { | 384 | elsif($l =~ /^Width\.${main_width}x${main_height}x$main_depth: (.*)/i) { |
379 | $width = $1; | 385 | $width = $1; |
380 | } | 386 | } |
381 | elsif($l =~ /^Height: (.*)/i) { | 387 | elsif($l =~ /^Height: (.*)/i) { |
382 | $height = $1; | 388 | $height = $1; |
383 | } | 389 | } |
384 | elsif($l =~ /^Height\.${main_width}x${main_height}x$main_depth: (.*)/i) { | 390 | elsif($l =~ /^Height\.${main_width}x${main_height}x$main_depth: (.*)/i) { |
385 | $height = $1; | 391 | $height = $1; |
386 | } | 392 | } |
387 | elsif($l =~ /^Font: (.*)/i) { | 393 | elsif($l =~ /^Font: (.*)/i) { |
388 | $font = $1; | 394 | $font = $1; |
389 | } | 395 | } |
@@ -402,55 +408,52 @@ while(<WPS>) { | |||
402 | } | 408 | } |
403 | elsif($l =~ /^Statusbar\.${main_width}x${main_height}x$main_depth: (.*)/i) { | 409 | elsif($l =~ /^Statusbar\.${main_width}x${main_height}x$main_depth: (.*)/i) { |
404 | $statusbar = $1; | 410 | $statusbar = $1; |
405 | } | 411 | } |
406 | elsif($l =~ /^Backdrop: (.*)/i) { | 412 | elsif($l =~ /^Backdrop: (.*)/i) { |
407 | $backdrop = $1; | 413 | $backdrop = $1; |
408 | copybackdrop(); | 414 | copybackdrop(); |
409 | } | 415 | } |
410 | elsif($l =~ /^Backdrop\.${main_width}x${main_height}x$main_depth: (.*)/i) { | 416 | elsif($l =~ /^Backdrop\.${main_width}x${main_height}x$main_depth: (.*)/i) { |
411 | $backdrop = $1; | 417 | $backdrop = $1; |
412 | copybackdrop(); | 418 | copybackdrop(); |
413 | } | 419 | } |
414 | elsif($l =~ /^line selector start color: (.*)/i) { | 420 | elsif($l =~ /^line selector start color: (.*)/i) { |
415 | $lineselectstart = $1; | 421 | $lineselectstart = $1; |
416 | } | 422 | } |
417 | elsif($l =~ /^line selector end color: (.*)/i) { | 423 | elsif($l =~ /^line selector end color: (.*)/i) { |
418 | $lineselectend = $1; | 424 | $lineselectend = $1; |
419 | } | 425 | } |
420 | elsif($l =~ /^selector type: (.*)/i) { | 426 | elsif($l =~ /^selector type: (.*)/i) { |
421 | $selecttype = $1; | 427 | $selecttype = $1; |
422 | } | 428 | } |
423 | elsif($l =~ /^selector type\.${main_width}x${main_height}x$main_depth: (.*)/i) { | 429 | elsif($l =~ /^selector type\.${main_width}x${main_height}x$main_depth: (.*)/i) { |
424 | $selecttype = $1; | 430 | $selecttype = $1; |
425 | } | 431 | } |
426 | elsif($l =~ /^iconset: (.*)/i) { | 432 | elsif($l =~ /^iconset: (.*)/i) { |
427 | $iconset = $1; | 433 | $iconset = $1; |
428 | copythemeicon(); | 434 | copythemeicon(); |
429 | } | 435 | } |
430 | elsif($l =~ /^iconset\.${main_width}x${main_height}x$main_depth: (.*)/i) { | 436 | elsif($l =~ /^iconset\.${main_width}x${main_height}x$main_depth: (.*)/i) { |
431 | $iconset = $1; | 437 | $iconset = $1; |
432 | copythemeicon(); | 438 | copythemeicon(); |
433 | } | 439 | } |
434 | elsif($l =~ /^viewers iconset: (.*)/i) { | 440 | elsif($l =~ /^viewers iconset: (.*)/i) { |
435 | $viewericon = $1; | 441 | $viewericon = $1; |
436 | copythemeviewericon(); | 442 | copythemeviewericon(); |
437 | } | 443 | } |
438 | elsif($l =~ /^viewers iconset\.${main_width}x${main_height}x$main_depth: (.*)/i) { | 444 | elsif($l =~ /^viewers iconset\.${main_width}x${main_height}x$main_depth: (.*)/i) { |
439 | $viewericon = $1; | 445 | $viewericon = $1; |
440 | copythemeviewericon(); | 446 | copythemeviewericon(); |
441 | } | 447 | } |
442 | elsif($l =~ /^line selector text color: (.*)/i) { | 448 | elsif($l =~ /^line selector text color: (.*)/i) { |
443 | $lineselecttextcolor = $1; | 449 | $lineselecttextcolor = $1; |
444 | } | 450 | } |
445 | elsif($l =~ /^filetype colours: (.*)/i) { | 451 | elsif($l =~ /^filetype colours: (.*)/i) { |
446 | $filetylecolor = $1; | 452 | $filetylecolor = $1; |
447 | } | 453 | } |
448 | else{ | 454 | else{ |
449 | #print "Unknown line: $l!\n"; | 455 | #print "Unknown line: $l!\n"; |
450 | } | 456 | } |
451 | |||
452 | |||
453 | |||
454 | } | 457 | } |
455 | } | 458 | } |
456 | 459 | ||