=cut
+use strict;
use Config;
use File::Basename;
use vars qw(@ISA $VERSION);
-$VERSION = '2.02_01';
+$VERSION = '2.05';
require ExtUtils::MM_Win32;
@ISA = qw(ExtUtils::MM_Win32);
push @m, "BOOT_SYMBOL = $self->{'BOOT_SYMBOL'}\n";
# If the final binary name is greater than 8 chars,
- # truncate it here and rename it after creation
- # otherwise, Watcom Linker fails
+ # truncate it here.
if(length($self->{'BASEEXT'}) > 8) {
$self->{'NLM_SHORT_NAME'} = substr($self->{'BASEEXT'},0,8);
push @m, "NLM_SHORT_NAME = $self->{'NLM_SHORT_NAME'}\n";
# Copy this to makefile as INCLUDE = d:\...;d:\;
(my $inc = $Config{'incpath'}) =~ s/([ ]*)-I/;/g;
- # Get the additional include path and append to INCLUDE, keeping it
- # in INC will give problems during compilation, hence reset it
- # after getting the value
- $self->{INC} = '';
+ # Get the additional include path from the user through the command prompt
+ # and append to INCLUDE
+# $self->{INC} = '';
+ push @m, "INC = $self->{'INC'}\n";
push @m, qq{
INCLUDE = $inc;
sub static_lib {
my($self) = @_;
-# Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
-# return '' unless $self->needs_linking(); #might be because of a subdir
return '' unless $self->has_link_code;
- my(@m);
- push(@m, <<'END');
+ my $m = <<'END';
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists
$(RM_RF) $@
END
# If this extension has it's own library (eg SDBM_File)
# then copy that to $(INST_STATIC) and add $(OBJECT) into it.
- push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
+ $m .= <<'END' if $self->{MYEXTLIB};
+ $self->{CP} $(MYEXTLIB) $@
+END
- push @m,
-q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")'
- : ($GCC ? '-ru $@ $(OBJECT)'
- : '-type library -o $@ $(OBJECT)')).q{
- }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
- $(CHMOD) 755 $@
-};
-# CW change ( -type library ... )
-# Old mechanism - still available:
+ my $ar_arg;
+ if( $BORLAND ) {
+ $ar_arg = '$@ $(OBJECT:^"+")';
+ }
+ elsif( $GCC ) {
+ $ar_arg = '-ru $@ $(OBJECT)';
+ }
+ else {
+ $ar_arg = '-type library -o $@ $(OBJECT)';
+ }
- push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n"
- if $self->{PERL_SRC};
+ $m .= sprintf <<'END', $ar_arg;
+ $(AR) %s
+ $(NOECHO)echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
+ $(CHMOD) 755 $@
+END
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
- join('', "\n",@m);
+ $m .= <<'END' if $self->{PERL_SRC};
+ $(NOECHO)echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs
+
+
+END
+ $m .= $self->dir_target('$(INST_ARCHAUTODIR)');
+ return $m;
}
-
=item dynamic_lib (o)
Defines how to produce the *.so (or equivalent) files.
MAKE_FRAG
}
- $m .= ' $(LD) $(LDFLAGS) $(OBJECT:.obj=.obj) -desc "Perl 5.7.3 Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION)';
+ # Reconstruct the X.Y.Z version.
+ my $version = join '.', map { sprintf "%d", $_ }
+ $] =~ /(\d)\.(\d{3})(\d{2})/;
+ $m .= sprintf ' $(LD) $(LDFLAGS) $(OBJECT:.obj=.obj) -desc "Perl %s Extension ($(BASEEXT)) XS_VERSION: $(XS_VERSION)" -nlmversion $(NLM_VERSION)', $version;
# Taking care of long names like FileHandle, ByteLoader, SDBM_File etc
if($self->{NLM_SHORT_NAME}) {
# In case of nlms with names exceeding 8 chars, build nlm in the
- # current dir, rename and move to auto\lib. If we create in auto\lib
- # in the first place, we can't rename afterwards.
+ # current dir, rename and move to auto\lib.
$m .= q{ -o $(NLM_SHORT_NAME).$(DLEXT)}
} else {
$m .= q{ -o $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)}
$m .= q{ $(PERL_INC)\Main.lib -commandfile $(BASEEXT).def}."\n";
- # If it is having a short name, rename it
if($self->{NLM_SHORT_NAME}) {
$m .= <<'MAKE_FRAG';
- if exist $(INST_AUTODIR)\$(BASEEXT).$(DLEXT) del $(INST_AUTODIR)\$(BASEEXT).$(DLEXT)
- rename $(NLM_SHORT_NAME).$(DLEXT) $(BASEEXT).$(DLEXT)
- move $(BASEEXT).$(DLEXT) $(INST_AUTODIR)
+ if exist $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT) del $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT)
+ move $(NLM_SHORT_NAME).$(DLEXT) $(INST_AUTODIR)
MAKE_FRAG
}