6 name => 'namespace-clean',
9 abstract => 'Keep imports and functions out of your namespace',
11 'Robert \'phaylon\' Sedlacek <rs@474.at>',
12 'Florian Ragwitz <rafl@debian.org>',
13 'Jesse Luehrs <doy@tozt.net>',
14 'Peter Rabbitson <ribasushi@cpan.org>',
15 'Father Chrysostomos <sprout@cpan.org>',
21 'ExtUtils::MakeMaker' => 0,
22 'ExtUtils::CBuilder' => 0.27,
27 'Package::Stash' => '0.23',
28 'B::Hooks::EndOfScope' => '0.12',
34 'Test::More' => '0.88',
40 x_IRC => 'irc://irc.perl.org/#toolchain',
41 homepage => 'http://search.cpan.org/dist/namespace-clean',
44 url => 'git://git.shadowcat.co.uk/p5sagit/namespace-clean.git',
45 web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/namespace-clean.git',
48 mailto => 'bug-namespace-clean@rt.cpan.org',
49 web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean',
55 # a sub-namer is needed if using the debugger on some perls
56 require 'lib/namespace/clean/_Util.pm'
58 namespace::clean::_Util::DEBUGGER_NEEDS_CV_RENAME()
60 namespace::clean::_Util::_namer_load_error()
64 # when changing version, also change $sn_ver in namespace/clean/_Util.pm
65 ? ( PREREQ_PM => { 'Sub::Name' => '0.04' } )
70 ## BOILERPLATE ###############################################################
71 require ExtUtils::MakeMaker;
73 # have to do this since old EUMM dev releases miss the eval $VERSION line
74 my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
75 my $mymeta = $eumm_version >= 6.57_02;
76 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
78 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
79 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
80 $META{license} = [ $META{license} ]
81 if $META{license} && !ref $META{license};
82 $MM_ARGS{LICENSE} = $META{license}[0]
83 if $META{license} && $eumm_version >= 6.30;
84 $MM_ARGS{NO_MYMETA} = 1
86 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
89 for (qw(configure build test runtime)) {
90 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
91 my $r = $MM_ARGS{$key} = {
92 %{$META{prereqs}{$_}{requires} || {}},
93 %{delete $MM_ARGS{$key} || {}},
95 defined $r->{$_} or delete $r->{$_} for keys %$r;
98 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
100 delete $MM_ARGS{MIN_PERL_VERSION}
101 if $eumm_version < 6.47_01;
102 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
103 if $eumm_version < 6.63_03;
104 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
105 if $eumm_version < 6.55_01;
106 delete $MM_ARGS{CONFIGURE_REQUIRES}
107 if $eumm_version < 6.51_03;
109 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
110 ## END BOILERPLATE ###########################################################
114 # Need to replace with EU::HC, but too many changes for this release already
115 ###########################################
116 # can we locate a (the) C compiler
118 my @chunks = split(/ /, $Config::Config{cc}) or return;
120 # $Config{cc} may contain args; try to find out the program part
122 return can_run("@chunks") || (pop(@chunks), next);
128 # check if we can run some command
132 return $cmd if -x $cmd;
133 if (my $found_cmd = MM->maybe_command($cmd)) {
138 for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
140 my $abs = File::Spec->catfile($dir, $cmd);
141 return $abs if (-x $abs or $abs = MM->maybe_command($abs));
147 # Can our C compiler environment build XS files
149 # Do we have the configure_requires checker?
151 eval "require ExtUtils::CBuilder; ExtUtils::CBuilder->VERSION(0.27)";
153 # They don't obey configure_requires, so it is
154 # someone old and delicate. Try to avoid hurting
155 # them by falling back to an older simpler test.
159 # Do we have a working C compiler
160 my $builder = ExtUtils::CBuilder->new(
163 unless ( $builder->have_compiler ) {
164 # No working C compiler
168 # Write a C file representative of what XS becomes
170 my ( $FH, $tmpfile ) = File::Temp::tempfile(
180 int main(int argc, char **argv) {
191 # Can the C compiler access the same headers XS does
196 $object = $builder->compile(
199 @libs = $builder->link(
201 module_name => 'sanexs',
204 my $result = $@ ? 0 : 1;
206 # Clean up all the build files
207 foreach ( $tmpfile, $object, @libs ) {
208 next unless defined $_;