diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2014-05-22 18:11:33 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-05-22 18:11:33 +0100 |
commit | c144fd71ae82ebcd3c6dfa519ae787a66f4ca2e4 (patch) | |
tree | 5fd247b5b6a5427056b630a9328ae740fa499983 /Makefile.PL | |
parent | b76af9289d4542cf2b9e1f3c2de0baf0ba8bae09 (diff) | |
download | perl-libnet-c144fd71ae82ebcd3c6dfa519ae787a66f4ca2e4.tar.gz |
Bump/set minimum Perl and EU::MM versions and overhaul Makefile.PL
Also add a .gitignore file.
Diffstat (limited to 'Makefile.PL')
-rw-r--r-- | Makefile.PL | 220 |
1 files changed, 113 insertions, 107 deletions
diff --git a/Makefile.PL b/Makefile.PL index 95feb8a..1cb5be7 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,121 +1,127 @@ -# This -*- perl -*- script makes the Makefile - -#--- Distribution section --- - -$NAME = 'Net'; -$DISTNAME = "libnet"; -$VERSION = "1.25"; - -BEGIN { require 5.002 } - -use ExtUtils::MakeMaker; -use ExtUtils::Manifest qw(maniread); - -#--- Installation check - -sub chk_version -{ - my($pkg,$wanted,$msg) = @_; - - local($|) = 1; - print "Checking for $pkg..."; - - eval { my $p; ($p = $pkg . ".pm") =~ s#::#/#g; require $p; }; - - my $vstr = ${"${pkg}::VERSION"} ? "found v" . ${"${pkg}::VERSION"} - : "not found"; - my $vnum = ${"${pkg}::VERSION"} || 0; - - print $vnum >= $wanted ? "ok\n" : " " . $vstr . "\n"; - - $vnum >= $wanted; +#!perl +#=============================================================================== +# +# Makefile.PL +# +# DESCRIPTION +# Makefile creation script. +# +# COPYRIGHT +# Copyright (C) 2014 Steve Hay. All rights reserved. +# +# LICENCE +# You may distribute under the terms of either the GNU General Public License +# or the Artistic License, as specified in the LICENCE file. +# +#=============================================================================== + +use 5.008001; + +use strict; +use warnings; + +use ExtUtils::MakeMaker 6.64; +use ExtUtils::MakeMaker qw(WriteMakefile); + +#=============================================================================== +# INITIALIZATION +#=============================================================================== + +our($CfgFile, $CfgPath); + +BEGIN { + $CfgFile = 'libnet.cfg'; + $CfgPath = "Net/$CfgFile"; } -sub MY::post_initialize -{ - my ($self) = @_; - - #--- Create Net::Config +#=============================================================================== +# MAIN PROGRAM +#=============================================================================== + +MAIN: { + my %prereq_pms = (); + $prereq_pms{'Convert::EBCDIC'} = '0.06' if $^O eq 'os390'; + + WriteMakefile( + NAME => 'Net', + DISTNAME => 'libnet', + ABSTRACT => 'Collection of network protocol modules', + AUTHOR => 'Graham Barr <gbarr@pobox.com>, Steve Hay <shay@cpan.org>', + LICENSE => 'perl_5', + VERSION => '1.25', + + META_MERGE => { + 'meta-spec' => { + version => 2 + }, + + resources => { + repository => 'https://github.com/steve-m-hay/perl-libnet', + } + }, - my $config_pm = "Net/libnet.cfg"; - my $libnet_cfg = "libnet.cfg"; + MIN_PERL_VERSION => '5.008001', - # Use %INC and ExtUtils::MakeMaker to determine how this machine - # maps package names to path names + CONFIGURE_REQUIRES => { + 'ExtUtils::MakeMaker' => '6.64', + 'Getopt::Std' => 0, + 'IO:File' => 0, + 'strict' => 0, + 'vars' => 0, + 'warnings' => 0 + }, - foreach (keys %INC) { - last if ($config_pm = $_) =~ s/^ExtUtils(.)MakeMaker.pm/Net${1}libnet.cfg/; - } + TEST_REQUIRES => { + 'Cwd' => 0, + 'IO::File' => 0, + 'strict' => 0 + }, - system(($^O eq 'VMS' ? 'mcr ': ()),$^X, 'Configure') - unless -f $libnet_cfg; + PREREQ_PM => { + %prereq_pms, + # 'Authen::SASL' => 0, # Only required for AUTH support + 'Carp' => 0, + # 'Digest::MD5' => 0, # Only required for APOP support + 'Errno' => 0, + 'Exporter' => 0, + 'Fcntl' => 0, + 'File::Basename' => 0, + 'FileHandle' => 0, + 'IO::Select' => 0, + 'IO::Socket' => '1.05', + # 'MIME::Base64' => 0, # Only required for AUTH support + 'POSIX' => 0, + 'Socket' => '1.3', + 'Symbol' => 0, + 'Time::Local' => 0, + 'strict' => 0, + 'vars' => 0 + }, - $self->{PM}->{$libnet_cfg} = $self->catfile('$(INST_LIBDIR)',$config_pm); + INSTALLDIRS => 'perl', - ""; -} + realclean => { + FILES => $CfgFile + }, -#--- Check for Socket - -chk_version(Socket => '1.30') or - warn "\n" - . "*** For Net::Cmd to work you require version 1.30, or later, of\n" - . " Socket.pm from CPAN/modules/by-module/Socket/Socket-x.x.tar.gz\n\n"; - -chk_version(IO::Socket => '1.05') or - warn "\n" - . "*** For Net::Cmd to work you require version 1.05, or later, of\n" - . " IO/Socket.pm from CPAN/modules/by-module/IO/IO-x.x.tar.gz\n\n"; - -if ($^O eq 'os390') -{ - chk_version(Convert::EBCDIC => '0.06') or - warn "\n" - . "*** For Net::Cmd to work on $^O version 0.06, or later, of\n" - . " Convert::EBCDIC is required, which can be found at" - . " CPAN/modules/by-module/Convert/Convert-EBCDIC-x.x.tar.gz\n\n"; + dist => { + PREOP => 'find $(DISTVNAME) -type f -print|xargs chmod 0644 && ' . + 'find $(DISTVNAME) -type d -print|xargs chmod 0755', + TO_UNIX => 'find $(DISTVNAME) -type f -print|xargs dos2unix' + } + ); } -#--- Write the Makefile - -my @ppd; +#=============================================================================== +# MAKEMAKER OVERRIDES +#=============================================================================== -if ($] >= 5.00503) { - @ppd = ( - AUTHOR => 'Graham Barr <gbarr@pobox.com>', - ABSTRACT => 'Collection of Network protocol modules', - ); +sub MY::post_initialize { + my $self = shift; + return '' if $self->{PERL_CORE}; + system(($^O eq 'VMS' ? 'mcr ': ()), $^X, 'Configure') unless -f $CfgFile; + $self->{PM}{$CfgFile} = $self->catfile('$(INST_LIBDIR)',$CfgPath); + return ''; } -WriteMakefile( - INSTALLDIRS => ($] >= 5.008 ? 'perl' : 'site'), - VERSION => $VERSION, - DISTNAME => $DISTNAME, - NAME => $NAME, - 'realclean' => {FILES => $config_pm}, - PREREQ_PM => { - Socket => 1.3, - IO::Socket => 1.05 - }, - dist => { DIST_DEFAULT => 'mydist', }, - (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()), - ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( - META_MERGE => { - resources => { ## - repository => 'http://github.com/steve-m-hay/perl-libnet', - }, - } - ) - : () - ), - @ppd, -); - -sub MY::postamble { - return <<'POSTAMBLE'; - -mydist : distmeta tardist - -POSTAMBLE - -} +#=============================================================================== |