Daniel Stenberg | 760b7b9 | 2004-05-21 19:05:27 +0000 | [diff] [blame] | 1 | #!/usr/bin/perl |
| 2 | |
| 3 | sub buildlangs { |
| 4 | my ($outputlang)=@_; |
| 5 | my $dir = "../apps/lang"; |
| 6 | opendir(DIR, $dir); |
| 7 | my @files = grep { /\.lang$/ } readdir(DIR); |
| 8 | closedir(DIR); |
| 9 | |
| 10 | for(@files) { |
| 11 | my $output = $_; |
| 12 | $output =~ s/(.*)\.lang/$1.lng/; |
| 13 | print "lang $_\n" if($verbose); |
| 14 | system ("../tools/binlang $dir/english.lang $dir/$_ $outputlang/$output >/dev/null 2>&1"); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | sub buildzip { |
| 19 | my ($zip, $image, $notplayer)=@_; |
| 20 | |
| 21 | # remove old traces |
| 22 | `rm -rf .rockbox`; |
| 23 | |
| 24 | mkdir ".rockbox", 0777; |
| 25 | mkdir ".rockbox/langs", 0777; |
| 26 | mkdir ".rockbox/rocks", 0777; |
| 27 | `find . -name "*.rock" ! -empty | xargs --replace=foo cp foo .rockbox/rocks/`; |
| 28 | |
| 29 | if($notplayer) { |
| 30 | `cp ../apps/plugins/sokoban.levels .rockbox/`; # sokoban levels |
| 31 | |
Björn Stenberg | 0d53b48 | 2004-05-21 21:01:20 +0000 | [diff] [blame] | 32 | open VIEWERS, "../apps/plugins/viewers.config" or |
| 33 | die "can't open viewers.config"; |
| 34 | @viewers = <VIEWERS>; |
| 35 | close VIEWERS; |
| 36 | `cp ../apps/plugins/viewers.config .rockbox`; |
| 37 | mkdir ".rockbox/viewers"; |
| 38 | for (@viewers) { |
| 39 | if (/,(.+),/) { |
| 40 | `mv .rockbox/rocks/$1 .rockbox/viewers`; |
| 41 | } |
| 42 | } |
| 43 | |
Daniel Stenberg | 760b7b9 | 2004-05-21 19:05:27 +0000 | [diff] [blame] | 44 | mkdir ".rockbox/fonts", 0777; |
| 45 | |
| 46 | opendir(DIR, "../fonts") || die "can't open dir fonts"; |
| 47 | my @fonts = grep { /\.bdf$/ && -f "../fonts/$_" } readdir(DIR); |
| 48 | closedir DIR; |
| 49 | |
| 50 | for(@fonts) { |
| 51 | my $f = $_; |
| 52 | |
| 53 | print "FONT: $f\n" if($verbose); |
| 54 | my $o = $f; |
| 55 | $o =~ s/\.bdf/\.fnt/; |
| 56 | my $cmd ="../tools/convbdf -s 32 -l 255 -f -o \".rockbox/fonts/$o\" \"../fonts/$f\" >/dev/null 2>&1"; |
| 57 | print "CMD: $cmd\n" if($verbose); |
| 58 | `$cmd`; |
| 59 | } |
| 60 | |
Daniel Stenberg | b156352 | 2004-06-14 15:04:46 +0000 | [diff] [blame] | 61 | if($image) { |
| 62 | # image is blank when this is a simulator |
| 63 | `cp rockbox.ucl .rockbox/`; # UCL for flashing |
| 64 | } |
Daniel Stenberg | 760b7b9 | 2004-05-21 19:05:27 +0000 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | mkdir ".rockbox/docs", 0777; |
| 68 | for(("BATTERY-FAQ", |
| 69 | "CUSTOM_CFG_FORMAT", |
| 70 | "CUSTOM_WPS_FORMAT", |
| 71 | "FAQ", |
| 72 | "NODO", |
| 73 | "TECH")) { |
| 74 | `cp ../docs/$_ .rockbox/docs/$_.txt`; |
| 75 | } |
| 76 | |
| 77 | # now copy the file made for reading on the unit: |
| 78 | #if($notplayer) { |
| 79 | # `cp $webroot/docs/Help-JBR.txt .rockbox/docs/`; |
| 80 | #} |
| 81 | #else { |
| 82 | # `cp $webroot/docs/Help-Stu.txt .rockbox/docs/`; |
| 83 | #} |
| 84 | |
| 85 | buildlangs(".rockbox/langs"); |
| 86 | |
| 87 | `find .rockbox | zip $zip -@ >/dev/null`; |
| 88 | |
Daniel Stenberg | b156352 | 2004-06-14 15:04:46 +0000 | [diff] [blame] | 89 | if($image) { |
| 90 | `zip $zip $image`; |
| 91 | } |
Daniel Stenberg | 760b7b9 | 2004-05-21 19:05:27 +0000 | [diff] [blame] | 92 | |
| 93 | # remove the .rockbox afterwards |
| 94 | `rm -rf .rockbox`; |
Daniel Stenberg | 760b7b9 | 2004-05-21 19:05:27 +0000 | [diff] [blame] | 95 | } |
| 96 | |
| 97 | my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = |
| 98 | localtime(time); |
| 99 | |
| 100 | $mon+=1; |
| 101 | $year+=1900; |
| 102 | |
| 103 | $date=sprintf("%04d%02d%02d", $year,$mon, $mday); |
| 104 | $shortdate=sprintf("%02d%02d%02d", $year%100,$mon, $mday); |
| 105 | |
| 106 | my $verbose; |
| 107 | if($ARGV[0] eq "-v") { |
| 108 | $verbose =1; |
| 109 | shift @ARGV; |
| 110 | } |
| 111 | |
| 112 | # made once for all targets |
| 113 | sub runone { |
| 114 | my ($type, $target)=@_; |
| 115 | |
| 116 | # build a full install zip file |
| 117 | buildzip("rockbox.zip", $target, |
| 118 | ($type eq "player")?0:1); |
| 119 | }; |
| 120 | |
Daniel Stenberg | b156352 | 2004-06-14 15:04:46 +0000 | [diff] [blame] | 121 | my $target = $ARGV[0]; |
| 122 | |
| 123 | my $exe = ""; |
| 124 | |
| 125 | if($target !~ /sim/i) { |
| 126 | # not a simulator |
| 127 | if($target =~ /recorder/i) { |
| 128 | $exe = "ajbrec.ajz"; |
| 129 | } |
| 130 | else { |
| 131 | $exe = "archos.mod"; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | if($target =~ /recorder/i) { |
| 136 | runone("recorder", $exe); |
Daniel Stenberg | 760b7b9 | 2004-05-21 19:05:27 +0000 | [diff] [blame] | 137 | } |
| 138 | else { |
Daniel Stenberg | b156352 | 2004-06-14 15:04:46 +0000 | [diff] [blame] | 139 | runone("player", $exe); |
Daniel Stenberg | 760b7b9 | 2004-05-21 19:05:27 +0000 | [diff] [blame] | 140 | } |
| 141 | |