| line | stmt | bran | cond | sub | pod | 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 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 |  |  | 1 |  | 3314 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 29 |  | 
| 22 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 23 | 1 |  |  | 1 |  | 5 | use ExtUtils::MakeMaker::Config; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 24 | 1 |  |  | 1 |  | 6 | use File::Basename; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 143 |  | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | our $VERSION = '7.70'; | 
| 27 |  |  |  |  |  |  | $VERSION =~ tr/_//d; | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | require ExtUtils::MM_Win32; | 
| 30 |  |  |  |  |  |  | our @ISA = qw(ExtUtils::MM_Win32); | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 1 |  |  | 1 |  | 18 | use ExtUtils::MakeMaker qw(&neatvalue &_sprintf562); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 1131 |  | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | $ENV{EMXSHELL} = 'sh'; # to run `commands` | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | my $BORLAND  = $Config{'cc'} =~ /\bbcc/i; | 
| 37 |  |  |  |  |  |  | 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 |  |  |  |  |  |  | sub os_flavor { | 
| 47 | 0 |  |  | 0 | 1 |  | 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 |  |  |  |  |  |  | sub init_platform { | 
| 66 | 0 |  |  | 0 | 1 |  | 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 | 0 |  |  |  |  | if($self->{'base_import'}) { | 
| 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 | 0 |  |  |  |  | if(length($self->{'BASEEXT'}) > 8) { | 
| 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 |  |  |  |  |  |  | sub platform_constants { | 
| 109 | 0 |  |  | 0 | 1 |  | 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 | 0 |  |  |  |  | next unless defined $self->{$macro}; | 
| 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 |  |  |  |  |  |  | sub static_lib_pure_cmd { | 
| 134 | 0 |  |  | 0 | 1 |  | my ($self, $src) = @_; | 
| 135 | 0 | 0 |  |  |  |  | $src =~ s/(\$\(\w+)(\))/$1:^"+"$2/g if $BORLAND; | 
| 136 | 0 | 0 |  |  |  |  | sprintf qq{\t\$(AR) %s\n}, ($BORLAND ? '$@ ' . $src | 
|  |  | 0 |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | : ($GCC ? '-ru $@ ' . $src | 
| 138 |  |  |  |  |  |  | : '-type library -o $@ ' . $src)); | 
| 139 |  |  |  |  |  |  | } | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =item xs_static_lib_is_xs | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =cut | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | sub xs_static_lib_is_xs { | 
| 146 | 0 |  |  | 0 | 1 |  | return 1; | 
| 147 |  |  |  |  |  |  | } | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | =item dynamic_lib | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | Override of utility methods for OS-specific work. | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | =cut | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | sub xs_make_dynamic_lib { | 
| 156 | 0 |  |  | 0 | 1 |  | 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 | 0 |  |  |  |  | if ($to =~ /^\$/) { | 
| 160 | 0 | 0 |  |  |  |  | if ($self->{NLM_SHORT_NAME}) { | 
| 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 | 0 |  |  |  |  | if ($f =~ /[^\.]{9}\./) { | 
| 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 | 0 |  |  |  |  | if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) { | 
| 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", $_ } | 
|  | 0 |  |  |  |  |  |  | 
| 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; | 
| 205 |  |  |  |  |  |  | __END__ | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | =back | 
| 208 |  |  |  |  |  |  |  | 
| 209 |  |  |  |  |  |  | =cut |