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