"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20200916/tlpkg/tlperl/lib/ExtUtils/CBuilder/Platform/os2.pm" (7 Mar 2020, 2411 Bytes) of package /windows/misc/install-tl.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package ExtUtils::CBuilder::Platform::os2;
    2 
    3 use warnings;
    4 use strict;
    5 use ExtUtils::CBuilder::Platform::Unix;
    6 
    7 our $VERSION = '0.280231'; # VERSION
    8 our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
    9 
   10 sub need_prelink { 1 }
   11 
   12 sub prelink {
   13   # Generate import libraries (XXXX currently near .DEF; should be near DLL!)
   14   my $self = shift;
   15   my %args = @_;
   16 
   17   my @res = $self->SUPER::prelink(%args);
   18   die "Unexpected number of DEF files" unless @res == 1;
   19   die "Can't find DEF file in the output"
   20     unless $res[0] =~ m,^(.*)\.def$,si;
   21   my $libname = "$1$self->{config}{lib_ext}";   # Put .LIB file near .DEF file
   22   $self->do_system('emximp', '-o', $libname, $res[0]) or die "emxexp: res=$?";
   23   return (@res, $libname);
   24 }
   25 
   26 sub _do_link {
   27   my $self = shift;
   28   my ($how, %args) = @_;
   29   if ($how eq 'lib_file'
   30       and (defined $args{module_name} and length $args{module_name})) {
   31 
   32     # Now know the basename, find directory parts via lib_file, or objects
   33     my $objs = ( (ref $args{objects}) ? $args{objects} : [$args{objects}] );
   34     my $near_obj = $self->lib_file(@$objs);
   35     my $exp_dir = ($near_obj =~ m,(.*)[/\\],s ? "$1/" : '' );
   36 
   37     $args{dl_file} = $1 if $near_obj =~ m,(.*)\.,s; # put ExportList near OBJ
   38 
   39     # XXX _do_link does not have place to put libraries?
   40     push @$objs, $self->perl_inc() . "/libperl$self->{config}{lib_ext}";
   41     $args{objects} = $objs;
   42   }
   43   # Some 'env' do exec(), thus return too early when run from ksh;
   44   # To avoid 'env', remove (useless) shrpenv
   45   local $self->{config}{shrpenv} = '';
   46   return $self->SUPER::_do_link($how, %args);
   47 }
   48 
   49 sub extra_link_args_after_prelink {
   50   # Add .DEF file to the link line
   51   my ($self, %args) = @_;
   52 
   53   my @DEF = grep /\.def$/i, @{$args{prelink_res}};
   54   die "More than one .def files created by 'prelink' stage" if @DEF > 1;
   55   # XXXX No "$how" argument here, so how to test for dynamic link?
   56   die "No .def file created by 'prelink' stage"
   57     unless @DEF or not @{$args{prelink_res}};
   58 
   59   my @after_libs = ($OS2::is_aout ? ()
   60       : $self->perl_inc() . "/libperl_override$self->{config}{lib_ext}");
   61   # , "-L", "-lperl"
   62   (@after_libs, @DEF);
   63 }
   64 
   65 sub link_executable {
   66   # ldflags is not expecting .exe extension given on command line; remove -Zexe
   67   my $self = shift;
   68   local $self->{config}{ldflags} = $self->{config}{ldflags};
   69   $self->{config}{ldflags} =~ s/(?<!\S)-Zexe(?!\S)//;
   70   return $self->SUPER::link_executable(@_);
   71 }
   72 
   73 
   74 1;