summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/buildzip.pl86
1 files changed, 27 insertions, 59 deletions
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 107c1b7ff1..6e25f79e8e 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -8,10 +8,14 @@
8# $Id$ 8# $Id$
9# 9#
10 10
11use strict;
12
11use File::Copy; # For move() and copy() 13use File::Copy; # For move() and copy()
12use File::Find; # For find() 14use File::Find; # For find()
13use File::Path; # For rmtree() 15use File::Path; # For rmtree()
14use Cwd 'abs_path'; 16use Cwd 'abs_path';
17use Getopt::Long qw(:config pass_through); # pass_through so not
18 # confused by -DTYPE_STUFF
15 19
16sub glob_copy { 20sub glob_copy {
17 my ($pattern, $destination) = @_; 21 my ($pattern, $destination) = @_;
@@ -37,7 +41,7 @@ sub glob_unlink {
37sub find_copyfile { 41sub find_copyfile {
38 my ($pattern, $destination) = @_; 42 my ($pattern, $destination) = @_;
39 return sub { 43 return sub {
40 $path = $_; 44 my $path = $_;
41 if ($path =~ $pattern && filesize($path) > 0 && !($path =~ /\.rockbox/)) { 45 if ($path =~ $pattern && filesize($path) > 0 && !($path =~ /\.rockbox/)) {
42 copy($path, $destination); 46 copy($path, $destination);
43 chmod(0755, $destination.'/'.$path); 47 chmod(0755, $destination.'/'.$path);
@@ -45,7 +49,7 @@ sub find_copyfile {
45 } 49 }
46} 50}
47 51
48$ROOT=".."; 52my $ROOT="..";
49 53
50my $ziptool="zip -r9"; 54my $ziptool="zip -r9";
51my $output="rockbox.zip"; 55my $output="rockbox.zip";
@@ -55,58 +59,22 @@ my $exe;
55my $target; 59my $target;
56my $archos; 60my $archos;
57my $incfonts; 61my $incfonts;
62my $target_id; # passed in, not currently used
58 63
59while(1) { 64# Get options
60 if($ARGV[0] eq "-r") { 65GetOptions ( 'r|root=s' => \$ROOT,
61 $ROOT=$ARGV[1]; 66 'z|ziptool=s' => \$ziptool,
62 shift @ARGV; 67 't|target=s' => \$archos, # The target name as used in ARCHOS in the root makefile
63 shift @ARGV; 68 'i|id=s' => \$target_id, # The target id name as used in TARGET_ID in the root makefile
64 } 69 'o|output=s' => \$output,
65 70 'f|fonts=s' => \$incfonts, # 0 - no fonts, 1 - fonts only 2 - fonts and package
66 elsif($ARGV[0] eq "-z") { 71 'v|verbose' => \$verbose,
67 $ziptool=$ARGV[1]; 72 's|sim' => \$sim );
68 shift @ARGV;
69 shift @ARGV;
70 }
71
72 elsif($ARGV[0] eq "-t") {
73 # The target name as used in ARCHOS in the root makefile
74 $archos=$ARGV[1];
75 shift @ARGV;
76 shift @ARGV;
77 }
78 elsif($ARGV[0] eq "-i") {
79 # The target id name as used in TARGET_ID in the root makefile
80 $target_id=$ARGV[1];
81 shift @ARGV;
82 shift @ARGV;
83 }
84 elsif($ARGV[0] eq "-o") {
85 $output=$ARGV[1];
86 shift @ARGV;
87 shift @ARGV;
88 }
89 elsif($ARGV[0] eq "-f") {
90 $incfonts=$ARGV[1]; # 0 - no fonts, 1 - fonts only 2 - fonts and package
91 shift @ARGV;
92 shift @ARGV;
93 }
94 73
95 elsif($ARGV[0] eq "-v") { 74($target, $exe) = @ARGV;
96 $verbose =1;
97 shift @ARGV;
98 }
99 elsif($ARGV[0] eq "-s") {
100 $sim =1;
101 shift @ARGV;
102 }
103 else {
104 $target = $ARGV[0];
105 $exe = $ARGV[1];
106 last;
107 }
108}
109 75
76# Some basic sanity
77die "No firmware found @ $exe" if !-f $exe;
110 78
111my $firmdir="$ROOT/firmware"; 79my $firmdir="$ROOT/firmware";
112my $appsdir="$ROOT/apps"; 80my $appsdir="$ROOT/apps";
@@ -149,7 +117,7 @@ STOP
149 my ($bitmap, $depth, $swcodec, $icon_h, $icon_w); 117 my ($bitmap, $depth, $swcodec, $icon_h, $icon_w);
150 my ($remote_depth, $remote_icon_h, $remote_icon_w); 118 my ($remote_depth, $remote_icon_h, $remote_icon_w);
151 my ($recording); 119 my ($recording);
152 $icon_count = 1; 120 my $icon_count = 1;
153 while(<TARGET>) { 121 while(<TARGET>) {
154 # print STDERR "DATA: $_"; 122 # print STDERR "DATA: $_";
155 if($_ =~ /^Bitmap: (.*)/) { 123 if($_ =~ /^Bitmap: (.*)/) {
@@ -216,7 +184,7 @@ sub buildzip {
216 if($fonts) { 184 if($fonts) {
217 mkdir ".rockbox/fonts", 0777; 185 mkdir ".rockbox/fonts", 0777;
218 chdir(".rockbox/fonts"); 186 chdir(".rockbox/fonts");
219 $cmd = "$ROOT/tools/convbdf -f $ROOT/fonts/*bdf >/dev/null 2>&1"; 187 my $cmd = "$ROOT/tools/convbdf -f $ROOT/fonts/*bdf >/dev/null 2>&1";
220 print($cmd."\n") if $verbose; 188 print($cmd."\n") if $verbose;
221 system($cmd); 189 system($cmd);
222 chdir("../../"); 190 chdir("../../");
@@ -294,7 +262,7 @@ STOP
294 262
295 open VIEWERS, "$ROOT/apps/plugins/viewers.config" or 263 open VIEWERS, "$ROOT/apps/plugins/viewers.config" or
296 die "can't open viewers.config"; 264 die "can't open viewers.config";
297 @viewers = <VIEWERS>; 265 my @viewers = <VIEWERS>;
298 close VIEWERS; 266 close VIEWERS;
299 267
300 open VIEWERS, ">.rockbox/viewers.config" or 268 open VIEWERS, ">.rockbox/viewers.config" or
@@ -342,10 +310,10 @@ STOP
342 } 310 }
343 } 311 }
344 close VIEWERS; 312 close VIEWERS;
345 313
346 open CATEGORIES, "$ROOT/apps/plugins/CATEGORIES" or 314 open CATEGORIES, "$ROOT/apps/plugins/CATEGORIES" or
347 die "can't open CATEGORIES"; 315 die "can't open CATEGORIES";
348 @rock_targetdirs = <CATEGORIES>; 316 my @rock_targetdirs = <CATEGORIES>;
349 close CATEGORIES; 317 close CATEGORIES;
350 foreach my $line (@rock_targetdirs) { 318 foreach my $line (@rock_targetdirs) {
351 if ($line =~ /([^,]*),(.*)/) { 319 if ($line =~ /([^,]*),(.*)/) {
@@ -353,7 +321,7 @@ STOP
353 move(".rockbox/rocks/${plugin}.rock", ".rockbox/rocks/$dir/${plugin}.rock"); 321 move(".rockbox/rocks/${plugin}.rock", ".rockbox/rocks/$dir/${plugin}.rock");
354 } 322 }
355 } 323 }
356 324
357 if ($bitmap) { 325 if ($bitmap) {
358 mkdir ".rockbox/icons", 0777; 326 mkdir ".rockbox/icons", 0777;
359 copy("$viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp", ".rockbox/icons/viewers.bmp"); 327 copy("$viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp", ".rockbox/icons/viewers.bmp");
@@ -361,10 +329,10 @@ STOP
361 copy("$viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp", ".rockbox/icons/remote_viewers.bmp"); 329 copy("$viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp", ".rockbox/icons/remote_viewers.bmp");
362 } 330 }
363 } 331 }
364 332
365 copy("$ROOT/apps/tagnavi.config", ".rockbox/"); 333 copy("$ROOT/apps/tagnavi.config", ".rockbox/");
366 copy("$ROOT/apps/plugins/disktidy.config", ".rockbox/rocks/apps/"); 334 copy("$ROOT/apps/plugins/disktidy.config", ".rockbox/rocks/apps/");
367 335
368 if($bitmap) { 336 if($bitmap) {
369 copy("$ROOT/apps/plugins/sokoban.levels", ".rockbox/rocks/games/sokoban.levels"); # sokoban levels 337 copy("$ROOT/apps/plugins/sokoban.levels", ".rockbox/rocks/games/sokoban.levels"); # sokoban levels
370 copy("$ROOT/apps/plugins/snake2.levels", ".rockbox/rocks/games/snake2.levels"); # snake2 levels 338 copy("$ROOT/apps/plugins/snake2.levels", ".rockbox/rocks/games/snake2.levels"); # snake2 levels