Author: kwilliams
Date: Sat Apr 28 10:23:09 2007
New Revision: 9469

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/Base.pm
   Module-Build/trunk/t/basic.t

Log:
Fix --extra_compiler_flags and --extra_linker_flags

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Sat Apr 28 10:23:09 2007
@@ -12,6 +12,9 @@
 
  - Workaround Test::Pod::Coverage @INC bug. [Eric Wilhelm]
 
+ - Fixed the command-line args --extra_compiler_flags and
+   --extra_linker_flags so they properly shell-split their arguments.
+
 0.2807 - Sat Mar 24 22:19:02 2007
 
  - Upgraded to version.pm 0.71. [John Peacock]

Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Sat Apr 28 10:23:09 2007
@@ -1633,6 +1633,10 @@
   }
   $args{ARGV} = [EMAIL PROTECTED];
 
+  for ('extra_compiler_flags', 'extra_linker_flags') {
+    $args{$_} = [ $self->split_like_shell($args{$_}) ] if exists $args{$_};
+  }
+
   # Hashify these parameters
   for ($self->hash_properties, 'config') {
     next unless exists $args{$_};

Modified: Module-Build/trunk/t/basic.t
==============================================================================
--- Module-Build/trunk/t/basic.t        (original)
+++ Module-Build/trunk/t/basic.t        Sat Apr 28 10:23:09 2007
@@ -2,7 +2,7 @@
 
 use strict;
 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 49;
+use MBTest tests => 52;
 
 use Cwd ();
 my $cwd = Cwd::cwd;
@@ -206,6 +206,14 @@
   ok $mb;
   is_deeply $mb->extra_compiler_flags, ['-I/foo', '-I/bar'], "Should split 
shell string into list";
   is_deeply $mb->extra_linker_flags,   ['-L/foo', '-L/bar'], "Should split 
shell string into list";
+
+  # Try again with command-line args
+  eval {Module::Build->run_perl_script('Build.PL', [], 
['--extra_compiler_flags', '-I/foo -I/bar',
+                                                       '--extra_linker_flags', 
'-L/foo -L/bar'])};
+  $mb = Module::Build->resume;
+  ok $mb;
+  is_deeply $mb->extra_compiler_flags, ['-I/foo', '-I/bar'], "Should split 
shell string into list";
+  is_deeply $mb->extra_linker_flags,   ['-L/foo', '-L/bar'], "Should split 
shell string into list";
 }
 
 

Reply via email to