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