Add conflicting checks to Makefile.PL
[gitmo/Mouse.git] / Makefile.PL
1 use strict;
2 use warnings;
3 use inc::Module::Install;
4
5 # for co-developpers
6 use Module::Install::XSUtil 0.21;
7
8 system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
9     or warn "Cannot generate Mouse::Tiny: $!";
10
11 name     'Mouse';
12 all_from 'lib/Mouse.pm';
13
14 # Scalar::Util < 1.14 has a bug.
15 # > Fixed looks_like_number(undef) to return false for perl >= 5.009002
16 requires 'Scalar::Util' => 1.14;
17
18 test_requires 'Test::More'      => 0.88;
19 test_requires 'Test::Exception' => 0.27;
20 # test_requires 'Test::Output'    => 0.16; # too many dependencies!
21
22 include_deps 'Test::Exception'; # work around 0.27_0x (its use of diehook might be wrong)
23
24 if($] < 5.010) {
25     recommends 'Class::C3';
26 }
27
28 my %suggests = (
29     'Class::Method::Modifiers::Fast' => 0.041,
30     'MouseX::AttributeHelpers'       => 0.06,
31 );
32
33 while(my($mod, $least) = each %suggests){
34     if(can_use($mod)){
35         if(!eval { $mod->VERSION($least) }){
36             my $ver = $mod->VERSION;
37             warn("\n",
38                 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
39                 "         Please update $mod after installation of Mouse.\n",
40                 "\n"
41             );
42         }
43     }
44 }
45
46 require 'lib/Mouse/Spec.pm'; # for the version
47
48 #if(Mouse::Spec->MouseVersion =~ /_/){ # DEVEL RELEASE
49 #    require Carp::Always; Carp::Always->import();
50 #    include_deps 'Carp::Always';
51 #}
52
53 # cc_available recognizes the '--pp' and '--xs' options
54 my $use_xs = ($] >= 5.008_001 && cc_available());
55
56 if($use_xs){
57     print "Mouse configured with XS.\n",
58           "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
59
60     cc_warnings();
61     use_ppport(3.19);
62     cc_src_paths('xs-src');
63 }
64 else{
65     print "Mouse configured with Pure Perl.\n";
66 }
67
68
69 tests 't/*.t t/*/*.t';
70
71 repository 'git://git.moose.perl.org/Mouse.git';
72
73 clean_files 'lib/Mouse/Tiny.pm $(O_FILES)';
74
75
76 if (author_context()) {
77     my $require_version = Mouse::Spec->MooseVersion;
78
79     if (eval { require Moose; Moose->VERSION($require_version) }) {
80         print "You have Moose ", Moose->VERSION, ".\n";
81         if (eval { require Module::Install::AuthorTests }) {
82             do 'tool/create-moose-compatibility-tests.pl';
83             recursive_author_tests('xt');
84         } else {
85             print "You don't have a M::I::AuthorTests.\n";
86         }
87     } else {
88         print "You don't have Moose $require_version. skipping moose compatibility test\n";
89     }
90
91     if($use_xs){
92         # repeat testing
93         # see also ExtUtils::MM_Any::test_via_harness()
94         my $test_via_harness =  q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
95                                .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
96                                .q{ $(TEST_FILES)} . "\n";
97
98         postamble qq{test_dynamic :: test_pp\n\n}
99                 . qq{test_pp :: pure_all\n}
100                 . qq{\t} . $test_via_harness;
101     }
102 }
103
104 WriteAll check_nmake => 0;