line |
stmt |
bran |
cond |
sub |
time |
code |
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
|
|
|
1
|
846
|
use strict; |
|
1
|
|
|
|
3
|
|
|
1
|
|
|
|
135
|
|
22
|
1
|
|
|
1
|
6
|
use ExtUtils::MakeMaker::Config; |
|
1
|
|
|
|
2
|
|
|
1
|
|
|
|
7
|
|
23
|
1
|
|
|
1
|
5
|
use File::Basename; |
|
1
|
|
|
|
3
|
|
|
1
|
|
|
|
132
|
|
24
|
|
|
|
|
|
|
25
|
|
|
|
|
|
our $VERSION = '6.74'; |
26
|
|
|
|
|
|
|
27
|
|
|
|
|
|
require ExtUtils::MM_Win32; |
28
|
|
|
|
|
|
our @ISA = qw(ExtUtils::MM_Win32); |
29
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
7
|
use ExtUtils::MakeMaker qw( &neatvalue ); |
|
1
|
|
|
|
2
|
|
|
1
|
|
|
|
1337
|
|
31
|
|
|
|
|
|
|
32
|
|
|
|
|
|
$ENV{EMXSHELL} = 'sh'; # to run `commands` |
33
|
|
|
|
|
|
|
34
|
|
|
|
|
|
my $BORLAND = $Config{'cc'} =~ /^bcc/i; |
35
|
|
|
|
|
|
my $GCC = $Config{'cc'} =~ /^gcc/i; |
36
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
38
|
|
|
|
|
|
=item os_flavor |
39
|
|
|
|
|
|
|
40
|
|
|
|
|
|
We're Netware in addition to being Windows. |
41
|
|
|
|
|
|
|
42
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
44
|
|
|
|
|
|
sub os_flavor { |
45
|
0
|
|
|
0
|
|
my $self = shift; |
46
|
0
|
|
|
|
|
return ($self->SUPER::os_flavor, 'Netware'); |
47
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
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
|
|
|
|
|
|
sub init_platform { |
64
|
0
|
|
|
0
|
|
my($self) = shift; |
65
|
|
|
|
|
|
|
66
|
|
|
|
|
|
# To get Win32's setup. |
67
|
0
|
|
|
|
|
$self->SUPER::init_platform; |
68
|
|
|
|
|
|
|
69
|
|
|
|
|
|
# incpath is copied to makefile var INCLUDE in constants sub, here just |
70
|
|
|
|
|
|
# make it empty |
71
|
0
|
|
|
|
|
my $libpth = $Config{'libpth'}; |
72
|
0
|
|
|
|
|
$libpth =~ s( )(;); |
73
|
0
|
|
|
|
|
$self->{'LIBPTH'} = $libpth; |
74
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
$self->{'BASE_IMPORT'} = $Config{'base_import'}; |
76
|
|
|
|
|
|
|
77
|
|
|
|
|
|
# Additional import file specified from Makefile.pl |
78
|
0
|
0
|
|
|
|
if($self->{'base_import'}) { |
79
|
0
|
|
|
|
|
$self->{'BASE_IMPORT'} .= ', ' . $self->{'base_import'}; |
80
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
$self->{'NLM_VERSION'} = $Config{'nlm_version'}; |
83
|
0
|
|
|
|
|
$self->{'MPKTOOL'} = $Config{'mpktool'}; |
84
|
0
|
|
|
|
|
$self->{'TOOLPATH'} = $Config{'toolpath'}; |
85
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
(my $boot = $self->{'NAME'}) =~ s/:/_/g; |
87
|
0
|
|
|
|
|
$self->{'BOOT_SYMBOL'}=$boot; |
88
|
|
|
|
|
|
|
89
|
|
|
|
|
|
# If the final binary name is greater than 8 chars, |
90
|
|
|
|
|
|
# truncate it here. |
91
|
0
|
0
|
|
|
|
if(length($self->{'BASEEXT'}) > 8) { |
92
|
0
|
|
|
|
|
$self->{'NLM_SHORT_NAME'} = substr($self->{'BASEEXT'},0,8); |
93
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
95
|
|
|
|
|
|
# Get the include path and replace the spaces with ; |
96
|
|
|
|
|
|
# Copy this to makefile as INCLUDE = d:\...;d:\; |
97
|
0
|
|
|
|
|
($self->{INCLUDE} = $Config{'incpath'}) =~ s/([ ]*)-I/;/g; |
98
|
|
|
|
|
|
|
99
|
|
|
|
|
|
# Set the path to CodeWarrior binaries which might not have been set in |
100
|
|
|
|
|
|
# any other place |
101
|
0
|
|
|
|
|
$self->{PATH} = '$(PATH);$(TOOLPATH)'; |
102
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
$self->{MM_NW5_VERSION} = $VERSION; |
104
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
106
|
|
|
|
|
|
sub platform_constants { |
107
|
0
|
|
|
0
|
|
my($self) = shift; |
108
|
0
|
|
|
|
|
my $make_frag = ''; |
109
|
|
|
|
|
|
|
110
|
|
|
|
|
|
# Setup Win32's constants. |
111
|
0
|
|
|
|
|
$make_frag .= $self->SUPER::platform_constants; |
112
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
foreach my $macro (qw(LIBPTH BASE_IMPORT NLM_VERSION MPKTOOL |
114
|
|
|
|
|
|
TOOLPATH BOOT_SYMBOL NLM_SHORT_NAME INCLUDE PATH |
115
|
|
|
|
|
|
MM_NW5_VERSION |
116
|
|
|
|
|
|
)) |
117
|
|
|
|
|
|
{ |
118
|
0
|
0
|
|
|
|
next unless defined $self->{$macro}; |
119
|
0
|
|
|
|
|
$make_frag .= "$macro = $self->{$macro}\n"; |
120
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
return $make_frag; |
123
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
126
|
|
|
|
|
|
=item const_cccmd |
127
|
|
|
|
|
|
|
128
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
130
|
|
|
|
|
|
sub const_cccmd { |
131
|
0
|
|
|
0
|
|
my($self,$libperl)=@_; |
132
|
0
|
0
|
|
|
|
return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; |
133
|
0
|
0
|
|
|
|
return '' unless $self->needs_linking(); |
134
|
0
|
|
|
|
|
return $self->{CONST_CCCMD} = <<'MAKE_FRAG'; |
135
|
|
|
|
|
|
CCCMD = $(CC) $(CCFLAGS) $(INC) $(OPTIMIZE) \ |
136
|
|
|
|
|
|
$(PERLTYPE) $(MPOLLUTE) -o $@ \ |
137
|
|
|
|
|
|
-DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(XS_VERSION)\" |
138
|
|
|
|
|
|
MAKE_FRAG |
139
|
|
|
|
|
|
|
140
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
143
|
|
|
|
|
|
=item static_lib |
144
|
|
|
|
|
|
|
145
|
|
|
|
|
|
=cut |
146
|
|
|
|
|
|
|
147
|
|
|
|
|
|
sub static_lib { |
148
|
0
|
|
|
0
|
|
my($self) = @_; |
149
|
|
|
|
|
|
|
150
|
0
|
0
|
|
|
|
return '' unless $self->has_link_code; |
151
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
my $m = <<'END'; |
153
|
|
|
|
|
|
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists |
154
|
|
|
|
|
|
$(RM_RF) $@ |
155
|
|
|
|
|
|
END |
156
|
|
|
|
|
|
|
157
|
|
|
|
|
|
# If this extension has it's own library (eg SDBM_File) |
158
|
|
|
|
|
|
# then copy that to $(INST_STATIC) and add $(OBJECT) into it. |
159
|
0
|
0
|
|
|
|
$m .= <<'END' if $self->{MYEXTLIB}; |
160
|
|
|
|
|
|
$self->{CP} $(MYEXTLIB) $@ |
161
|
|
|
|
|
|
END |
162
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
my $ar_arg; |
164
|
0
|
0
|
|
|
|
if( $BORLAND ) { |
|
|
0
|
|
|
|
|
165
|
0
|
|
|
|
|
$ar_arg = '$@ $(OBJECT:^"+")'; |
166
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
elsif( $GCC ) { |
168
|
0
|
|
|
|
|
$ar_arg = '-ru $@ $(OBJECT)'; |
169
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
else { |
171
|
0
|
|
|
|
|
$ar_arg = '-type library -o $@ $(OBJECT)'; |
172
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
174
|
0
|
|
|
|
|
$m .= sprintf <<'END', $ar_arg; |
175
|
|
|
|
|
|
$(AR) %s |
176
|
|
|
|
|
|
$(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld |
177
|
|
|
|
|
|
$(CHMOD) 755 $@ |
178
|
|
|
|
|
|
END |
179
|
|
|
|
|
|
|
180
|
0
|
0
|
|
|
|
$m .= <<'END' if $self->{PERL_SRC}; |
181
|
|
|
|
|
|
$(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs |
182
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
184
|
|
|
|
|
|
END |
185
|
0
|
|
|
|
|
return $m; |
186
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
188
|
|
|
|
|
|
=item dynamic_lib |
189
|
|
|
|
|
|
|
190
|
|
|
|
|
|
Defines how to produce the *.so (or equivalent) files. |
191
|
|
|
|
|
|
|
192
|
|
|
|
|
|
=cut |
193
|
|
|
|
|
|
|
194
|
|
|
|
|
|
sub dynamic_lib { |
195
|
0
|
|
|
0
|
|
my($self, %attribs) = @_; |
196
|
0
|
0
|
|
|
|
return '' unless $self->needs_linking(); #might be because of a subdir |
197
|
|
|
|
|
|
|
198
|
0
|
0
|
|
|
|
return '' unless $self->has_link_code; |
199
|
|
|
|
|
|
|
200
|
0
|
|
0
|
|
|
my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': ''); |
201
|
0
|
|
0
|
|
|
my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || ""; |
202
|
0
|
|
|
|
|
my($ldfrom) = '$(LDFROM)'; |
203
|
|
|
|
|
|
|
204
|
0
|
|
|
|
|
(my $boot = $self->{NAME}) =~ s/:/_/g; |
205
|
|
|
|
|
|
|
206
|
0
|
|
|
|
|
my $m = <<'MAKE_FRAG'; |
207
|
|
|
|
|
|
# This section creates the dynamically loadable $(INST_DYNAMIC) |
208
|
|
|
|
|
|
# from $(OBJECT) and possibly $(MYEXTLIB). |
209
|
|
|
|
|
|
OTHERLDFLAGS = '.$otherldflags.' |
210
|
|
|
|
|
|
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.' |
211
|
|
|
|
|
|
|
212
|
|
|
|
|
|
# Create xdc data for an MT safe NLM in case of mpk build |
213
|
|
|
|
|
|
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DFSEP).exists |
214
|
|
|
|
|
|
$(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def |
215
|
|
|
|
|
|
$(NOECHO) $(ECHO) $(BASE_IMPORT) >> $(BASEEXT).def |
216
|
|
|
|
|
|
$(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def |
217
|
|
|
|
|
|
MAKE_FRAG |
218
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
220
|
0
|
0
|
|
|
|
if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) { |
221
|
0
|
|
|
|
|
$m .= <<'MAKE_FRAG'; |
222
|
|
|
|
|
|
$(MPKTOOL) $(XDCFLAGS) $(BASEEXT).xdc |
223
|
|
|
|
|
|
$(NOECHO) $(ECHO) xdcdata $(BASEEXT).xdc >> $(BASEEXT).def |
224
|
|
|
|
|
|
MAKE_FRAG |
225
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
227
|
|
|
|
|
|
# Reconstruct the X.Y.Z version. |
228
|
0
|
|
|
|
|
my $version = join '.', map { sprintf "%d", $_ } |
|
0
|
|
|
|
|
|
229
|
|
|
|
|
|
$] =~ /(\d)\.(\d{3})(\d{2})/; |
230
|
0
|
|
|
|
|
$m .= sprintf ' $(LD) $(LDFLAGS) $(OBJECT:.obj=.obj) -desc "Perl %s Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION)', $version; |
231
|
|
|
|
|
|
|
232
|
|
|
|
|
|
# Taking care of long names like FileHandle, ByteLoader, SDBM_File etc |
233
|
0
|
0
|
|
|
|
if($self->{NLM_SHORT_NAME}) { |
234
|
|
|
|
|
|
# In case of nlms with names exceeding 8 chars, build nlm in the |
235
|
|
|
|
|
|
# current dir, rename and move to auto\lib. |
236
|
0
|
|
|
|
|
$m .= q{ -o $(NLM_SHORT_NAME).$(DLEXT)} |
237
|
|
|
|
|
|
} else { |
238
|
0
|
|
|
|
|
$m .= q{ -o $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)} |
239
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
241
|
|
|
|
|
|
# Add additional lib files if any (SDBM_File) |
242
|
0
|
0
|
|
|
|
$m .= q{ $(MYEXTLIB) } if $self->{MYEXTLIB}; |
243
|
|
|
|
|
|
|
244
|
0
|
|
|
|
|
$m .= q{ $(PERL_INC)\Main.lib -commandfile $(BASEEXT).def}."\n"; |
245
|
|
|
|
|
|
|
246
|
0
|
0
|
|
|
|
if($self->{NLM_SHORT_NAME}) { |
247
|
0
|
|
|
|
|
$m .= <<'MAKE_FRAG'; |
248
|
|
|
|
|
|
if exist $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT) del $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT) |
249
|
|
|
|
|
|
move $(NLM_SHORT_NAME).$(DLEXT) $(INST_AUTODIR) |
250
|
|
|
|
|
|
MAKE_FRAG |
251
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
253
|
0
|
|
|
|
|
$m .= <<'MAKE_FRAG'; |
254
|
|
|
|
|
|
|
255
|
|
|
|
|
|
$(CHMOD) 755 $@ |
256
|
|
|
|
|
|
MAKE_FRAG |
257
|
|
|
|
|
|
|
258
|
0
|
|
|
|
|
return $m; |
259
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
262
|
|
|
|
|
|
1; |
263
|
|
|
|
|
|
__END__ |