File Coverage

lib/ExtUtils/MM_NW5.pm
Criterion Covered Total %
statement 15 68 22.0
branch 0 20 0.0
condition n/a
subroutine 5 11 45.4
pod 6 6 100.0
total 26 105 24.7


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