Randy W. Sims | 3 Oct 2005 09:40

[Module::Build] [PATCH] ExtUtils::CBuilder - process defines & extra_compiler_flags

Module::Build in cvs now depends on this updated version 0.15 to handle 
correct processing of defines & extra_compiler_flags.

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
Ken Williams | 3 Oct 2005 20:29
Favicon

Re: [Module::Build] [PATCH] ExtUtils::CBuilder - process defines & extra_compiler_flags


On Oct 3, 2005, at 2:40 AM, Randy W. Sims wrote:

> Module::Build in cvs now depends on this updated version 0.15 to 
> handle correct processing of defines & extra_compiler_flags.

I think you forgot the patch here.

  -Ken

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
Randy W. Sims | 3 Oct 2005 20:34

Re: [Module::Build] [PATCH] ExtUtils::CBuilder - process defines & extra_compiler_flags

Ken Williams wrote:
> 
> On Oct 3, 2005, at 2:40 AM, Randy W. Sims wrote:
> 
>> Module::Build in cvs now depends on this updated version 0.15 to 
>> handle correct processing of defines & extra_compiler_flags.
> 
> 
> I think you forgot the patch here.

Ooops.

--

-- 
diff -ru ExtUtils-CBuilder-0.14-orig/lib/ExtUtils/CBuilder/Base.pm 
ExtUtils-CBuilder-0.14/lib/ExtUtils/CBuilder/Base.pm
--- ExtUtils-CBuilder-0.14-orig/lib/ExtUtils/CBuilder/Base.pm	2005-09-19 
20:46:30.000000000 -0400
+++ ExtUtils-CBuilder-0.14/lib/ExtUtils/CBuilder/Base.pm	2005-10-03 
01:55:36.356992000 -0400
 <at>  <at>  -86,11 +86,13  <at>  <at> 
      ( <at> {$args{include_dirs} || []},
       $self->perl_inc());

+  my  <at> defines = map "-D$_=$args{defines}{$_}", keys %{$args{defines} || 
{}};
+
    my  <at> extra_compiler_flags = 
$self->split_like_shell($args{extra_compiler_flags});
    my  <at> cccdlflags = $self->split_like_shell($cf->{cccdlflags});
    my  <at> ccflags = $self->split_like_shell($cf->{ccflags});
(Continue reading)

Ken Williams | 3 Oct 2005 21:10
Favicon

Re: [Module::Build] [PATCH] ExtUtils::CBuilder - process defines & extra_compiler_flags


On Oct 3, 2005, at 1:34 PM, Randy W. Sims wrote:

> Ken Williams wrote:
>> On Oct 3, 2005, at 2:40 AM, Randy W. Sims wrote:
>>> Module::Build in cvs now depends on this updated version 0.15 to 
>>> handle correct processing of defines & extra_compiler_flags.
>> I think you forgot the patch here.
>
> Ooops.
> [...snip patch]

Thanks, looks good.  I've applied it, and then I'm going to move the 
actual formatting of the -Dfoo=bar arguments (and other platform 
equivalents) to a new arg_defines() method, just like 
arg_object_file(), arg_nolink(), and the like.

Also, would you care to write a documentation patch mentioning the new 
'defines' parameter?

  -Ken

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
Randy W. Sims | 5 Oct 2005 11:24

Re: [Module::Build] [PATCH] ExtUtils::CBuilder - process defines & extra_compiler_flags

Ken Williams wrote:
> I've applied it, and then I'm going to move the 
> actual formatting of the -Dfoo=bar arguments (and other platform 
> equivalents) to a new arg_defines() method, just like arg_object_file(), 
> arg_nolink(), and the like.
> 
> Also, would you care to write a documentation patch mentioning the new 
> 'defines' parameter?

Sure, but in writing it I realized the need to alter the behavior 
somewhat. In particular an array should be used instead of a hash to 
preserve order of definition, and C<undef> as a value should either be 
an error or used as described in the doc patch below to undefine macros. 
I'll patch CBuilder to follow the behavior described if you can send me 
the changes you mentioned above.

Note, given the C program:

#include <stdio.h>
main(){printf("%s\n",MACRO);}

The commands:

gcc -DMACRO=\"foo\" test.c
gcc -DFOO=\"foo\" -DMACRO=FOO test.c

both output the string "foo\n". The second command defines a macro and 
then uses it in a subsequent macro, so order can be important.

But, I'm not sure how to implement the reference to a previously defined 
(Continue reading)

Ken Williams | 7 Oct 2005 04:48
Favicon

Re: [Module::Build] [PATCH] ExtUtils::CBuilder - process defines & extra_compiler_flags


On Oct 5, 2005, at 4:24 AM, Randy W. Sims wrote:

>
> Sure, but in writing it I realized the need to alter the behavior 
> somewhat. In particular an array should be used instead of a hash to 
> preserve order of definition, and C<undef> as a value should either be 
> an error or used as described in the doc patch below to undefine 
> macros. I'll patch CBuilder to follow the behavior described if you 
> can send me the changes you mentioned above.

Sheepishly, I will admit that I have already released it.  It's the 
latest CBuilder on CPAN.

I think the param ought to be able to take either an array ref or a 
hash ref.  The hash is the most natural structure for it, and I don't 
think we should deprive people of that interface just because of the 
weird edge case - but we should support that weird edge case too when 
we get around to it.

  -Ken

-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

Gmane