"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20200916/tlpkg/tlperl/lib/ExtUtils/MM_NW5.pm" (10 Mar 2019, 5466 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::MM_NW5;
    2 
    3 =head1 NAME
    4 
    5 ExtUtils::MM_NW5 - methods to override UN*X behaviour in ExtUtils::MakeMaker
    6 
    7 =head1 SYNOPSIS
    8 
    9  use ExtUtils::MM_NW5; # Done internally by ExtUtils::MakeMaker if needed
   10 
   11 =head1 DESCRIPTION
   12 
   13 See ExtUtils::MM_Unix for a documentation of the methods provided
   14 there. This package overrides the implementation of these methods, not
   15 the semantics.
   16 
   17 =over
   18 
   19 =cut
   20 
   21 use strict;
   22 use ExtUtils::MakeMaker::Config;
   23 use File::Basename;
   24 
   25 our $VERSION = '7.34';
   26 $VERSION = eval $VERSION;
   27 
   28 require ExtUtils::MM_Win32;
   29 our @ISA = qw(ExtUtils::MM_Win32);
   30 
   31 use ExtUtils::MakeMaker qw(&neatvalue &_sprintf562);
   32 
   33 $ENV{EMXSHELL} = 'sh'; # to run `commands`
   34 
   35 my $BORLAND  = $Config{'cc'} =~ /\bbcc/i;
   36 my $GCC      = $Config{'cc'} =~ /\bgcc/i;
   37 
   38 
   39 =item os_flavor
   40 
   41 We're Netware in addition to being Windows.
   42 
   43 =cut
   44 
   45 sub os_flavor {
   46     my $self = shift;
   47     return ($self->SUPER::os_flavor, 'Netware');
   48 }
   49 
   50 =item init_platform
   51 
   52 Add Netware macros.
   53 
   54 LIBPTH, BASE_IMPORT, NLM_VERSION, MPKTOOL, TOOLPATH, BOOT_SYMBOL,
   55 NLM_SHORT_NAME, INCLUDE, PATH, MM_NW5_REVISION
   56 
   57 
   58 =item platform_constants
   59 
   60 Add Netware macros initialized above to the Makefile.
   61 
   62 =cut
   63 
   64 sub init_platform {
   65     my($self) = shift;
   66 
   67     # To get Win32's setup.
   68     $self->SUPER::init_platform;
   69 
   70     # incpath is copied to makefile var INCLUDE in constants sub, here just
   71     # make it empty
   72     my $libpth = $Config{'libpth'};
   73     $libpth =~ s( )(;);
   74     $self->{'LIBPTH'} = $libpth;
   75 
   76     $self->{'BASE_IMPORT'} = $Config{'base_import'};
   77 
   78     # Additional import file specified from Makefile.pl
   79     if($self->{'base_import'}) {
   80         $self->{'BASE_IMPORT'} .= ', ' . $self->{'base_import'};
   81     }
   82 
   83     $self->{'NLM_VERSION'} = $Config{'nlm_version'};
   84     $self->{'MPKTOOL'}  = $Config{'mpktool'};
   85     $self->{'TOOLPATH'} = $Config{'toolpath'};
   86 
   87     (my $boot = $self->{'NAME'}) =~ s/:/_/g;
   88     $self->{'BOOT_SYMBOL'}=$boot;
   89 
   90     # If the final binary name is greater than 8 chars,
   91     # truncate it here.
   92     if(length($self->{'BASEEXT'}) > 8) {
   93         $self->{'NLM_SHORT_NAME'} = substr($self->{'BASEEXT'},0,8);
   94     }
   95 
   96     # Get the include path and replace the spaces with ;
   97     # Copy this to makefile as INCLUDE = d:\...;d:\;
   98     ($self->{INCLUDE} = $Config{'incpath'}) =~ s/([ ]*)-I/;/g;
   99 
  100     # Set the path to CodeWarrior binaries which might not have been set in
  101     # any other place
  102     $self->{PATH} = '$(PATH);$(TOOLPATH)';
  103 
  104     $self->{MM_NW5_VERSION} = $VERSION;
  105 }
  106 
  107 sub platform_constants {
  108     my($self) = shift;
  109     my $make_frag = '';
  110 
  111     # Setup Win32's constants.
  112     $make_frag .= $self->SUPER::platform_constants;
  113 
  114     foreach my $macro (qw(LIBPTH BASE_IMPORT NLM_VERSION MPKTOOL
  115                           TOOLPATH BOOT_SYMBOL NLM_SHORT_NAME INCLUDE PATH
  116                           MM_NW5_VERSION
  117                       ))
  118     {
  119         next unless defined $self->{$macro};
  120         $make_frag .= "$macro = $self->{$macro}\n";
  121     }
  122 
  123     return $make_frag;
  124 }
  125 
  126 =item static_lib_pure_cmd
  127 
  128 Defines how to run the archive utility
  129 
  130 =cut
  131 
  132 sub static_lib_pure_cmd {
  133     my ($self, $src) = @_;
  134     $src =~ s/(\$\(\w+)(\))/$1:^"+"$2/g if $BORLAND;
  135     sprintf qq{\t\$(AR) %s\n}, ($BORLAND ? '$@ ' . $src
  136                           : ($GCC ? '-ru $@ ' . $src
  137                                   : '-type library -o $@ ' . $src));
  138 }
  139 
  140 =item xs_static_lib_is_xs
  141 
  142 =cut
  143 
  144 sub xs_static_lib_is_xs {
  145     return 1;
  146 }
  147 
  148 =item dynamic_lib
  149 
  150 Override of utility methods for OS-specific work.
  151 
  152 =cut
  153 
  154 sub xs_make_dynamic_lib {
  155     my ($self, $attribs, $from, $to, $todir, $ldfrom, $exportlist) = @_;
  156     my @m;
  157     # Taking care of long names like FileHandle, ByteLoader, SDBM_File etc
  158     if ($to =~ /^\$/) {
  159         if ($self->{NLM_SHORT_NAME}) {
  160             # deal with shortnames
  161             my $newto = q{$(INST_AUTODIR)\\$(NLM_SHORT_NAME).$(DLEXT)};
  162             push @m, "$to: $newto\n\n";
  163             $to = $newto;
  164         }
  165     } else {
  166         my ($v, $d, $f) = File::Spec->splitpath($to);
  167         # relies on $f having a literal "." in it, unlike for $(OBJ_EXT)
  168         if ($f =~ /[^\.]{9}\./) {
  169             # 9+ chars before '.', need to shorten
  170             $f = substr $f, 0, 8;
  171         }
  172         my $newto = File::Spec->catpath($v, $d, $f);
  173         push @m, "$to: $newto\n\n";
  174         $to = $newto;
  175     }
  176     # bits below should be in dlsyms, not here
  177     #                                   1    2      3       4
  178     push @m, _sprintf562 <<'MAKE_FRAG', $to, $from, $todir, $exportlist;
  179 # Create xdc data for an MT safe NLM in case of mpk build
  180 %1$s: %2$s $(MYEXTLIB) $(BOOTSTRAP) %3$s$(DFSEP).exists
  181     $(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > %4$s
  182     $(NOECHO) $(ECHO) $(BASE_IMPORT) >> %4$s
  183     $(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> %4$s
  184 MAKE_FRAG
  185     if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) {
  186         (my $xdc = $exportlist) =~ s#def\z#xdc#;
  187         $xdc = '$(BASEEXT).xdc';
  188         push @m, sprintf <<'MAKE_FRAG', $xdc, $exportlist;
  189     $(MPKTOOL) $(XDCFLAGS) %s
  190     $(NOECHO) $(ECHO) xdcdata $(BASEEXT).xdc >> %s
  191 MAKE_FRAG
  192     }
  193     # Reconstruct the X.Y.Z version.
  194     my $version = join '.', map { sprintf "%d", $_ }
  195                               $] =~ /(\d)\.(\d{3})(\d{2})/;
  196     push @m, sprintf <<'EOF', $from, $version, $to, $exportlist;
  197     $(LD) $(LDFLAGS) %s -desc "Perl %s Extension ($(BASEEXT))  XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION) -o %s $(MYEXTLIB) $(PERL_INC)\Main.lib -commandfile %s
  198     $(CHMOD) 755 $@
  199 EOF
  200     join '', @m;
  201 }
  202 
  203 1;
  204 __END__
  205 
  206 =back
  207 
  208 =cut