forked from len0rd/rockbox
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
This commit is contained in:
parent
6e39dc9e27
commit
30804e5a3f
1 changed files with 134 additions and 6 deletions
|
@ -39,7 +39,7 @@ my $has_remote;
|
|||
|
||||
|
||||
if(!$wpslist) {
|
||||
print "Usage: wpsbuilds.pl <WPSLIST> <target>\n",
|
||||
print "Usage: buildtheme.pl <WPSLIST> <target>\n",
|
||||
"Run this script in the root of the target build, and it will put all the\n",
|
||||
"stuff in $rbdir/wps/\n";
|
||||
exit;
|
||||
|
@ -101,8 +101,8 @@ STOP
|
|||
}
|
||||
|
||||
# Get the LCD sizes first
|
||||
($main_height, $main_width, $main_depth) = (320,240,16);#getlcdsizes();
|
||||
($remote_height, $remote_width, $remote_depth) = ();#getlcdsizes(1);
|
||||
($main_height, $main_width, $main_depth) = getlcdsizes();
|
||||
($remote_height, $remote_width, $remote_depth) = getlcdsizes(1);
|
||||
|
||||
#print "LCD: ${main_width}x${main_height}x${main_depth}\n";
|
||||
$has_remote = 1 if ($remote_height && $remote_width && $remote_depth);
|
||||
|
@ -134,6 +134,8 @@ sub mkdirs
|
|||
mkdir "$rbdir", 0777;
|
||||
mkdir "$rbdir/wps", 0777;
|
||||
mkdir "$rbdir/themes", 0777;
|
||||
mkdir "$rbdir/icons", 0777;
|
||||
mkdir "$rbdir/backdrops", 0777;
|
||||
|
||||
if( -d "$rbdir/wps/$themename") {
|
||||
# print STDERR "wpsbuild warning: directory wps/$themename already exists!\n";
|
||||
|
@ -150,7 +152,7 @@ sub buildcfg {
|
|||
|
||||
push @out, <<MOO
|
||||
\#
|
||||
\# generated by wpsbuild.pl
|
||||
\# generated by buildtheme.pl
|
||||
\# $themename is made by $theme{"Author"}
|
||||
\#
|
||||
MOO
|
||||
|
@ -175,14 +177,31 @@ MOO
|
|||
{
|
||||
# do nothing
|
||||
}
|
||||
elsif ($k =~ "/WPS|RWPS|FMS|RFMF|SBS|RSBS/" && exists($theme{$k}))
|
||||
elsif ($k =~ /WPS|RWPS|FMS|RFMS|SBS|RSBS/ && exists($theme{$k}))
|
||||
{
|
||||
push (@out, "$v: $themename.$v\n");
|
||||
}
|
||||
elsif ($k =~ /backdrop/ )
|
||||
{
|
||||
if (exists($theme{$k}))
|
||||
{
|
||||
my $dst = $theme{$k};
|
||||
$dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
|
||||
push (@out, "$v: $theme{$k}\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@out, "$v: -\n");
|
||||
}
|
||||
}
|
||||
elsif (exists($theme{$k}))
|
||||
{
|
||||
push (@out, "$v: $theme{$k}\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
push (@out, "$v: -\n");
|
||||
}
|
||||
}
|
||||
|
||||
# if(-f "$rbdir/themes/$themename.cfg") {
|
||||
|
@ -195,6 +214,101 @@ MOO
|
|||
# }
|
||||
}
|
||||
|
||||
|
||||
sub copythemefont
|
||||
{
|
||||
my ($font) = @_;
|
||||
#copy the font specified by the theme
|
||||
|
||||
my $o=$font;
|
||||
$o =~ s/\.fnt/\.bdf/;
|
||||
mkdir "$rbdir/fonts";
|
||||
my $cmd ="$ROOT/tools/convbdf -f -o \"$rbdir/fonts/$font\" \"$ROOT/fonts/$o\" ";
|
||||
# print "$cmd\n";
|
||||
`$cmd`;
|
||||
}
|
||||
|
||||
sub copyiconset
|
||||
{
|
||||
my ($iconset) = @_;
|
||||
#copy the icon specified by the theme
|
||||
|
||||
if ($iconset ne '') {
|
||||
$iconset =~ s/.rockbox/$rbdir/;
|
||||
$iconset =~ /\/(.*icons\/(.*))/i;
|
||||
`cp $ROOT/icons/$2 $1`;
|
||||
}
|
||||
}
|
||||
|
||||
sub copybackdrop
|
||||
{
|
||||
my ($backdrop) = @_;
|
||||
#copy the backdrop file into the build dir
|
||||
if ($backdrop ne '')
|
||||
{
|
||||
my $dst = $backdrop;
|
||||
$dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
|
||||
my $cmd = "cp $ROOT/$backdrop $rbdir/$dst";
|
||||
# print "$cmd\n";
|
||||
`$cmd`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub copyskin
|
||||
{
|
||||
my ($themename, $skin, $ext) = @_;
|
||||
# we assume that we copy the WPS files from the same dir the WPSLIST
|
||||
# file is located in
|
||||
my $dir;
|
||||
my @filelist;
|
||||
my $src;
|
||||
my $dest;
|
||||
|
||||
if($wpslist =~ /(.*)OUT/) {
|
||||
$dir = $1;
|
||||
|
||||
# first try the actual filename given to us
|
||||
# then $skin.widthxheightxdepths.ext
|
||||
# then $skin.ext
|
||||
$src = "${dir}$skin.$ext";
|
||||
if ( -e $src )
|
||||
{
|
||||
my $cmd = "cp $src $rbdir/wps/$themename.$ext";
|
||||
`$cmd`;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $is_remote = ($ext =~ /^r.../i);
|
||||
my $width = $is_remote ? $remote_width : $main_width;
|
||||
my $height = $is_remote ? $remote_height : $main_height;
|
||||
my $depth = $is_remote ? $remote_depth : $main_depth;
|
||||
|
||||
foreach my $d (@depthlist)
|
||||
{
|
||||
next if ($d > $depth);
|
||||
$src = "${dir}$skin.${width}x${height}x${d}.$ext";
|
||||
last if (-e $src);
|
||||
}
|
||||
if (-e $src)
|
||||
{
|
||||
my $cmd = "cp $src $rbdir/wps/$themename.$ext";
|
||||
print "$cmd\n";
|
||||
`$cmd`;
|
||||
}
|
||||
elsif (-e "${dir}$skin.$ext")
|
||||
{
|
||||
my $cmd = "cp ${dir}$skin.$ext $rbdir/wps/$themename.$ext";
|
||||
`$cmd`;
|
||||
}
|
||||
else
|
||||
{
|
||||
#print STDERR "buildtheme warning: No suitable skin file for $ext\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
open(WPS, "<$wpslist");
|
||||
while(<WPS>) {
|
||||
my $l = $_;
|
||||
|
@ -222,8 +336,22 @@ while(<WPS>) {
|
|||
mkdirs($theme{Name});
|
||||
buildcfg($theme{Name});
|
||||
|
||||
copyskin($theme{"Name"}, $theme{"WPS"}, "wps") if exists($theme{"WPS"});
|
||||
copyskin($theme{"Name"}, $theme{"RWPS"}, "rwps") if exists($theme{"RWPS"});
|
||||
copyskin($theme{"Name"}, $theme{"FMS"}, "fms") if exists($theme{"FMS"});
|
||||
copyskin($theme{"Name"}, $theme{"RFMS"}, "rfms") if exists($theme{"RFMS"});
|
||||
copyskin($theme{"Name"}, $theme{"SBS"}, "sbs") if exists($theme{"SBS"});
|
||||
copyskin($theme{"Name"}, $theme{"RSBS"}, "rsbs") if exists($theme{"RSBS"});
|
||||
|
||||
copyiconset($theme{"iconset"}) if exists($theme{"iconset"});
|
||||
copyiconset($theme{"remote iconset"}) if exists($theme{"remote iconset"});
|
||||
copyiconset($theme{"viewers iconset"}) if exists($theme{"viewers iconset"});
|
||||
copyiconset($theme{"remote viewers iconset"}) if exists($theme{"remote viewers iconset"});
|
||||
|
||||
copythemefont($theme{"Font"}) if exists($theme{"Font"});
|
||||
copythemefont($theme{"Remote Font"}) if exists($theme{"Remote Font"});
|
||||
|
||||
copybackdrop($theme{"backdrop"}) if exists($theme{"backdrop"});
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue