Devel-NYTProf

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    if $opt_gettime;
push @hdr_match_lib, ['zlib.h', qr/(deflateInit2)(?:_)?\s*\(/, '-DHAS_ZLIB',     '-lz']
    if $opt_zlib;
push @hdr_match_lib, ['mach_time.h', qr/(mach_absolute_time)\s*\(/, '-DHAS_MACH_TIME', undef]
    if $opt_machtime and $^O eq 'darwin';

foreach (@hdr_match_lib) {
    my ($header, $regexp, $define, $libs) = @$_;
    if (my $result = search_h_file($header, $regexp)) {
        print "Found $result in $header\n";
        push @libs, $libs if $libs;
        $mm_opts{DEFINE} .= " $define" if $define;
    }
}

if ($opt_assert or (not defined $opt_assert and $is_developer)) {
    warn "Assertion testing enabled\n";
    $mm_opts{DEFINE} .= " -DUSE_HARD_ASSERT";
}

if ($ENV{NYTP_MAX_SUB_NAME_LEN}) {
    $mm_opts{DEFINE} .= " -DNYTP_MAX_SUB_NAME_LEN=$ENV{NYTP_MAX_SUB_NAME_LEN}";
}

$mm_opts{LICENSE}  = 'perl' if $ExtUtils::MakeMaker::VERSION >= 6.3002;
$mm_opts{OPTIMIZE} = '-g'   if $opt_g;
$mm_opts{CCFLAGS}  = "-pg"  if $opt_pg;

if( $ExtUtils::MakeMaker::VERSION >= 6.46 ) {
    $mm_opts{META_MERGE} = {
        "meta-spec" => { version => 2 },
        no_index => {
            package => [ 'SVG' ], # in bin/flamegraph.pl
        },
        resources => {
            license     => 'http://dev.perl.org/licenses/',
            homepage    => 'https://code.google.com/p/perl-devel-nytprof/',
            bugtracker  => {
                web    => 'https://github.com/timbunce/devel-nytprof/issues',
            },
            repository  => {
                url  => 'https://github.com/timbunce/devel-nytprof.git',
                web  => 'https://github.com/timbunce/devel-nytprof',
                type => 'git',
            },
            # not a valid key:
            MailingList => 'http://groups.google.com/group/develnytprof-dev',
        }
    }
}

$mm_opts{PREREQ_PM} = {
    'List::Util'   => 0,
    'File::Which'  => '1.09',
    'XSLoader'     => 0,
    'Getopt::Long' => 0,
    'JSON::MaybeXS' => 0,
};
$mm_opts{TEST_REQUIRES} = {
    'Test::More'   => '0.84',
    'Test::Differences' => '0.60',
    'Capture::Tiny' => 0,
    'Sub::Name' => '0.11',
};

$mm_opts{BUILD_REQUIRES} = {
    %{$mm_opts{BUILD_REQUIRES} || {}},
    %{delete $mm_opts{TEST_REQUIRES}}
} if $ExtUtils::MakeMaker::VERSION < 6.63_03;

$mm_opts{PREREQ_PM} = {
    %{$mm_opts{PREREQ_PM}},
    %{delete $mm_opts{BUILD_REQUIRES}}
} if $ExtUtils::MakeMaker::VERSION < 6.55_01;


if (my $gccversion = $Config{gccversion}) {    # ask gcc to be more pedantic
    print "Your perl was compiled with gcc (version $Config{gccversion}), okay.\n";
    $gccversion =~ s/[^\d\.]//g;               # just a number please
    $mm_opts{DEFINE} .= ' -W -Wall -Wpointer-arith';
    $mm_opts{DEFINE} .= ' -Wno-comment -Wno-sign-compare -Wno-cast-qual';
    $mm_opts{DEFINE} .= ' -Wmissing-noreturn -Wno-unused-parameter' if $gccversion ge "3.0";
    if ($is_developer && $opt_g) {
        $mm_opts{DEFINE} .= ' -DPERL_GCC_PEDANTIC -ansi -pedantic' if $gccversion ge "3.0";
        $mm_opts{DEFINE} .= ' -Wdisabled-optimization -Wformat'    if $gccversion ge "3.0";
        $mm_opts{DEFINE} .= ' -Wmissing-prototypes';
    }
}


WriteMakefile(
    NAME          => 'Devel::NYTProf',
    VERSION_FROM  => 'lib/Devel/NYTProf/Core.pm',    # finds $VERSION
    ABSTRACT_FROM => 'lib/Devel/NYTProf.pm',         # retrieve abstract from module
    AUTHOR    => 'Tim Bunce <timb@cpan.org>',
    LICENSE => 'perl',
    LIBS      => [join ' ', @libs],
    OBJECT    => q/$(O_FILES)/,
    FUNCLIST => ['boot_Devel__NYTProf', 'boot_Devel__NYTProf__FileHandle'],
    EXE_FILES => ['bin/nytprofhtml', 'bin/flamegraph.pl', 'bin/nytprofcsv', 'bin/nytprofcalls', 'bin/nytprofcg', 'bin/nytprofmerge'],
    @man,
    INC   => $INCLUDE,
    clean => {
        FILES => join(" ",
            "nytprof demo-out",
            map { ("t/$_", "xt/$_") } qw(
                nytprof nytprof*.out *_outdir test*.*_new auto *.rdt_newp
            ))
    },
    dist  => {
        DIST_DEFAULT => 'clean distcheck disttest_author tardist',
        PREOP        => '$(MAKE) -f Makefile.old distdir',
        COMPRESS     => 'gzip -v9',
        SUFFIX       => 'gz',
    },
    %mm_opts,
);

exit 0;

# --- Utility functions ---



( run in 3.708 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )