This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Sync Archive::Extract with CPAN
[perl5.git] / lib / ExtUtils / CBuilder / Platform / os2.pm
CommitLineData
6b09c160
YST
1package ExtUtils::CBuilder::Platform::os2;
2
3use strict;
4use ExtUtils::CBuilder::Platform::Unix;
5
6use vars qw($VERSION @ISA);
d1cf867f 7$VERSION = '0.13';
6b09c160
YST
8@ISA = qw(ExtUtils::CBuilder::Platform::Unix);
9
10sub need_prelink { 1 }
11
d1cf867f
SP
12sub prelink {
13 # Generate import libraries (XXXX currently near .DEF; should be near DLL!)
14 my $self = shift;
15 my @res = $self->SUPER::prelink(@_);
16 die "Unexpected number of DEF files" unless @res == 1;
17 die "Can't find DEF file in the output"
18 unless $res[0] =~ m,^(.*?)([^\\/]+)\.def$,si;
19 my $libname = "$2$self->{config}{lib_ext}";
20 $self->do_system('emximp', '-o', $libname, $res[0]) or die "emxexp: res=$?";
21 return (@res, $libname);
22}
23
24sub _do_link {
25 # Some 'env' do exec(), thus return too early when run from ksh;
26 # To avoid 'env', remove (useless) shrpenv
27 my $self = shift;
28 local $self->{config}{shrpenv} = '';
29 return $self->SUPER::_do_link(@_);
30}
31
32sub extra_link_args_after_prelink { # Add .DEF file to the link line
33 my ($self, %args) = @_;
34 grep /\.def$/i, @{$args{prelink_res}};
35}
36
37sub link_executable {
38 # ldflags is not expecting .exe extension given on command line; remove -Zexe
39 my $self = shift;
40 local $self->{config}{ldflags} = $self->{config}{ldflags};
41 $self->{config}{ldflags} =~ s/(?<!\S)-Zexe(?!\S)//;
42 return $self->SUPER::link_executable(@_);
43}
44
45
6b09c160 461;