diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-06-03 13:44:41 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-06-03 13:44:41 +0000 |
commit | 30804e5a3f6ab53cff56f11b44c077b5044e0b51 (patch) | |
tree | dab9d66b6ccd51133e173a782d1e71aedc2f60a1 /tools/buildtheme.pl | |
parent | 6e39dc9e27e852bcf88490ee0c5e267c90f0513b (diff) | |
download | rockbox-30804e5a3f6ab53cff56f11b44c077b5044e0b51.tar.gz rockbox-30804e5a3f6ab53cff56f11b44c077b5044e0b51.zip |
almost finished... copy fonts, backdrops, icon files, skins. last thing to do is copy the images from inside the skins
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26511 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/buildtheme.pl')
-rwxr-xr-x | tools/buildtheme.pl | 140 |
1 files changed, 134 insertions, 6 deletions
diff --git a/tools/buildtheme.pl b/tools/buildtheme.pl index 7f135fd121..488a57d0ab 100755 --- a/tools/buildtheme.pl +++ b/tools/buildtheme.pl | |||
@@ -39,7 +39,7 @@ my $has_remote; | |||
39 | 39 | ||
40 | 40 | ||
41 | if(!$wpslist) { | 41 | if(!$wpslist) { |
42 | print "Usage: wpsbuilds.pl <WPSLIST> <target>\n", | 42 | print "Usage: buildtheme.pl <WPSLIST> <target>\n", |
43 | "Run this script in the root of the target build, and it will put all the\n", | 43 | "Run this script in the root of the target build, and it will put all the\n", |
44 | "stuff in $rbdir/wps/\n"; | 44 | "stuff in $rbdir/wps/\n"; |
45 | exit; | 45 | exit; |
@@ -101,8 +101,8 @@ STOP | |||
101 | } | 101 | } |
102 | 102 | ||
103 | # Get the LCD sizes first | 103 | # Get the LCD sizes first |
104 | ($main_height, $main_width, $main_depth) = (320,240,16);#getlcdsizes(); | 104 | ($main_height, $main_width, $main_depth) = getlcdsizes(); |
105 | ($remote_height, $remote_width, $remote_depth) = ();#getlcdsizes(1); | 105 | ($remote_height, $remote_width, $remote_depth) = getlcdsizes(1); |
106 | 106 | ||
107 | #print "LCD: ${main_width}x${main_height}x${main_depth}\n"; | 107 | #print "LCD: ${main_width}x${main_height}x${main_depth}\n"; |
108 | $has_remote = 1 if ($remote_height && $remote_width && $remote_depth); | 108 | $has_remote = 1 if ($remote_height && $remote_width && $remote_depth); |
@@ -134,6 +134,8 @@ sub mkdirs | |||
134 | mkdir "$rbdir", 0777; | 134 | mkdir "$rbdir", 0777; |
135 | mkdir "$rbdir/wps", 0777; | 135 | mkdir "$rbdir/wps", 0777; |
136 | mkdir "$rbdir/themes", 0777; | 136 | mkdir "$rbdir/themes", 0777; |
137 | mkdir "$rbdir/icons", 0777; | ||
138 | mkdir "$rbdir/backdrops", 0777; | ||
137 | 139 | ||
138 | if( -d "$rbdir/wps/$themename") { | 140 | if( -d "$rbdir/wps/$themename") { |
139 | # print STDERR "wpsbuild warning: directory wps/$themename already exists!\n"; | 141 | # print STDERR "wpsbuild warning: directory wps/$themename already exists!\n"; |
@@ -150,7 +152,7 @@ sub buildcfg { | |||
150 | 152 | ||
151 | push @out, <<MOO | 153 | push @out, <<MOO |
152 | \# | 154 | \# |
153 | \# generated by wpsbuild.pl | 155 | \# generated by buildtheme.pl |
154 | \# $themename is made by $theme{"Author"} | 156 | \# $themename is made by $theme{"Author"} |
155 | \# | 157 | \# |
156 | MOO | 158 | MOO |
@@ -175,14 +177,31 @@ MOO | |||
175 | { | 177 | { |
176 | # do nothing | 178 | # do nothing |
177 | } | 179 | } |
178 | elsif ($k =~ "/WPS|RWPS|FMS|RFMF|SBS|RSBS/" && exists($theme{$k})) | 180 | elsif ($k =~ /WPS|RWPS|FMS|RFMS|SBS|RSBS/ && exists($theme{$k})) |
179 | { | 181 | { |
180 | push (@out, "$v: $themename.$v\n"); | 182 | push (@out, "$v: $themename.$v\n"); |
181 | } | 183 | } |
184 | elsif ($k =~ /backdrop/ ) | ||
185 | { | ||
186 | if (exists($theme{$k})) | ||
187 | { | ||
188 | my $dst = $theme{$k}; | ||
189 | $dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; | ||
190 | push (@out, "$v: $theme{$k}\n"); | ||
191 | } | ||
192 | else | ||
193 | { | ||
194 | push (@out, "$v: -\n"); | ||
195 | } | ||
196 | } | ||
182 | elsif (exists($theme{$k})) | 197 | elsif (exists($theme{$k})) |
183 | { | 198 | { |
184 | push (@out, "$v: $theme{$k}\n"); | 199 | push (@out, "$v: $theme{$k}\n"); |
185 | } | 200 | } |
201 | else | ||
202 | { | ||
203 | push (@out, "$v: -\n"); | ||
204 | } | ||
186 | } | 205 | } |
187 | 206 | ||
188 | # if(-f "$rbdir/themes/$themename.cfg") { | 207 | # if(-f "$rbdir/themes/$themename.cfg") { |
@@ -195,6 +214,101 @@ MOO | |||
195 | # } | 214 | # } |
196 | } | 215 | } |
197 | 216 | ||
217 | |||
218 | sub copythemefont | ||
219 | { | ||
220 | my ($font) = @_; | ||
221 | #copy the font specified by the theme | ||
222 | |||
223 | my $o=$font; | ||
224 | $o =~ s/\.fnt/\.bdf/; | ||
225 | mkdir "$rbdir/fonts"; | ||
226 | my $cmd ="$ROOT/tools/convbdf -f -o \"$rbdir/fonts/$font\" \"$ROOT/fonts/$o\" "; | ||
227 | # print "$cmd\n"; | ||
228 | `$cmd`; | ||
229 | } | ||
230 | |||
231 | sub copyiconset | ||
232 | { | ||
233 | my ($iconset) = @_; | ||
234 | #copy the icon specified by the theme | ||
235 | |||
236 | if ($iconset ne '') { | ||
237 | $iconset =~ s/.rockbox/$rbdir/; | ||
238 | $iconset =~ /\/(.*icons\/(.*))/i; | ||
239 | `cp $ROOT/icons/$2 $1`; | ||
240 | } | ||
241 | } | ||
242 | |||
243 | sub copybackdrop | ||
244 | { | ||
245 | my ($backdrop) = @_; | ||
246 | #copy the backdrop file into the build dir | ||
247 | if ($backdrop ne '') | ||
248 | { | ||
249 | my $dst = $backdrop; | ||
250 | $dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//; | ||
251 | my $cmd = "cp $ROOT/$backdrop $rbdir/$dst"; | ||
252 | # print "$cmd\n"; | ||
253 | `$cmd`; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | |||
258 | sub copyskin | ||
259 | { | ||
260 | my ($themename, $skin, $ext) = @_; | ||
261 | # we assume that we copy the WPS files from the same dir the WPSLIST | ||
262 | # file is located in | ||
263 | my $dir; | ||
264 | my @filelist; | ||
265 | my $src; | ||
266 | my $dest; | ||
267 | |||
268 | if($wpslist =~ /(.*)OUT/) { | ||
269 | $dir = $1; | ||
270 | |||
271 | # first try the actual filename given to us | ||
272 | # then $skin.widthxheightxdepths.ext | ||
273 | # then $skin.ext | ||
274 | $src = "${dir}$skin.$ext"; | ||
275 | if ( -e $src ) | ||
276 | { | ||
277 | my $cmd = "cp $src $rbdir/wps/$themename.$ext"; | ||
278 | `$cmd`; | ||
279 | } | ||
280 | else | ||
281 | { | ||
282 | my $is_remote = ($ext =~ /^r.../i); | ||
283 | my $width = $is_remote ? $remote_width : $main_width; | ||
284 | my $height = $is_remote ? $remote_height : $main_height; | ||
285 | my $depth = $is_remote ? $remote_depth : $main_depth; | ||
286 | |||
287 | foreach my $d (@depthlist) | ||
288 | { | ||
289 | next if ($d > $depth); | ||
290 | $src = "${dir}$skin.${width}x${height}x${d}.$ext"; | ||
291 | last if (-e $src); | ||
292 | } | ||
293 | if (-e $src) | ||
294 | { | ||
295 | my $cmd = "cp $src $rbdir/wps/$themename.$ext"; | ||
296 | print "$cmd\n"; | ||
297 | `$cmd`; | ||
298 | } | ||
299 | elsif (-e "${dir}$skin.$ext") | ||
300 | { | ||
301 | my $cmd = "cp ${dir}$skin.$ext $rbdir/wps/$themename.$ext"; | ||
302 | `$cmd`; | ||
303 | } | ||
304 | else | ||
305 | { | ||
306 | #print STDERR "buildtheme warning: No suitable skin file for $ext\n"; | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | |||
198 | open(WPS, "<$wpslist"); | 312 | open(WPS, "<$wpslist"); |
199 | while(<WPS>) { | 313 | while(<WPS>) { |
200 | my $l = $_; | 314 | my $l = $_; |
@@ -222,8 +336,22 @@ while(<WPS>) { | |||
222 | mkdirs($theme{Name}); | 336 | mkdirs($theme{Name}); |
223 | buildcfg($theme{Name}); | 337 | buildcfg($theme{Name}); |
224 | 338 | ||
339 | copyskin($theme{"Name"}, $theme{"WPS"}, "wps") if exists($theme{"WPS"}); | ||
340 | copyskin($theme{"Name"}, $theme{"RWPS"}, "rwps") if exists($theme{"RWPS"}); | ||
341 | copyskin($theme{"Name"}, $theme{"FMS"}, "fms") if exists($theme{"FMS"}); | ||
342 | copyskin($theme{"Name"}, $theme{"RFMS"}, "rfms") if exists($theme{"RFMS"}); | ||
343 | copyskin($theme{"Name"}, $theme{"SBS"}, "sbs") if exists($theme{"SBS"}); | ||
344 | copyskin($theme{"Name"}, $theme{"RSBS"}, "rsbs") if exists($theme{"RSBS"}); | ||
345 | |||
346 | copyiconset($theme{"iconset"}) if exists($theme{"iconset"}); | ||
347 | copyiconset($theme{"remote iconset"}) if exists($theme{"remote iconset"}); | ||
348 | copyiconset($theme{"viewers iconset"}) if exists($theme{"viewers iconset"}); | ||
349 | copyiconset($theme{"remote viewers iconset"}) if exists($theme{"remote viewers iconset"}); | ||
225 | 350 | ||
351 | copythemefont($theme{"Font"}) if exists($theme{"Font"}); | ||
352 | copythemefont($theme{"Remote Font"}) if exists($theme{"Remote Font"}); | ||
226 | 353 | ||
354 | copybackdrop($theme{"backdrop"}) if exists($theme{"backdrop"}); | ||
227 | 355 | ||
228 | 356 | ||
229 | 357 | ||
@@ -238,7 +366,7 @@ while(<WPS>) { | |||
238 | ($extra && (match($target, $extra) || matchdisplaystring($extra)))) | 366 | ($extra && (match($target, $extra) || matchdisplaystring($extra)))) |
239 | { | 367 | { |
240 | $theme{$var} = $value; | 368 | $theme{$var} = $value; |
241 | # print "\'$var\': $value\n"; | 369 | #print "\'$var\': $value\n"; |
242 | } | 370 | } |
243 | } | 371 | } |
244 | } | 372 | } |