diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2008-11-17 10:14:48 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2008-11-17 10:14:48 +0000 |
commit | 7afbb491bf7c778dea386ced1dd3237488d384e0 (patch) | |
tree | 18b0a34b2537536543fba1e14db93dadcf52f446 | |
parent | ee1c231779c2e75c2d267e88ef859209a7c93d9c (diff) | |
download | rockbox-7afbb491bf7c778dea386ced1dd3237488d384e0.tar.gz rockbox-7afbb491bf7c778dea386ced1dd3237488d384e0.zip |
Patch FS#9556 by Alex Bennee - clean up buildzip.pl
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19125 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | docs/CREDITS | 2 | ||||
-rwxr-xr-x | tools/buildzip.pl | 86 |
2 files changed, 28 insertions, 60 deletions
diff --git a/docs/CREDITS b/docs/CREDITS index 8ceced7284..8ddf3aa224 100644 --- a/docs/CREDITS +++ b/docs/CREDITS | |||
@@ -430,7 +430,7 @@ Klaas Bosteels | |||
430 | Teruaki Kawashima | 430 | Teruaki Kawashima |
431 | Marcin Łukasik | 431 | Marcin Łukasik |
432 | Le Jin | 432 | Le Jin |
433 | 433 | Alex Bennee | |
434 | 434 | ||
435 | The libmad team | 435 | The libmad team |
436 | The wavpack team | 436 | The wavpack team |
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 | ||
11 | use strict; | ||
12 | |||
11 | use File::Copy; # For move() and copy() | 13 | use File::Copy; # For move() and copy() |
12 | use File::Find; # For find() | 14 | use File::Find; # For find() |
13 | use File::Path; # For rmtree() | 15 | use File::Path; # For rmtree() |
14 | use Cwd 'abs_path'; | 16 | use Cwd 'abs_path'; |
17 | use Getopt::Long qw(:config pass_through); # pass_through so not | ||
18 | # confused by -DTYPE_STUFF | ||
15 | 19 | ||
16 | sub glob_copy { | 20 | sub glob_copy { |
17 | my ($pattern, $destination) = @_; | 21 | my ($pattern, $destination) = @_; |
@@ -37,7 +41,7 @@ sub glob_unlink { | |||
37 | sub find_copyfile { | 41 | sub 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=".."; | 52 | my $ROOT=".."; |
49 | 53 | ||
50 | my $ziptool="zip -r9"; | 54 | my $ziptool="zip -r9"; |
51 | my $output="rockbox.zip"; | 55 | my $output="rockbox.zip"; |
@@ -55,58 +59,22 @@ my $exe; | |||
55 | my $target; | 59 | my $target; |
56 | my $archos; | 60 | my $archos; |
57 | my $incfonts; | 61 | my $incfonts; |
62 | my $target_id; # passed in, not currently used | ||
58 | 63 | ||
59 | while(1) { | 64 | # Get options |
60 | if($ARGV[0] eq "-r") { | 65 | GetOptions ( '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 | ||
77 | die "No firmware found @ $exe" if !-f $exe; | ||
110 | 78 | ||
111 | my $firmdir="$ROOT/firmware"; | 79 | my $firmdir="$ROOT/firmware"; |
112 | my $appsdir="$ROOT/apps"; | 80 | my $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 |