At 10:59 PM -0500 3/14/06, John E. Malmberg wrote:
>Craig A. Berry wrote:
>>The attached provides the special handling needed for C compiler defines
>in ExtUtils::CBuilder.


>This patch against [EMAIL PROTECTED]

As my patch is already in the CPAN version, a patch that furthers it
instead of replaces it would be easier for Ken to deal with.  I
recommend what I attach here against CBuilder, then we can integrate
CBuilder into the core when things stabilize.

>is an update Craig's patch to handle the cases where there are no defines at 
>all, or only defines from config.

In practice, I'm not sure that will ever happen as all XS compiles
get the version number as a define.

>
>This gets it to pass the tests below in addition to the Module Build test.
>
>lib/ExtUtils/CBuilder/t/01-basic
>lib/ExtUtils/CBuilder/t/02-link

My bad.  I reran the Module::Build tests that depended on
CBuilder, but not the CBuilder tests.

>The case were there are one or more defines in %args, but not in config is 
>probably still broken, as it will end up with /define(,xxx="a.b") which is an 
>illegal syntax.

I did allow for that case and only put in the comma when there is
something in $Config{ccflags}.  One scenario I missed, though, was
when arg_defines gets called with an empty hash.  In that case we
ended up with "/define=()" which the compiler doesn't like, and this
is what caused the CBuilder test failures you saw.  The attached
patch on top of my previous fixes that.

The other scenario it now handles that it didn't before is when there
is a define with a key but no value.  This is still currently broken
in the generic version of arg_defines (and no current test exercises
it).  So if you pass the following to compile:

defines => { FOO => Bar, Baz }

You get this:

-DBaz= -DFOO=Bar

where the equals sign after Baz seems likely to cause trouble (though
I don't know offhand what compilers will do with that).  Yes, I know
I should patch that too and write tests for it, but I've already
burned my before-breakfast Perl time for the day.


-- 
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Attachment: cbuilder2.patch
Description: Binary data

Reply via email to