dep on the xs implementation of package-stash explicitly
[gitmo/Class-MOP.git] / Makefile.PL
CommitLineData
591a9381 1use strict;
2use warnings;
89dc39a9 3use inc::Module::Install;
42d5274b 4use Module::Install::AuthorRequires;
3ba545a6 5use Module::Install::ExtraTests;
89dc39a9 6use 5.008001;
7
1a2f7db5 8check_conflicts();
9
89dc39a9 10name 'Class-MOP';
11perl_version '5.008001';
12all_from 'lib/Class/MOP.pm';
13license 'perl';
591a9381 14
72bc0a47 15require Config;
16my $ccflags = ( $Config::Config{ccflags} || '' ) . ' -I.';
06e9254b 17
18if ( -d '.git' || $ENV{MAINTAINER_MODE} ) {
19 $ccflags .= ' -Wall -Wdeclaration-after-statement';
20}
f125b31e 21
89dc39a9 22requires 'Carp';
4154c4d0 23requires 'Data::OptList';
89dc39a9 24requires 'Devel::GlobalDestruction';
d65739b4 25requires 'List::MoreUtils' => '0.12';
26requires 'MRO::Compat' => '0.05';
103ad105 27requires 'Package::DeprecationManager' => '0.10';
ddfac3c0 28requires 'Package::Stash' => '0.15';
29requires 'Package::Stash::XS' => '0.17';
d65739b4 30requires 'Scalar::Util' => '1.18';
e59e2f13 31requires 'Sub::Name' => '0.05';
d65739b4 32requires 'Try::Tiny' => '0.02';
89dc39a9 33requires 'Task::Weaken';
34
35test_requires 'File::Spec';
d65739b4 36test_requires 'Test::More' => '0.88';
37test_requires 'Test::Fatal' => '0.001';
38test_requires 'Test::Requires' => '0.05';
89dc39a9 39
42d5274b 40author_requires 'Algorithm::C3';
41author_requires 'Module::Info';
42author_requires 'Test::LeakTrace';
43author_requires 'Test::NoTabs';
44author_requires 'Test::Output';
45author_requires 'Test::Spelling';
46
8c463274 47repository 'git://git.moose.perl.org/Class-MOP.git';
6b951296 48add_metadata(x_authority => 'cpan:STEVAN');
8c463274 49
3fd3a2ab 50extra_tests();
51
89dc39a9 52makemaker_args( CCFLAGS => $ccflags );
53
d846ade3 54{
55 my (@clean, @OBJECT, %XS);
56
57 for my $xs (<xs/*.xs>) {
58 (my $c = $xs) =~ s/\.xs$/.c/i;
59 (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i;
60
61 $XS{$xs} = $c;
62 push @OBJECT, $o;
63 push @clean, $o;
64 }
65
66 for my $c (<*.c>) {
67 (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i;
68 push @OBJECT, $o;
69 push @clean, $o;
70 }
71
72 makemaker_args(
73 clean => { FILES => join(q{ }, @clean) },
74 OBJECT => join (q{ }, @OBJECT),
75 XS => \%XS,
76 );
77}
78
8a9fe086 79postamble(<<'EOM');
80$(OBJECT) : mop.h
81EOM
82
89dc39a9 83WriteAll();
84
9b970254 85# Use the cpan-smolder-stable script in the Moose svn root to figure
86# out what on CPAN will break with the latest Moose, then update this
87# before a release.
88sub check_conflicts {
89 my %conflicts = (
38f51483 90 'Moose' => '1.14',
0f762e30 91 'namespace::autoclean' => '0.08',
9b970254 92 );
93
94 my $found = 0;
95 for my $mod ( sort keys %conflicts ) {
96 eval "require $mod";
97 next if $@;
98
99 my $installed = $mod->VERSION();
100 if ( $installed le $conflicts{$mod} ) {
101
102 print <<"EOF";
103
104***
105 This version of Class::MOP conflicts with the version of
106 $mod ($installed) you have installed.
107
108 You will need to upgrade $mod after installing
109 this version of Class::MOP.
110***
111
112EOF
113
114 $found = 1;
115 }
116 }
117
118 return unless $found;
119
120 # More or less copied from Module::Build
121 return if $ENV{PERL_MM_USE_DEFAULT};
122 return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );
123
124 sleep 4;
125}
126
d846ade3 127package MY;
128
129use Config;
130
131sub const_cccmd {
132 my $ret = shift->SUPER::const_cccmd(@_);
133 return q{} unless $ret;
134
135 if ($Config{cc} =~ /^cl\b/i) {
136 warn 'you are using MSVC... my condolences.';
137 $ret .= ' /Fo$@';
138 }
139 else {
140 $ret .= ' -o $@';
141 }
142
143 return $ret;
144}