develooper Front page | perl.perl5.porters | Postings from August 2008

Re: FYI - Blead changes to ExtUtils::CBuilder

Thread Previous | Thread Next
From:
Reini Urban
Date:
August 31, 2008 00:02
Subject:
Re: FYI - Blead changes to ExtUtils::CBuilder
Message ID:
48BA4198.3090105@x-ray.at
Ken Williams schrieb:
> On Tue, Aug 26, 2008 at 2:42 PM, Jerry D. Hedden <jdhedden@cpan.org> wrote:
>> In case you missed it, changes 34200 and 34219 to blead made changes
>> to lib/ExtUtils/CBuilder/Platform/cygwin.pm.
> 
> The changes to link_executable() in changelist 34200 don't make sense
> to me, so I haven't applied them yet.  If it's trying to "revert the
> stupid Unix cc=ld override", why does it do "local $self->{config}{cc}
> = $self->{config}{ld};" ?  That seems like it propagates the override
> even further.

cygwin.pm:
  sub link_executable {
    my $self = shift;
-  # $Config{ld} is set up as a special script for building
-  # perl-linkable libraries.  We don't want that here.
-  local $self->{config}{ld} = 'gcc';
+  # $Config{ld} is okay. revert the stupid Unix cc=ld override
+  local $self->{config}{cc} = $self->{config}{ld};
    return $self->SUPER::link_executable(@_);
  }

In short:
use ExtUtils::CBuilder::Platform::Unix;
#...
sub link_executable {
   my $self = shift;
   # $Config{ld} is okay. revert the stupid Unix cc=ld override
   local $self->{config}{cc} = $self->{config}{ld};
   return $self->SUPER::link_executable(@_);
}

cygwin has a good ld setting now (gcc or g++).
Before it was ld2, a helper script. Which was stupid. Which you 
overwrote with gcc. But we want also g++ support for special C++ XS 
code. That's why we don't want to touch ld.

Why cc?
Because SUPER is Unix.pm, which has a special treatment for ld, which is 
also stupid. So we revert it. We should trust the config.sh and don't 
try to be smarter. If a ld setting is wrong, fix Configure, not CBuilder.

Unix.pm:
sub link_executable {
   my $self = shift;
   # $Config{cc} is usually a better bet for linking executables than 
$Config{ld}
   local $self->{config}{ld} =
     $self->{config}{cc} . " " . $self->{config}{ldflags};
   return $self->SUPER::link_executable(@_);
}

Since the linker flags assumes gcc semantics (-Wl,...) and are not real 
ld flags without -Wl, we have to use for the linker executable the 
setting of $Config{ld}.

Better the Unix.pm mess should be cleanup also, but I leave that to 
someone else.
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About