1 package ExtUtils::CBuilder::Platform::os2;
4 use ExtUtils::CBuilder::Platform::Unix;
6 use vars qw($VERSION @ISA);
8 @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
10 sub need_prelink { 1 }
13 # Generate import libraries (XXXX currently near .DEF; should be near DLL!)
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);
25 # Some 'env' do exec(), thus return too early when run from ksh;
26 # To avoid 'env', remove (useless) shrpenv
28 local $self->{config}{shrpenv} = '';
29 return $self->SUPER::_do_link(@_);
32 sub extra_link_args_after_prelink { # Add .DEF file to the link line
33 my ($self, %args) = @_;
34 grep /\.def$/i, @{$args{prelink_res}};
38 # ldflags is not expecting .exe extension given on command line; remove -Zexe
40 local $self->{config}{ldflags} = $self->{config}{ldflags};
41 $self->{config}{ldflags} =~ s/(?<!\S)-Zexe(?!\S)//;
42 return $self->SUPER::link_executable(@_);