The real fix for RT#73402 (abaondon tie %^H entirely), FC++
[p5sagit/namespace-clean.git] / Makefile.PL
CommitLineData
fa84e425 1use strict;
2use warnings;
3use 5.008001;
4
5use ExtUtils::MakeMaker;
6
7my $mymeta_works = eval { ExtUtils::MakeMaker->VERSION('6.5707'); 1 };
8my $mymeta = $mymeta_works || eval { ExtUtils::MakeMaker->VERSION('6.5702'); 1 };
9
10my %BUILD_DEPS = (
11 'Test::More' => '0.88',
12);
13
14my %RUN_DEPS = (
15 'Package::Stash' => '0.23',
fa84e425 16);
17
4e908301 18my %OPT_RUN_DEPS = (can_cc() ? (
b3279c1c 19 'B::Hooks::EndOfScope' => '0.07', # when changing, also change $b_h_eos_req in namespace/clean.pm
20
21 # these pieces are needed if using the debugger on the perl range
22 ($] > 5.008_008_9 && $] < 5.013_006_1)
23 ? ( 'Sub::Name' => '0.04', 'Sub::Identify' => '0.04' ) # when changing, also change $sn_ver and $si_ver in namespace/clean.pm
24 : ()
25 ,
26
27 # make sure we smoke the pure-perl version
28 is_smoker() ? ( 'Devel::Hide' => 0 ) : (),
4e908301 29) : () );
30
fa84e425 31my %META_BITS = (
32 resources => {
33 homepage => 'http://search.cpan.org/dist/namespace-clean',
34
35 # EUMM not supporting nested meta :(
36 #repository => {
37 # type => 'git',
842fcd09 38 # url => 'git://git.shadowcat.co.uk/p5sagit/namespace-clean.git',
fa84e425 39 # web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/namespace-clean.git',
40 #}
41 #bugtracker => {
42 # mailto => 'bug-namespace-clean@rt.cpan.org',
43 # web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean',
44 #},
45
842fcd09 46 repository => 'git://git.shadowcat.co.uk/p5sagit/namespace-clean.git',
fa84e425 47 bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean',
48 },
49);
50
51my %WriteMakefileArgs = (
52 'NAME' => 'namespace::clean',
53 'VERSION_FROM' => 'lib/namespace/clean.pm',
54 'ABSTRACT' => 'Keep imports and functions out of your namespace',
55 'AUTHOR' => 'Robert \'phaylon\' Sedlacek <rs@474.at>, Florian Ragwitz <rafl@debian.org>, Jesse Luehrs <doy@tozt.net>',
56
57 'PREREQ_PM' => {
4e908301 58 %RUN_DEPS, %OPT_RUN_DEPS,
fa84e425 59 $mymeta_works ? () : (%BUILD_DEPS),
60 },
61
62 $mymeta_works
63 ? ( # BUILD_REQUIRES makes MYMETA right, requires stops META being wrong
64 'BUILD_REQUIRES' => \%BUILD_DEPS,
65 'META_ADD' => {
66 %META_BITS,
67 requires => \%RUN_DEPS,
68 },
69 )
70 : ( # META_ADD both to get META right - only Makefile written
71 'META_ADD' => {
72 %META_BITS,
73 requires => \%RUN_DEPS,
74 build_requires => \%BUILD_DEPS,
75 },
76 )
77 ,
78
79 ($mymeta and !$mymeta_works) ? ( 'NO_MYMETA' => 1 ) : (),
80
81 'LICENSE' => 'perl',
82);
83
84
85unless ( eval { ExtUtils::MakeMaker->VERSION('6.56') } ) {
86 my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
87 my $pp = $WriteMakefileArgs{PREREQ_PM};
88 for my $mod ( keys %$br ) {
89 if ( exists $pp->{$mod} ) {
90 $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
91 }
92 else {
93 $pp->{$mod} = $br->{$mod};
94 }
95 }
96}
97
98delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
99 unless eval { ExtUtils::MakeMaker->VERSION('6.52') };
100
101WriteMakefile(%WriteMakefileArgs);
102
103
104# can we locate a (the) C compiler
105sub can_cc {
106 my @chunks = split(/ /, $Config::Config{cc}) or return;
107
108 # $Config{cc} may contain args; try to find out the program part
109 while (@chunks) {
110 return can_run("@chunks") || (pop(@chunks), next);
111 }
112
113 return;
114}
115
116# check if we can run some command
117sub can_run {
118 my ($cmd) = @_;
119
120 return $cmd if -x $cmd;
121 if (my $found_cmd = MM->maybe_command($cmd)) {
122 return $found_cmd;
123 }
124
125 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
126 next if $dir eq '';
127 my $abs = File::Spec->catfile($dir, $cmd);
128 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
129 }
130
131 return;
132}
133
134sub is_smoker {
135 return ( $ENV{AUTOMATED_TESTING} && ! $ENV{PERL5_CPANM_IS_RUNNING} && ! $ENV{RELEASE_TESTING} )
136}