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'; |
d65739b4 |
25 | requires 'List::MoreUtils' => '0.12'; |
26 | requires 'MRO::Compat' => '0.05'; |
103ad105 |
27 | requires 'Package::DeprecationManager' => '0.10'; |
ddfac3c0 |
28 | requires 'Package::Stash' => '0.15'; |
29 | requires 'Package::Stash::XS' => '0.17'; |
d65739b4 |
30 | requires 'Scalar::Util' => '1.18'; |
e59e2f13 |
31 | requires 'Sub::Name' => '0.05'; |
d65739b4 |
32 | requires 'Try::Tiny' => '0.02'; |
89dc39a9 |
33 | requires 'Task::Weaken'; |
34 | |
35 | test_requires 'File::Spec'; |
d65739b4 |
36 | test_requires 'Test::More' => '0.88'; |
37 | test_requires 'Test::Fatal' => '0.001'; |
38 | test_requires 'Test::Requires' => '0.05'; |
89dc39a9 |
39 | |
42d5274b |
40 | author_requires 'Algorithm::C3'; |
41 | author_requires 'Module::Info'; |
42 | author_requires 'Test::LeakTrace'; |
43 | author_requires 'Test::NoTabs'; |
44 | author_requires 'Test::Output'; |
45 | author_requires 'Test::Spelling'; |
46 | |
8c463274 |
47 | repository 'git://git.moose.perl.org/Class-MOP.git'; |
6b951296 |
48 | add_metadata(x_authority => 'cpan:STEVAN'); |
8c463274 |
49 | |
3fd3a2ab |
50 | extra_tests(); |
51 | |
89dc39a9 |
52 | makemaker_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 |
79 | postamble(<<'EOM'); |
80 | $(OBJECT) : mop.h |
81 | EOM |
82 | |
89dc39a9 |
83 | WriteAll(); |
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. |
88 | sub 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 | |
112 | EOF |
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 |
127 | package MY; |
128 | |
129 | use Config; |
130 | |
131 | sub 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 | } |