lib/ExtUtils/MM_NW5.pm

filter: Statementstmt 27.7% 20 / 72 Branchbran 0.0% 0 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 44.4% 4 / 9 Podpod 100% 5 / 5 totaltotal 27.3% 29 / 106 CC 12 SCAR 27.3
CC
12
Cov
22%
xs_make_dynamic_lib
30.0
static_lib_pure_cmd
20.0
init_platform
12.0
CRAP 15.4
« lib/ExtUtils/MM_BeOS.pm ↑ Summary blib/lib/ExtUtils/MM_Win32.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 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 ExtUtils::MakeMaker::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 our $VERSION = '7.13_01';
26 1 $VERSION = eval $VERSION;
27  
28 1 require ExtUtils::MM_Win32;
29 1 our @ISA = qw(ExtUtils::MM_Win32);
30  
31 1 ▶use ExtUtils::MakeMaker qw(&neatvalue &_sprintf562);
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 1 $ENV{EMXSHELL} = 'sh'; # to run `commands`
34  
35 1 my $BORLAND = $Config{'cc'} =~ /\bbcc/i;
36 1 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 0 ▶ my $self = shift;
Subroutine os_flavor: not called CC=1 SCAR=6.9
Pod documented
47 0 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 0 ▶ my($self) = shift;
Subroutine init_platform: not called CC=3 SCAR=24.8
Pod documented
66  
67 # To get Win32's setup.
68 0 $self->SUPER::init_platform;
69  
70 # incpath is copied to makefile var INCLUDE in constants sub, here just
71 # make it empty
72 0 my $libpth = $Config{'libpth'};
73 0 $libpth =~ s( )(;);
74 0 $self->{'LIBPTH'} = $libpth;
75  
76 0 $self->{'BASE_IMPORT'} = $Config{'base_import'};
77  
78 # Additional import file specified from Makefile.pl
79 0 ▶ if($self->{'base_import'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"base_import"}) 0 0 0
80 0 $self->{'BASE_IMPORT'} .= ', ' . $self->{'base_import'};
81 }
82  
83 0 $self->{'NLM_VERSION'} = $Config{'nlm_version'};
84 0 $self->{'MPKTOOL'} = $Config{'mpktool'};
85 0 $self->{'TOOLPATH'} = $Config{'toolpath'};
86  
87 0 (my $boot = $self->{'NAME'}) =~ s/:/_/g;
88 0 $self->{'BOOT_SYMBOL'}=$boot;
89  
90 # If the final binary name is greater than 8 chars,
91 # truncate it here.
92 0 ▶ if(length($self->{'BASEEXT'}) > 8) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->{"BASEEXT"} > 8) 0 0 0
93 0 $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 0 ($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 0 $self->{PATH} = '$(PATH);$(TOOLPATH)';
103  
104 0 $self->{MM_NW5_VERSION} = $VERSION;
105 }
106  
107 sub platform_constants {
108 0 ▶ my($self) = shift;
Subroutine platform_constants: not called CC=3 SCAR=24.8
Pod documented
109 0 my $make_frag = '';
110  
111 # Setup Win32's constants.
112 0 $make_frag .= $self->SUPER::platform_constants;
113  
114 0 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 0 ▶ next unless defined $self->{$macro};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$macro} 0 0 0
120 0 $make_frag .= "$macro = $self->{$macro}\n";
121 }
122  
123 0 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 0 ▶ my ($self, $src) = @_;
Subroutine static_lib_pure_cmd: not called CC=4 SCAR=30.0
Pod documented
134 0 ▶ $src =~ s/(\$\(\w+)(\))/$1:^"+"$2/g if $BORLAND;
Branch: 1 branch
BranchTrueFalseTotal
if $BORLAND 0 0 0
135 0 ▶ sprintf qq{\t\$(AR) %s\n}, ($BORLAND ? '$@ ' . $src
Branch: 2 branches
BranchTrueFalseTotal
$BORLAND ? : 0 0 0
$GCC ? : 0 0 0
136 : ($GCC ? '-ru $@ ' . $src
137 : '-type library -o $@ ' . $src));
138 }
139  
140 =item dynamic_lib
141  
142 Override of utility methods for OS-specific work.
143  
144 =cut
145  
146 sub xs_make_dynamic_lib {
147 0 ▶ my ($self, $attribs, $from, $to, $todir, $ldfrom, $exportlist) = @_;
Subroutine xs_make_dynamic_lib: not called CC=5 SCAR=34.0
Pod documented
148 0 my @m;
149 # Taking care of long names like FileHandle, ByteLoader, SDBM_File etc
150 0 ▶ if ($to =~ /^\$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($to =~ /^\$/) { } 0 0 0
151 0 ▶ if ($self->{NLM_SHORT_NAME}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"NLM_SHORT_NAME"}) 0 0 0
152 # deal with shortnames
153 0 my $newto = q{$(INST_AUTODIR)\\$(NLM_SHORT_NAME).$(DLEXT)};
154 0 push @m, "$to: $newto\n\n";
155 0 $to = $newto;
156 }
157 } else {
158 0 my ($v, $d, $f) = File::Spec->splitpath($to);
159 # relies on $f having a literal "." in it, unlike for $(OBJ_EXT)
160 0 ▶ if ($f =~ /[^\.]{9}\./) {
Branch: 1 branch
BranchTrueFalseTotal
if ($f =~ /[^\.]{9}\./) 0 0 0
161 # 9+ chars before '.', need to shorten
162 0 $f = substr $f, 0, 8;
163 }
164 0 my $newto = File::Spec->catpath($v, $d, $f);
165 0 push @m, "$to: $newto\n\n";
166 0 $to = $newto;
167 }
168 # bits below should be in dlsyms, not here
169 # 1 2 3 4
170 0 push @m, _sprintf562 <<'MAKE_FRAG', $to, $from, $todir, $exportlist;
171 # Create xdc data for an MT safe NLM in case of mpk build
172 %1$s: %2$s $(MYEXTLIB) $(BOOTSTRAP) %3$s$(DFSEP).exists
173 $(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > %4$s
174 $(NOECHO) $(ECHO) $(BASE_IMPORT) >> %4$s
175 $(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> %4$s
176 MAKE_FRAG
177 0 ▶ if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"CCFLAGS"} =~ / -DMPK_ON /) 0 0 0
178 0 (my $xdc = $exportlist) =~ s#def\z#xdc#;
179 0 $xdc = '$(BASEEXT).xdc';
180 0 push @m, sprintf <<'MAKE_FRAG', $xdc, $exportlist;
181 $(MPKTOOL) $(XDCFLAGS) %s
182 $(NOECHO) $(ECHO) xdcdata $(BASEEXT).xdc >> %s
183 MAKE_FRAG
184 }
185 # Reconstruct the X.Y.Z version.
186 0 my $version = join '.', map { sprintf "%d", $_ }
187 $] =~ /(\d)\.(\d{3})(\d{2})/;
188 0 push @m, sprintf <<'EOF', $from, $version, $to, $exportlist;
189 $(LD) $(LDFLAGS) %s -desc "Perl %s Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION) -o %s $(MYEXTLIB) $(PERL_INC)\Main.lib -commandfile %s
190 $(CHMOD) 755 $@
191 EOF
192 0 join '', @m;
193 }
194  
195 1 1;
196 __END__
« lib/ExtUtils/MM_BeOS.pm ↑ Summary blib/lib/ExtUtils/MM_Win32.pm »