[ANNOUNCE] Math::BigInt v1.69
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / MM_Unix.pm
index 24348ac..a1c21d2 100644 (file)
@@ -20,7 +20,7 @@ use vars qw($VERSION @ISA
 
 use ExtUtils::MakeMaker qw($Verbose neatvalue);
 
-$VERSION = '1.44';
+$VERSION = '1.45';
 
 require ExtUtils::MM_Any;
 @ISA = qw(ExtUtils::MM_Any);
@@ -559,6 +559,73 @@ sub depend {
     join "", @m;
 }
 
+
+=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>.  blibdirs_target provides a much
+simpler mechanism and pm_to_blib() can create its own directories anyway.
+
+Returns a Makefile entry for a .exists file in each of the @directories.
+The purpose is to create a directory and provide a make target to depend on.
+The make target is a .exists file in each of those directories.
+
+For example
+
+    $mm->dir_target('$(INST_ARCHDIR)');
+
+would return the make target C<$(INST_ARCHDIR)/.exists> which would
+create $(INST_ARCHDIR) and touch .exists.  You would depend on this target
+to make sure $(INST_ARCHDIR) is created.
+
+Ignores directories which have already gone through dir_target() so you
+might wind up getting nothing.
+
+=cut
+
+sub dir_target {
+    my($self, @dirs) = @_;
+
+    my @targs = ();
+    my $make = '';
+    foreach my $dir (@dirs) {
+        my $targ = $self->catfile($dir, '.exists');
+
+        my $targdir;
+        if ($Is_VMS) { # Just remove file name; dirspec is often in macro
+            ($targdir = $targ) =~ s:/?\.exists\z::;
+        }
+        else { # while elsewhere we expect to see the dir separator in $targ
+            $targdir = dirname($targ);
+        }
+
+        next if $self->{DIR_TARGET}{$self}{$targdir}++;
+
+        push @targs, $targ;
+        $make .= <<MAKE_FRAG;
+$targ ::
+       \$(NOECHO) \$(MKPATH) $targdir
+       \$(NOECHO) \$(TOUCH) $targ
+       \$(NOECHO) \$(CHMOD) \$(PERM_RWX) $targdir
+
+MAKE_FRAG
+
+    }
+
+    # So these new .exists targets get called along with blibdirs.
+    my $blib_addition = '';
+    $blib_addition = <<MAKE_FRAG if @targs;
+blibdirs :: @targs
+       \$(NOECHO) \$(NOOP)
+
+MAKE_FRAG
+
+    return $blib_addition . $make;
+}
+
+
 =item init_DEST
 
   $mm->init_DEST
@@ -1083,9 +1150,9 @@ $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) blibdirs $(EXPORT_LIST) $(PE
        # platforms.  We peek at lddlflags to see if we need -Wl,-R
        # or -R to add paths to the run-time library search path.
         if ($Config{'lddlflags'} =~ /-Wl,-R/) {
-            $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl';
+            $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -Wl,-R$(PERL_ARCHLIB)/CORE -lperl';
         } elsif ($Config{'lddlflags'} =~ /-R/) {
-            $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -lperl';
+            $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -R$(PERL_ARCHLIB)/CORE -lperl';
         }
     }
 
@@ -1170,7 +1237,7 @@ WARNING
             next unless $self->maybe_command($abs);
             print "Executing $abs\n" if ($trace >= 2);
 
-            my $version_check = qq{$abs -e "require $ver; print qq{VER_OK\n}"};
+            my $version_check = qq{$abs -le "require $ver; print qq{VER_OK}"};
             # To avoid using the unportable 2>&1 to supress STDERR,
             # we close it before running the command.
             # However, thanks to a thread library bug in many BSDs
@@ -2574,7 +2641,7 @@ realclean ::
        last unless defined $from;
        my $todir = dirname($to);
        push @m, "
-$to: $from \$(FIRST_MAKEFILE) blibdirs
+$to : $from \$(FIRST_MAKEFILE) blibdirs
        \$(NOECHO) \$(RM_F) $to
        \$(CP) $from $to
        \$(FIXIN) $to
@@ -2710,7 +2777,7 @@ $(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
     require File::Find;
     File::Find::find(sub {
        return unless m/\Q$self->{LIB_EXT}\E$/;
-       return if m/^libperl/;
+       return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/;
        # Skip purified versions of libraries (e.g., DynaLoader_pure_p1_c0_032.a)
        return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure";
 
@@ -2905,8 +2972,8 @@ $(OBJECT) : $(FIRST_MAKEFILE)
 $(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
        $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
        $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
-       $(NOECHO) $(RM_F) $(MAKEFILE_OLD)
-       $(NOECHO) $(MV)   $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
+       -$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
+       -$(NOECHO) $(MV)   $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
        -$(MAKE) -f $(MAKEFILE_OLD) clean $(DEV_NULL) || $(NOOP)
        $(PERLRUN) Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
        $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
@@ -3778,7 +3845,7 @@ test :: \$(TEST_TYPE)
 ");
 
     if ($Is_Win95) {
-        push(@m, map(qq{\t\$(NOECHO) \$(PERLRUN) -e "exit unless -f shift; chdir '$_'; system q{\$(MAKE) test \$(PASTHRU)}" \$(FIRST_MAKEFILE)\n}, @{$self->{DIR}}));
+        push(@m, map(qq{\t\$(NOECHO) \$(PERLRUN) -e "exit unless -f shift; chdir '$_'; system q[\$(MAKE) test \$(PASTHRU)]" \$(FIRST_MAKEFILE)\n}, @{$self->{DIR}}));
     }
     else {
         push(@m, map("\t\$(NOECHO) cd $_ && \$(TEST_F) \$(FIRST_MAKEFILE) && \$(MAKE) test \$(PASTHRU)\n", @{$self->{DIR}}));
@@ -3967,14 +4034,12 @@ config :: $(FIRST_MAKEFILE) blibdirs
        $(NOECHO) $(NOOP)
 ';
 
-    push @m, $self->blibdirs_target;
-
     push @m, '
 $(O_FILES): $(H_FILES)
 ' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
 
     push @m, q{
-help:
+help :
        perldoc ExtUtils::MakeMaker
 };