Subject: | Make MM_Win32 cd back from subdirectories |
Windows XP, nmake, Perl 5.8.8 (ActiveState build 816).
Pugs likes to build in directories below ext, for example the resulting
Makefile says:
subdirs ::
$(NOECHO) cd ext\Algorithm-TokenBucket
$(MAKE) $(USEMAKEFILE) $(FIRST_MAKEFILE) all $(PASTHRU)
cd ..
This won't work, as we're only stepping one directory back, as
documented in MM_Win32.
I've attached a simple patch. Not sure if it's a good way to solve it,
but it works for me.
Ron
Subject: | win32_cdback.patch |
--- MM_Win32.pm.orig 2006-05-05 22:40:50.000000000 +0200
+++ MM_Win32.pm 2006-05-05 23:05:06.000000000 +0200
@@ -478,9 +478,6 @@
another_command
cd ..
-B<NOTE> This cd can only go one level down. So far this sufficient for
-what MakeMaker needs.
-
=cut
sub cd {
@@ -490,11 +487,23 @@
my $cmd = join "\n\t", map "$_", @cmds;
+ my $cdbackdirs = File::Spec->catdir(
+ (File::Spec->updir)
+ x File::Spec->no_upwards(
+ File::Spec->splitdir($dir)
+ )
+ );
+ unless ($cdbackdirs) {
+ require Carp;
+ Carp::croak("ERROR: Don't know how to cd back from".
+ " directory '$dir'\n");
+ }
+
# No leading tab and no trailing newline makes for easier embedding.
- my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd;
+ my $make_frag = sprintf <<'MAKE_FRAG', $dir, $cmd, $cdbackdirs;
cd %s
%s
- cd ..
+ cd %s
MAKE_FRAG
chomp $make_frag;