This fixes RT#59460. (Curtis Jewell)
[gitmo/Mouse.git] / Makefile.PL
CommitLineData
e8c583d3 1# for developpers:
2BEGIN{
3 if(grep{ $_ eq '--author' } @ARGV){
01f38ab1 4 print "$^X -S cpanm < author/requires.cpanm\n";
e8c583d3 5 system "$^X -S cpanm < author/requires.cpanm";
6 }
7}
8
08f7a8db 9use strict;
10use warnings;
37008311 11use inc::Module::Install 0.99;
c3398f5b 12
884bf37f 13# for co-developpers
ec7a9423 14use Module::Install::XSUtil 0.24;
d202164d 15use Module::Install::AuthorTests;
884bf37f 16
bd0fe31f 17system($^X, 'tool/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
3f9d4c2b 18 or warn "Cannot generate Mouse::Tiny: $!";
19
c3398f5b 20name 'Mouse';
21all_from 'lib/Mouse.pm';
22
ec53d678 23# Scalar::Util < 1.14 has a bug.
24# > Fixed looks_like_number(undef) to return false for perl >= 5.009002
25requires 'Scalar::Util' => 1.14;
272a1930 26
eb88905f 27test_requires 'Test::More' => 0.88;
da1d264b 28test_requires 'Test::Exception' => 0.29;
01f38ab1 29if ( $ENV{RELEASE_TESTING} || (grep { $_ eq '--author' } @ARGV) ) {
30 test_requires 'Test::Requires' => 0.03;
31}
f1c70cbe 32# test_requires 'Test::Output' => 0.16; # too many dependencies!
33
92ff14d0 34if($] < 5.010) {
35 recommends 'Class::C3';
36}
179ac6cc 37
3310ddf2 38my %suggests = (
cabc9331 39 'Data::Util' => 0.55,
3310ddf2 40 'MouseX::AttributeHelpers' => 0.06,
41);
42
43while(my($mod, $least) = each %suggests){
44 if(can_use($mod)){
45 if(!eval { $mod->VERSION($least) }){
46 my $ver = $mod->VERSION;
47 warn("\n",
48 "WARNING: $mod is installed, but its version ($ver) is too old (< $least).\n",
49 " Please update $mod after installation of Mouse.\n",
50 "\n"
51 );
52 }
53 }
54}
55
a1d1c5cc 56require 'lib/Mouse/Spec.pm'; # for the version
98f255c5 57
5e3cb4c0 58#if(Mouse::Spec->MouseVersion =~ /_/){ # DEVEL RELEASE
59# require Carp::Always; Carp::Always->import();
60# include_deps 'Carp::Always';
61#}
62
ec7a9423 63# cc_want deals with the '--pp' and '--xs' options
64my $use_xs = ($] >= 5.008_001 && want_xs());
0e81c55d 65
66if($use_xs){
7b92a82b 67 print "Mouse configured with XS.\n",
98f255c5 68 "NOTE: You can try --pp option to configure Mouse with Pure Perl.\n";
bb543d7f 69
0e81c55d 70 cc_warnings();
fdee07cc 71 use_ppport(3.19);
0e81c55d 72 cc_src_paths('xs-src');
0e81c55d 73}
74else{
7b92a82b 75 print "Mouse configured with Pure Perl.\n";
0e81c55d 76}
77
125dc1a8 78
79tests 't/*.t t/*/*.t';
1e2f2888 80author_tests 'xt';
81
125dc1a8 82
83repository 'git://git.moose.perl.org/Mouse.git';
84
2462603a 85clean_files 'lib/Mouse/Tiny.pm $(O_FILES) test-mydeps-*.log';
125dc1a8 86
87
83eab7b3 88if (author_context()) {
121acb8a 89 my $require_version = Mouse::Spec->MooseVersion;
bf9f3f91 90
64f61124 91 if (eval { require Moose; Moose->VERSION($require_version) }) {
92ff14d0 92 print "You have Moose ", Moose->VERSION, ".\n";
64f61124 93 if (eval { require Module::Install::AuthorTests }) {
bd0fe31f 94 do 'tool/create-moose-compatibility-tests.pl';
1e2f2888 95 # repeat testing
96 # see also ExtUtils::MM_Any::test_via_harness()
97 my $t_moose = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
98 .q{ "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
99 .q{ xt/compatibility/t/*/*.t } . "\n";
100
101 postamble qq{test_dynamic :: test_moose\n\n}
102 . qq{test_moose :: pure_all\n}
103 . qq{\t} . $t_moose;
314fe304 104 } else {
92ff14d0 105 print "You don't have a M::I::AuthorTests.\n";
314fe304 106 }
107 } else {
92ff14d0 108 print "You don't have Moose $require_version. skipping moose compatibility test\n";
314fe304 109 }
4358792d 110
111 if($use_xs){
112 # repeat testing
113 # see also ExtUtils::MM_Any::test_via_harness()
1e2f2888 114 my $t_pp = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
115 .q{ "do 'tool/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
116 .q{ $(TEST_FILES)} . "\n";
4358792d 117
118 postamble qq{test_dynamic :: test_pp\n\n}
119 . qq{test_pp :: pure_all\n}
1e2f2888 120 . qq{\t} . $t_pp;
4358792d 121 }
314fe304 122}
123
1e2f2888 124
eb88905f 125WriteAll check_nmake => 0;