This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to ExtUtils::MakeMaker 6.25
[perl5.git] / lib / ExtUtils / MM_Any.pm
index 9c73e04..df89c1f 100644 (file)
@@ -2,7 +2,7 @@ package ExtUtils::MM_Any;
 
 use strict;
 use vars qw($VERSION @ISA);
-$VERSION = 0.07;
+$VERSION = '0.10';
 @ISA = qw(File::Spec);
 
 use Config;
@@ -87,6 +87,52 @@ sub os_flavor_is {
     return (grep { $flavors{$_} } @_) ? 1 : 0;
 }
 
+
+=item dir_target B<DEPRECATED>
+
+    my $make_frag = $mm->dir_target(@directories);
+
+I<This function is deprecated> its use is no longer necessary and is
+I<only provided for backwards compatibility>.  It is now a no-op.
+blibdirs_target provides a much simpler mechanism and pm_to_blib() can
+create its own directories anyway.
+
+=cut
+
+sub dir_target {}
+
+
+=item blibdirs_target (o)
+
+    my $make_frag = $mm->blibdirs_target;
+
+Creates the blibdirs.ts target which creates all the directories we use in
+blib/.
+
+=cut
+
+sub blibdirs_target {
+    my $self = shift;
+
+    my @dirs = map { uc "\$(INST_$_)" } qw(libdir archlib
+                                           autodir archautodir
+                                           bin script
+                                           man1dir man3dir
+                                          );
+    my @mkpath = $self->split_command('$(NOECHO) $(MKPATH)', @dirs);
+    my @chmod  = $self->split_command('$(NOECHO) $(CHMOD) 755', @dirs);
+
+    my $make = "\nblibdirs.ts :\n";
+    $make .= join "", map { "\t$_\n" } @mkpath, @chmod;
+    $make .= <<'MAKE';
+       $(NOECHO) $(TOUCH) $@
+
+MAKE
+
+    return $make;
+}
+
+
 =back
 
 =head2 File::Spec wrappers
@@ -178,7 +224,7 @@ sub split_command {
         }
         chop $arg_str;
 
-        push @cmds, $self->escape_newlines("$cmd\n$arg_str");
+        push @cmds, $self->escape_newlines("$cmd \n$arg_str");
     } while @args;
 
     return @cmds;
@@ -584,7 +630,7 @@ MAKE_FRAG
         my $ver = $self->{PREREQ_PM}{$mod};
         $prereq_pm .= sprintf "    %-30s %s\n", "$mod:", $ver;
     }
-    
+
     my $meta = <<YAML;
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
@@ -598,10 +644,16 @@ distribution_type: module
 generated_by: ExtUtils::MakeMaker version $ExtUtils::MakeMaker::VERSION
 YAML
 
-    my @write_meta = $self->echo($meta, 'META.yml');
-    return sprintf <<'MAKE_FRAG', join "\n\t", @write_meta;
+    my @write_meta = $self->echo($meta, 'META_new.yml');
+    my $move = $self->oneliner(<<'CODE', ['-MExtUtils::Command', '-MFile::Compare']);
+compare(@ARGV) != 0 ? (mv or warn "Cannot move @ARGV: $$!\n") : unlink(shift);
+CODE
+
+    return sprintf <<'MAKE_FRAG', join("\n\t", @write_meta), $move;
 metafile :
+       $(NOECHO) $(ECHO) Generating META.yml
        %s
+       -$(NOECHO) %s META_new.yml META.yml
 MAKE_FRAG
 
 }
@@ -621,12 +673,12 @@ sub signature_target {
     my $self = shift;
 
     return <<'MAKE_FRAG' if !$self->{SIGN};
-signature:
+signature :
        $(NOECHO) $(NOOP)
 MAKE_FRAG
 
     return <<'MAKE_FRAG';
-signature:
+signature :  signature_addtomanifest
        cpansign -s
 MAKE_FRAG
 
@@ -656,6 +708,7 @@ CODE
 
     return sprintf <<'MAKE_FRAG', $add_meta;
 metafile_addtomanifest:
+       $(NOECHO) $(ECHO) Adding META.yml to MANIFEST
        $(NOECHO) %s
 MAKE_FRAG
 
@@ -674,7 +727,7 @@ sub signature_addtomanifest_target {
     my $self = shift;
 
     return <<'MAKE_FRAG' if !$self->{SIGN};
-signature_addtomanifest:
+signature_addtomanifest :
        $(NOECHO) $(NOOP)
 MAKE_FRAG
 
@@ -684,7 +737,8 @@ eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) }
 CODE
 
     return sprintf <<'MAKE_FRAG', $add_sign;
-signature_addtomanifest:
+signature_addtomanifest :
+       $(NOECHO) $(ECHO) Adding SIGNATURE to MANIFEST
        $(NOECHO) %s
 MAKE_FRAG
 
@@ -878,7 +932,7 @@ sub platform_constants {
 corresponding to the MM_*.pm file we're using.  
 
 The first element of @os_flavor is the major family (ie. Unix,
-Windows, VMS, OS/2, MacOS, etc...) and the rest are sub families.
+Windows, VMS, OS/2, etc...) and the rest are sub families.
 
 Some examples:
 
@@ -886,7 +940,6 @@ Some examples:
     Windows NT     ('Win32', 'WinNT')
     Win98          ('Win32', 'Win9x')
     Linux          ('Unix',  'Linux')
-    MacOS Classic  ('MacOS', 'MacOS Classic')
     MacOS X        ('Unix',  'Darwin', 'MacOS', 'MacOS X')
     OS/2           ('OS/2')