Inline::CPP: New Darwin failure.

[email protected] (David Oswald)
Newsgroups perl.inline
Message-ID <CAKTcQ96UBZEA39Fu2og0Ny9raDUPZDB-rtsXhksz_5MG9a7P9w@mail.gmail.com>
Inline::CPP version 0.38_004:

I just noticed another Darwin smoke-test failure.

PASS:  http://www.cpantesters.org/cpan/report/c30eb71a-8bac-11e1-9ec4-a796756b88d3
FAIL:  http://www.cpantesters.org/cpan/report/b5830500-89c8-11e1-9ec4-a796756b88d3

The only difference I see between the two is Perl version number
(which shouldn't be an issue), and thread support in the failure case.
However, we passed on Darwin with thread support in version 0.38_002:

PASS:  http://www.cpantesters.org/cpan/report/7b429bc8-6b5d-11e1-b453-f9f6ec0326e0

All of these tests are from Chris Williams.

There have been some changes to Makefile.PL from 0.38_002 to 0.38_004,
but none that specifically affect how Darwin is handled.  Though
nothing in specific stands out to me, I'm attaching a diff of
Makefile.PL resulting from the following Git command:

git diff --minimal v0.38_002 v0.38_004 -- Makefile.PL

If there are any OS-X/Darwin users out there who have some idea of
what needs to happen to fix the Darwin failure I'd appreciate hearing.

Dave

-- 

David Oswald
[email protected]
Mf_PL.diff (application/octet-stream, 4.8 KB)
diff --git a/Makefile.PL b/Makefile.PL
index c790ae3..0fc9149 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
 use Config;
 
 use strict;
-use 5.006000;
+# use 5.006000;
 
 # We're using bareword file handles and two arg open for backward
 # compatibility in Makefile.PL.  Here we disable those tests in Perl::Critic.
@@ -10,6 +10,8 @@ use 5.006000;
 ## no critic (bareword file handle)
 ## no critic (two-argument open)
 
+my $CPP_Config_path = 'lib/Inline/CPP/Config.pm';
+
 
 my %PREREQ_PM = (
     'Inline'            => '0.50',
@@ -76,7 +78,8 @@ elsif ($Config{osname} eq 'linux') {
     $cc_guess   = 'g++';
     $libs_guess = '-lstdc++';
 }
-elsif( $Config{osname} eq 'netbsd' ) {
+# Dragonfly patch is just a hunch...
+elsif( $Config{osname} eq 'netbsd' || $Config{osname} eq 'dragonfly' ) {
     $cc_guess   = 'g++';
     $libs_guess = '-lstdc++ -lgcc_s';
 }
@@ -123,6 +126,7 @@ my $libs         = prompt(
     $libs_guess
 );
 
+
 #============================================================================
 # Test whether the compiler prefers <iostream> or <iostream.h>.
 #============================================================================
@@ -148,15 +152,13 @@ else {
     );
 }
 
-my $iostream_fname_style = 'iostream';
-my $namespace_std        = "#define __INLINE_CPP_NAMESPACE_STD 1\n";
-my $standard_headers     = "#define __INLINE_CPP_STANDARD_HEADERS 1\n";
+my $iostream_fname    = 'iostream';
+my $comment           = '';
 if( $result != 0 ) {
     # Compiling with <iostream> failed, so we'll assume .h headers.
     print "Detected <iostream.h> style headers. ('.h' needed.)\n";
-    $iostream_fname_style = 'iostream.h';
-    $namespace_std        = "// $namespace_std";
-    $standard_headers     = "// $standard_headers";
+    $iostream_fname    = 'iostream.h';
+    $comment           = '//';          # Prepend a comment to a #define.
 }
 else {
     # Compiling with <iostream> passed, so we'll assume Standard headers.
@@ -168,53 +170,43 @@ unlink "$test_cpp_filename.cpp" or warn $!;  # Unlink the test source.
 
 
 # Apply the defaults:
-open CPP, "CPP.pm" or die "Can't read from CPP.pm for configuration!\n$!";
-my @lines = <CPP>;
-close CPP;
+open CPP_Config, $CPP_Config_path
+    or die "Can't read from $CPP_Config_path for configuration!\n$!";
+my @lines = <CPP_Config>;
+close CPP_Config;
 
 for (@lines) {
-
-    $_ =    " \$o->{ILSM}{MAKEFILE}{CC} ||= '$cpp_compiler'; "
-            . "# default compiler\n"
-        if /# default compiler/;
-
-    $_  =   " \$o->{ILSM}{MAKEFILE}{LIBS} ||= ['$libs']; "
-            . "# default libs\n"
-        if /# default libs/;
-
-    $_  =   " my \$iostream = '$iostream_fname_style';"
-            . " # default iostream filename\n"
-        if /# default iostream filename/;
-
-    $_  =   $namespace_std
-        if /#define __INLINE_CPP_NAMESPACE_STD/;
-
-    $_  =   $standard_headers
-        if /#define __INLINE_CPP_STANDARD_HEADERS/;
-
+    s{ ( our \s* \$compiler    \s* = \s* ['"] ) [^'"]+ } {$1$cpp_compiler}x;
+    s{ ( our \s* \$libs        \s* = \s* ['"] ) [^'"]+ } {$1$libs}x;
+    s{ ( our \s* \$iostream_fn \s* = \s* ['"] ) [^'"]+ } {$1$iostream_fname}x;
+    s{ ^ [^#]* ( \#define \s+ __INLINE_CPP_NAMESPACE_STD    ) } {$comment$1}x;
+    s{ ^ [^#]* ( \#define \s+ __INLINE_CPP_STANDARD_HEADERS ) } {$comment$1}x;
 }
 
-open  CPP, '>CPP.pm'
-    or die "Can't write to CPP.pm for configuration!\n$!";
+open  CPP_Config, ">$CPP_Config_path"
+    or die "Can't write to $CPP_Config_path for configuration!\n$!";
 
-print CPP  @lines
-    or die "Can't write to CPP.pm for configuration!\n$!"; # Unlikely.
+print CPP_Config  @lines
+    or die "Can't write to $CPP_Config_path for configuration!\n$!";
 
-close CPP
-    or die "Can't close CPP.pm after config output!\n$!";
+close CPP_Config
+    or die "Can't close $CPP_Config_path after config output!\n$!";
 
 
 WriteMakefile(
-    NAME            => 'Inline::CPP',
-    AUTHOR          => 'David Oswald <[email protected]>',
-    VERSION_FROM    => 'CPP.pm',
-    ABSTRACT_FROM   => 'lib/Inline/CPP.pod',
-    PREREQ_PM       => \%PREREQ_PM,
-    BUILD_REQUIRES  => {
-        'Test::More'    => '0.98', # This is core. Just being explicit.
-#        'Test'          => '1.13', # This is core from Perl 5.6.0.
+    NAME            	=> 'Inline::CPP',
+    AUTHOR          	=> 'David Oswald <[email protected]>',
+    VERSION_FROM    	=> 'CPP.pm',
+    ABSTRACT_FROM   	=> 'lib/Inline/CPP.pod',
+    PREREQ_PM       	=> \%PREREQ_PM,
+    BUILD_REQUIRES		=> {
+        'Test::More'    		=> '0.98', # Core. Just being explicit.
     },
-    clean           => {
-        FILES           => '_Inline/ grammar/_Inline'
+    CONFIGURE_REQUIRES	=> {
+		'ExtUtils::MakeMaker'	=> '6.56',
+	},
+    MIN_PERL_VERSION 	=> '5.006001',
+    clean           	=> {
+        FILES           		=> '_Inline/ grammar/_Inline'
     },
 );
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.