Author: dagolden
Date: Fri Jun 19 13:30:09 2009
New Revision: 12867

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/Compat.pm
   Module-Build/trunk/t/compat.t

Log:
Fixed Module::Build::Compat handling of INSTALL*LIB (RT#43827)


Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Fri Jun 19 13:30:09 2009
@@ -6,6 +6,7 @@
  - Removes Module::Build from its own configure/build_requires
  - ConfigData->feature() confirms that modules actually load successfully,
    not just that they are present. (RT#43557)
+ - Module::Build::Compat handling of INSTALL*LIB (RT#43827)
 
  Other
  - On MSWin32, bumped File::Spec prereq to 3.30 for a variety of fixes

Modified: Module-Build/trunk/lib/Module/Build/Compat.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Compat.pm       (original)
+++ Module-Build/trunk/lib/Module/Build/Compat.pm       Fri Jun 19 13:30:09 2009
@@ -38,14 +38,21 @@
    # Convert INSTALLVENDORLIB and friends.
    (
        map {
-           my $name = "INSTALL".$_."LIB";
+           my $name = $_;
            $name => sub {
-                 my @ret = (config => { lc $name => shift });
+                 my @ret = (config => lc($name) . "=" . shift );
                  print STDERR "# Converted to @ret\n";
 
                  return @ret;
            }
-       } keys %convert_installdirs
+       } qw(
+         INSTALLARCHLIB  INSTALLSITEARCH     INSTALLVENDORARCH
+         INSTALLPRIVLIB  INSTALLSITELIB      INSTALLVENDORLIB
+         INSTALLBIN      INSTALLSITEBIN      INSTALLVENDORBIN
+         INSTALLSCRIPT   INSTALLSITESCRIPT   INSTALLVENDORSCRIPT
+         INSTALLMAN1DIR  INSTALLSITEMAN1DIR  INSTALLVENDORMAN1DIR
+         INSTALLMAN3DIR  INSTALLSITEMAN3DIR  INSTALLVENDORMAN3DIR
+       )
    ),
 
    # Some names they have in common
@@ -242,14 +249,30 @@
 
 sub makefile_to_build_macros {
   my @out;
+  my %config; # must accumulate and return as a hashref
   while (my ($macro, $trans) = each %macro_to_build) {
     # On some platforms (e.g. Cygwin with 'make'), the mere presence
     # of "EXPORT: FOO" in the Makefile will make $ENV{FOO} defined.
     # Therefore we check length() too.
     next unless exists $ENV{$macro} && length $ENV{$macro};
     my $val = $ENV{$macro};
-    push @out, ref($trans) ? $trans->($val) : ($trans => $val);
+    my @args = ref($trans) ? $trans->($val) : ($trans => $val);
+    while (@args) {
+      my ($k, $v) = splice(@args, 0, 2);
+      if ( $k eq 'config' ) {
+        if ( $v =~ /^([^=]+)=(.*)$/ ) {
+          $config{$1} = $2;
+        }
+        else {
+          warn "Couldn't parse config '$v'\n";
+        }
+      }
+      else {
+        push @out, ($k => $v);
+      }
+    }
   }
+  push @out, (config => \%config) if %config; 
   return @out;
 }
 

Modified: Module-Build/trunk/t/compat.t
==============================================================================
--- Module-Build/trunk/t/compat.t       (original)
+++ Module-Build/trunk/t/compat.t       Fri Jun 19 13:30:09 2009
@@ -213,13 +213,14 @@
        'Should be non-verbose';
 
   (my $libdir2 = $libdir) =~ s/libdir/lbiidr/;
+  my $libarch2 = File::Spec->catdir($libdir2, 'arch');
 
   SKIP: {
     require ExtUtils::Install;
     skip "Needs ExtUtils::Install 1.32 or later", 2
       if ExtUtils::Install->VERSION < 1.32;
 
-    my @make_args = ('INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2");
+    my @make_args = ('INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2", 
"INSTALLVENDORARCH=$libarch2");
 
     if ($is_vms_mms) { # VMS MMK/MMS macros use different syntax.
       $make_args[0] = '/macro=("' . join('","',@make_args) . '")';

Reply via email to