summaryrefslogtreecommitdiffstats
path: root/wps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2008-11-24 22:16:07 +0000
committerBjörn Stenberg <bjorn@haxx.se>2008-11-24 22:16:07 +0000
commitad8d6031c18d131a4f63bc12110a49efb482dafe (patch)
treec9159d712bf857a98751def6b773d1ed6323f046 /wps
parent4c43f7be0aa634904f0da2eca3d51876419aa36d (diff)
downloadrockbox-ad8d6031c18d131a4f63bc12110a49efb482dafe.tar.gz
rockbox-ad8d6031c18d131a4f63bc12110a49efb482dafe.tar.bz2
rockbox-ad8d6031c18d131a4f63bc12110a49efb482dafe.zip
Added support for configurable rockbox directory. FS#9567 by Alex Bennee.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19208 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'wps')
-rwxr-xr-xwps/wpsbuild.pl108
1 files changed, 71 insertions, 37 deletions
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl
index f7d095268e..4a27325e35 100755
--- a/wps/wpsbuild.pl
+++ b/wps/wpsbuild.pl
@@ -8,32 +8,60 @@
# $Id$
#
-$ROOT="..";
-
-if($ARGV[0] eq "-r") {
- $ROOT=$ARGV[1];
- shift @ARGV;
- shift @ARGV;
-}
+use strict;
+use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
+my $ROOT="..";
my $verbose;
-if($ARGV[0] eq "-v") {
- $verbose =1;
- shift @ARGV;
-}
-
my $firmdir="$ROOT/firmware";
+my $rbdir=".rockbox";
+my $wpslist;
+my $target;
-my $wpslist=$ARGV[0];
+# Get options
+GetOptions ( 'r|root=s' => \$ROOT,
+ 'v|verbose' => \$verbose,
+ 'rbdir=s' => \$rbdir, # If we want to put in a different directory
+ );
+
+($wpslist, $target) = @ARGV;
-my $target = $ARGV[1];
my $cppdef = $target;
my @depthlist = ( 16, 8, 4, 2, 1 );
+# These parameters are filled in as we parse wpslist
+my $wps;
+my $wps_prefix;
+my $rwps;
+my $width;
+my $height;
+my $font;
+my $fgcolor;
+my $bgcolor;
+my $statusbar;
+my $author;
+my $req_g;
+my $req_g_wps;
+my $req_t_wps;
+my $backdrop;
+my $lineselectstart;
+my $lineselectend;
+my $selecttype;
+my $iconset;
+my $viewericon;
+my $lineselecttextcolor;
+my $filetylecolor;
+
+# LCD sizes
+my ($main_height, $main_width, $main_depth);
+my ($remote_height, $remote_width, $remote_depth);
+my $has_remote;
+
+
if(!$wpslist) {
print "Usage: wpsbuilds.pl <WPSLIST> <target>\n",
"Run this script in the root of the target build, and it will put all the\n",
- "stuff in .rockbox/wps/\n";
+ "stuff in $rbdir/wps/\n";
exit;
}
@@ -71,7 +99,7 @@ STOP
open(GETSIZE, "$c|");
- my ($height, $width);
+ my ($height, $width, $depth);
while(<GETSIZE>) {
if($_ =~ /^Height: (\d*)/) {
$height = $1;
@@ -96,15 +124,15 @@ sub mkdirs
{
my $wpsdir = $wps;
$wpsdir =~ s/\.(r|)wps//;
- mkdir ".rockbox/wps", 0777;
- mkdir ".rockbox/themes", 0777;
+ mkdir "$rbdir/wps", 0777;
+ mkdir "$rbdir/themes", 0777;
- if( -d ".rockbox/wps/$wpsdir") {
+ if( -d "$rbdir/wps/$wpsdir") {
#print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n";
}
else
{
- mkdir ".rockbox/wps/$wpsdir", 0777;
+ mkdir "$rbdir/wps/$wpsdir", 0777;
}
}
@@ -112,9 +140,9 @@ sub copybackdrop
{
#copy the backdrop file into the build dir
if ($backdrop ne '') {
- $dst = $backdrop;
+ my $dst = $backdrop;
$dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
- $cmd = "cp $ROOT/$backdrop .rockbox/$dst";
+ my $cmd = "cp $ROOT/$backdrop $rbdir/$dst";
`$cmd`;
}
}
@@ -123,10 +151,10 @@ sub copythemefont
{
#copy the font specified by the theme
- $o=$font;
+ my $o=$font;
$o =~ s/\.fnt/\.bdf/;
- `mkdir .rockbox/fonts/ >/dev/null 2>&1`;
- $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$font\" \"$ROOT/fonts/$o\" ";
+ mkdir "$rbdir/fonts";
+ my $cmd ="$ROOT/tools/convbdf -f -o \"$rbdir/fonts/$font\" \"$ROOT/fonts/$o\" ";
`$cmd`;
}
@@ -135,6 +163,7 @@ sub copythemeicon
#copy the icon specified by the theme
if ($iconset ne '') {
+ $iconset =~ s/.rockbox/$rbdir/;
$iconset =~ /\/(.*icons\/(.*))/i;
`cp $ROOT/icons/$2 $1`;
}
@@ -145,6 +174,7 @@ sub copythemeviewericon
#copy the viewer icon specified by the theme
if ($viewericon ne '') {
+ $viewericon =~ s/.rockbox/$rbdir/;
$viewericon =~ /\/(.*icons\/(.*))/i;
`cp $ROOT/icons/$2 $1`;
}
@@ -164,10 +194,10 @@ sub copywps
# print "$req_t_wps $req_g_wps\n";
if (-e "$dir/$req_t_wps" ) {
- system("cp $dir/$req_t_wps .rockbox/wps/$wps");
+ system("cp $dir/$req_t_wps $rbdir/wps/$wps");
} elsif (-e "$dir/$req_g_wps") {
- system("cp $dir/$req_g_wps .rockbox/wps/$wps");
+ system("cp $dir/$req_g_wps $rbdir/wps/$wps");
open(WPSFILE, "$dir/$req_g_wps");
while (<WPSFILE>) {
@@ -178,12 +208,12 @@ sub copywps
if ($#filelist >= 0) {
if (-e "$dir/$wps_prefix/$req_g") {
foreach $file (@filelist) {
- system("cp $dir/$wps_prefix/$req_g/$file .rockbox/wps/$wps_prefix/");
+ system("cp $dir/$wps_prefix/$req_g/$file $rbdir/wps/$wps_prefix/");
}
}
elsif (-e "$dir/$wps_prefix") {
foreach $file (@filelist) {
- system("cp $dir/$wps_prefix/$file .rockbox/wps/$wps_prefix/");
+ system("cp $dir/$wps_prefix/$file $rbdir/wps/$wps_prefix/");
}
}
else {
@@ -210,11 +240,11 @@ sub buildcfg {
\# $cfg generated by wpsbuild.pl
\# $wps is made by $author
\#
-wps: /.rockbox/wps/$wps
+wps: /$rbdir/wps/$wps
MOO
;
if($font) {
- push @out, "font: /.rockbox/fonts/$font\n";
+ push @out, "font: /$rbdir/fonts/$font\n";
}
if($fgcolor && $main_depth > 2) {
push @out, "foreground color: $fgcolor\n";
@@ -231,7 +261,7 @@ MOO
} else {
# clip resolution from filename
$backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
- push @out, "backdrop: /.rockbox/$backdrop\n";
+ push @out, "backdrop: /$rbdir/$backdrop\n";
}
}
if($lineselectstart && $main_depth > 2) {
@@ -256,13 +286,13 @@ MOO
push @out, "filetype colours: $filetylecolor\n";
}
if($rwps && $has_remote ) {
- push @out, "rwps: /.rockbox/wps/$rwps\n";
+ push @out, "rwps: /$rbdir/wps/$rwps\n";
}
- if(-f ".rockbox/wps/$cfg") {
+ if(-f "$rbdir/wps/$cfg") {
print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
}
else {
- open(CFG, ">.rockbox/themes/$cfg");
+ open(CFG, ">$rbdir/themes/$cfg");
print CFG @out;
close(CFG);
}
@@ -273,11 +303,15 @@ MOO
($remote_height, $remote_width, $remote_depth) = getlcdsizes(1);
#print "LCD: ${main_height}x${main_width}x${main_depth}\n";
-$has_remote = 1 if ($remote_height && $remote_width && remote_depth);
+$has_remote = 1 if ($remote_height && $remote_width && $remote_depth);
+
+my $isrwps;
+my $within;
open(WPS, "<$wpslist");
while(<WPS>) {
my $l = $_;
+
# remove CR
$l =~ s/\r//g;
if($l =~ /^ *\#/) {
@@ -334,7 +368,7 @@ while(<WPS>) {
my $wpsdir = $1;
# If this WPS installable on this platform, one of the following
# two files will be present
- foreach $d (@depthlist) {
+ foreach my $d (@depthlist) {
next if ($d > $rdepth);
$req_g = $rwidth . "x" . $rheight . "x" . $d;