Ensure backward compatibility
[gitmo/Mouse.git] / Makefile.PL
CommitLineData
83eab7b3 1BEGIN{ $INC{'Module/Install/ExtraTests.pm'} = __FILE__ } # to disable the use of ExtrTests
08f7a8db 2use strict;
3use warnings;
c3398f5b 4use inc::Module::Install;
5
3f9d4c2b 6system($^X, 'author/generate-mouse-tiny.pl', 'lib/Mouse/Tiny.pm') == 0
7 or warn "Cannot generate Mouse::Tiny: $!";
8
c3398f5b 9name 'Mouse';
10all_from 'lib/Mouse.pm';
11
b9add211 12tests 't/*.t t/*/*.t';
13
ec53d678 14# Scalar::Util < 1.14 has a bug.
15# > Fixed looks_like_number(undef) to return false for perl >= 5.009002
16requires 'Scalar::Util' => 1.14;
272a1930 17
eb88905f 18test_requires 'Test::More' => 0.88;
19test_requires 'Test::Exception' => 0.27;
f1c70cbe 20# test_requires 'Test::Output' => 0.16; # too many dependencies!
21
22include 'Test::Exception'; # work around 0.27_0x (its use of diehook might be wrong)
c3398f5b 23
179ac6cc 24recommends 'MRO::Compat' if $] < 5.010;
25
df6dd016 26my $use_xs;
27
28for (@ARGV) {
29 /^--pp$/ and $use_xs = 0;
30 /^--xs$/ and $use_xs = 1;
31}
0e81c55d 32
3ea28db6 33if($] < 5.008_001){
34 $use_xs = 0;
35}
36
0e81c55d 37if(!defined $use_xs){
38 configure_requires 'ExtUtils::CBuilder';
39 require ExtUtils::CBuilder;
40 $use_xs = ExtUtils::CBuilder->new(quiet => 1)->have_compiler();
41}
42
43if($use_xs){
44 require Module::Install::XSUtil;
45 use_ppport(3.19);
46 cc_warnings();
47 cc_src_paths('xs-src');
48
49 print "Mouse configured in XS (--xs)\n";
50}
51else{
52 print "Mouse configured in Pure Perl (--pp)\n";
53}
54
83eab7b3 55if (author_context()) {
bf9f3f91 56 local @INC = ('lib', @INC);
121acb8a 57 require 'lib/Mouse/Spec.pm';
58 my $require_version = Mouse::Spec->MooseVersion;
bf9f3f91 59
60 if (eval{ require Moose; Moose->VERSION($require_version) }) {
314fe304 61 if (eval 'use Module::Install::AuthorTests; 1') {
32cf1353 62 do 'author/create-moose-compatibility-tests.pl';
314fe304 63 recursive_author_tests('xt');
64 } else {
65 print "you don't have a M::I::AuthorTests.\n";
66 }
67 } else {
bf9f3f91 68 print "you don't have Moose $require_version. skipping moose compatibility test\n";
314fe304 69 }
4358792d 70
71 if($use_xs){
72 # repeat testing
73 # see also ExtUtils::MM_Any::test_via_harness()
74 my $test_via_harness = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
75 .q{ "do 'author/force-pp.pl'; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
76 .q{ $(TEST_FILES)} . "\n";
77
78 postamble qq{test_dynamic :: test_pp\n\n}
79 . qq{test_pp :: pure_all\n}
80 . qq{\t} . $test_via_harness;
81 }
314fe304 82}
83
02cf53bb 84clean_files 'lib/Mouse/Tiny.pm';
85
eb88905f 86WriteAll check_nmake => 0;