make leaktest/leakcheck enabled and executed
[Data-Peek.git] / Makefile.PL
blobe248d815333af3fc7f007acc61964ed2fa6571cf
1 #!/usr/bin/perl
3 # Copyright PROCURA B.V. (c) 2008-2008 H.Merijn Brand
5 require 5.006; # <- also see postamble at the bottom for META.yml
6 use strict;
8 use ExtUtils::MakeMaker;
10 my %wm = (
11 NAME => "Data::Peek",
12 ABSTRACT => "Extended/Modified debugging utilities",
13 AUTHOR => "H.Merijn Brand <h.merijn\@xs4all.nl>",
14 VERSION_FROM => "Peek.pm",
15 PREREQ_PM => { "DynaLoader" => 0,
16 "Data::Dumper" => 0,
17 "Test::More" => 0,
18 "Test::Harness" => 0,
20 clean => { FILES => join " ", qw(
21 Peek.c.gcov
22 Peek.gcda
23 Peek.gcno
24 Peek.xs.gcov
25 cover_db
26 valgrind.log
30 $ExtUtils::MakeMaker::VERSION > 6.30 and $wm{LICENSE} = "perl";
32 unless (exists $ENV{AUTOMATED_TESTING} and $ENV{AUTOMATED_TESTING} == 1) {
33 if (prompt ("Do you want to install module DP as a shortcut for Data::Peek ?", "y") =~ m/[yY]/) {
34 local $/;
35 open my $pm, "<", "Peek.pm" or die "CAnnot read Peek.pm: $!\n";
36 my $vsn = do { <$pm> =~ m/^\$VERSION\s*=\s*"([0-9._]+)/m; $1 };
37 close $pm;
39 (my $dp = <DATA>) =~ s/::VERSION::/"$vsn"/;
40 open my $fh, ">", "DP.pm" or die "Cannot open DP.pm: $!\n";
41 print $fh $dp;
42 close $fh;
43 $wm{PM} = {
44 "Peek.pm" => '$(INST_LIB)/Data/Peek.pm',
45 "DP.pm" => '$(INST_LIB)/DP.pm',
47 $wm{clean}{FILES} .= " DP.pm";
51 $ENV{NO_SV_PEEK} and $wm{DEFINE} = "-DNO_SV_PEEK";
53 my $rv = WriteMakefile (%wm);
57 package MY;
59 sub postamble
61 my $valgrind = join " ", qw(
62 PERL_DESTRUCT_LEVEL=2 PERL_DL_NONLAZY=1
63 valgrind
64 --suppressions=sandbox/perl.supp
65 --leak-check=yes
66 --leak-resolution=high
67 --show-reachable=yes
68 --num-callers=50
69 --log-fd=3
70 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e"
71 "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"
72 $(TEST_FILES) 3>valgrind.log
75 my $min_vsn = ($] >= 5.010 && -d "xt" && ($ENV{AUTOMATED_TESTING} || 0) != 1)
76 ? join "\n" =>
77 'test ::',
78 ' -@env TEST_FILES="xt/*.t" make -e test_dynamic',
80 : "";
81 join "\n" =>
82 'cover test_cover:',
83 ' ccache -C',
84 ' cover -test',
85 '',
86 'leakcheck:',
87 " $valgrind",
88 ' -@tail -5 valgrind.log',
89 '',
90 'leaktest:',
91 q{ sandbox/leaktest $(FULLPERLRUN) "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)},
92 '',
93 'checkmeta:',
94 ' perl sandbox/genMETA.pl -c',
95 '',
96 'fixmeta: distmeta',
97 ' perl sandbox/genMETA.pl',
98 '',
99 'tgzdist: checkmeta fixmeta $(DISTVNAME).tar.gz distcheck',
100 ' -@mv -f $(DISTVNAME).tar.gz $(DISTVNAME).tgz',
101 ' -@cpants_lint.pl $(DISTVNAME).tgz',
102 ' -@rm -f Debian_CPANTS.txt',
104 $min_vsn;
105 } # postamble
107 __END__
108 use Data::Peek;
110 BEGIN { *DP:: = \%Data::Peek:: }
111 $VERSION = ::VERSION::;
115 =head1 NAME
117 DP - Alias for Data::Peek
119 =head1 SYNOPSIS
121 perl -MDP -wle'print DPeek for DDual ($?, 1)'
123 =head1 DESCRIPTION
125 See L<Data::Peek>.
127 =head1 AUTHOR
129 H.Merijn Brand <h.m.brand@xs4all.nl>
131 =head1 COPYRIGHT AND LICENSE
133 Copyright (C) 2008-2008 H.Merijn Brand
135 This library is free software; you can redistribute it and/or modify it
136 under the same terms as Perl itself.
138 =cut