lib/Module/Build.pm Module::Build
lib/Module/Build/PodParser.pm Module::Build
lib/Module/Build/PPMMaker.pm Module::Build
-lib/Module/Build/scripts/bundle.pl Module::Build
lib/Module/Build/scripts/config_data Module::Build
lib/Module/Build/t/add_property.t Module::Build
lib/Module/Build/t/basic.t Module::Build
'Module::Build' =>
{
'MAINTAINER' => 'kwilliams',
- 'DISTRIBUTION' => 'EWILHELM/Module-Build-0.32.tar.gz',
+ 'DISTRIBUTION' => 'DAGOLDEN/Module-Build-0.33_02.tar.gz',
'FILES' => q[lib/Module/Build lib/Module/Build.pm],
- 'EXCLUDED' => [ qw{ t/par.t t/signature.t }, ],
+ 'EXCLUDED' => [ qw{ t/par.t t/signature.t scripts/bundle.pl}, ],
'CPAN' => 1,
- 'UPSTREAM' => undef,
+ 'UPSTREAM' => 'cpan',
},
'Module::CoreList' =>
use vars qw($VERSION @ISA);
@ISA = qw(Module::Build::Base);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
# Okay, this is the brute-force method of finding out what kind of
tarball of the files listed in F<MANIFEST> and compress the tarball using
GZIP compression.
-By default, this action will use the external C<tar> and C<gzip>
-executables on Unix-like platforms, and the C<Archive::Tar> module
-elsewhere. However, you can force it to use whatever executable you
-want by supplying an explicit C<tar> (and optional C<gzip>) parameter:
+By default, this action will use the C<Archive::Tar> module. However, you can
+force it to use binary "tar" and "gzip" executables by supplying an explicit
+C<tar> (and optional C<gzip>) parameter:
./Build dist --tar C:\path\to\tar.exe --gzip C:\path\to\zip.exe
See the documentation for L<Module::Build::Authoring/"PREREQUISITES">
for the details of how requirements can be specified.
+=item create_license
+
+[version 0.31]
+
+This parameter tells Module::Build to automatically create a
+F<LICENSE> file at the top level of your distribution, containing the
+full text of the author's chosen license. This requires
+C<Software::License> on the author's machine, and further requires
+that the C<license> parameter specifies a license that it knows about.
+
=item create_makefile_pl
[version 0.19]
F<META.yml> file and install these items before running the
C<Build.PL>.
-*TODO* auto-add M::B? In what circumstances?
+If no configure_requires is specified, the current version of Module::Build
+is automatically added to configure_requires.
=item build_requires
use strict;
use vars qw($VERSION);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
BEGIN { require 5.00503 }
%input,
},
phash => {},
+ stash => {}, # temporary caching, not stored in _build
}, $package;
$self->_set_defaults;
my $version_from = File::Spec->catfile( split( qr{/}, $dist_version_from ) );
my $pm_info = Module::Build::ModuleInfo->new_from_file( $version_from )
or die "Can't find file $version_from to determine version";
- $p->{dist_version} = $pm_info->version();
+ $p->{dist_version} = $self->normalize_version( $pm_info->version() );
}
die ("Can't determine distribution version, must supply either 'dist_version',\n".
sub dist_dir {
my ($self) = @_;
- return "$self->{properties}{dist_name}-$self->{properties}{dist_version}";
+ return join "-", $self->dist_name, $self->dist_version;
}
sub ppm_name {
push @INC, File::Spec->catdir($self->blib, 'lib');
}
- $self->write_metafile;
+ if ( $self->write_metafile( $self->metafile, $self->generate_metadata ) ) {
+ $self->{wrote_metadata} = 1;
+ $self->_add_to_manifest('MANIFEST', $metafile);
+ }
+
+ return 1;
}
-sub write_metafile {
+sub generate_metadata {
my $self = shift;
- my $metafile = $self->metafile;
+ my $node = {};
if ($self->_mb_feature('YAML_support')) {
require YAML;
require YAML::Node;
-
# We use YAML::Node to get the order nice in the YAML file.
- $self->prepare_metadata( my $node = YAML::Node->new({}) );
-
+ $self->prepare_metadata( $node = YAML::Node->new({}) );
+ } else {
+ require Module::Build::YAML;
+ my @order_keys;
+ $self->prepare_metadata($node, \@order_keys);
+ $node->{_order} = \@order_keys;
+ }
+ return $node;
+}
+
+sub write_metafile {
+ my $self = shift;
+ my ($metafile, $node) = @_;
+
+ if ($self->_mb_feature('YAML_support')) {
+ # XXX this is probably redundant, but stick with it
+ require YAML;
+ require YAML::Node;
+ delete $node->{_order}; # XXX also probably redundant, but for safety
# YAML API changed after version 0.30
my $yaml_sub = $YAML::VERSION le '0.30' ? \&YAML::StoreFile : \&YAML::DumpFile;
- $self->{wrote_metadata} = $yaml_sub->($metafile, $node );
-
+ $yaml_sub->( $metafile, $node );
} else {
+ # XXX probably redundant
require Module::Build::YAML;
- my (%node, @order_keys);
- $self->prepare_metadata(\%node, \@order_keys);
- $node{_order} = \@order_keys;
- &Module::Build::YAML::DumpFile($metafile, \%node);
- $self->{wrote_metadata} = 1;
+ &Module::Build::YAML::DumpFile($metafile, $node);
}
+ return 1;
+}
- $self->_add_to_manifest('MANIFEST', $metafile);
+sub normalize_version {
+ my ($self, $version) = @_;
+ if ( $version =~ /[=<>!,]/ ) { # logic, not just version
+ # take as is without modification
+ }
+ elsif ( ref $version eq 'version' ||
+ ref $version eq 'Module::Build::Version' ) { # version objects
+ my $string = $version->stringify;
+ # normalize leading-v: "v1.2" -> "v1.2.0"
+ $version = substr($string,0,1) eq 'v' ? $version->normal : $string;
+ }
+ elsif ( $version =~ /^[^v][^.]*\.[^.]+\./ ) { # no leading v, multiple dots
+ # normalize string tuples without "v": "1.2.3" -> "v1.2.3"
+ $version = "v$version";
+ }
+ else {
+ # leave alone
+ }
+ return $version;
}
sub prepare_metadata {
die "ERROR: Missing required field '$_' for META.yml\n"
unless defined($node->{$name}) && length($node->{$name});
}
- $node->{version} = '' . $node->{version}; # Stringify version objects
+ $node->{version} = $self->normalize_version($node->{version});
if (defined( my $l = $self->license )) {
die "Unknown license string '$l'"
- unless exists $self->valid_licenses->{ $self->license };
+ unless exists $self->valid_licenses->{ $l };
- if (my $key = $self->valid_licenses->{ $self->license }) {
+ if (my $key = $self->valid_licenses->{ $l }) {
my $class = "Software::License::$key";
if (eval "use $class; 1") {
# S::L requires a 'holder' key
$node->{resources}{license} = $class->new({holder=>"nobody"})->url;
- } else {
- $node->{resources}{license} = $self->_license_url($key);
+ }
+ else {
+ $node->{resources}{license} = $self->_license_url($l);
}
}
+ # XXX we are silently omitting the url for any unknown license
}
if (exists $p->{configure_requires}) {
foreach my $spec (keys %{$p->{configure_requires}}) {
warn ("Warning: $spec is listed in 'configure_requires', but ".
- "it is not found in any of the other prereq fields.\n")
- unless grep exists $p->{$_}{$spec},
- grep !/conflicts$/, @{$self->prereq_action_types};
+ "it is not found in any of the other prereq fields.\n")
+ unless grep exists $p->{$_}{$spec},
+ grep !/conflicts$/, @{$self->prereq_action_types};
+ }
+ }
+
+ # copy prereq data structures so we can modify them before writing to META
+ my %prereq_types;
+ for my $type ( 'configure_requires', @{$self->prereq_action_types} ) {
+ if (exists $p->{$type}) {
+ for my $mod ( keys %{ $p->{$type} } ) {
+ $prereq_types{$type}{$mod} =
+ $self->normalize_version($p->{$type}{$mod});
+ }
}
}
- foreach ( 'configure_requires', @{$self->prereq_action_types} ) {
- if (exists $p->{$_} and keys %{ $p->{$_} }) {
- $add_node->($_, $p->{$_});
+ # add current Module::Build to configure_requires if there
+ # isn't a configure_requires already specified
+ if ( ! $prereq_types{'configure_requires'} ) {
+ for my $t ('configure_requires', 'build_requires') {
+ $prereq_types{$t}{'Module::Build'} = $VERSION;
}
}
+ for my $t ( keys %prereq_types ) {
+ $add_node->($t, $prereq_types{$t});
+ }
+
if (exists $p->{dynamic_config}) {
$add_node->('dynamic_config', $p->{dynamic_config});
}
$add_node->('generated_by', "Module::Build version $Module::Build::VERSION");
$add_node->('meta-spec',
- {version => '1.2',
- url => 'http://module-build.sourceforge.net/META-spec-v1.2.html',
+ {version => '1.4',
+ url => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
});
while (my($k, $v) = each %{$self->meta_add}) {
}
}
- # Stringify versions. Can't use exists() here because of bug in YAML::Node.
+ # Normalize versions. Can't use exists() here because of bug in YAML::Node.
+ # XXX "bug in YAML::Node" comment seems irrelvant -- dagolden, 2009-05-18
for (grep defined $_->{version}, values %prime) {
- $_->{version} = '' . $_->{version};
+ $_->{version} = $self->normalize_version( $_->{version} );
}
return \%prime;
# Returns a CBuilder object
my $self = shift;
- my $p = $self->{properties};
- return $p->{_cbuilder} if $p->{_cbuilder};
+ my $s = $self->{stash};
+ return $s->{_cbuilder} if $s->{_cbuilder};
die "Module::Build is not configured with C_support"
unless $self->_mb_feature('C_support');
require ExtUtils::CBuilder;
- return $p->{_cbuilder} = ExtUtils::CBuilder->new(
+ return $s->{_cbuilder} = ExtUtils::CBuilder->new(
config => $self->config,
($self->quiet ? (quiet => 1 ) : ()),
);
use strict;
use vars qw($VERSION);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
use File::Spec;
use IO::File;
eval "use Module::Build::Compat 0.02; 1" or die $@;
%s
Module::Build::Compat->run_build_pl(args => \@ARGV);
- exit(0) unless(-e 'Build'); # cpantesters convention
+ my $build_script = 'Build';
+ $build_script .= '.com' if $^O eq 'VMS';
+ exit(0) unless(-e $build_script); # cpantesters convention
require %s;
Module::Build::Compat->write_makefile(build_class => '%s');
EOF
$MM_Args{EXE_FILES} = [ sort keys %{$build->script_files} ] if $build->script_files;
- $MM_Args{PL_FILES} = $build->PL_files if $build->PL_files;
+ $MM_Args{PL_FILES} = $build->PL_files || {};
local $Data::Dumper::Terse = 1;
my $args = Data::Dumper::Dumper(\%MM_Args);
realclean : force_do_it
$perl $Build realclean
$unlink
+distclean : force_do_it
+ $perl $Build distclean
+ $unlink
+
force_do_it :
@ $noop
EOF
foreach my $action ($class->known_actions) {
- next if $action =~ /^(all|realclean|force_do_it)$/; # Don't double-define
+ next if $action =~ /^(all|distclean|realclean|force_do_it)$/; # Don't double-define
$maketext .= <<"EOF";
$action : force_do_it
$perl $Build $action
they won't get to take advantage of Module::Build's extra features
either.
-If you go this route, make sure you explicitly set C<PL_FILES> in the
-call to C<WriteMakefile()> (probably to an empty hash reference), or
-else MakeMaker will mistakenly run the Build.PL and you'll get an
-error message about "Too early to run Build script" or something. For
-good measure, of course, test both the F<Makefile.PL> and the
+For good measure, of course, test both the F<Makefile.PL> and the
F<Build.PL> before shipping.
=item 3.
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Config;
sub write {
my $me = __FILE__;
require IO::File;
+
+ # Can't use Module::Build::Dumper here because M::B is only a
+ # build-time prereq of this module
require Data::Dumper;
my $mode_orig = (stat $me)[2] & 07777;
}
die "Couldn't find __DATA__ token in $me" if eof($fh);
- local $Data::Dumper::Terse = 1;
seek($fh, tell($fh), 0);
- $fh->print( Data::Dumper::Dumper([$config, $features, $auto_features]) );
+ my $data = [$config, $features, $auto_features];
+ $fh->print( 'do{ my '
+ . Data::Dumper->new([$data],['x'])->Purity(1)->Dump()
+ . '$x; }' );
truncate($fh, tell($fh));
$fh->close;
__DATA__
-[
- {},
- {},
- {
- 'YAML_support' => {
- 'requires' => {
- 'YAML' => ' >= 0.35, != 0.49_01 '
- },
- 'description' => 'Use YAML.pm to write META.yml files'
- },
- 'manpage_support' => {
- 'requires' => {
- 'Pod::Man' => 0
- },
- 'description' => 'Create Unix man pages'
- },
- 'C_support' => {
+do{ my $x = [
+ {},
+ {},
+ {
+ 'YAML_support' => {
'requires' => {
- 'ExtUtils::CBuilder' => '0.15'
+ 'YAML' => ' >= 0.35, != 0.49_01 '
},
- 'recommends' => {
- 'ExtUtils::ParseXS' => '1.02'
- },
- 'description' => 'Compile/link C & XS code'
+ 'description' => 'Use YAML.pm to write META.yml files'
},
- 'HTML_support' => {
+ 'manpage_support' => {
'requires' => {
- 'Pod::Html' => 0
+ 'Pod::Man' => 0
},
- 'description' => 'Create HTML documentation'
- }
- }
- ]
+ 'description' => 'Create Unix man pages'
+ },
+ 'C_support' => {
+ 'requires' => {
+ 'ExtUtils::CBuilder' => '0.15'
+ },
+ 'recommends' => {
+ 'ExtUtils::ParseXS' => '1.02'
+ },
+ 'description' => 'Compile/link C & XS code'
+ },
+ 'HTML_support' => {
+ 'requires' => {
+ 'Pod::Html' => 0
+ },
+ 'description' => 'Create HTML documentation'
+ }
+ }
+ ];
+$x; }
\ No newline at end of file
package Module::Build::Cookbook;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
=head1 NAME
Module::Build::Cookbook - Examples of Module::Build Usage
-
=head1 DESCRIPTION
C<Module::Build> isn't conceptually very complicated, but examples are
package Module::Build::Dumper;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
# This is just a split-out of a wrapper function to do Data::Dumper
# stuff "the right way". See:
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use File::Spec;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Data::Dumper;
use IO::File;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
# This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
my ($self, $config) = @_;
my $varchname = $config->{archname};
# Append "-5.8" to architecture name for Perl 5.8 and later
- if (defined($^V) && ord(substr($^V,1)) >= 8) {
- $varchname .= sprintf("-%d.%d", ord($^V), ord(substr($^V,1)));
+ if ($] >= 5.008) {
+ my $vstring = sprintf "%vd", $^V;
+ $vstring =~ s/\.\d+$//;
+ $varchname .= "-$vstring";
}
return $varchname;
}
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use vars qw(@ISA);
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use vars qw(@ISA);
@ISA = qw(Module::Build::Base);
-sub make_tarball {
- my $self = shift;
- $self->{args}{tar} ||= ['tar'];
- $self->{args}{gzip} ||= ['gzip'];
- $self->SUPER::make_tarball(@_);
-}
-
sub is_executable {
# We consider the owner bit to be authoritative on a file, because
# -x will always return true if the user is root and *any*
use strict;
use vars qw($VERSION);
-$VERSION = '0.32_01';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
=item rscan_dir
-Inherit the standard version but remove dots at end of name. This may not be
-necessary if File::Find has been fixed or DECC$FILENAME_UNIX_REPORT is in effect.
+Inherit the standard version but remove dots at end of name.
+If the extended character set is in effect, do not remove dots from filenames
+with Unix path delimiters.
=cut
my $result = $self->SUPER::rscan_dir( $dir, $pattern );
- for my $file (@$result) { $file =~ s/\.$//; }
+ for my $file (@$result) {
+ if (!_efs() && ($file =~ m#/#)) {
+ $file =~ s/\.$//;
+ }
+ }
return $result;
}
my $self = shift;
my $dist_dir = $self->SUPER::dist_dir;
- $dist_dir =~ s/\./_/g;
+ $dist_dir =~ s/\./_/g unless _efs();
return $dist_dir;
}
# break up the paths for the merge
my $home = VMS::Filespec::unixify($ENV{HOME});
+ # In the default VMS mode, the trailing slash is present.
+ # In Unix report mode it is not. The parsing logic assumes that
+ # it is present.
+ $home .= '/' unless $home =~ m#/$#;
+
# Trivial case of just ~ by it self
if ($spec eq '') {
$home =~ s#/$##;
# Now put the two cases back together
$arg = File::Spec::Unix->catpath($hvol, $newdirs, $file);
- } else {
- return $arg;
}
+ return $arg;
}
=cut
-sub find_perl_interpreter { return $^X; }
+sub find_perl_interpreter {
+ return VMS::Filespec::vmsify($^X);
+}
=item localize_file_path
sub localize_file_path {
my ($self, $path) = @_;
+ $path = VMS::Filespec::vmsify($path);
$path =~ s/\.\z//;
- return VMS::Filespec::vmsify($path);
+ return $path;
}
=item localize_dir_path
}
}
+
+# Need to look up the feature settings. The preferred way is to use the
+# VMS::Feature module, but that may not be available to dual life modules.
+
+my $use_feature;
+BEGIN {
+ if (eval { local $SIG{__DIE__}; require VMS::Feature; }) {
+ $use_feature = 1;
+ }
+}
+
+# Need to look up the UNIX report mode. This may become a dynamic mode
+# in the future.
+sub _unix_rpt {
+ my $unix_rpt;
+ if ($use_feature) {
+ $unix_rpt = VMS::Feature::current("filename_unix_report");
+ } else {
+ my $env_unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
+ $unix_rpt = $env_unix_rpt =~ /^[ET1]/i;
+ }
+ return $unix_rpt;
+}
+
+# Need to look up the EFS character set mode. This may become a dynamic
+# mode in the future.
+sub _efs {
+ my $efs;
+ if ($use_feature) {
+ $efs = VMS::Feature::current("efs_charset");
+ } else {
+ my $env_efs = $ENV{'DECC$EFS_CHARSET'} || '';
+ $efs = $env_efs =~ /^[ET1]/i;
+ }
+ return $efs;
+}
+
=back
=head1 AUTHOR
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Config;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.32';
+$VERSION = '0.33_02';
$VERSION = eval $VERSION;
use vars qw(@ISA);
+++ /dev/null
-#!/usr/bin/perl
-
-# this is just a first crack and it uses File::Fu because I'm lazy.
-
-=head1 using
-
-This installs from a fresh Module::Build to your inc/inc_Module-Build
-directory. Use it from within your dist:
-
- perl /path/to/Module-Build/scripts/bundle.pl
-
-You still need to manually add the following to your Build.PL
-
- use lib 'inc';
- use latest 'Module::Build';
-
-You also need to regen your manifest.
-
- perl Build.PL
- ./Build distmeta; >MANIFEST; ./Build manifest; svn diff MANIFEST
-
-=cut
-
-use warnings;
-use strict;
-
-use File::Fu;
-use File::Copy ();
-
-my $inc_dir = shift(@ARGV);
-$inc_dir = File::Fu->dir($inc_dir || 'inc/inc_Module-Build');
-$inc_dir->create unless($inc_dir->e);
-$inc_dir = $inc_dir->absolutely;
-
-
-my $mb_dir = File::Fu->program_dir->dirname;
-
-$mb_dir->chdir_for(sub {
- my $temp = File::Fu->temp_dir('mb_bundle');
- local @INC = @INC;
- unshift(@INC, 'lib', 'inc');
- require Module::Build;
- my $builder = Module::Build->new_from_context;
- $builder->dispatch(install =>
- install_base => $temp,
- install_path => {lib => $inc_dir},
- );
-});
-
-my $latest = $mb_dir/'inc'+'latest.pm';
-File::Copy::copy($latest, 'inc');
-
-# vim:ts=2:sw=2:et:sta
#
# Author: Christopher J. Madsen <cjm@pobox.com>
# Created: 08 Nov 1997
-# $Revision: 5841 $ $Date: 2006-03-21 05:27:29 -0800 (Tue, 21 Mar 2006) $
+# $Revision: 5841 $ $Date: 2006-03-21 08:27:29 -0500 (Tue, 21 Mar 2006) $
#
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
$foo_builder = Foo::Builder->new_from_context;
});
foreach my $style ('passthrough', 'small') {
- Module::Build::Compat->create_makefile_pl($style, $foo_builder);
- ok -e 'Makefile.PL', "$style Makefile.PL created";
+ create_makefile_pl($style, $foo_builder);
# Should fail with "can't find Foo/Builder.pm"
my $result;
$bar_builder = Module::Build->subclass( class => 'Bar::Builder' )->new_from_context;
});
foreach my $style ('passthrough', 'small') {
- Module::Build::Compat->create_makefile_pl($style, $bar_builder);
- ok -e 'Makefile.PL', "$style Makefile.PL created via subclass";
+ create_makefile_pl($style, $bar_builder);
my $result;
stdout_of( sub {
$result = $mb->run_perl_script('Makefile.PL');
{
# Make sure various Makefile.PL arguments are supported
- Module::Build::Compat->create_makefile_pl('passthrough', $mb);
+ create_makefile_pl('passthrough', $mb);
my $libdir = File::Spec->catdir( $tmp, 'libdir' );
my $result;
# C<glob> on MSWin32 uses $ENV{HOME} if defined to do tilde-expansion
local $ENV{HOME} = 'C:/' if $^O =~ /MSWin/ && !exists( $ENV{HOME} );
- Module::Build::Compat->create_makefile_pl('passthrough', $mb);
+ create_makefile_pl('passthrough', $mb);
stdout_of( sub {
$mb->run_perl_script('Makefile.PL', [], ['INSTALL_BASE=~/foo']);
ok $mb, "Module::Build->new_from_context";
# Create and test Makefile.PL
- Module::Build::Compat->create_makefile_pl($type, $mb);
- ok -e 'Makefile.PL', "$type Makefile.PL created";
+ create_makefile_pl($type, $mb);
+
test_makefile_pl_requires_perl( $opts{requires}{perl} );
test_makefile_creation($mb);
test_makefile_prereq_pm( $opts{requires} );
ok $success, "make realclean ran without error";
# Try again with some Makefile.PL arguments
- test_makefile_creation($mb, [], 'INSTALLDIRS=vendor', 1);
+ test_makefile_creation($mb, [], 'INSTALLDIRS=vendor', 'realclean');
+ # Try again using distclean
+ test_makefile_creation($mb, [], '', 'distclean');
+
1 while unlink 'Makefile.PL';
ok ! -e 'Makefile.PL', "cleaned up Makefile";
}
ok -e $makefile, "$makefile exists";
if ($cleanup) {
- $output = stdout_of( sub {
- $build->do_system(@make, 'realclean');
+ # default to 'realclean' unless we recognize the clean method
+ $cleanup = 'realclean' unless $cleanup =~ /^(dist|real)clean$/;
+ my ($stdout, $stderr ) = stdout_stderr_of (sub {
+ $build->do_system(@make, $cleanup);
});
- ok ! -e '$makefile', "$makefile cleaned up";
+ ok ! -e $makefile, "$makefile cleaned up with $cleanup";
}
else {
pass '(skipping cleanup)'; # keep test count constant
my $expected = shift;
SKIP: {
- skip "$makefile not found", 1 unless -e $makefile;
- my $pl_files = find_params_in_makefile()->{PL_FILES} || {};
- is_deeply $pl_files, $expected,
- "$makefile has correct PL_FILES line";
+ skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
+ my $args = extract_writemakefile_args() || {};
+ is_deeply $args->{PL_FILES}, $expected,
+ "Makefile.PL has correct PL_FILES line";
}
}
sub test_makefile_pl_requires_perl {
my $perl_version = shift || q{};
SKIP: {
- skip 'Makefile.PL not found', 1 unless -e 'Makefile.PL';
+ skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
my $file_contents = slurp 'Makefile.PL';
my $found_requires = $file_contents =~ m{^require $perl_version;}ms;
if (length $perl_version) {
return \%params;
}
+
+sub extract_writemakefile_args {
+ SKIP: {
+ skip 1, 'Makefile.PL not found' unless -e 'Makefile.PL';
+ my $file_contents = slurp 'Makefile.PL';
+ my ($args) = $file_contents =~ m{^WriteMakefile\n\((.*)\).*;}ms;
+ ok $args, "Found WriteMakefile arguments"
+ or diag "Makefile.PL:\n$file_contents";
+ my %args = eval $args or diag $args; ## no critic
+ return \%args;
+ }
+}
+
+sub create_makefile_pl {
+ Module::Build::Compat->create_makefile_pl(@_);
+ my $ok = ok -e 'Makefile.PL', "$_[0] Makefile.PL created";
+
+ # Some really conservative make's, like HP/UX, assume files with the same
+ # timestamp are out of date. Send the Makefile.PL one second into the past
+ # so its older than the Makefile it will generate.
+ # See [rt.cpan.org 45700]
+ my $mtime = (stat("Makefile.PL"))[9];
+ utime $mtime, $mtime - 1, "Makefile.PL";
+
+ return $ok;
+}
my @data = map values(%$_), @unix_splits, @win_splits;
for my $d (@data) {
- chomp(my $out = Module::Build->_backticks('perl', '-le', 'print join " ", map "{$_}", @ARGV', @$d));
+ chomp(my $out = Module::Build->_backticks($^X, '-le', 'print join " ", map "{$_}", @ARGV', @$d));
is($out, join(' ', map "{$_}", @$d), "backticks round trip for ".join('',map "{$_}", @$d));
}
}
{
# Make sure run_perl_script() propagates @INC
my $dir = MBTest->tmpdir;
+ if ($^O eq 'VMS') {
+ # VMS can store INC paths in Unix format with out the trailing
+ # directory delimiter.
+ $dir = VMS::Filespec::unixify($dir);
+ $dir =~ s#/$##;
+ }
local @INC = ($dir, @INC);
my $output = stdout_of( sub { Module::Build->run_perl_script('-le', [], ['print for @INC']) } );
like $output, qr{^\Q$dir\E}m;
$mb->test_files('*t*');
my $files = $mb->test_files;
ok grep {$_ eq 'script'} @$files;
- ok grep {$_ eq File::Spec->catfile('t', 'basic.t')} @$files;
+ my $t_basic_t = File::Spec->catfile('t', 'basic.t');
+ $t_basic_t = VMS::Filespec::vmsify($t_basic_t) if $^O eq 'VMS';
+ ok grep {$_ eq $t_basic_t} @$files;
ok !grep {$_ eq 'Build.PL' } @$files;
# Make sure order is preserved
my $simple_file = 'lib/Simple.pm';
my $simple2_file = 'lib/Simple2.pm';
- #TODO:
# Traditional VMS will return the file in in lower case, and is_deeply
# does exact case comparisons.
- # When ODS-5 support is active for preserved case file names, this will
- # need to be changed.
+ # When ODS-5 support is active for preserved case file names we do not
+ # change the case.
if ($^O eq 'VMS') {
- $simple_file = lc($simple_file);
- $simple2_file = lc($simple2_file);
+ my $lower_case_expect = 1;
+ my $vms_efs_case = 0;
+ if (eval 'require VMS::Feature') {
+ $vms_efs_case = VMS::Feature::current("efs_case_preserve");
+ } else {
+ my $efs_case = $ENV{'DECC$EFS_CASE_PRESERVE'} || '';
+ $vms_efs_case = $efs_case =~ /^[ET1]/i;
+ }
+ $lower_case_expect = 0 if $vms_efs_case;
+ if ($lower_case_expect) {
+ $simple_file = lc($simple_file);
+ $simple2_file = lc($simple2_file);
+ }
}
my $dist_dir = 'Simple-0.01';
-# VMS may or may not need to modify the name, vmsify will do this if
-# the name looks like a UNIX directory.
+# VMS in traditional mode needs the $dist_dir name to not have a '.' in it
+# as this is a directory delimiter. In extended character set mode the dot
+# is permitted for Unix format file specifications.
if ($^O eq 'VMS') {
- my @dist_dirs = File::Spec->splitdir(VMS::Filespec::vmsify($dist_dir.'/'));
- $dist_dir = $dist_dirs[0];
+ my $Is_VMS_noefs = 1;
+ my $vms_efs = 0;
+ if (eval 'require VMS::Feature') {
+ $vms_efs = VMS::Feature::current("efs_charset");
+ } else {
+ my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
+ $vms_efs = $efs_charset =~ /^[ET1]/i;
+ }
+ $Is_VMS_noefs = 0 if $vms_efs;
+ if ($Is_VMS_noefs) {
+ $dist_dir = 'Simple-0_01';
+ }
}
is $mb->dist_dir, $dist_dir;