build/mklar.pl:
- fix heisenbug with file list padding - call luac if available - include non-lua files - include cbi models and controllers
This commit is contained in:
parent
e4fd058c2e
commit
f7a726ec9e
1 changed files with 13 additions and 18 deletions
|
@ -39,16 +39,7 @@ find( sub {
|
||||||
( $File::Find::name =~ m{/luasrc/} ) || return;
|
( $File::Find::name =~ m{/luasrc/} ) || return;
|
||||||
|
|
||||||
# Skip .svn foo
|
# Skip .svn foo
|
||||||
( $File::Find::name !~ m{/\.svn\z} ) || return;
|
( $File::Find::name !~ m{/\.svn\b} ) || return;
|
||||||
|
|
||||||
# Skip non-lua files
|
|
||||||
( $File::Find::name =~ m{\.lua\z} ) || return;
|
|
||||||
|
|
||||||
# Skip i18n files
|
|
||||||
( $File::Find::name !~ m{/i18n/} ) || return;
|
|
||||||
|
|
||||||
# Exclude cbi models and controllers for now
|
|
||||||
( $File::Find::name !~ m{/controller/} && $File::Find::name !~ m{/model/cbi/} ) || return;
|
|
||||||
|
|
||||||
# Exclude luci-statistics and lucittpd for now
|
# Exclude luci-statistics and lucittpd for now
|
||||||
( $File::Find::name !~ m{/luci-statistics/} && $File::Find::name !~ m{/lucittpd/} ) || return;
|
( $File::Find::name !~ m{/luci-statistics/} && $File::Find::name !~ m{/lucittpd/} ) || return;
|
||||||
|
@ -57,7 +48,10 @@ find( sub {
|
||||||
my $file = $File::Find::name;
|
my $file = $File::Find::name;
|
||||||
$file =~ s{^.+/luasrc/}{luci/};
|
$file =~ s{^.+/luasrc/}{luci/};
|
||||||
|
|
||||||
if( open F, "< $_" )
|
my $command = ( $File::Find::name =~ m{\.lua\z} && $ENV{LUAC} )
|
||||||
|
? "$ENV{LUAC} -o - $_ |" : "< $_";
|
||||||
|
|
||||||
|
if( open F, $command )
|
||||||
{
|
{
|
||||||
warn sprintf "Member at 0x%08X: %s\n", $offset, $file;
|
warn sprintf "Member at 0x%08X: %s\n", $offset, $file;
|
||||||
push @index, [ ];
|
push @index, [ ];
|
||||||
|
@ -66,7 +60,7 @@ find( sub {
|
||||||
my $pad = 0;
|
my $pad = 0;
|
||||||
|
|
||||||
$index[-1][0] = $offset;
|
$index[-1][0] = $offset;
|
||||||
|
|
||||||
while( read F, my $buffer, 4096 ) {
|
while( read F, my $buffer, 4096 ) {
|
||||||
$size += length $buffer;
|
$size += length $buffer;
|
||||||
print $buffer;
|
print $buffer;
|
||||||
|
@ -97,17 +91,18 @@ find( sub {
|
||||||
my $filelist = join("\0", map $_->[4], @index) . "\0";
|
my $filelist = join("\0", map $_->[4], @index) . "\0";
|
||||||
my $listsize = length $filelist;
|
my $listsize = length $filelist;
|
||||||
push @index, [ $offset, $listsize, "", 0xFFFF, undef ];
|
push @index, [ $offset, $listsize, "", 0xFFFF, undef ];
|
||||||
warn sprintf "Filelist at 0x%08X\n", $offset;
|
|
||||||
|
|
||||||
if( $listsize % 4 )
|
warn sprintf "Filelist at 0x%08X, length 0x%08X\n", $offset, $listsize;
|
||||||
{
|
|
||||||
$listsize += ( 4 - ($listsize % 4) );
|
|
||||||
$filelist .= "\0" x ( 4 - ($listsize % 4) );
|
|
||||||
}
|
|
||||||
|
|
||||||
print $filelist;
|
print $filelist;
|
||||||
$offset += $listsize;
|
$offset += $listsize;
|
||||||
|
|
||||||
|
if( $listsize % 4 )
|
||||||
|
{
|
||||||
|
$offset += ( 4 - ($listsize % 4) );
|
||||||
|
print "\0" x ( 4 - ($listsize % 4) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
my $count = 1;
|
my $count = 1;
|
||||||
foreach my $file ( @index )
|
foreach my $file ( @index )
|
||||||
|
|
Loading…
Reference in a new issue