1require 5.008;
2use ExtUtils::MakeMaker;
3
4WriteMakefile(
5    NAME => 'Encode::Locale',
6    VERSION_FROM => 'lib/Encode/Locale.pm',
7    ABSTRACT_FROM => "lib/Encode/Locale.pm",
8    AUTHOR => 'Gisle Aas <gisle@activestate.com>',
9    LICENSE => "perl",
10    MIN_PERL_VERSION => 5.008,
11    PREREQ_PM    => {
12	'Encode' => 2,
13	'Encode::Alias' => 0,
14    },
15    META_MERGE => {
16        resources => {
17            repository => 'http://github.com/gisle/encode-locale',
18        },
19        recommends => {
20            'I18N::Langinfo' => 0,
21            ($^O eq 'MSWin32'
22                ? ('Win32::Console' => 0)
23                : ()),
24        },
25    },
26    TEST_REQUIRES => {
27        'Test::More' => 0,
28    },
29);
30
31BEGIN {
32    # compatibility with older versions of MakeMaker
33    my $developer = -d ".git";
34    my %mm_req = (
35        LICENCE => 6.31,
36        META_MERGE => 6.45,
37        META_ADD => 6.45,
38        MIN_PERL_VERSION => 6.48,
39        BUILD_REQUIRES => 6.56,
40        TEST_REQUIRES => 6.64,
41    );
42    undef(*WriteMakefile);
43    *WriteMakefile = sub {
44        my %arg = @_;
45        unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{TEST_REQUIRES}) }) {
46            warn "Downgrading TEST_REQUIRES" if $developer;
47            $arg{BUILD_REQUIRES} = {
48                %{ $arg{BUILD_REQUIRES} },
49                %{ delete $arg{TEST_REQUIRES} },
50            };
51        }
52        for (keys %mm_req) {
53            unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) {
54                warn "$_ $@" if $developer;
55                delete $arg{$_};
56            }
57        }
58        ExtUtils::MakeMaker::WriteMakefile(%arg);
59    };
60}
61