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