diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-08-24 15:13:08 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-08-24 15:13:08 +0000 |
commit | d1851e3364d4fa1c54525755cfd3c33c09e39767 (patch) | |
tree | 95e9b55ef60b62364561db33c7e71c5c8e7dba46 /tools/buildzip.pl | |
parent | fa5fa54a1b4af2e9a8d86d8b29e16b213765ae3d (diff) | |
download | rockbox-d1851e3364d4fa1c54525755cfd3c33c09e39767.tar.gz rockbox-d1851e3364d4fa1c54525755cfd3c33c09e39767.zip |
Make the buildzip script able to build zips even when not run in a dir
one level "down" from the rockbox source root.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5013 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/buildzip.pl')
-rwxr-xr-x | tools/buildzip.pl | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/tools/buildzip.pl b/tools/buildzip.pl index 8fd0e6592d..4db1f5e4bb 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl | |||
@@ -1,5 +1,20 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | 2 | ||
3 | $ROOT=".."; | ||
4 | |||
5 | if($ARGV[0] eq "-r") { | ||
6 | $ROOT=$ARGV[1]; | ||
7 | shift @ARGV; | ||
8 | shift @ARGV; | ||
9 | } | ||
10 | |||
11 | my $verbose; | ||
12 | if($ARGV[0] eq "-v") { | ||
13 | $verbose =1; | ||
14 | shift @ARGV; | ||
15 | } | ||
16 | |||
17 | |||
3 | sub filesize { | 18 | sub filesize { |
4 | my ($filename)=@_; | 19 | my ($filename)=@_; |
5 | my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, | 20 | my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, |
@@ -10,7 +25,7 @@ sub filesize { | |||
10 | 25 | ||
11 | sub buildlangs { | 26 | sub buildlangs { |
12 | my ($outputlang)=@_; | 27 | my ($outputlang)=@_; |
13 | my $dir = "../apps/lang"; | 28 | my $dir = "$ROOT/apps/lang"; |
14 | opendir(DIR, $dir); | 29 | opendir(DIR, $dir); |
15 | my @files = grep { /\.lang$/ } readdir(DIR); | 30 | my @files = grep { /\.lang$/ } readdir(DIR); |
16 | closedir(DIR); | 31 | closedir(DIR); |
@@ -19,7 +34,7 @@ sub buildlangs { | |||
19 | my $output = $_; | 34 | my $output = $_; |
20 | $output =~ s/(.*)\.lang/$1.lng/; | 35 | $output =~ s/(.*)\.lang/$1.lng/; |
21 | print "lang $_\n" if($verbose); | 36 | print "lang $_\n" if($verbose); |
22 | system ("../tools/binlang $dir/english.lang $dir/$_ $outputlang/$output >/dev/null 2>&1"); | 37 | system ("$ROOT/tools/binlang $dir/english.lang $dir/$_ $outputlang/$output >/dev/null 2>&1"); |
23 | } | 38 | } |
24 | } | 39 | } |
25 | 40 | ||
@@ -34,7 +49,7 @@ sub buildzip { | |||
34 | mkdir ".rockbox/rocks", 0777; | 49 | mkdir ".rockbox/rocks", 0777; |
35 | `find . -name "*.rock" ! -empty | xargs --replace=foo cp foo .rockbox/rocks/`; | 50 | `find . -name "*.rock" ! -empty | xargs --replace=foo cp foo .rockbox/rocks/`; |
36 | 51 | ||
37 | open VIEWERS, "../apps/plugins/viewers.config" or | 52 | open VIEWERS, "$ROOT/apps/plugins/viewers.config" or |
38 | die "can't open viewers.config"; | 53 | die "can't open viewers.config"; |
39 | @viewers = <VIEWERS>; | 54 | @viewers = <VIEWERS>; |
40 | close VIEWERS; | 55 | close VIEWERS; |
@@ -53,17 +68,17 @@ sub buildzip { | |||
53 | close VIEWERS; | 68 | close VIEWERS; |
54 | 69 | ||
55 | if($notplayer) { | 70 | if($notplayer) { |
56 | `cp ../apps/plugins/sokoban.levels .rockbox/`; # sokoban levels | 71 | `cp $ROOT/apps/plugins/sokoban.levels .rockbox/`; # sokoban levels |
57 | `cp ../apps/plugins/snake2.levels .rockbox/`; # snake2 levels | 72 | `cp $ROOT/apps/plugins/snake2.levels .rockbox/`; # snake2 levels |
58 | 73 | ||
59 | mkdir ".rockbox/fonts", 0777; | 74 | mkdir ".rockbox/fonts", 0777; |
60 | 75 | ||
61 | opendir(DIR, "../fonts") || die "can't open dir fonts"; | 76 | opendir(DIR, "$ROOT/fonts") || die "can't open dir fonts"; |
62 | my @fonts = grep { /\.bdf$/ && -f "../fonts/$_" } readdir(DIR); | 77 | my @fonts = grep { /\.bdf$/ && -f "$ROOT/fonts/$_" } readdir(DIR); |
63 | closedir DIR; | 78 | closedir DIR; |
64 | 79 | ||
65 | my $maxfont; | 80 | my $maxfont; |
66 | open(HEADER, "<../firmware/export/font.h"); | 81 | open(HEADER, "<$ROOT/firmware/export/font.h"); |
67 | while(<HEADER>) { | 82 | while(<HEADER>) { |
68 | if(/^\#define MAX_FONT_SIZE[ \t]*(\d+)/) { | 83 | if(/^\#define MAX_FONT_SIZE[ \t]*(\d+)/) { |
69 | $maxfont = $1; | 84 | $maxfont = $1; |
@@ -78,7 +93,7 @@ sub buildzip { | |||
78 | print "FONT: $f\n" if($verbose); | 93 | print "FONT: $f\n" if($verbose); |
79 | my $o = $f; | 94 | my $o = $f; |
80 | $o =~ s/\.bdf/\.fnt/; | 95 | $o =~ s/\.bdf/\.fnt/; |
81 | my $cmd ="../tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"../fonts/$f\" >/dev/null 2>&1"; | 96 | my $cmd ="$ROOT/tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"$ROOT/fonts/$f\" >/dev/null 2>&1"; |
82 | print "CMD: $cmd\n" if($verbose); | 97 | print "CMD: $cmd\n" if($verbose); |
83 | `$cmd`; | 98 | `$cmd`; |
84 | 99 | ||
@@ -102,7 +117,7 @@ sub buildzip { | |||
102 | "FAQ", | 117 | "FAQ", |
103 | "NODO", | 118 | "NODO", |
104 | "TECH")) { | 119 | "TECH")) { |
105 | `cp ../docs/$_ .rockbox/docs/$_.txt`; | 120 | `cp $ROOT/docs/$_ .rockbox/docs/$_.txt`; |
106 | } | 121 | } |
107 | 122 | ||
108 | # now copy the file made for reading on the unit: | 123 | # now copy the file made for reading on the unit: |
@@ -134,12 +149,6 @@ $year+=1900; | |||
134 | $date=sprintf("%04d%02d%02d", $year,$mon, $mday); | 149 | $date=sprintf("%04d%02d%02d", $year,$mon, $mday); |
135 | $shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday); | 150 | $shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday); |
136 | 151 | ||
137 | my $verbose; | ||
138 | if($ARGV[0] eq "-v") { | ||
139 | $verbose =1; | ||
140 | shift @ARGV; | ||
141 | } | ||
142 | |||
143 | # made once for all targets | 152 | # made once for all targets |
144 | sub runone { | 153 | sub runone { |
145 | my ($type, $target)=@_; | 154 | my ($type, $target)=@_; |