This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade libnet from version 3.07 to 3.08
[perl5.git] / cpan / libnet / Makefile.PL
1 #!perl
2 #===============================================================================
3 #
4 # Makefile.PL
5 #
6 # DESCRIPTION
7 #   Makefile creation script.
8 #
9 # COPYRIGHT
10 #   Copyright (C) 2014, 2015 Steve Hay.  All rights reserved.
11 #
12 # LICENCE
13 #   This script is free software; you can redistribute it and/or modify it under
14 #   the same terms as Perl itself, i.e. under the terms of either the GNU
15 #   General Public License or the Artistic License, as specified in the LICENCE
16 #   file.
17 #
18 #===============================================================================
19
20 use 5.008001;
21
22 use strict;
23 use warnings;
24
25 use ExtUtils::MakeMaker 6.64;
26 use ExtUtils::MakeMaker qw(WriteMakefile);
27
28 ## no critic (Subroutines::ProhibitSubroutinePrototypes)
29
30 sub running_under_cpan();
31
32 #===============================================================================
33 # INITIALIZATION
34 #===============================================================================
35
36 our($CfgFile, $CfgPath);
37
38 BEGIN {
39     $CfgFile = 'libnet.cfg';
40     $CfgPath = "Net/$CfgFile";
41 }
42
43 #===============================================================================
44 # MAIN PROGRAM
45 #===============================================================================
46
47 MAIN: {
48     my %prereq_pms = ();
49     $prereq_pms{'Convert::EBCDIC'} = '0.06' if $^O eq 'os390';
50
51     my $xt = 'n';
52     if (not running_under_cpan() and not $ENV{PERL_CORE}) {
53         $xt = prompt("Should I do external tests?\n" .
54                      "These tests will fail if there is no internet" .
55                      " connection or if a firewall\n" .
56                      "blocks or modifies some traffic.\n" .
57                      "[y/N]", 'n');
58     }
59
60     my $tests = 't/*.t';
61     $tests .= ' t/external/*.t' if $xt =~ m/^y/io;
62
63     WriteMakefile(
64         NAME     => 'Net',
65         DISTNAME => 'libnet',
66         ABSTRACT => 'Collection of network protocol modules',
67         AUTHOR   => 'Graham Barr <gbarr@pobox.com>, Steve Hay <shay@cpan.org>',
68         LICENSE  => 'perl_5',
69         VERSION  => '3.08',
70
71         META_MERGE => {
72             'meta-spec' => {
73                 version => 2
74             },
75
76             resources => {
77                 repository => {
78                     type => 'git',
79                     url  => 'https://github.com/steve-m-hay/perl-libnet.git'
80                 }
81             },
82
83             optional_features => {
84                 APOP => {
85                     description => 'APOP support',
86                     prereqs => {
87                         runtime => {
88                             requires => {
89                                 'Digest::MD5' => '0'
90                             }
91                         }
92                     }
93                 },
94
95                 AUTH => {
96                     description => 'AUTH support',
97                     prereqs => {
98                         runtime => {
99                             requires => {
100                                 'Authen::SASL' => '0',
101                                 'MIME::Base64' => '0'
102                             }
103                         }
104                     }
105                 },
106
107                 SSL => {
108                     description => 'SSL support',
109                     prereqs => {
110                         runtime => {
111                             requires => {
112                                 'IO::Socket::SSL' => '2.007'
113                             }
114                         }
115                     }
116                 },
117
118                 IPv6 => {
119                     description => 'IPv6 support',
120                     prereqs => {
121                         runtime => {
122                             requires => {
123                                 'IO::Socket::IP' => '0.20'
124                             # or IO::Socket::INET6 2.62
125                             }
126                         }
127                     }
128                 },
129
130                 changestest => {
131                     description => 'Changes testing',
132                     prereqs => {
133                         test => {
134                             requires => {
135                                 'Test::CPAN::Changes' => '0'
136                             }
137                         }
138                     }
139                 },
140
141                 critictest => {
142                     description => 'Perl::Critic testing',
143                     prereqs => {
144                         test => {
145                             requires => {
146                                 'Test::Perl::Critic' => '0'
147                             }
148                         }
149                     }
150                 },
151
152                 podtest => {
153                     description => 'POD testing',
154                     prereqs => {
155                         test => {
156                             requires => {
157                                 'Test::Pod' => '1.00'
158                             }
159                         }
160                     }
161                 },
162
163                 podcoveragetest => {
164                     description => 'POD coverage testing',
165                     prereqs => {
166                         test => {
167                             requires => {
168                                 'Test::Pod::Coverage' => '0.08'
169                             }
170                         }
171                     }
172                 }
173             }
174         },
175
176         MIN_PERL_VERSION => '5.008001',
177
178         CONFIGURE_REQUIRES => {
179             'ExtUtils::MakeMaker' => '6.64',
180             'Getopt::Std'         => '0',
181             'IO::File'            => '0',
182             'perl'                => '5.008001',
183             'strict'              => '0',
184             'vars'                => '0',
185             'warnings'            => '0'
186         },
187
188         TEST_REQUIRES => {
189             'Config' => '0',
190             'Cwd'    => '0'
191         },
192
193         PREREQ_PM => {
194             %prereq_pms,
195             'Carp'           => '0',
196             'Errno'          => '0',
197             'Exporter'       => '0',
198             'Fcntl'          => '0',
199             'File::Basename' => '0',
200             'FileHandle'     => '0',
201             'IO::Select'     => '0',
202             'IO::Socket'     => '1.05',
203             'POSIX'          => '0',
204             'Socket'         => '2.016',
205             'Symbol'         => '0',
206             'Time::Local'    => '0',
207             'constant'       => '0',
208             'strict'         => '0',
209             'utf8'           => '0',
210             'vars'           => '0'
211         },
212
213         INSTALLDIRS => ($] < 5.011 ? 'perl' : 'site'),
214
215         realclean => {
216             FILES => $CfgFile
217         },
218
219         test => {
220             TESTS => $tests
221         },
222
223         dist => {
224             PREOP   => 'find $(DISTVNAME) -type d -print|xargs chmod 0755 && ' .
225                        'find $(DISTVNAME) -type f -print|xargs chmod 0644',
226             TO_UNIX => 'find $(DISTVNAME) -type f -print|xargs dos2unix'
227         }
228     );
229 }
230
231 #===============================================================================
232 # MAKEMAKER OVERRIDES
233 #===============================================================================
234
235 sub MY::post_initialize {
236     my $self = shift;
237
238     return '' if $self->{PERL_CORE};
239
240     if (not -f $CfgFile) {
241         my @args = qw(Configure);
242         push @args, '-d' if $ENV{PERL5_CPAN_IS_RUNNING}     ||
243                             $ENV{PERL5_CPANPLUS_IS_RUNNING} ||
244                             $ENV{PERL5_CPANM_IS_RUNNING};
245         system(($^O eq 'VMS' ? 'mcr ': ()), $^X, @args)
246     }
247
248     $self->{PM}{$CfgFile} = $self->catfile('$(INST_LIBDIR)',$CfgPath);
249
250     return '';
251 }
252
253 #===============================================================================
254 # SUBROUTINES
255 #===============================================================================
256
257 sub running_under_cpan() {
258     return $ENV{PERL5_CPAN_IS_RUNNING}     || # cpan
259            $ENV{PERL5_CPANPLUS_IS_RUNNING} || # cpanp
260            $ENV{PERL5_CPANM_IS_RUNNING};      # cpanm
261 }
262
263 #===============================================================================