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