X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Makefile.PL;h=cb510263bc09878d6760f4f036c360fb80119c38;hb=821a0fde221f5accf93e3f65efa77b5a6733cb5e;hp=f74169eab2820b712400f58766b65ce38d033aa7;hpb=4b6a634117887e197c80a3acfb53c03307d37cb2;p=dbsrgits%2FSQL-Translator.git diff --git a/Makefile.PL b/Makefile.PL index f74169e..cb51026 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,123 +1,7 @@ -package SQL::Translator; +# $Id$ use strict; -use ExtUtils::MakeMaker; -$|++; +use Module::Build::Compat; -my %PREREQ_PM; -my %missing = ( - optional => [ ], - required => [ ], -); - -print "Checking for required and recommended modules.\n"; -# Module Name Version Optional? -check_version('Class::Base' => 0 => 0); -check_version('File::Basename' => 0 => 0); -check_version('File::Spec' => 0 => 0); -check_version('GD' => 0 => 1); -check_version('GraphViz' => 0 => 1); -check_version('IO::Dir' => 0 => 0); -check_version('IO::File' => 0 => 0); -check_version('IO::Scalar' => 0 => 0); -check_version('Parse::RecDescent' => 1.94 => 0); -check_version('Pod::Usage' => 0 => 0); -check_version('Spreadsheet::ParseExcel' => 0 => 1); -check_version('Test::More' => 0 => 0); -check_version('Text::ParseWords' => 0 => 0); -check_version('Text::RecordParser' => 0.02 => 0); -check_version('XML::Writer' => 0 => 1); - -print "\n"; - -if (@{$missing{'optional'}} + @{$missing{'required'}}) { - print "Some components might not work correctly:\n"; - my $count; - if ($missing{'required'}) { - $count = scalar(@{$missing{'required'}}); - printf " You are missing %d required module%s: %s\n", - $count, - $count == 1 ? '' : 's', - join ', ', @{$missing{'required'}}; - } - if ($missing{'optional'}) { - $count = scalar(@{$missing{'optional'}}); - printf " You are missing %d optional module%s: %s\n", - $count, - $count == 1 ? '' : 's', - join ', ', @{$missing{'optional'}}; - } - - print "\n"; -} - -WriteMakefile( - 'NAME' => __PACKAGE__, - 'VERSION_FROM' => 'lib/SQL/Translator.pm', - 'EXE_FILES' => [ - 'bin/sqlt-diagram.pl', - 'bin/sqlt-dumper.pl', - 'bin/sqlt-graph.pl', - 'bin/sql_translator.pl', - ], - 'PREREQ_PM' => \%PREREQ_PM, - 'clean' => { - FILES => '$(DISTVNAME).tar$(SUFFIX)', - }, -); - -# ---------------------------------------------------------------------- -# check_version($module, $version, $optional) -# -# Takes a module name, optional version number, and a flag indicating -# whether the module is optional (default is no). -# ---------------------------------------------------------------------- -sub check_version { - my ($module, $version, $optional) = @_; - my ($dots, $load); - - if ($version) { - $load = "$module $version"; - } - else { - $load = $module; - } - - $dots = '.' x (36 - length($load)); - - eval "use $load;"; - if ($@) { - if ($optional) { - push @{$missing{'optional'}}, $module; - } - else { - push @{$missing{'required'}}, $module; - } - print "$load $dots not found!"; - if ($optional) { - print optional('not found!'), "\n"; - return; - } - print required('not found!'); - print "\n"; - } - else { - no strict qw(refs); - my $version = ${"$module\::VERSION"}; - print "$load $dots $version"; - print $optional ? optional($version) : required($version); - print "\n"; - } - - $PREREQ_PM{$module} = $version; -} - -sub optional { return _message("[optional]", @_) } -sub required { return _message("", @_) } - -sub _message { - my ($message, $version) = @_; - my $size = 24 - (length "$version"); - my $fmt = '%' . $size . 's'; - sprintf $fmt => $message; -} +Module::Build::Compat->run_build_pl(args => \@ARGV); +Module::Build::Compat->write_makefile();