line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::Mkbootstrap; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
45904
|
use strict; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
168
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '7.70'; |
7
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require Exporter; |
10
|
|
|
|
|
|
|
our @ISA = ('Exporter'); |
11
|
|
|
|
|
|
|
our @EXPORT = ('&Mkbootstrap'); |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
12
|
use Config; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
360
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $Verbose = 0; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub Mkbootstrap { |
19
|
7
|
|
|
7
|
0
|
7672
|
my($baseext, @bsloadlibs)=@_; |
20
|
7
|
|
|
|
|
22
|
@bsloadlibs = grep($_, @bsloadlibs); # strip empty libs |
21
|
|
|
|
|
|
|
|
22
|
7
|
100
|
|
|
|
38
|
print " bsloadlibs=@bsloadlibs\n" if $Verbose; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# We need DynaLoader here because we and/or the *_BS file may |
25
|
|
|
|
|
|
|
# call dl_findfile(). We don't say `use' here because when |
26
|
|
|
|
|
|
|
# first building perl extensions the DynaLoader will not have |
27
|
|
|
|
|
|
|
# been built when MakeMaker gets first used. |
28
|
7
|
|
|
|
|
66
|
require DynaLoader; |
29
|
|
|
|
|
|
|
|
30
|
7
|
100
|
|
|
|
168
|
rename "$baseext.bs", "$baseext.bso" |
31
|
|
|
|
|
|
|
if -s "$baseext.bs"; |
32
|
|
|
|
|
|
|
|
33
|
7
|
100
|
|
|
|
111
|
if (-f "${baseext}_BS"){ |
34
|
1
|
|
|
|
|
5
|
$_ = "${baseext}_BS"; |
35
|
|
|
|
|
|
|
package DynaLoader; # execute code as if in DynaLoader |
36
|
2
|
|
|
2
|
|
14
|
no strict 'vars'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
288
|
|
37
|
1
|
|
|
|
|
4
|
local($osname, $dlsrc) = (); # avoid warnings |
38
|
1
|
|
|
|
|
14
|
($osname, $dlsrc) = @Config::Config{qw(osname dlsrc)}; |
39
|
1
|
|
|
|
|
6
|
$bscode = ""; |
40
|
1
|
|
|
|
|
3
|
unshift @INC, "."; |
41
|
1
|
|
|
|
|
210
|
require $_; |
42
|
1
|
|
|
|
|
15
|
shift @INC; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
7
|
50
|
|
|
|
84
|
if ($Config{'dlsrc'} =~ /^dl_dld/){ |
46
|
|
|
|
|
|
|
package DynaLoader; |
47
|
2
|
|
|
2
|
|
14
|
no strict 'vars'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
764
|
|
48
|
0
|
|
|
|
|
0
|
push(@dl_resolve_using, dl_findfile('-lc')); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
7
|
|
|
|
|
24
|
my(@all) = (@bsloadlibs, @DynaLoader::dl_resolve_using); |
52
|
7
|
|
|
|
|
14
|
my($method) = ''; |
53
|
7
|
100
|
66
|
|
|
43
|
if (@all || (defined $DynaLoader::bscode && length $DynaLoader::bscode)){ |
|
|
|
100
|
|
|
|
|
54
|
3
|
50
|
|
|
|
177
|
open my $bs, ">", "$baseext.bs" |
55
|
|
|
|
|
|
|
or die "Unable to open $baseext.bs: $!"; |
56
|
3
|
|
|
|
|
21
|
print "Writing $baseext.bs\n"; |
57
|
3
|
100
|
|
|
|
31
|
print " containing: @all" if $Verbose; |
58
|
3
|
|
|
|
|
40
|
print $bs "# $baseext DynaLoader bootstrap file for $^O architecture.\n"; |
59
|
3
|
|
|
|
|
10
|
print $bs "# Do not edit this file, changes will be lost.\n"; |
60
|
3
|
|
|
|
|
29
|
print $bs "# This file was automatically generated by the\n"; |
61
|
3
|
|
|
|
|
12
|
print $bs "# Mkbootstrap routine in ExtUtils::Mkbootstrap (v$VERSION).\n"; |
62
|
3
|
50
|
|
|
|
8
|
if (@all) { |
63
|
3
|
|
|
|
|
6
|
print $bs "\@DynaLoader::dl_resolve_using = "; |
64
|
|
|
|
|
|
|
# If @all contains names in the form -lxxx or -Lxxx then it's asking for |
65
|
|
|
|
|
|
|
# runtime library location so we automatically add a call to dl_findfile() |
66
|
3
|
100
|
|
|
|
17
|
if (" @all" =~ m/ -[lLR]/){ |
67
|
1
|
|
|
|
|
4
|
print $bs " dl_findfile(qw(\n @all\n ));\n"; |
68
|
|
|
|
|
|
|
} else { |
69
|
2
|
|
|
|
|
7
|
print $bs " qw(@all);\n"; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
# write extra code if *_BS says so |
73
|
3
|
100
|
|
|
|
8
|
print $bs $DynaLoader::bscode if $DynaLoader::bscode; |
74
|
3
|
|
|
|
|
36
|
print $bs "\n1;\n"; |
75
|
3
|
|
|
|
|
250
|
close $bs; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 NAME |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
ExtUtils::Mkbootstrap - make a bootstrap file for use by DynaLoader |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 SYNOPSIS |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Mkbootstrap |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DESCRIPTION |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Mkbootstrap typically gets called from an extension Makefile. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
There is no C<*.bs> file supplied with the extension. Instead, there may |
96
|
|
|
|
|
|
|
be a C<*_BS> file which has code for the special cases, like posix for |
97
|
|
|
|
|
|
|
berkeley db on the NeXT. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This file will get parsed, and produce a maybe empty |
100
|
|
|
|
|
|
|
C<@DynaLoader::dl_resolve_using> array for the current architecture. |
101
|
|
|
|
|
|
|
That will be extended by $BSLOADLIBS, which was computed by |
102
|
|
|
|
|
|
|
ExtUtils::Liblist::ext(). If this array still is empty, we do nothing, |
103
|
|
|
|
|
|
|
else we write a .bs file with an C<@DynaLoader::dl_resolve_using> |
104
|
|
|
|
|
|
|
array. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
The C<*_BS> file can put some code into the generated C<*.bs> file by |
107
|
|
|
|
|
|
|
placing it in C<$bscode>. This is a handy 'escape' mechanism that may |
108
|
|
|
|
|
|
|
prove useful in complex situations. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
If @DynaLoader::dl_resolve_using contains C<-L*> or C<-l*> entries then |
111
|
|
|
|
|
|
|
Mkbootstrap will automatically add a dl_findfile() call to the |
112
|
|
|
|
|
|
|
generated C<*.bs> file. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |