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'; |
a9073879 |
28 | requires 'Package::Stash' => '0.13'; |
d65739b4 |
29 | requires 'Scalar::Util' => '1.18'; |
30 | requires 'Sub::Name' => '0.04'; |
31 | requires 'Try::Tiny' => '0.02'; |
89dc39a9 |
32 | requires 'Task::Weaken'; |
33 | |
34 | test_requires 'File::Spec'; |
d65739b4 |
35 | test_requires 'Test::More' => '0.88'; |
36 | test_requires 'Test::Fatal' => '0.001'; |
37 | test_requires 'Test::Requires' => '0.05'; |
89dc39a9 |
38 | |
42d5274b |
39 | author_requires 'Algorithm::C3'; |
40 | author_requires 'Module::Info'; |
41 | author_requires 'Test::LeakTrace'; |
42 | author_requires 'Test::NoTabs'; |
43 | author_requires 'Test::Output'; |
44 | author_requires 'Test::Spelling'; |
45 | |
8c463274 |
46 | repository 'git://git.moose.perl.org/Class-MOP.git'; |
6b951296 |
47 | add_metadata(x_authority => 'cpan:STEVAN'); |
8c463274 |
48 | |
3fd3a2ab |
49 | extra_tests(); |
50 | |
89dc39a9 |
51 | makemaker_args( CCFLAGS => $ccflags ); |
52 | |
d846ade3 |
53 | { |
54 | my (@clean, @OBJECT, %XS); |
55 | |
56 | for my $xs (<xs/*.xs>) { |
57 | (my $c = $xs) =~ s/\.xs$/.c/i; |
58 | (my $o = $xs) =~ s/\.xs$/\$(OBJ_EXT)/i; |
59 | |
60 | $XS{$xs} = $c; |
61 | push @OBJECT, $o; |
62 | push @clean, $o; |
63 | } |
64 | |
65 | for my $c (<*.c>) { |
66 | (my $o = $c) =~ s/\.c$/\$(OBJ_EXT)/i; |
67 | push @OBJECT, $o; |
68 | push @clean, $o; |
69 | } |
70 | |
71 | makemaker_args( |
72 | clean => { FILES => join(q{ }, @clean) }, |
73 | OBJECT => join (q{ }, @OBJECT), |
74 | XS => \%XS, |
75 | ); |
76 | } |
77 | |
8a9fe086 |
78 | postamble(<<'EOM'); |
79 | $(OBJECT) : mop.h |
80 | EOM |
81 | |
89dc39a9 |
82 | WriteAll(); |
83 | |
9b970254 |
84 | # Use the cpan-smolder-stable script in the Moose svn root to figure |
85 | # out what on CPAN will break with the latest Moose, then update this |
86 | # before a release. |
87 | sub check_conflicts { |
88 | my %conflicts = ( |
38f51483 |
89 | 'Moose' => '1.14', |
0f762e30 |
90 | 'namespace::autoclean' => '0.08', |
9b970254 |
91 | ); |
92 | |
93 | my $found = 0; |
94 | for my $mod ( sort keys %conflicts ) { |
95 | eval "require $mod"; |
96 | next if $@; |
97 | |
98 | my $installed = $mod->VERSION(); |
99 | if ( $installed le $conflicts{$mod} ) { |
100 | |
101 | print <<"EOF"; |
102 | |
103 | *** |
104 | This version of Class::MOP conflicts with the version of |
105 | $mod ($installed) you have installed. |
106 | |
107 | You will need to upgrade $mod after installing |
108 | this version of Class::MOP. |
109 | *** |
110 | |
111 | EOF |
112 | |
113 | $found = 1; |
114 | } |
115 | } |
116 | |
117 | return unless $found; |
118 | |
119 | # More or less copied from Module::Build |
120 | return if $ENV{PERL_MM_USE_DEFAULT}; |
121 | return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) ); |
122 | |
123 | sleep 4; |
124 | } |
125 | |
d846ade3 |
126 | package MY; |
127 | |
128 | use Config; |
129 | |
130 | sub const_cccmd { |
131 | my $ret = shift->SUPER::const_cccmd(@_); |
132 | return q{} unless $ret; |
133 | |
134 | if ($Config{cc} =~ /^cl\b/i) { |
135 | warn 'you are using MSVC... my condolences.'; |
136 | $ret .= ' /Fo$@'; |
137 | } |
138 | else { |
139 | $ret .= ' -o $@'; |
140 | } |
141 | |
142 | return $ret; |
143 | } |