lib/ExtUtils/MM_NW5.pm

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