summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-11-17 22:39:26 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-11-17 22:39:26 +0000
commit2bace6a37569044b38dc7de79b4cbebc33513c93 (patch)
tree85ddc7ed6bb10eef842a3cf256d66636cfdb6ac8
parentbec94c9e2a99f420ab2e3598a538a072d68a6f49 (diff)
downloadrockbox-2bace6a37569044b38dc7de79b4cbebc33513c93.tar.gz
rockbox-2bace6a37569044b38dc7de79b4cbebc33513c93.zip
.rwps support and support for a rwps: field within the WPSLIST file, which
really is more like a list of themes now... git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7940 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xwps/wpsbuild.pl72
1 files changed, 58 insertions, 14 deletions
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl
index a8e325fde7..74aad42417 100755
--- a/wps/wpsbuild.pl
+++ b/wps/wpsbuild.pl
@@ -38,13 +38,28 @@ if(!$wpslist) {
38} 38}
39 39
40sub getlcdsizes { 40sub getlcdsizes {
41 my ($remote) = @_;
42
41 open(GCC, ">gcctemp"); 43 open(GCC, ">gcctemp");
44 if($remote) {
45 # Get the remote LCD screen size
46 print GCC <<STOP
47\#include "config.h"
48#ifdef HAVE_REMOTE_LCD
49Height: LCD_REMOTE_HEIGHT
50Width: LCD_REMOTE_WIDTH
51#endif
52STOP
53;
54 }
55 else {
42 print GCC <<STOP 56 print GCC <<STOP
43\#include "config.h" 57\#include "config.h"
44Height: LCD_HEIGHT 58Height: LCD_HEIGHT
45Width: LCD_WIDTH 59Width: LCD_WIDTH
46STOP 60STOP
47; 61;
62}
48 close(gcc); 63 close(gcc);
49 64
50 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -"; 65 my $c="cat gcctemp | gcc $cppdef -I. -I$firmdir/export -E -P -";
@@ -73,9 +88,15 @@ STOP
73 88
74sub mkdirs { 89sub mkdirs {
75 my $wpsdir = $wps; 90 my $wpsdir = $wps;
76 $wpsdir =~ s/\.wps//; 91 $wpsdir =~ s/\.(r|)wps//;
77 mkdir ".rockbox/wps", 0777; 92 mkdir ".rockbox/wps", 0777;
78 mkdir ".rockbox/wps/$wpsdir", 0777; 93
94 if( -d ".rockbox/wps/$wpsdir") {
95 print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n";
96 }
97 else {
98 mkdir ".rockbox/wps/$wpsdir", 0777;
99 }
79} 100}
80 101
81sub copywps { 102sub copywps {
@@ -86,7 +107,7 @@ sub copywps {
86 if($wpslist =~ /(.*)WPSLIST/) { 107 if($wpslist =~ /(.*)WPSLIST/) {
87 $dir = $1; 108 $dir = $1;
88 my $wpsdir = $wps; 109 my $wpsdir = $wps;
89 $wpsdir =~ s/\.wps//; 110 $wpsdir =~ s/\.(r|)wps//;
90 system("cp $dir/$wps .rockbox/wps/"); 111 system("cp $dir/$wps .rockbox/wps/");
91 if (-e "$dir/$wpsdir") { 112 if (-e "$dir/$wpsdir") {
92 system("cp $dir/$wpsdir/*.bmp .rockbox/wps/$wpsdir/"); 113 system("cp $dir/$wpsdir/*.bmp .rockbox/wps/$wpsdir/");
@@ -101,7 +122,7 @@ sub buildcfg {
101 my $cfg = $wps; 122 my $cfg = $wps;
102 my @out; 123 my @out;
103 124
104 $cfg =~ s/\.wps/.cfg/; 125 $cfg =~ s/\.(r|)wps/.cfg/;
105 126
106 push @out, <<MOO 127 push @out, <<MOO
107\# 128\#
@@ -117,12 +138,24 @@ MOO
117 if($statusbar) { 138 if($statusbar) {
118 push @out, "statusbar: $statusbar\n"; 139 push @out, "statusbar: $statusbar\n";
119 } 140 }
141 if($rwps) {
142 push @out, "rwps: /.rockbox/wps/$rwps\n";
143 }
120 144
121 open(CFG, ">.rockbox/wps/$cfg"); 145 if(-f ".rockbox/wps/$cfg") {
122 print CFG @out; 146 print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
123 close(CFG); 147 }
148 else {
149 open(CFG, ">.rockbox/wps/$cfg");
150 print CFG @out;
151 close(CFG);
152 }
124} 153}
125 154
155# Get the LCD sizes first
156my ($main_height, $main_width) = getlcdsizes();
157my ($remote_height, $remote_width) = getlcdsizes(1);
158
126open(WPS, "<$wpslist"); 159open(WPS, "<$wpslist");
127while(<WPS>) { 160while(<WPS>) {
128 my $l = $_; 161 my $l = $_;
@@ -130,18 +163,26 @@ while(<WPS>) {
130 # skip comment 163 # skip comment
131 next; 164 next;
132 } 165 }
133 if($l =~ /^ *<wps>/i) { 166 if($l =~ /^ *<(r|)wps>/i) {
167 $isrwps = $1;
134 $within = 1; 168 $within = 1;
135 next; 169 next;
136 } 170 }
137 if($within) { 171 if($within) {
138 if($l =~ /^ *<\/wps>/i) { 172 if($l =~ /^ *<\/${isrwps}wps>/i) {
139 173 # Get the required width and height
140 my ($rheight, $rwidth) = getlcdsizes(); 174 my ($rheight, $rwidth);
175 if($isrwps) {
176 ($rheight, $rwidth) = ($remote_height, $remote_width);
177 }
178 else {
179 ($rheight, $rwidth) = ($main_height, $main_width);
180 }
141 181
142 if(!$rheight || !$rwidth) { 182 if(!$rheight || !$rwidth) {
143 print STDER "Failed to get LCD sizes!\n"; 183 printf STDERR "wpsbuild notice: No %sLCD size, skipping $wps\n",
144 exit; 184 $isrwps?"remote ":"";
185 next;
145 } 186 }
146 187
147 #print "LCD: $wps wants $height x $width\n"; 188 #print "LCD: $wps wants $height x $width\n";
@@ -163,11 +204,14 @@ while(<WPS>) {
163 } 204 }
164 $within = 0; 205 $within = 0;
165 206
166 undef $wps, $width, $height, $font, $statusbar, $author; 207 undef $wps, $rwps, $width, $height, $font, $statusbar, $author;
167 } 208 }
168 elsif($l =~ /^Name: (.*)/i) { 209 elsif($l =~ /^Name: (.*)/i) {
169 $wps = $1; 210 $wps = $1;
170 } 211 }
212 elsif($l =~ /^RWPS: (.*)/i) {
213 $rwps = $1;
214 }
171 elsif($l =~ /^Author: (.*)/i) { 215 elsif($l =~ /^Author: (.*)/i) {
172 $author = $1; 216 $author = $1;
173 } 217 }