summaryrefslogtreecommitdiffstats
path: root/inc/MakeMaker.pm
blob: 20185671bb7e4322d4329030b2c7ad44e7d64b19 (plain) (blame)
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
package inc::MakeMaker;
use Moose;

extends 'Dist::Zilla::Plugin::MakeMaker::Awesome';

around _build_MakeFile_PL_template => sub {
    my $orig = shift;
    my $self = shift;
    my $tmpl = $self->$orig;
    my $extra = <<'EXTRA';
use Config;
use Devel::CallParser 'callparser1_h', 'callparser_linkable';
open my $fh, '>', 'callparser1.h' or die "Couldn't write to callparser1.h";
$fh->print(callparser1_h);
my @linkable = callparser_linkable;
unshift @linkable, "Keyword$Config{obj_ext}" if @linkable;
$WriteMakefileArgs{OBJECT} = join(' ', @linkable) if @linkable;
EXTRA
    $tmpl =~ s/^(WriteMakefile\()/$extra\n$1/m
        or die "Couldn't fix template";
    return $tmpl;
};

__PACKAGE__->meta->make_immutable;
no Moose;

1;