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