From: Steve Peters Date: Thu, 29 Sep 2005 00:23:44 +0000 (+0000) Subject: Upgrade to ExtUtils::CBuilder 0.14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2bd31f1a4a58e1269b235e3660ee031e5b786af9;p=p5sagit%2Fp5-mst-13.2.git Upgrade to ExtUtils::CBuilder 0.14 p4raw-id: //depot/perl@25650 --- diff --git a/lib/ExtUtils/CBuilder.pm b/lib/ExtUtils/CBuilder.pm index 9100bc7..f137a00 100644 --- a/lib/ExtUtils/CBuilder.pm +++ b/lib/ExtUtils/CBuilder.pm @@ -5,7 +5,7 @@ use File::Path (); use File::Basename (); use vars qw($VERSION @ISA); -$VERSION = '0.12_01'; +$VERSION = '0.14'; $VERSION = eval $VERSION; # Okay, this is the brute-force method of finding out what kind of diff --git a/lib/ExtUtils/CBuilder/Base.pm b/lib/ExtUtils/CBuilder/Base.pm index 774bb46..a262a37 100644 --- a/lib/ExtUtils/CBuilder/Base.pm +++ b/lib/ExtUtils/CBuilder/Base.pm @@ -176,7 +176,7 @@ sub link_executable { my ($self, %args) = @_; return $self->_do_link('exe_file', lddl => 0, %args); } - + sub _do_link { my ($self, $type, %args) = @_; @@ -195,6 +195,7 @@ sub _do_link { my @output = $args{lddl} ? $self->arg_share_object_file($out) : $self->arg_exec_file($out); my @shrp = $self->split_like_shell($cf->{shrpenv}); my @ld = $self->split_like_shell($cf->{ld}); + $self->do_system(@shrp, @ld, @output, @$objects, @linker_flags) or die "error building $out from @$objects"; diff --git a/lib/ExtUtils/CBuilder/Platform/VMS.pm b/lib/ExtUtils/CBuilder/Platform/VMS.pm index 9014e7c..b69d699 100644 --- a/lib/ExtUtils/CBuilder/Platform/VMS.pm +++ b/lib/ExtUtils/CBuilder/Platform/VMS.pm @@ -10,8 +10,38 @@ $VERSION = '0.12'; sub need_prelink { 0 } sub arg_include_dirs { - my $self = shift; - return '/include=(' . join(',', @_) . ')'; + my ($self, @dirs) = @_; + + # VMS can only have one include list, add the one from config. + if ($self->{config}{ccflags} =~ s{/inc[^=]+(?:=)+(?:\()?([^\/\)]*)} {}i) { + unshift @dirs, $1; + } + return unless @dirs; + + return ('/include=(' . join(',', @dirs) . ')'); +} + +sub _do_link { + my ($self, $type, %args) = @_; + + my $objects = delete $args{objects}; + $objects = [$objects] unless ref $objects; + + # VMS has two option files, the external symbol, and to pull in PerlShr + if ($args{lddl}) { + my @temp_files = + $self->prelink(%args, dl_name => $args{module_name}); + + $objects->[-1] .= ','; + + # If creating a loadable library, the link option file is needed. + push @$objects, 'sys$disk:[]' . $temp_files[0] . '/opt,'; + + # VMS always needs the option file for the Perl shared image. + push @$objects, $self->perl_inc() . 'PerlShr.Opt/opt'; + } + + return $self->SUPER::_do_link($type, %args, objects => $objects); } sub arg_nolink { return; } @@ -31,4 +61,20 @@ sub arg_share_object_file { return ("$self->{config}{lddlflags}=$file"); } + +sub lib_file { + my ($self, $dl_file) = @_; + $dl_file =~ s/\.[^.]+$//; + $dl_file =~ tr/"//d; + $dl_file = $dl_file .= '.' . $self->{config}{dlext}; + + # Need to create with the same name as DynaLoader will load with. + if (defined &DynaLoader::mod2fname) { + my ($dev,$dir,$file) = File::Spec->splitpath($dl_file); + $file = DynaLoader::mod2fname([$file]); + $dl_file = File::Spec->catpath($dev,$dir,$file); + } + return $dl_file; +} + 1; diff --git a/lib/ExtUtils/CBuilder/t/01-basic.t b/lib/ExtUtils/CBuilder/t/01-basic.t index 39c6e5b..b13f4d0 100644 --- a/lib/ExtUtils/CBuilder/t/01-basic.t +++ b/lib/ExtUtils/CBuilder/t/01-basic.t @@ -47,10 +47,7 @@ my ($lib, @temps) = $b->link(objects => $object_file, $lib =~ tr/"'//d; ok $lib_file, $lib; -for ($source_file, $lib_file, $object_file) { - tr/"'//d; - 1 while unlink; -} +unlink $source_file; my @words = $b->split_like_shell(' foo bar'); ok @words, 2; diff --git a/lib/ExtUtils/CBuilder/t/02-link.t b/lib/ExtUtils/CBuilder/t/02-link.t index 48a63f0..ccfe4ee 100644 --- a/lib/ExtUtils/CBuilder/t/02-link.t +++ b/lib/ExtUtils/CBuilder/t/02-link.t @@ -55,10 +55,7 @@ ok $exe_file; ok my_system($exe_file), 11; # Clean up -for ($source_file, $exe_file, $object_file) { - tr/"'//d; - 1 while unlink; -} +unlink $source_file; sub my_system { my $cmd = shift;