summaryrefslogtreecommitdiff
path: root/Makefile.PL
blob: 17158b719669e9c03fcf78c66e5880cec124c8ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!perl -w

require 5.008001;
use strict;
use ExtUtils::MakeMaker;
use Getopt::Long qw(GetOptions);

GetOptions(\my %opt,
   'aliases',
   'no-programs|n',
   'live-tests',
   'jigsaw-tests',
) or do {
    die "Usage: $0 [--aliases] [--no-programs] [--live-tests] [--jigsaw-tests]\n";
};

my @prog;
push(@prog, qw(lwp-request lwp-mirror lwp-download lwp-dump))
    unless $opt{'no-programs'} || grep /^LIB=/, @ARGV;

if ($opt{'aliases'} && grep(/lwp-request/, @prog)) {
    require File::Copy;
    for (qw(GET HEAD POST)) {
        File::Copy::copy("bin/lwp-request", "bin/$_") || die "Can't copy bin/$_";
        chmod(0755, "bin/$_");
        push(@prog, $_);
    }
}

my $tests = 't/base/*.t t/html/*.t t/robot/*.t t/local/*.t t/net/*.t';
$tests .= ' t/live/*.t'
  if $opt{'live-tests'};
$tests .= ' t/live/jigsaw/*.t'
  if $opt{'jigsaw-tests'};

my %WriteMakefileArgs = (
    NAME => 'LWP',
    DISTNAME => 'libwww-perl',
    VERSION_FROM => 'lib/LWP.pm',
    ABSTRACT => 'The World-Wide Web library for Perl',
    AUTHOR => 'Gisle Aas <gisle@activestate.com>',
    EXE_FILES => [ map "bin/$_", @prog ],
    LICENSE => 'perl_5',
    MIN_PERL_VERSION => 5.008001,
    PREREQ_PM => {
        'Digest::MD5' => 0,
        'Encode' => "2.12",
        'Encode::Locale' => 0,
        'File::Listing' => 6,
        'HTML::Entities' => 0,
        'HTML::HeadParser' => 0,
        'HTTP::Cookies' => 6,
        'HTTP::Daemon' => 6,
        'HTTP::Date' => 6,
        'HTTP::Negotiate' => 6,
        'HTTP::Request' => 6,
        'HTTP::Request::Common' => 6,
        'HTTP::Response' => 6,
        'HTTP::Status' => 6,
        'IO::Select' => 0,
        'IO::Socket' => 0,
        'LWP::MediaTypes' => 6,
        'MIME::Base64' => "2.1",
        'Net::FTP' => "2.58",
        'Net::HTTP' => "6.07",
        'URI' => "1.10",
        'URI::Escape' => 0,
        'WWW::RobotRules' => 6,
    },
    TEST_REQUIRES => {
        'Test' => '0',
        'Test::More' => '0',
        'FindBin' => '0',
    },
    META_MERGE => {
        'meta-spec' => { version => 2 },
        dynamic_config => 0,
        prereqs => {
            runtime => {
                suggests => {
                    'LWP::Protocol::https' => '6.02',
                    'Authen::NTLM' => "1.02",
                    'HTTP::GHTTP' => '0',
                },
            },
        },
        resources => {
            repository => {
                 url => 'https://github.com/libwww-perl/libwww-perl.git',
                 web => 'https://github.com/libwww-perl/libwww-perl',
                 type => 'git',
            },
            bugtracker => {
                 mailto => 'bug-libwww-perl@rt.cpan.org',
                 web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=libwww-perl',
            },
            x_MailingList => 'mailto:libwww@perl.org',
            x_IRC => 'irc://irc.perl.org/#lwp',
        }
    },
    clean => { FILES => join(" ", map "bin/$_", grep /^[A-Z]+$/, @prog) },
    test => { TESTS => $tests },
);

{
    # compatibility with older versions of MakeMaker
    my $developer = -f ".gitignore";

    die 'need to do a merge with CPAN::Meta::Requirements!!'
        if $developer && exists $WriteMakefileArgs{BUILD_REQUIRES};

    if (!eval { ExtUtils::MakeMaker->VERSION('6.6303') }) {
        $WriteMakefileArgs{BUILD_REQUIRES} = $WriteMakefileArgs{TEST_REQUIRES};
        delete $WriteMakefileArgs{TEST_REQUIRES};
    }

    if (!eval { ExtUtils::MakeMaker->VERSION('6.5501') }) {
        @{$WriteMakefileArgs{PREREQ_PM}}{ keys %{$WriteMakefileArgs{BUILD_REQUIRES}} } =
            @{$WriteMakefileArgs{BUILD_REQUIRES}}{ keys %{$WriteMakefileArgs{BUILD_REQUIRES}} };

        delete $WriteMakefileArgs{BUILD_REQUIRES};
    }

    my %mm_req = (
        LICENCE => 6.31,
        META_MERGE => 6.45,
        META_ADD => 6.45,
        MIN_PERL_VERSION => 6.48,
    );
    for (keys %mm_req) {
        unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) {
            warn "$_ $@" if $developer;
            delete $WriteMakefileArgs{$_};
        }
    }
}

WriteMakefile(%WriteMakefileArgs);