2005-11-14 14:24:17 +00:00
|
|
|
#!/usr/bin/perl
|
2005-11-14 15:05:53 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
use strict;
|
|
|
|
use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
|
2005-11-14 15:05:53 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
my $ROOT="..";
|
2005-11-14 15:05:53 +00:00
|
|
|
my $verbose;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $rbdir=".rockbox";
|
|
|
|
my $wpslist;
|
|
|
|
my $target;
|
2009-01-31 12:23:35 +00:00
|
|
|
my $modelname;
|
2005-11-14 14:24:17 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
# Get options
|
|
|
|
GetOptions ( 'r|root=s' => \$ROOT,
|
2009-01-31 12:23:35 +00:00
|
|
|
'm|modelname=s' => \$modelname,
|
2008-11-24 22:16:07 +00:00
|
|
|
'v|verbose' => \$verbose,
|
|
|
|
'rbdir=s' => \$rbdir, # If we want to put in a different directory
|
|
|
|
);
|
|
|
|
|
|
|
|
($wpslist, $target) = @ARGV;
|
2005-11-14 14:24:17 +00:00
|
|
|
|
2008-11-26 09:36:34 +00:00
|
|
|
my $firmdir="$ROOT/firmware";
|
2008-02-23 10:03:51 +00:00
|
|
|
my $cppdef = $target;
|
2006-05-11 14:27:12 +00:00
|
|
|
my @depthlist = ( 16, 8, 4, 2, 1 );
|
2005-11-14 15:05:53 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
# These parameters are filled in as we parse wpslist
|
2009-10-19 15:28:15 +00:00
|
|
|
my $req_size;
|
|
|
|
my $req_g_wps;
|
|
|
|
my $req_t;
|
|
|
|
my $req_t_wps;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $wps;
|
|
|
|
my $wps_prefix;
|
2009-10-19 15:28:15 +00:00
|
|
|
my $sbs_prefix;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $rwps;
|
2009-10-19 15:28:15 +00:00
|
|
|
my $sbs;
|
|
|
|
my $sbs_w_size;
|
|
|
|
my $rsbs;
|
|
|
|
my $rsbs_w_size;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $width;
|
|
|
|
my $height;
|
|
|
|
my $font;
|
|
|
|
my $fgcolor;
|
|
|
|
my $bgcolor;
|
|
|
|
my $statusbar;
|
|
|
|
my $author;
|
|
|
|
my $backdrop;
|
|
|
|
my $lineselectstart;
|
|
|
|
my $lineselectend;
|
|
|
|
my $selecttype;
|
|
|
|
my $iconset;
|
|
|
|
my $viewericon;
|
|
|
|
my $lineselecttextcolor;
|
|
|
|
my $filetylecolor;
|
2009-08-16 22:20:11 +00:00
|
|
|
my $listviewport;
|
|
|
|
my $remotelistviewport;
|
2008-11-24 22:16:07 +00:00
|
|
|
|
|
|
|
# LCD sizes
|
|
|
|
my ($main_height, $main_width, $main_depth);
|
|
|
|
my ($remote_height, $remote_width, $remote_depth);
|
|
|
|
my $has_remote;
|
|
|
|
|
|
|
|
|
2005-11-14 14:24:17 +00:00
|
|
|
if(!$wpslist) {
|
2005-11-14 15:05:53 +00:00
|
|
|
print "Usage: wpsbuilds.pl <WPSLIST> <target>\n",
|
|
|
|
"Run this script in the root of the target build, and it will put all the\n",
|
2008-11-24 22:16:07 +00:00
|
|
|
"stuff in $rbdir/wps/\n";
|
2005-11-14 14:24:17 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub getlcdsizes
|
|
|
|
{
|
2005-11-17 22:39:26 +00:00
|
|
|
my ($remote) = @_;
|
|
|
|
|
2005-11-14 15:05:53 +00:00
|
|
|
open(GCC, ">gcctemp");
|
2005-11-17 22:39:26 +00:00
|
|
|
if($remote) {
|
|
|
|
# Get the remote LCD screen size
|
|
|
|
print GCC <<STOP
|
|
|
|
\#include "config.h"
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
Height: LCD_REMOTE_HEIGHT
|
|
|
|
Width: LCD_REMOTE_WIDTH
|
2006-05-11 14:27:12 +00:00
|
|
|
Depth: LCD_REMOTE_DEPTH
|
2005-11-17 22:39:26 +00:00
|
|
|
#endif
|
|
|
|
STOP
|
|
|
|
;
|
|
|
|
}
|
|
|
|
else {
|
2005-11-14 15:05:53 +00:00
|
|
|
print GCC <<STOP
|
|
|
|
\#include "config.h"
|
|
|
|
Height: LCD_HEIGHT
|
|
|
|
Width: LCD_WIDTH
|
2006-05-11 14:27:12 +00:00
|
|
|
Depth: LCD_DEPTH
|
2005-11-14 15:05:53 +00:00
|
|
|
STOP
|
|
|
|
;
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2007-03-12 12:57:31 +00:00
|
|
|
close(GCC);
|
2005-11-14 15:05:53 +00:00
|
|
|
|
|
|
|
my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
|
2008-02-23 10:03:51 +00:00
|
|
|
|
2005-11-14 15:05:53 +00:00
|
|
|
#print "CMD $c\n";
|
|
|
|
|
|
|
|
open(GETSIZE, "$c|");
|
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
my ($height, $width, $depth);
|
2005-11-14 15:05:53 +00:00
|
|
|
while(<GETSIZE>) {
|
|
|
|
if($_ =~ /^Height: (\d*)/) {
|
|
|
|
$height = $1;
|
|
|
|
}
|
|
|
|
elsif($_ =~ /^Width: (\d*)/) {
|
|
|
|
$width = $1;
|
|
|
|
}
|
2006-05-11 14:27:12 +00:00
|
|
|
elsif($_ =~ /^Depth: (\d*)/) {
|
|
|
|
$depth = $1;
|
|
|
|
}
|
|
|
|
if($height && $width && $depth) {
|
2005-11-14 15:05:53 +00:00
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close(GETSIZE);
|
|
|
|
unlink("gcctemp");
|
|
|
|
|
2006-05-11 14:27:12 +00:00
|
|
|
return ($height, $width, $depth);
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub mkdirs
|
|
|
|
{
|
2005-11-14 15:05:53 +00:00
|
|
|
my $wpsdir = $wps;
|
2005-11-17 22:39:26 +00:00
|
|
|
$wpsdir =~ s/\.(r|)wps//;
|
2008-11-24 22:16:07 +00:00
|
|
|
mkdir "$rbdir/wps", 0777;
|
|
|
|
mkdir "$rbdir/themes", 0777;
|
2005-11-17 22:39:26 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
if( -d "$rbdir/wps/$wpsdir") {
|
2005-11-17 23:47:23 +00:00
|
|
|
#print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n";
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2006-05-11 14:27:12 +00:00
|
|
|
else
|
|
|
|
{
|
2008-11-24 22:16:07 +00:00
|
|
|
mkdir "$rbdir/wps/$wpsdir", 0777;
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub copybackdrop
|
|
|
|
{
|
|
|
|
#copy the backdrop file into the build dir
|
2008-02-23 10:22:06 +00:00
|
|
|
if ($backdrop ne '') {
|
2008-11-24 22:16:07 +00:00
|
|
|
my $dst = $backdrop;
|
2008-02-23 10:22:06 +00:00
|
|
|
$dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
|
2008-11-24 22:16:07 +00:00
|
|
|
my $cmd = "cp $ROOT/$backdrop $rbdir/$dst";
|
2008-02-23 10:22:06 +00:00
|
|
|
`$cmd`;
|
|
|
|
}
|
2008-01-18 04:00:12 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub copythemefont
|
|
|
|
{
|
|
|
|
#copy the font specified by the theme
|
2008-01-21 00:21:40 +00:00
|
|
|
|
2008-11-24 22:16:07 +00:00
|
|
|
my $o=$font;
|
2008-02-23 10:03:51 +00:00
|
|
|
$o =~ s/\.fnt/\.bdf/;
|
2008-11-24 22:16:07 +00:00
|
|
|
mkdir "$rbdir/fonts";
|
|
|
|
my $cmd ="$ROOT/tools/convbdf -f -o \"$rbdir/fonts/$font\" \"$ROOT/fonts/$o\" ";
|
2008-02-23 10:03:51 +00:00
|
|
|
`$cmd`;
|
2008-01-21 01:48:38 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub copythemeicon
|
|
|
|
{
|
|
|
|
#copy the icon specified by the theme
|
|
|
|
|
2008-02-23 10:22:06 +00:00
|
|
|
if ($iconset ne '') {
|
2008-11-24 22:16:07 +00:00
|
|
|
$iconset =~ s/.rockbox/$rbdir/;
|
2008-02-23 10:22:06 +00:00
|
|
|
$iconset =~ /\/(.*icons\/(.*))/i;
|
|
|
|
`cp $ROOT/icons/$2 $1`;
|
|
|
|
}
|
2008-01-21 01:48:38 +00:00
|
|
|
}
|
|
|
|
|
2008-02-23 10:03:51 +00:00
|
|
|
sub copythemeviewericon
|
|
|
|
{
|
|
|
|
#copy the viewer icon specified by the theme
|
2008-01-21 01:48:38 +00:00
|
|
|
|
2008-02-23 22:54:33 +00:00
|
|
|
if ($viewericon ne '') {
|
2008-11-24 22:16:07 +00:00
|
|
|
$viewericon =~ s/.rockbox/$rbdir/;
|
2008-02-23 22:54:33 +00:00
|
|
|
$viewericon =~ /\/(.*icons\/(.*))/i;
|
|
|
|
`cp $ROOT/icons/$2 $1`;
|
|
|
|
}
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub copywps
|
|
|
|
{
|
2005-11-14 15:05:53 +00:00
|
|
|
# we assume that we copy the WPS files from the same dir the WPSLIST
|
|
|
|
# file is located in
|
|
|
|
my $dir;
|
2006-05-11 14:27:12 +00:00
|
|
|
my @filelist;
|
|
|
|
my $file;
|
2009-10-19 15:28:15 +00:00
|
|
|
my $__sb;
|
2005-11-14 15:05:53 +00:00
|
|
|
|
|
|
|
if($wpslist =~ /(.*)WPSLIST/) {
|
|
|
|
$dir = $1;
|
2009-10-19 15:28:15 +00:00
|
|
|
$__sb = $sbs_prefix . "." . $req_size . ".sbs";
|
|
|
|
#print "$req_t_wps $req_g_wps $sbs_prefix\n";
|
|
|
|
#print "$dir/$__sb\n";
|
2009-10-16 20:34:04 +00:00
|
|
|
|
2009-10-19 15:28:15 +00:00
|
|
|
# system("cp $dir/$wps .rockbox/wps/");
|
|
|
|
# check for <name>.WIDTHxHEIGHTxDEPTH.sbs
|
|
|
|
if (-e "$dir/$__sb") {
|
|
|
|
system("cp $dir/$__sb $rbdir/wps/$sbs");
|
|
|
|
}
|
|
|
|
# check for <name>.WIDTHxHEIGHTxDEPTH.<model>.sbs and overwrite the
|
|
|
|
# previous sb if needed
|
|
|
|
$__sb = $sbs_prefix . "." . $req_size . "." . $modelname . ".sbs";
|
|
|
|
if (-e "$dir/$__sb") {
|
|
|
|
system("cp $dir/$__sb $rbdir/wps/$sbs");
|
|
|
|
}
|
|
|
|
|
2006-05-11 14:27:12 +00:00
|
|
|
if (-e "$dir/$req_t_wps" ) {
|
2008-11-24 22:16:07 +00:00
|
|
|
system("cp $dir/$req_t_wps $rbdir/wps/$wps");
|
2006-05-11 14:27:12 +00:00
|
|
|
|
2006-06-14 22:06:11 +00:00
|
|
|
} elsif (-e "$dir/$req_g_wps") {
|
2008-11-24 22:16:07 +00:00
|
|
|
system("cp $dir/$req_g_wps $rbdir/wps/$wps");
|
2006-05-11 14:27:12 +00:00
|
|
|
|
|
|
|
open(WPSFILE, "$dir/$req_g_wps");
|
|
|
|
while (<WPSFILE>) {
|
|
|
|
$filelist[$#filelist + 1] = $1 if (/\|([^|]*?.bmp)\|/);
|
|
|
|
}
|
|
|
|
close(WPSFILE);
|
|
|
|
|
2007-04-04 06:26:53 +00:00
|
|
|
if ($#filelist >= 0) {
|
2009-10-19 15:28:15 +00:00
|
|
|
if (-e "$dir/$wps_prefix/$req_size") {
|
2007-04-04 06:26:53 +00:00
|
|
|
foreach $file (@filelist) {
|
2009-10-19 15:28:15 +00:00
|
|
|
system("cp $dir/$wps_prefix/$req_size/$file $rbdir/wps/$wps_prefix/");
|
2007-04-04 06:26:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif (-e "$dir/$wps_prefix") {
|
|
|
|
foreach $file (@filelist) {
|
2008-11-24 22:16:07 +00:00
|
|
|
system("cp $dir/$wps_prefix/$file $rbdir/wps/$wps_prefix/");
|
2007-04-04 06:26:53 +00:00
|
|
|
}
|
2006-05-15 07:47:29 +00:00
|
|
|
}
|
2007-04-04 06:26:53 +00:00
|
|
|
else {
|
|
|
|
print STDERR "beep, no dir to copy WPS from!\n";
|
2006-05-11 14:27:12 +00:00
|
|
|
}
|
|
|
|
}
|
2007-04-04 06:26:53 +00:00
|
|
|
|
2006-05-11 14:27:12 +00:00
|
|
|
} else {
|
|
|
|
print STDERR "Skipping $wps - no matching resolution.\n";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
print STDERR "No source directory!\n";
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-14 14:24:17 +00:00
|
|
|
sub buildcfg {
|
|
|
|
my $cfg = $wps;
|
2009-10-19 15:28:15 +00:00
|
|
|
my @out;
|
2005-11-14 14:24:17 +00:00
|
|
|
|
2005-11-17 22:39:26 +00:00
|
|
|
$cfg =~ s/\.(r|)wps/.cfg/;
|
2005-11-14 14:24:17 +00:00
|
|
|
|
2005-11-14 15:05:53 +00:00
|
|
|
push @out, <<MOO
|
|
|
|
\#
|
2005-11-14 14:24:17 +00:00
|
|
|
\# $cfg generated by wpsbuild.pl
|
2005-11-14 15:05:53 +00:00
|
|
|
\# $wps is made by $author
|
2005-11-14 14:24:17 +00:00
|
|
|
\#
|
2008-11-24 22:16:07 +00:00
|
|
|
wps: /$rbdir/wps/$wps
|
2005-11-14 14:24:17 +00:00
|
|
|
MOO
|
|
|
|
;
|
2009-10-19 15:28:15 +00:00
|
|
|
if(defined($sbs)) {
|
|
|
|
if ($sbs eq '') {
|
|
|
|
push @out, "sbs: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "sbs: /$rbdir/wps/$sbs\n";
|
|
|
|
}
|
|
|
|
}
|
2010-02-21 19:10:57 +00:00
|
|
|
if(defined($rsbs) && $has_remote) {
|
2009-10-19 15:28:15 +00:00
|
|
|
if ($rsbs eq '') {
|
|
|
|
push @out, "rsbs: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "rsbs: /$rbdir/wps/$rsbs\n";
|
|
|
|
}
|
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
if($font) {
|
2010-02-21 19:10:57 +00:00
|
|
|
if ($font eq '') {
|
|
|
|
push @out, "font: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "font: /$rbdir/fonts/$font\n";
|
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
2008-02-22 22:32:22 +00:00
|
|
|
if($fgcolor && $main_depth > 2) {
|
2007-02-11 20:49:48 +00:00
|
|
|
push @out, "foreground color: $fgcolor\n";
|
|
|
|
}
|
2008-02-22 22:32:22 +00:00
|
|
|
if($bgcolor && $main_depth > 2) {
|
2007-02-11 20:49:48 +00:00
|
|
|
push @out, "background color: $bgcolor\n";
|
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
if($statusbar) {
|
2009-07-12 22:02:02 +00:00
|
|
|
if($rwps && $has_remote ) {
|
|
|
|
push @out, "remote statusbar: $statusbar\n";
|
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
push @out, "statusbar: $statusbar\n";
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
if(defined($backdrop)) {
|
|
|
|
if ($backdrop eq '') {
|
2009-10-19 15:28:15 +00:00
|
|
|
push @out, "backdrop: -\n";
|
2008-02-23 10:22:06 +00:00
|
|
|
} else {
|
|
|
|
# clip resolution from filename
|
|
|
|
$backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
|
2008-11-24 22:16:07 +00:00
|
|
|
push @out, "backdrop: /$rbdir/$backdrop\n";
|
2008-02-23 10:22:06 +00:00
|
|
|
}
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2008-02-22 22:32:22 +00:00
|
|
|
if($lineselectstart && $main_depth > 2) {
|
2008-01-18 04:00:12 +00:00
|
|
|
push @out, "line selector start color: $lineselectstart\n";
|
|
|
|
}
|
2008-02-22 22:32:22 +00:00
|
|
|
if($lineselectend && $main_depth > 2) {
|
2008-01-18 04:00:12 +00:00
|
|
|
push @out, "line selector end color: $lineselectend\n";
|
|
|
|
}
|
|
|
|
if($selecttype) {
|
|
|
|
push @out, "selector type: $selecttype\n";
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
if(defined($iconset)) {
|
2010-02-21 19:10:57 +00:00
|
|
|
if ($iconset eq '') {
|
|
|
|
push @out, "iconset: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "iconset: $iconset\n";
|
|
|
|
}
|
2008-01-18 04:00:12 +00:00
|
|
|
}
|
2008-02-23 22:54:33 +00:00
|
|
|
if(defined($viewericon)) {
|
2010-02-21 19:10:57 +00:00
|
|
|
if ($viewericon eq '') {
|
|
|
|
push @out, "viewers iconset: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "viewers iconset: $viewericon\n";
|
|
|
|
}
|
2008-01-18 04:00:12 +00:00
|
|
|
}
|
2008-02-22 22:32:22 +00:00
|
|
|
if($lineselecttextcolor && $main_depth > 2 ) {
|
2008-01-18 04:00:12 +00:00
|
|
|
push @out, "line selector text color: $lineselecttextcolor\n";
|
|
|
|
}
|
2008-02-22 22:32:22 +00:00
|
|
|
if($filetylecolor && $main_depth > 2) {
|
2010-02-21 19:10:57 +00:00
|
|
|
if ($filetylecolor eq '') {
|
|
|
|
push @out, "filetype colours: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "filetype colours: $filetylecolor\n";
|
|
|
|
}
|
2008-01-18 04:00:12 +00:00
|
|
|
}
|
2005-11-18 15:33:05 +00:00
|
|
|
if($rwps && $has_remote ) {
|
2010-02-21 19:10:57 +00:00
|
|
|
if ($rwps eq '') {
|
|
|
|
push @out, "rwps: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "rwps: /$rbdir/wps/$rwps\n";
|
|
|
|
}
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2009-08-16 22:20:11 +00:00
|
|
|
if(defined($listviewport)) {
|
2010-02-21 19:10:57 +00:00
|
|
|
if ($listviewport eq '') {
|
|
|
|
push @out, "ui viewport: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "ui viewport: $listviewport\n";
|
|
|
|
}
|
2009-08-16 22:20:11 +00:00
|
|
|
}
|
|
|
|
if(defined($remotelistviewport) && $has_remote) {
|
2010-02-21 19:10:57 +00:00
|
|
|
if ($remotelistviewport eq '') {
|
|
|
|
push @out, "remote ui viewport: -\n";
|
|
|
|
} else {
|
|
|
|
push @out, "remote ui viewport: $listviewport\n";
|
|
|
|
}
|
2009-08-16 22:20:11 +00:00
|
|
|
}
|
2008-11-24 22:16:07 +00:00
|
|
|
if(-f "$rbdir/wps/$cfg") {
|
2005-11-17 22:39:26 +00:00
|
|
|
print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
|
|
|
|
}
|
|
|
|
else {
|
2008-11-24 22:16:07 +00:00
|
|
|
open(CFG, ">$rbdir/themes/$cfg");
|
2005-11-17 22:39:26 +00:00
|
|
|
print CFG @out;
|
|
|
|
close(CFG);
|
|
|
|
}
|
2005-11-14 14:24:17 +00:00
|
|
|
}
|
|
|
|
|
2005-11-17 22:39:26 +00:00
|
|
|
# Get the LCD sizes first
|
2008-02-23 09:18:09 +00:00
|
|
|
($main_height, $main_width, $main_depth) = getlcdsizes();
|
|
|
|
($remote_height, $remote_width, $remote_depth) = getlcdsizes(1);
|
2005-11-17 22:39:26 +00:00
|
|
|
|
2009-01-23 20:46:49 +00:00
|
|
|
#print "LCD: ${main_width}x${main_height}x${main_depth}\n";
|
2008-11-24 22:16:07 +00:00
|
|
|
$has_remote = 1 if ($remote_height && $remote_width && $remote_depth);
|
|
|
|
|
|
|
|
my $isrwps;
|
|
|
|
my $within;
|
2005-11-18 15:33:05 +00:00
|
|
|
|
2005-11-14 14:24:17 +00:00
|
|
|
open(WPS, "<$wpslist");
|
|
|
|
while(<WPS>) {
|
|
|
|
my $l = $_;
|
2008-11-24 22:16:07 +00:00
|
|
|
|
2008-03-10 17:47:58 +00:00
|
|
|
# remove CR
|
|
|
|
$l =~ s/\r//g;
|
2005-11-14 14:24:17 +00:00
|
|
|
if($l =~ /^ *\#/) {
|
|
|
|
# skip comment
|
|
|
|
next;
|
|
|
|
}
|
2005-11-17 22:39:26 +00:00
|
|
|
if($l =~ /^ *<(r|)wps>/i) {
|
|
|
|
$isrwps = $1;
|
2005-11-14 14:24:17 +00:00
|
|
|
$within = 1;
|
2005-11-18 15:33:05 +00:00
|
|
|
# undef is a unary operator (!)
|
|
|
|
undef $wps;
|
2006-05-11 14:27:12 +00:00
|
|
|
undef $wps_prefix;
|
2005-11-18 15:33:05 +00:00
|
|
|
undef $rwps;
|
2009-10-19 15:28:15 +00:00
|
|
|
undef $sbs;
|
|
|
|
undef $rsbs;
|
2008-02-23 10:03:51 +00:00
|
|
|
undef $width;
|
2005-11-18 15:33:05 +00:00
|
|
|
undef $height;
|
|
|
|
undef $font;
|
2007-02-11 20:49:48 +00:00
|
|
|
undef $fgcolor;
|
|
|
|
undef $bgcolor;
|
2005-11-18 15:33:05 +00:00
|
|
|
undef $statusbar;
|
|
|
|
undef $author;
|
2006-05-11 14:27:12 +00:00
|
|
|
undef $req_g_wps;
|
2006-06-14 22:06:11 +00:00
|
|
|
undef $req_t_wps;
|
2008-01-18 04:00:12 +00:00
|
|
|
undef $backdrop;
|
|
|
|
undef $lineselectstart;
|
|
|
|
undef $lineselectend;
|
|
|
|
undef $selecttype;
|
|
|
|
undef $iconset;
|
|
|
|
undef $viewericon;
|
|
|
|
undef $lineselecttextcolor;
|
|
|
|
undef $filetylecolor;
|
2009-08-16 22:20:11 +00:00
|
|
|
undef $listviewport;
|
|
|
|
undef $remotelistviewport;
|
2008-02-23 10:03:51 +00:00
|
|
|
|
2005-11-14 14:24:17 +00:00
|
|
|
next;
|
|
|
|
}
|
|
|
|
if($within) {
|
2005-11-17 22:39:26 +00:00
|
|
|
if($l =~ /^ *<\/${isrwps}wps>/i) {
|
|
|
|
# Get the required width and height
|
2006-05-11 14:27:12 +00:00
|
|
|
my ($rheight, $rwidth, $rdepth);
|
2005-11-17 22:39:26 +00:00
|
|
|
if($isrwps) {
|
2008-02-23 10:03:51 +00:00
|
|
|
($rheight, $rwidth, $rdepth) =
|
2006-05-11 14:27:12 +00:00
|
|
|
($remote_height, $remote_width, $remote_depth);
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
|
|
|
else {
|
2008-02-23 10:03:51 +00:00
|
|
|
($rheight, $rwidth, $rdepth) =
|
2006-05-11 14:27:12 +00:00
|
|
|
($main_height, $main_width, $main_depth);
|
2005-11-17 22:39:26 +00:00
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
|
|
|
|
if(!$rheight || !$rwidth) {
|
2006-03-18 21:17:05 +00:00
|
|
|
#printf STDERR "wpsbuild notice: No %sLCD size, skipping $wps\n",
|
2007-03-12 12:57:31 +00:00
|
|
|
#$isrwps?"remote ":"";
|
2005-11-18 15:33:05 +00:00
|
|
|
$within = 0;
|
2005-11-17 22:39:26 +00:00
|
|
|
next;
|
2005-11-14 15:05:53 +00:00
|
|
|
}
|
2006-05-11 14:27:12 +00:00
|
|
|
$wpslist =~ /(.*)WPSLIST/;
|
|
|
|
my $wpsdir = $1;
|
2009-01-23 20:46:49 +00:00
|
|
|
# If this WPS installable on this platform, one of the following
|
|
|
|
# two files will be present
|
|
|
|
foreach my $d (@depthlist) {
|
2008-02-23 10:03:51 +00:00
|
|
|
next if ($d > $rdepth);
|
2006-05-11 14:27:12 +00:00
|
|
|
|
2009-10-19 15:28:15 +00:00
|
|
|
$req_size = $rwidth . "x" . $rheight . "x" . $d;
|
2006-05-15 07:47:29 +00:00
|
|
|
|
2009-01-31 12:23:35 +00:00
|
|
|
# check for model specific wps
|
2009-10-19 15:28:15 +00:00
|
|
|
$req_g_wps = $wps_prefix . "." . $req_size . "." . $modelname . ".wps";
|
2009-01-31 12:23:35 +00:00
|
|
|
last if (-e "$wpsdir/$req_g_wps");
|
|
|
|
|
2009-10-19 15:28:15 +00:00
|
|
|
# check for normal wps (with WIDTHxHEIGHTxDEPTH)
|
|
|
|
$req_g_wps = $wps_prefix . "." . $req_size . ".wps";
|
2007-04-04 06:26:53 +00:00
|
|
|
last if (-e "$wpsdir/$req_g_wps");
|
2006-06-15 20:17:47 +00:00
|
|
|
|
|
|
|
if ($isrwps) {
|
2009-10-19 15:28:15 +00:00
|
|
|
$req_size = $req_size . "." . $main_width . "x" . $main_height . "x" . "$main_depth";
|
2006-06-15 20:17:47 +00:00
|
|
|
|
2009-10-19 15:28:15 +00:00
|
|
|
$req_g_wps = $wps_prefix . "." . $req_size . ".wps";
|
2008-02-23 10:03:51 +00:00
|
|
|
last if (-e "$wpsdir/$req_g_wps");
|
2006-06-15 20:17:47 +00:00
|
|
|
}
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2010-01-05 17:21:30 +00:00
|
|
|
$req_t_wps = $wps_prefix . ".txt" . ".wps";
|
2005-11-14 15:05:53 +00:00
|
|
|
|
2009-01-23 20:46:49 +00:00
|
|
|
#print "LCD: $wps wants $width x $height\n";
|
|
|
|
#print "LCD: is $rwidth x $rheight\n";
|
2005-11-14 15:05:53 +00:00
|
|
|
|
2006-05-11 14:27:12 +00:00
|
|
|
#print "gwps: $wpsdir/$req_g_wps" . "\n";
|
2008-02-23 10:03:51 +00:00
|
|
|
if (-e "$wpsdir/$req_g_wps" || -e "$wpsdir/$req_t_wps" ) {
|
2005-11-14 15:05:53 +00:00
|
|
|
#
|
|
|
|
# The target model has an LCD that is suitable for this
|
|
|
|
# WPS
|
|
|
|
#
|
2005-11-14 15:10:40 +00:00
|
|
|
#print "Size requirement is fine!\n";
|
2006-05-11 14:27:12 +00:00
|
|
|
mkdirs() if (-e "$wpsdir/$req_g_wps");
|
2009-01-23 20:46:49 +00:00
|
|
|
# Do the copying before building the .cfg - buildcfg()
|
|
|
|
# mangles some filenames
|
|
|
|
if ($backdrop) {
|
|
|
|
copybackdrop();
|
|
|
|
}
|
|
|
|
if ($iconset) {
|
|
|
|
copythemeicon();
|
|
|
|
}
|
|
|
|
if ($viewericon) {
|
|
|
|
copythemeviewericon();
|
|
|
|
}
|
|
|
|
if ($font) {
|
|
|
|
copythemefont();
|
|
|
|
}
|
2005-11-17 23:47:23 +00:00
|
|
|
if(!$isrwps) {
|
|
|
|
# We only make .cfg files for <wps> sections:
|
|
|
|
buildcfg();
|
|
|
|
}
|
2005-11-14 15:05:53 +00:00
|
|
|
copywps();
|
|
|
|
}
|
2005-11-14 15:10:40 +00:00
|
|
|
else {
|
2008-02-23 10:03:51 +00:00
|
|
|
#print "(${wps_prefix}-${rwidth}x${rheight}x$rdepth) ";
|
2006-10-26 14:20:31 +00:00
|
|
|
#print "Skip $wps due to size restraints\n";
|
2005-11-14 15:10:40 +00:00
|
|
|
}
|
2005-11-14 14:24:17 +00:00
|
|
|
$within = 0;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Name: *(.*)/i) {
|
2005-11-17 23:47:23 +00:00
|
|
|
# Note that in the case this is within <rwps>, $wps will contain the
|
|
|
|
# name of the rwps. Use $isrwps to figure out what type it is.
|
2006-05-11 14:27:12 +00:00
|
|
|
$wps = $wps_prefix = $1;
|
|
|
|
$wps_prefix =~ s/\.(r|)wps//;
|
2009-01-23 20:46:49 +00:00
|
|
|
#print $wps_prefix . "\n";
|
2005-11-14 14:24:17 +00:00
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^RWPS: *(.*)/i) {
|
2005-11-17 22:39:26 +00:00
|
|
|
$rwps = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^RWPS\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2006-06-15 20:17:47 +00:00
|
|
|
$rwps = $1;
|
|
|
|
}
|
2009-10-19 15:28:15 +00:00
|
|
|
elsif($l =~ /^SBS: *(.*)/i) {
|
|
|
|
$sbs = $sbs_prefix = $1;
|
|
|
|
$sbs_prefix =~ s/\.(r|)sbs//;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^SBS\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
|
|
|
$sbs = $sbs_prefix = $1;
|
|
|
|
$sbs_prefix =~ s/\.(r|)sbs//;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^RSBS: *(.*)/i) {
|
|
|
|
$rsbs = $1;
|
|
|
|
}
|
|
|
|
elsif($l =~ /^RSBS\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
|
|
|
$rsbs = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Author: *(.*)/i) {
|
2005-11-14 15:05:53 +00:00
|
|
|
$author = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Width: *(.*)/i) {
|
2005-11-14 15:05:53 +00:00
|
|
|
$width = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Width\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2008-01-18 04:00:12 +00:00
|
|
|
$width = $1;
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Height: *(.*)/i) {
|
2005-11-14 15:05:53 +00:00
|
|
|
$height = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Height\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2008-01-18 04:00:12 +00:00
|
|
|
$height = $1;
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Font: *(.*)/i) {
|
2005-11-14 14:24:17 +00:00
|
|
|
$font = $1;
|
2009-01-23 20:46:49 +00:00
|
|
|
}
|
|
|
|
elsif($l =~ /^Font\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
|
|
|
$font = $1;
|
2005-11-14 14:24:17 +00:00
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Foreground Color: *(.*)/i) {
|
2007-02-11 20:49:48 +00:00
|
|
|
$fgcolor = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Background Color: *(.*)/i) {
|
2007-02-11 20:49:48 +00:00
|
|
|
$bgcolor = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Statusbar: *(.*)/i) {
|
2005-11-14 14:24:17 +00:00
|
|
|
$statusbar = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Statusbar\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2008-01-18 04:00:12 +00:00
|
|
|
$statusbar = $1;
|
2008-02-23 10:03:51 +00:00
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Backdrop: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$backdrop = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^Backdrop\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$backdrop = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^line selector start color: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$lineselectstart = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^line selector end color: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$lineselectend = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^selector type: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$selecttype = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^selector type\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$selecttype = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^iconset: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$iconset = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^iconset\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$iconset = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^viewers iconset: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$viewericon = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^viewers iconset\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$viewericon = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^line selector text color: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$lineselecttextcolor = $1;
|
|
|
|
}
|
2008-02-23 10:22:06 +00:00
|
|
|
elsif($l =~ /^filetype colours: *(.*)/i) {
|
2008-02-23 10:03:51 +00:00
|
|
|
$filetylecolor = $1;
|
|
|
|
}
|
2009-08-16 22:20:11 +00:00
|
|
|
elsif($l =~ /^ui viewport: *(.*)/i) {
|
|
|
|
$listviewport = $1;
|
|
|
|
}
|
2009-10-19 15:28:15 +00:00
|
|
|
elsif($l =~ /^ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
|
|
|
$listviewport = $1;
|
|
|
|
}
|
2009-08-16 22:20:11 +00:00
|
|
|
elsif($l =~ /^remote ui viewport: *(.*)/i) {
|
|
|
|
$remotelistviewport = $1;
|
|
|
|
}
|
2009-10-19 15:28:15 +00:00
|
|
|
elsif($l =~ /^remote ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
|
|
|
|
$remotelistviewport = $1;
|
|
|
|
}
|
2008-02-23 10:03:51 +00:00
|
|
|
else{
|
|
|
|
#print "Unknown line: $l!\n";
|
|
|
|
}
|
2005-11-14 14:24:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-11 14:27:12 +00:00
|
|
|
close(WPS);
|