diff options
author | Steve Peters <steve@fisharerojo.org> | 2005-10-04 11:01:11 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2005-10-04 11:01:11 +0000 |
commit | d1cf867f11f5ad3d5457379402059086936e6ae7 (patch) | |
tree | 31249c474b6def004ae31d52eb7f51957de96964 | |
parent | 37038d913ecbccf83ca988aedaa1e6067b127dbc (diff) | |
download | perl-d1cf867f11f5ad3d5457379402059086936e6ae7.tar.gz |
Upgrade to ExtUtils-CBuilder-0.15 (with a small edit to
ExtUtils::CBuilder::Pltaform::dec_osf.pm to add a $VERSION)
p4raw-id: //depot/perl@25689
-rw-r--r-- | lib/ExtUtils/CBuilder/Base.pm | 17 | ||||
-rw-r--r-- | lib/ExtUtils/CBuilder/Platform/Windows.pm | 12 | ||||
-rw-r--r-- | lib/ExtUtils/CBuilder/Platform/dec_osf.pm | 3 | ||||
-rw-r--r-- | lib/ExtUtils/CBuilder/Platform/os2.pm | 36 | ||||
-rw-r--r-- | lib/ExtUtils/CBuilder/t/02-link.t | 8 |
5 files changed, 70 insertions, 6 deletions
diff --git a/lib/ExtUtils/CBuilder/Base.pm b/lib/ExtUtils/CBuilder/Base.pm index a262a37e2d..4ab83788ef 100644 --- a/lib/ExtUtils/CBuilder/Base.pm +++ b/lib/ExtUtils/CBuilder/Base.pm @@ -74,6 +74,11 @@ sub arg_exec_file { return ('-o', $file); } +sub arg_defines { + my ($self, %args) = @_; + return map "-D$_=$args{$_}", keys %args; +} + sub compile { my ($self, %args) = @_; die "Missing 'source' argument to compile()" unless defined $args{source}; @@ -86,11 +91,13 @@ sub compile { (@{$args{include_dirs} || []}, $self->perl_inc()); + my @defines = $self->arg_defines( %{$args{defines} || {}} ); + my @extra_compiler_flags = $self->split_like_shell($args{extra_compiler_flags}); my @cccdlflags = $self->split_like_shell($cf->{cccdlflags}); my @ccflags = $self->split_like_shell($cf->{ccflags}); my @optimize = $self->split_like_shell($cf->{optimize}); - my @flags = (@include_dirs, @cccdlflags, @extra_compiler_flags, + my @flags = (@include_dirs, @defines, @cccdlflags, @extra_compiler_flags, $self->arg_nolink, @ccflags, @optimize, $self->arg_object_file($args{object_file}), @@ -147,6 +154,8 @@ sub exe_file { sub need_prelink { 0 } +sub extra_link_args_after_prelink { return } + sub prelink { my ($self, %args) = @_; @@ -161,6 +170,7 @@ sub prelink { NAME => $args{dl_name}, DLBASE => $args{dl_base}, FILE => $args{dl_file}, + VERSION => (defined $args{dl_version} ? $args{dl_version} : '0.0'), ); # Mksymlists will create one of these files @@ -191,7 +201,10 @@ sub _do_link { $self->prelink(%args, dl_name => $args{module_name}) if $args{lddl} && $self->need_prelink; - my @linker_flags = $self->split_like_shell($args{extra_linker_flags}); + my @linker_flags = ($self->split_like_shell($args{extra_linker_flags}), + $self->extra_link_args_after_prelink(%args, dl_name => $args{module_name}, + prelink_res => \@temp_files)); + 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}); diff --git a/lib/ExtUtils/CBuilder/Platform/Windows.pm b/lib/ExtUtils/CBuilder/Platform/Windows.pm index a26df29e02..b4bb22ca0e 100644 --- a/lib/ExtUtils/CBuilder/Platform/Windows.pm +++ b/lib/ExtUtils/CBuilder/Platform/Windows.pm @@ -90,6 +90,12 @@ sub split_like_shell { return @argv; } +sub arg_defines { + my ($self, %args) = @_; + s/"/\\"/g foreach values %args; + return map "-D$_=$args{$_}", keys %args; +} + sub compile { my ($self, %args) = @_; my $cf = $self->{config}; @@ -101,6 +107,8 @@ sub compile { $srcdir ||= File::Spec->curdir(); + my @defines = $self->arg_defines( %{ $args{defines} || {} } ); + my %spec = ( srcdir => $srcdir, builddir => $srcdir, @@ -111,9 +119,10 @@ sub compile { cflags => [ $self->split_like_shell($cf->{ccflags}), $self->split_like_shell($cf->{cccdlflags}), + $self->split_like_shell($cf->{extra_compiler_flags}), ], optimize => [ $self->split_like_shell($cf->{optimize}) ], - defines => [ '' ], + defines => \@defines, includes => [ @{$args{include_dirs} || []} ], perlinc => [ $self->perl_inc(), @@ -308,7 +317,6 @@ sub write_compiler_script { $spec{basename} . '.ccs' ); $self->add_to_cleanup($script); - print "Generating script '$script'\n" if !$self->{quiet}; open( SCRIPT, ">$script" ) diff --git a/lib/ExtUtils/CBuilder/Platform/dec_osf.pm b/lib/ExtUtils/CBuilder/Platform/dec_osf.pm index 5381e90c03..363a5d135f 100644 --- a/lib/ExtUtils/CBuilder/Platform/dec_osf.pm +++ b/lib/ExtUtils/CBuilder/Platform/dec_osf.pm @@ -4,8 +4,9 @@ use strict; use ExtUtils::CBuilder::Platform::Unix; use File::Spec; -use vars qw(@ISA); +use vars qw($VERSION @ISA); @ISA = qw(ExtUtils::CBuilder::Platform::Unix); +$VERSION = '0.01'; sub link_executable { my $self = shift; diff --git a/lib/ExtUtils/CBuilder/Platform/os2.pm b/lib/ExtUtils/CBuilder/Platform/os2.pm index ec86bea0d0..16001c2b49 100644 --- a/lib/ExtUtils/CBuilder/Platform/os2.pm +++ b/lib/ExtUtils/CBuilder/Platform/os2.pm @@ -4,9 +4,43 @@ use strict; use ExtUtils::CBuilder::Platform::Unix; use vars qw($VERSION @ISA); -$VERSION = '0.12'; +$VERSION = '0.13'; @ISA = qw(ExtUtils::CBuilder::Platform::Unix); sub need_prelink { 1 } +sub prelink { + # Generate import libraries (XXXX currently near .DEF; should be near DLL!) + my $self = shift; + my @res = $self->SUPER::prelink(@_); + die "Unexpected number of DEF files" unless @res == 1; + die "Can't find DEF file in the output" + unless $res[0] =~ m,^(.*?)([^\\/]+)\.def$,si; + my $libname = "$2$self->{config}{lib_ext}"; + $self->do_system('emximp', '-o', $libname, $res[0]) or die "emxexp: res=$?"; + return (@res, $libname); +} + +sub _do_link { + # Some 'env' do exec(), thus return too early when run from ksh; + # To avoid 'env', remove (useless) shrpenv + my $self = shift; + local $self->{config}{shrpenv} = ''; + return $self->SUPER::_do_link(@_); +} + +sub extra_link_args_after_prelink { # Add .DEF file to the link line + my ($self, %args) = @_; + grep /\.def$/i, @{$args{prelink_res}}; +} + +sub link_executable { + # ldflags is not expecting .exe extension given on command line; remove -Zexe + my $self = shift; + local $self->{config}{ldflags} = $self->{config}{ldflags}; + $self->{config}{ldflags} =~ s/(?<!\S)-Zexe(?!\S)//; + return $self->SUPER::link_executable(@_); +} + + 1; diff --git a/lib/ExtUtils/CBuilder/t/02-link.t b/lib/ExtUtils/CBuilder/t/02-link.t index 604e474134..30ecbe5d3b 100644 --- a/lib/ExtUtils/CBuilder/t/02-link.t +++ b/lib/ExtUtils/CBuilder/t/02-link.t @@ -51,6 +51,14 @@ my ($exe_file, @temps); ($exe_file, @temps) = $b->link_executable(objects => $object_file); ok $exe_file; +if ($^O eq 'os2') { # Analogue of LDLOADPATH... + # Actually, not needed now, since we do not link with the generated DLL + my $old = OS2::extLibpath(); # [builtin function] + $old = ";$old" if defined $old and length $old; + # To pass the sanity check, components must have backslashes... + OS2::extLibpath_set(".\\$old"); +} + # Try the executable ok my_system($exe_file), 11; |