line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
######################################################################## |
2
|
|
|
|
|
|
|
package My::Build; |
3
|
|
|
|
|
|
|
######################################################################## |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
1284
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
87
|
|
6
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
84
|
|
7
|
2
|
|
|
2
|
|
936
|
use parent 'Module::Build'; |
|
2
|
|
|
|
|
554
|
|
|
2
|
|
|
|
|
12
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub ACTION_build { |
10
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
0
|
mkdir 'share'; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
0
|
$self->SUPER::ACTION_build; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
138536
|
use File::Path; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
305
|
|
18
|
|
|
|
|
|
|
sub ACTION_clean { |
19
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
File::Path::remove_tree('share'); |
22
|
0
|
|
|
|
|
0
|
$self->notes('build_state', ''); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Call system-specific cleanup code |
25
|
0
|
|
|
|
|
0
|
$self->my_clean; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Call base class code |
28
|
0
|
|
|
|
|
0
|
$self->SUPER::ACTION_clean; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
2
|
|
11
|
use File::Copy; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
109
|
|
32
|
2
|
|
|
2
|
|
11
|
use File::Spec; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
728
|
|
33
|
|
|
|
|
|
|
sub ACTION_devsetup { |
34
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
35
|
0
|
|
|
|
|
0
|
system qw(git submodule init); |
36
|
0
|
|
|
|
|
0
|
system qw(git submodule update); |
37
|
0
|
|
|
|
|
0
|
my $hook_filename = File::Spec->catfile(qw<.git hooks pre-commit>); |
38
|
0
|
|
|
|
|
0
|
copy 'git-pre-commit-hook.pl' => $hook_filename; |
39
|
0
|
|
|
|
|
0
|
chmod 0755, $hook_filename; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# Reset the tcc source code. This only makes sense if the person has |
43
|
|
|
|
|
|
|
# src checked out as a git submodule, but then again, the actions for |
44
|
|
|
|
|
|
|
# which this exists are generally considered author actions anyway. |
45
|
|
|
|
|
|
|
sub reset_src { |
46
|
0
|
|
|
0
|
0
|
0
|
chdir 'src'; |
47
|
0
|
|
|
|
|
0
|
system qw( git reset --hard HEAD ); |
48
|
0
|
|
|
|
|
0
|
chdir '..'; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub ACTION_devclean { |
52
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
53
|
0
|
|
|
|
|
0
|
reset_src; |
54
|
0
|
|
|
|
|
0
|
$self->ACTION_clean; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub ACTION_devrealclean { |
58
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
59
|
0
|
|
|
|
|
0
|
reset_src; |
60
|
0
|
|
|
|
|
0
|
$self->ACTION_realclean; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# This one's an author action, so I assume they have git and have properly |
64
|
|
|
|
|
|
|
# configured. |
65
|
|
|
|
|
|
|
sub ACTION_dist { |
66
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
67
|
0
|
|
|
|
|
0
|
reset_src; |
68
|
0
|
|
|
|
|
0
|
$self->SUPER::ACTION_dist; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# This one's an author action, so I assume they have git and have properly |
72
|
|
|
|
|
|
|
# configured. |
73
|
|
|
|
|
|
|
sub ACTION_distdir { |
74
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
75
|
0
|
|
|
|
|
0
|
reset_src; |
76
|
0
|
|
|
|
|
0
|
$self->SUPER::ACTION_distdir; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# This one's an author action, so I assume they have git and have properly |
80
|
|
|
|
|
|
|
# configured. |
81
|
|
|
|
|
|
|
sub ACTION_disttest { |
82
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
83
|
0
|
|
|
|
|
0
|
reset_src; |
84
|
0
|
|
|
|
|
0
|
$self->SUPER::ACTION_disttest; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub apply_patches { |
88
|
81
|
|
|
81
|
0
|
942620
|
my ($filename, @patches) = @_; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# make the file read-write (and executable, but that doesn't matter) |
91
|
81
|
|
|
|
|
3991
|
chmod 0700, $filename; |
92
|
|
|
|
|
|
|
|
93
|
81
|
50
|
|
|
|
4121
|
open my $in_fh, '<', $filename |
94
|
|
|
|
|
|
|
or die "Unable to open $filename for patching!"; |
95
|
81
|
50
|
|
|
|
9598
|
open my $out_fh, '>', "$filename.new" |
96
|
|
|
|
|
|
|
or die "Unable to open $filename.new for patching!"; |
97
|
81
|
|
|
|
|
1460
|
LINE: while (my $line = <$in_fh>) { |
98
|
|
|
|
|
|
|
# Apply each basic test regex, and call the function if it matches |
99
|
3091
|
|
|
|
|
5410
|
for (my $i = 0; $i < @patches; $i += 2) { |
100
|
6063
|
100
|
|
|
|
23215
|
if ($line =~ $patches[$i]) { |
101
|
71
|
|
|
|
|
393
|
my $next_line = $patches[$i+1]->($in_fh, $out_fh, $line); |
102
|
71
|
100
|
|
|
|
1294
|
next LINE if $next_line; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
} |
105
|
3087
|
|
|
|
|
8582
|
print $out_fh $line; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
81
|
|
|
|
|
785
|
close $in_fh; |
109
|
81
|
|
|
|
|
4741
|
close $out_fh; |
110
|
81
|
|
|
|
|
7665
|
unlink $filename; |
111
|
81
|
|
|
|
|
4952
|
rename "$filename.new" => $filename; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# make sure it's executable; we may be patching ./configure |
114
|
81
|
|
|
|
|
2222
|
chmod 0700, $filename; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |