From e9b6f0f44f231d53758033dd319abae100736ff6 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 6 Feb 2017 22:10:10 +0100 Subject: Use ExtUtils::AutoInstall * Makefile.PL: Rewrite. * bootstrap.pl: New file. --- Makefile.PL | 35 +++++++++++++++++++--------------- bootstrap.pl | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 15 deletions(-) create mode 100644 bootstrap.pl diff --git a/Makefile.PL b/Makefile.PL index 01345dc..b8c8f8d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,23 +1,28 @@ # -*- perl -*- use strict; -use ExtUtils::MakeMaker; +use lib 'inc'; +use ExtUtils::AutoInstall ( + -core => { + 'Getopt::Long' => 2.34, + 'File::Path' => 2.08, + 'File::Basename' => 2.84, + 'Protocol::ACME' => 1.01, + 'Protocol::ACME::Challenge::LocalFile' => 1.01, + 'Crypt::Format' => 0.06, + 'Crypt::OpenSSL::PKCS10' => 0.16, + 'Crypt::OpenSSL::RSA' => 0.28, + 'Crypt::OpenSSL::X509' => 1.807, + 'DateTime::Format::Strptime' => 1.42, + 'WWW::Curl::Easy' => 4.17, + 'Pod::Usage' => 1.51, + 'Pod::Man' => 2.25 + } +); WriteMakefile(NAME => 'acmeman', ABSTRACT_FROM => 'acmeman', VERSION_FROM => 'acmeman', AUTHOR => 'Sergey Poznyakoff ', LICENSE => 'gpl', - EXE_FILES => [ 'acmeman' ], - PREREQ_PM => { 'Getopt::Long' => 2.34, - 'File::Path' => 2.08, - 'File::Basename' => 2.84, - 'Protocol::ACME' => 1.01, - 'Protocol::ACME::Challenge::LocalFile' => 1.01, - 'Crypt::Format' => 0.06, - 'Crypt::OpenSSL::PKCS10' => 0.16, - 'Crypt::OpenSSL::RSA' => 0.28, - 'Crypt::OpenSSL::X509' => 1.807, - 'DateTime::Format::Strptime' => 1.42, - 'WWW::Curl::Easy' => 4.17, - 'Pod::Usage' => 1.51, - 'Pod::Man' => 2.25 } ); + EXE_FILES => [ 'acmeman' ] +); diff --git a/bootstrap.pl b/bootstrap.pl new file mode 100644 index 0000000..90db16a --- /dev/null +++ b/bootstrap.pl @@ -0,0 +1,61 @@ +#! /usr/bin/perl +# This file is part of acmeman. +# Copyright (C) 2014, 2017 Sergey Poznyakoff +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +use strict; +use CPAN; +use Cwd qw(getcwd); +use File::Path qw(mkpath); + +#### +my $incdir = "inc/ExtUtils"; +my $topdir = getcwd; + +my $modname = "ExtUtils::AutoInstall"; + +my $mod = CPAN::Shell->expandany($modname) or die "Can't expand $modname"; +my $file = $mod->inst_file; +my $dir; + +if (defined($file)) { + print "$modname installed at $file\n"; + if (-f $file) { + $file =~ s#/[^/]+\.pm$##; + if (-d $file) { + $dir = $file; + } else { + die "Can't find $modname directory"; + } + } +} else { + print "Getting $modname\n"; + my $distro = $mod->get or die "Can't get distribution for $modname"; + $dir = $distro->dir; +} + +$file = "$dir/$incdir/AutoInstall.pm"; +$file = "$dir/AutoInstall.pm" unless (-f $file); +-f $file or die "$file not found"; + +use autodie; +chdir $topdir; +mkpath $incdir unless -d $incdir; +chdir $incdir; +no autodie; +unlink "AutoInstall.pm"; +use autodie; +symlink $file, "AutoInstall.pm"; + -- cgit v1.2.1