994104e13f0cc49fe49687e5b8a3a84dad2ce77c
[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.17;
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 require 'lib/Mouse/Spec.pm'; # for the version
29
30 if(Mouse::Spec->MouseVersion =~ /_/){ # DEVEL RELEASE
31     require Carp::Always; Carp::Always->import();
32     include_deps 'Carp::Always';
33 }
34
35 my $use_xs;
36
37 if($] < 5.008_001){
38     $use_xs = 0;
39 }
40
41 for (@ARGV) {
42     /^--pp$/ and $use_xs = 0;
43     /^--xs$/ and $use_xs = 1;
44 }
45
46 if(!defined $use_xs){
47     $use_xs = cc_available();
48 }
49
50 if($use_xs){
51     print "Mouse configured with XS.\n",
52           "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
53
54     use_ppport(3.19);
55     cc_warnings();
56     cc_src_paths('xs-src');
57 }
58 else{
59     print "Mouse configured with Pure Perl.\n";
60 }
61
62
63 tests 't/*.t t/*/*.t';
64
65 repository 'git://git.moose.perl.org/Mouse.git';
66
67 clean_files 'lib/Mouse/Tiny.pm $(O_FILES)';
68
69
70 if (author_context()) {
71     my $require_version = Mouse::Spec->MooseVersion;
72
73     if (eval { require Moose; Moose->VERSION($require_version) }) {
74         print "You have Moose ", Moose->VERSION, ".\n";
75         if (eval { require Module::Install::AuthorTests }) {
76             do 'tool/create-moose-compatibility-tests.pl';
77             recursive_author_tests('xt');
78         } else {
79             print "You don't have a M::I::AuthorTests.\n";
80         }
81     } else {
82         print "You don't have Moose $require_version. skipping moose compatibility test\n";
83     }
84
85     if($use_xs){
86         # repeat testing
87         # see also ExtUtils::MM_Any::test_via_harness()
88         my $test_via_harness =  q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
89                                .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
90                                .q{ $(TEST_FILES)} . "\n";
91
92         postamble qq{test_dynamic :: test_pp\n\n}
93                 . qq{test_pp :: pure_all\n}
94                 . qq{\t} . $test_via_harness;
95     }
96 }
97
98 WriteAll check_nmake => 0;