-
Notifications
You must be signed in to change notification settings - Fork 119
/
update-jni-md5.pl
executable file
·52 lines (37 loc) · 2.31 KB
/
update-jni-md5.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env perl
use warnings;
use strict;
my $md5s = `bash -c "md5sum libs/**/*"`;
print "$md5s\n";
my ($grep_armv5) = $md5s =~ m{^([^ ]+) \*libs/armeabi/grep$}m;
my ($nflog_armv5) = $md5s =~ m{^([^ ]+) \*libs/armeabi/nflog$}m;
my ($run_pie_armv5) = $md5s =~ m{^([^ ]+) \*libs/armeabi/run_pie$}m;
my ($grep_armv7) = $md5s =~ m{^([^ ]+) \*libs/armeabi-v7a/grep$}m;
my ($nflog_armv7) = $md5s =~ m{^([^ ]+) \*libs/armeabi-v7a/nflog$}m;
my ($run_pie_armv7) = $md5s =~ m{^([^ ]+) \*libs/armeabi-v7a/run_pie$}m;
my ($grep_x86) = $md5s =~ m{^([^ ]+) \*libs/x86/grep$}m;
my ($nflog_x86) = $md5s =~ m{^([^ ]+) \*libs/x86/nflog$}m;
my ($run_pie_x86) = $md5s =~ m{^([^ ]+) \*libs/x86/run_pie$}m;
my ($grep_mips) = $md5s =~ m{^([^ ]+) \*libs/mips/grep$}m;
my ($nflog_mips) = $md5s =~ m{^([^ ]+) \*libs/mips/nflog$}m;
my ($run_pie_mips) = $md5s =~ m{^([^ ]+) \*libs/mips/run_pie$}m;
open my $in, '<', 'src/com/googlecode/networklog/SysUtils.java' or die "Couldn't open SysUtils.java for reading: $!";
my @lines = <$in>;
close $in;
open my $out, '>', 'src/com/googlecode/networklog/SysUtils.java' or die "Couldn't open SysUtils.java for writing: $!";
foreach my $text (@lines) {
$text =~ s/grepMd5 = ".*";\s+\/\/ grep_armv5/grepMd5 = "$grep_armv5"; \/\/ grep_armv5/;
$text =~ s/nflogMd5 = ".*";\s+\/\/ nflog_armv5/nflogMd5 = "$nflog_armv5"; \/\/ nflog_armv5/;
$text =~ s/run_pieMd5 = ".*";\s+\/\/ run_pie_armv5/run_pieMd5 = "$run_pie_armv5"; \/\/ run_pie_armv5/;
$text =~ s/grepMd5 = ".*";\s+\/\/ grep_armv7/grepMd5 = "$grep_armv7"; \/\/ grep_armv7/;
$text =~ s/nflogMd5 = ".*";\s+\/\/ nflog_armv7/nflogMd5 = "$nflog_armv7"; \/\/ nflog_armv7/;
$text =~ s/run_pieMd5 = ".*";\s+\/\/ run_pie_armv7/run_pieMd5 = "$run_pie_armv7"; \/\/ run_pie_armv7/;
$text =~ s/grepMd5 = ".*";\s+\/\/ grep_x86/grepMd5 = "$grep_x86"; \/\/ grep_x86/;
$text =~ s/nflogMd5 = ".*";\s+\/\/ nflog_x86/nflogMd5 = "$nflog_x86"; \/\/ nflog_x86/;
$text =~ s/run_pieMd5 = ".*";\s+\/\/ run_pie_x86/run_pieMd5 = "$run_pie_x86"; \/\/ run_pie_x86/;
$text =~ s/grepMd5 = ".*";\s+\/\/ grep_mips/grepMd5 = "$grep_mips"; \/\/ grep_mips/;
$text =~ s/nflogMd5 = ".*";\s+\/\/ nflog_mips/nflogMd5 = "$nflog_mips"; \/\/ nflog_mips/;
$text =~ s/run_pieMd5 = ".*";\s+\/\/ run_pie_mips/run_pieMd5 = "$run_pie_mips"; \/\/ run_pie_mips/;
print $out $text;
}
close $out;