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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
{ use 5.006; }
use warnings;
use strict;
use Module::Build;
Module::Build->subclass(code => q{
unless(__PACKAGE__->can("cbuilder")) {
*cbuilder = sub { $_[0]->_cbuilder or die "no C support" };
}
sub link_c {
no strict "refs";
my($self, $spec) = @_;
my $cb = $self->cbuilder;
my $cbclass = ref($cb);
my $orig_cb_prelink = $cb->can("prelink");
local *{"${cbclass}::prelink"} = sub {
use strict "refs";
my($self, %args) = @_;
if($args{dl_name} eq "Devel::CallChecker") {
$args{dl_func_list} = [
@{$args{dl_func_list}||[]},
("$]" >= 5.013006 ? () : qw(
xAd8NP3gxZglovQRL5Hn_roc0
xAd8NP3gxZglovQRL5Hn_eal0
xAd8NP3gxZglovQRL5Hn_eap0
xAd8NP3gxZglovQRL5Hn_ean0
xAd8NP3gxZglovQRL5Hn_gcc0
xAd8NP3gxZglovQRL5Hn_scc0
)),
];
$args{dl_funcs} ||= {};
my $pname = $args{dl_name};
unless(exists $args{dl_funcs}->{$pname}) {
$args{dl_funcs} = {
%{$args{dl_funcs}},
$pname => [],
};
}
}
@_ = ($self, %args);
goto &$orig_cb_prelink;
};
my($libfile, $impfile);
if($^O eq "MSWin32") {
my $dlext = $cb->{config}->{dlext};
my $libext = $cb->{config}->{lib_ext};
$libfile = $spec->{lib_file};
($impfile = $libfile) =~ s/\.\Q$dlext\E\z/$libext/
or die "can't generate import library name";
unlink $libfile, $impfile
unless $self->up_to_date($libfile, $impfile);
}
my $orig_cb_flk = $cb->can("format_linker_cmd");
local *{"${cbclass}::format_linker_cmd"} = sub {
use strict "refs";
my($self, %spec) = @_;
my @cmds = &$orig_cb_flk;
my $cf = $self->{config};
my $norm_libfile = $libfile;
my $norm_impfile = $impfile;
$self->normalize_filespecs(
\$norm_libfile, \$norm_impfile);
push @cmds, [
$cf->{dlltool} || "dlltool",
"--def", $spec{def_file},
"--output-lib", $norm_impfile,
"--dllname", $spec{basename}.".".$cf->{dlext},
$spec{output},
] if $spec{output} eq $norm_libfile;
return @cmds;
} if $cb->isa("ExtUtils::CBuilder::Platform::Windows::GCC");
$self->SUPER::link_c($spec);
if($^O eq "MSWin32") {
die "failed to generate import library"
unless -e $impfile;
$self->add_to_cleanup($impfile);
}
}
})->new(
module_name => "Devel::CallChecker",
license => "perl",
configure_requires => {
"Module::Build" => 0,
"perl" => "5.006",
"strict" => 0,
"warnings" => 0,
},
build_requires => {
"DynaLoader" => 0,
"ExtUtils::CBuilder" => "0.15",
"ExtUtils::ParseXS" => 0,
"File::Spec" => 0,
"IO::File" => "1.03",
"Module::Build" => 0,
"Test::More" => 0,
"perl" => "5.006",
"strict" => 0,
"warnings" => 0,
},
requires => {
"DynaLoader" => 0,
"DynaLoader::Functions" => "0.001",
"Exporter" => 0,
"parent" => 0,
"perl" => "5.006",
"strict" => 0,
"warnings" => 0,
},
conflicts => {
"B::Hooks::OP::Check" => "< 0.19",
},
dynamic_config => 0,
meta_add => { distribution_type => "module" },
meta_merge => {
"meta-spec" => { version => "2" },
resources => {
bugtracker => {
mailto => "bug-Devel-CallChecker\@rt.cpan.org",
web => "https://rt.cpan.org/Public/Dist/".
"Display.html?Name=Devel-CallChecker",
},
},
},
sign => 1,
)->create_build_script;
1;
|