5 use ExtUtils::MakeMaker;
11 my ($name, $preferred_path) = @_;
13 my (@candidates, @args);
14 if (File::Spec->file_name_is_absolute($name)) {
15 # No need to look for args if the name is absolute.
19 if (defined $preferred_path) {
20 @path = ($preferred_path, grep { $_ ne $preferred_path } File::Spec->path);
22 @path = File::Spec->path;
25 (my $base, @args) = split ' ', $name;
26 for my $path_entry (@path) {
27 my ($vol, $dir, $file) = File::Spec->splitpath($path_entry, 1);
28 next if defined $file and length $file;
29 push @candidates, File::Spec->catpath($vol, $dir, $base);
33 for my $path (@candidates) {
34 my $command = MM->maybe_command($path);
35 if (defined $command) {
36 $command .= " @args" if @args;
47 my $desc = delete $args{desc};
48 my $arg_var = delete $args{arg_var};
49 my $tries = delete $args{try};
50 my $preferred_path = delete $args{preferred_path};
55 if (/^\Q$arg_var\E=(.*)/) {
56 $exe = validate_exe($1, $preferred_path);
62 print "Forcing the use of $exe as the $desc.\n";
64 print "Checking for a valid $desc in the PATH... ";
65 for my $try (@$tries) {
66 next unless defined $try;
67 $exe = validate_exe($try, $preferred_path);
85 try => [ $Config{cc}, $ENV{CC}, 'cc' ],
88 my ($vol, $dir, $file) = File::Spec->splitpath($cc);
89 my $preferred_path = File::Spec->catpath($vol, $dir, '');
93 try => [ $Config{ld}, $ENV{LD}, 'ld' ],
94 preferred_path => $preferred_path,
97 my $xs = 'Valgrind.xs';
98 (my $c = $xs) =~ s/\.xs$/.c/;
99 my $opt = $Config{optimize};
103 $PARAMS{XS} = { $xs => $c };
106 $PARAMS{OPTIMIZE} = $opt;
110 unless ($PARAMS{C}) {
113 $PARAMS{OBJECT} = '';
116 my $dist = 'Test-Valgrind';
118 (my $name = $dist) =~ s{-}{::}g;
120 (my $file = $dist) =~ s{-}{/}g;
121 $file = "lib/$file.pm";
126 'Env::Sanctify' => 0,
127 'File::HomeDir' => '0.86',
130 'File::Temp' => '0.14', # OO interface
131 'Filter::Util::Call' => 0,
135 'Perl::Destruct::Level' => 0,
137 'Test::Builder' => 0,
144 my %CONFIGURE_REQUIRES = (
146 'ExtUtils::MakeMaker' => 0,
150 my %BUILD_REQUIRES = (
160 configure_requires => {
172 bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
173 homepage => "http://search.cpan.org/dist/$dist/",
174 license => 'http://dev.perl.org/licenses/',
175 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
181 AUTHOR => 'Vincent Pit <perl@profvince.com>',
183 VERSION_FROM => $file,
184 ABSTRACT_FROM => $file,
185 BUILD_REQUIRES => \%BUILD_REQUIRES,
186 PREREQ_PM => \%PREREQ_PM,
187 MIN_PERL_VERSION => '5.006',
188 META_MERGE => \%META,
190 PREOP => "pod2text -u $file > \$(DISTVNAME)/README",
191 COMPRESS => 'gzip -9f', SUFFIX => 'gz',
194 FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt*"