[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/linuxaux/opt/perl/lib/5.10.0/ExtUtils/ -> MM_NW5.pm (source)

   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  use vars qw(@ISA $VERSION);
  26  $VERSION = '6.42';
  27  
  28  require ExtUtils::MM_Win32;
  29  @ISA = qw(ExtUtils::MM_Win32);
  30  
  31  use ExtUtils::MakeMaker qw( &neatvalue );
  32  
  33  $ENV{EMXSHELL} = 'sh'; # to run `commands`
  34  
  35  my $BORLAND  = $Config{'cc'} =~ /^bcc/i;
  36  my $GCC      = $Config{'cc'} =~ /^gcc/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  
 127  =item const_cccmd
 128  
 129  =cut
 130  
 131  sub const_cccmd {
 132      my($self,$libperl)=@_;
 133      return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
 134      return '' unless $self->needs_linking();
 135      return $self->{CONST_CCCMD} = <<'MAKE_FRAG';
 136  CCCMD = $(CC) $(CCFLAGS) $(INC) $(OPTIMIZE) \
 137      $(PERLTYPE) $(MPOLLUTE) -o $@ \
 138      -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(XS_VERSION)\"
 139  MAKE_FRAG
 140  
 141  }
 142  
 143  
 144  =item static_lib
 145  
 146  =cut
 147  
 148  sub static_lib {
 149      my($self) = @_;
 150  
 151      return '' unless $self->has_link_code;
 152  
 153      my $m = <<'END';
 154  $(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists
 155      $(RM_RF) $@
 156  END
 157  
 158      # If this extension has it's own library (eg SDBM_File)
 159      # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
 160      $m .= <<'END'  if $self->{MYEXTLIB};
 161      $self->{CP} $(MYEXTLIB) $@
 162  END
 163  
 164      my $ar_arg;
 165      if( $BORLAND ) {
 166          $ar_arg = '$@ $(OBJECT:^"+")';
 167      }
 168      elsif( $GCC ) {
 169          $ar_arg = '-ru $@ $(OBJECT)';
 170      }
 171      else {
 172          $ar_arg = '-type library -o $@ $(OBJECT)';
 173      }
 174  
 175      $m .= sprintf <<'END', $ar_arg;
 176      $(AR) %s
 177      $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
 178      $(CHMOD) 755 $@
 179  END
 180  
 181      $m .= <<'END' if $self->{PERL_SRC};
 182      $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs
 183  
 184  
 185  END
 186      return $m;
 187  }
 188  
 189  =item dynamic_lib
 190  
 191  Defines how to produce the *.so (or equivalent) files.
 192  
 193  =cut
 194  
 195  sub dynamic_lib {
 196      my($self, %attribs) = @_;
 197      return '' unless $self->needs_linking(); #might be because of a subdir
 198  
 199      return '' unless $self->has_link_code;
 200  
 201      my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': '');
 202      my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
 203      my($ldfrom) = '$(LDFROM)';
 204  
 205      (my $boot = $self->{NAME}) =~ s/:/_/g;
 206  
 207      my $m = <<'MAKE_FRAG';
 208  # This section creates the dynamically loadable $(INST_DYNAMIC)
 209  # from $(OBJECT) and possibly $(MYEXTLIB).
 210  OTHERLDFLAGS = '.$otherldflags.'
 211  INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
 212  
 213  # Create xdc data for an MT safe NLM in case of mpk build
 214  $(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists
 215      $(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def
 216      $(NOECHO) $(ECHO) $(BASE_IMPORT) >> $(BASEEXT).def
 217      $(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def
 218  MAKE_FRAG
 219  
 220  
 221      if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) {
 222          $m .= <<'MAKE_FRAG';
 223      $(MPKTOOL) $(XDCFLAGS) $(BASEEXT).xdc
 224      $(NOECHO) $(ECHO) xdcdata $(BASEEXT).xdc >> $(BASEEXT).def
 225  MAKE_FRAG
 226      }
 227  
 228      # Reconstruct the X.Y.Z version.
 229      my $version = join '.', map { sprintf "%d", $_ }
 230                                $] =~ /(\d)\.(\d{3})(\d{2})/;
 231      $m .= sprintf '    $(LD) $(LDFLAGS) $(OBJECT:.obj=.obj) -desc "Perl %s Extension ($(BASEEXT))  XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION)', $version;
 232  
 233      # Taking care of long names like FileHandle, ByteLoader, SDBM_File etc
 234      if($self->{NLM_SHORT_NAME}) {
 235          # In case of nlms with names exceeding 8 chars, build nlm in the 
 236          # current dir, rename and move to auto\lib.
 237          $m .= q{ -o $(NLM_SHORT_NAME).$(DLEXT)}
 238      } else {
 239          $m .= q{ -o $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)}
 240      }
 241  
 242      # Add additional lib files if any (SDBM_File)
 243      $m .= q{ $(MYEXTLIB) } if $self->{MYEXTLIB};
 244  
 245      $m .= q{ $(PERL_INC)\Main.lib -commandfile $(BASEEXT).def}."\n";
 246  
 247      if($self->{NLM_SHORT_NAME}) {
 248          $m .= <<'MAKE_FRAG';
 249      if exist $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT) del $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT) 
 250      move $(NLM_SHORT_NAME).$(DLEXT) $(INST_AUTODIR)
 251  MAKE_FRAG
 252      }
 253  
 254      $m .= <<'MAKE_FRAG';
 255  
 256      $(CHMOD) 755 $@
 257  MAKE_FRAG
 258  
 259      return $m;
 260  }
 261  
 262  
 263  1;
 264  __END__
 265  
 266  =back
 267  
 268  =cut 
 269  
 270  


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1