=cut
+use strict;
use Config;
-#use Cwd;
use File::Basename;
-require Exporter;
-Exporter::import('ExtUtils::MakeMaker',
- qw( $Verbose &neatvalue));
+use vars qw(@ISA $VERSION);
+$VERSION = '2.07';
+
+require ExtUtils::MM_Win32;
+@ISA = qw(ExtUtils::MM_Win32);
+
+use ExtUtils::MakeMaker qw( &neatvalue );
$ENV{EMXSHELL} = 'sh'; # to run `commands`
-unshift @MM::ISA, 'ExtUtils::MM_NW5';
-
-$BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
-$GCC = 1 if $Config{'cc'} =~ /^gcc/i;
-$DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
-$NMAKE = 1 if $Config{'make'} =~ /^nmake/i;
-$PERLMAKE = 1 if $Config{'make'} =~ /^pmake/i;
-$OBJ = 1 if $Config{'ccflags'} =~ /PERL_OBJECT/i;
-
-# a few workarounds for command.com (very basic)
-{
- package ExtUtils::MM_Win95;
-
- # the $^O test may be overkill, but we want to be sure Win32::IsWin95()
- # exists before we try it
-
- unshift @MM::ISA, 'ExtUtils::MM_Win95'
- if ($^O =~ /Win32/ && Win32::IsWin95());
-
- sub xs_c {
- my($self) = shift;
- return '' unless $self->needs_linking();
- '
-.xs.c:
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
- $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
- '
- }
- sub xs_cpp {
- my($self) = shift;
- return '' unless $self->needs_linking();
- '
-.xs.cpp:
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
- $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.cpp
- ';
- }
+my $BORLAND = 1 if $Config{'cc'} =~ /^bcc/i;
+my $GCC = 1 if $Config{'cc'} =~ /^gcc/i;
+my $DMAKE = 1 if $Config{'make'} =~ /^dmake/i;
- # many makes are too dumb to use xs_c then c_o
- sub xs_o {
- my($self) = shift;
- return '' unless $self->needs_linking();
- '
-.xs$(OBJ_EXT):
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) \\
- $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.c
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
- ';
- }
-} # end of command.com workarounds
-sub dlsyms {
- my($self,%attribs) = @_;
+=item os_flavor
- my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
- my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || [];
- my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || [];
- my($imports) = $attribs{IMPORTS} || $self->{IMPORTS} || {};
- my(@m);
- (my $boot = $self->{NAME}) =~ s/:/_/g;
+We're Netware in addition to being Windows.
- if (not $self->{SKIPHASH}{'dynamic'}) {
- push(@m,"
-$self->{BASEEXT}.def: Makefile.PL
-",
- q! $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Mksymlists \\
- -e "Mksymlists('NAME' => '!, $self->{NAME},
- q!', 'DLBASE' => '!,$self->{DLBASE},
- q!', 'DL_FUNCS' => !,neatvalue($funcs),
- q!, 'FUNCLIST' => !,neatvalue($funclist),
- q!, 'IMPORTS' => !,neatvalue($imports),
- q!, 'DL_VARS' => !, neatvalue($vars), q!);"
-!);
- }
- join('',@m);
-}
+=cut
-sub replace_manpage_separator {
- my($self,$man) = @_;
- $man =~ s,/+,.,g;
- $man;
+sub os_flavor {
+ my $self = shift;
+ return ($self->SUPER::os_flavor, 'Netware');
}
-sub maybe_command {
- my($self,$file) = @_;
- my @e = exists($ENV{'PATHEXT'})
- ? split(/;/, $ENV{PATHEXT})
- : qw(.com .exe .bat .cmd);
- my $e = '';
- for (@e) { $e .= "\Q$_\E|" }
- chop $e;
- # see if file ends in one of the known extensions
- if ($file =~ /($e)$/i) {
- return $file if -e $file;
- }
- else {
- for (@e) {
- return "$file$_" if -e "$file$_";
- }
- }
- return;
-}
+=item init_platform (o)
-sub file_name_is_absolute {
- my($self,$file) = @_;
- $file =~ m{^([a-z]:)?[\\/]}i ;
-}
+Add Netware macros.
-sub find_perl {
- my($self, $ver, $names, $dirs, $trace) = @_;
- my($name, $dir);
- if ($trace >= 2){
- print "Looking for perl $ver by these names:
-@$names
-in these dirs:
-@$dirs
-";
- }
- foreach $dir (@$dirs){
- next unless defined $dir; # $self->{PERL_SRC} may be undefined
- foreach $name (@$names){
- my ($abs, $val);
- if ($self->file_name_is_absolute($name)) { # /foo/bar
- $abs = $name;
- } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
- $abs = $self->catfile($dir, $name);
- } else { # foo/bar
- $abs = $self->canonpath($self->catfile($self->curdir, $name));
- }
- print "Checking $abs\n" if ($trace >= 2);
- next unless $self->maybe_command($abs);
- print "Executing $abs\n" if ($trace >= 2);
- $val = `$abs -e "require $ver;" 2>&1`;
- if ($? == 0) {
- print "Using PERL=$abs\n" if $trace;
- return $abs;
- } elsif ($trace >= 2) {
- print "Result: `$val'\n";
- }
- }
- }
- print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
- 0; # false and not empty
-}
+LIBPTH, BASE_IMPORT, NLM_VERSION, MPKTOOL, TOOLPATH, BOOT_SYMBOL,
+NLM_SHORT_NAME, INCLUDE, PATH, MM_NW5_REVISION
-sub catdir {
- my $self = shift;
- my @args = @_;
- for (@args) {
- # append a slash to each argument unless it has one there
- $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\";
- }
- my $result = $self->canonpath(join('', @args));
- $result;
-}
-=item catfile
+=item platform_constants
-Concatenate one or more directory names and a filename to form a
-complete path ending with a filename
+Add Netware macros initialized above to the Makefile.
=cut
-sub catfile {
- my $self = shift @_;
- my $file = pop @_;
- return $file unless @_;
- my $dir = $self->catdir(@_);
- $dir =~ s/(\\\.)$//;
- $dir .= "\\" unless substr($dir,length($dir)-1,1) eq "\\";
- return $dir.$file;
-}
+sub init_platform {
+ my($self) = shift;
-sub init_others
-{
- my ($self) = @_;
- &ExtUtils::MM_Unix::init_others;
- $self->{'TOUCH'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e touch';
- $self->{'CHMOD'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e chmod';
- $self->{'CP'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp';
- $self->{'RM_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f';
- $self->{'RM_RF'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_rf';
- $self->{'MV'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mv';
- $self->{'NOOP'} = 'rem';
- $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f';
- $self->{'LD'} = $Config{'ld'} || 'link';
- $self->{'AR'} = $Config{'ar'} || 'lib';
- $self->{'LDLOADLIBS'} ||= $Config{'libs'};
- # -Lfoo must come first for Borland, so we put it in LDDLFLAGS
- if ($BORLAND) {
- my $libs = $self->{'LDLOADLIBS'};
- my $libpath = '';
- while ($libs =~ s/(?:^|\s)(("?)-L.+?\2)(?:\s|$)/ /) {
- $libpath .= ' ' if length $libpath;
- $libpath .= $1;
- }
- $self->{'LDLOADLIBS'} = $libs;
- $self->{'LDDLFLAGS'} ||= $Config{'lddlflags'};
- $self->{'LDDLFLAGS'} .= " $libpath";
- }
- $self->{'DEV_NULL'} = '> NUL';
- # $self->{'NOECHO'} = ''; # till we have it working
-
- # incpath is copied to makefile var INCLUDE in constants sub, here just make it empty
- my $libpth = $Config{'libpth'};
- $libpth =~ s( )(;);
- $self->{'LIBPTH'} = $libpth;
- $self->{'BASE_IMPORT'} = $Config{'base_import'};
-
- # Additional import file specified from Makefile.pl
- if($self->{'base_import'}) {
- $self->{'BASE_IMPORT'} .= ',' . $self->{'base_import'};
- }
-
- $self->{'NLM_VERSION'} = $Config{'nlm_version'};
- $self->{'MPKTOOL'} = $Config{'mpktool'};
- $self->{'TOOLPATH'} = $Config{'toolpath'};
-}
+ # To get Win32's setup.
+ $self->SUPER::init_platform;
+ # incpath is copied to makefile var INCLUDE in constants sub, here just
+ # make it empty
+ my $libpth = $Config{'libpth'};
+ $libpth =~ s( )(;);
+ $self->{'LIBPTH'} = $libpth;
-=item constants (o)
+ $self->{'BASE_IMPORT'} = $Config{'base_import'};
-Initializes lots of constants and .SUFFIXES and .PHONY
+ # Additional import file specified from Makefile.pl
+ if($self->{'base_import'}) {
+ $self->{'BASE_IMPORT'} .= ', ' . $self->{'base_import'};
+ }
+
+ $self->{'NLM_VERSION'} = $Config{'nlm_version'};
+ $self->{'MPKTOOL'} = $Config{'mpktool'};
+ $self->{'TOOLPATH'} = $Config{'toolpath'};
-=cut
-# NetWare override
-sub const_cccmd {
- my($self,$libperl)=@_;
- return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
- return '' unless $self->needs_linking();
- return $self->{CONST_CCCMD} =
- q{CCCMD = $(CC) $(INC) $(CCFLAGS) $(OPTIMIZE) \\
- $(PERLTYPE) $(LARGE) $(SPLIT) $(MPOLLUTE) \\
- -DVERSION="$(VERSION)" -DXS_VERSION="$(XS_VERSION)"};
-}
+ (my $boot = $self->{'NAME'}) =~ s/:/_/g;
+ $self->{'BOOT_SYMBOL'}=$boot;
-sub constants {
- my($self) = @_;
- my(@m,$tmp);
-
-# Added LIBPTH, BASE_IMPORT, ABSTRACT, NLM_VERSION BOOT_SYMBOL, NLM_SHORT_NAME
-# for NETWARE
-
- for $tmp (qw/
-
- AR_STATIC_ARGS NAME DISTNAME NAME_SYM VERSION
- VERSION_SYM XS_VERSION INST_BIN INST_EXE INST_LIB
- INST_ARCHLIB INST_SCRIPT PREFIX INSTALLDIRS
- INSTALLPRIVLIB INSTALLARCHLIB INSTALLSITELIB
- INSTALLSITEARCH INSTALLBIN INSTALLSCRIPT PERL_LIB
- PERL_ARCHLIB SITELIBEXP SITEARCHEXP LIBPERL_A MYEXTLIB
- FIRST_MAKEFILE MAKE_APERL_FILE PERLMAINCC PERL_SRC
- PERL_INC PERL FULLPERL LIBPTH BASE_IMPORT
- NLM_VERSION MPKTOOL TOOLPATH
-
- / ) {
- next unless defined $self->{$tmp};
- push @m, "$tmp = $self->{$tmp}\n";
+ # If the final binary name is greater than 8 chars,
+ # truncate it here.
+ if(length($self->{'BASEEXT'}) > 8) {
+ $self->{'NLM_SHORT_NAME'} = substr($self->{'BASEEXT'},0,8);
}
- (my $boot = $self->{'NAME'}) =~ s/:/_/g;
- $self->{'BOOT_SYMBOL'}=$boot;
- 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
- if(length($self->{'BASEEXT'}) > 8) {
- $self->{'NLM_SHORT_NAME'} = substr($self->{'NAME'},0,8);
- push @m, "NLM_SHORT_NAME = $self->{'NLM_SHORT_NAME'}\n";
- }
-
- push @m, qq{
-VERSION_MACRO = VERSION
-DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
-XS_VERSION_MACRO = XS_VERSION
-XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
-};
-
- # Get the include path and replace the spaces with ;
- # Copy this to makefile as INCLUDE = d:\...;d:\;
- (my $inc = $Config{'incpath'}) =~ s/ /;/g;
-
- # Get the additional include path and append to INCLUDE, keep it in
- # INC will give problems during compilation, hence reset it after getting
- # the value
- (my $add_inc = $self->{'INC'}) =~ s/ -I/;/g;
- $self->{'INC'} = '';
- push @m, qq{
-INCLUDE = $inc;$add_inc;
-};
-
- # Set the path to Watcom binaries which might not have been set in
- # any other place
- push @m, qq{
-PATH = \$(PATH);\$(TOOLPATH)
-};
-
- push @m, qq{
-MAKEMAKER = $INC{'ExtUtils\MakeMaker.pm'}
-MM_VERSION = $ExtUtils::MakeMaker::VERSION
-};
-
- push @m, q{
-# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
-# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
-# ROOTEXT = Directory part of FULLEXT with leading slash (eg /DBD) !!! Deprecated from MM 5.32 !!!
-# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
-# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
-};
-
- for $tmp (qw/
- FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT
- LDFROM LINKTYPE
- / ) {
- next unless defined $self->{$tmp};
- push @m, "$tmp = $self->{$tmp}\n";
- }
+ # Get the include path and replace the spaces with ;
+ # Copy this to makefile as INCLUDE = d:\...;d:\;
+ ($self->{INCLUDE} = $Config{'incpath'}) =~ s/([ ]*)-I/;/g;
- push @m, "
-# Handy lists of source code files:
-XS_FILES= ".join(" \\\n\t", sort keys %{$self->{XS}})."
-C_FILES = ".join(" \\\n\t", @{$self->{C}})."
-O_FILES = ".join(" \\\n\t", @{$self->{O_FILES}})."
-H_FILES = ".join(" \\\n\t", @{$self->{H}})."
-HTMLLIBPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLLIBPODS}})."
-HTMLSCRIPTPODS = ".join(" \\\n\t", sort keys %{$self->{HTMLSCRIPTPODS}})."
-MAN1PODS = ".join(" \\\n\t", sort keys %{$self->{MAN1PODS}})."
-MAN3PODS = ".join(" \\\n\t", sort keys %{$self->{MAN3PODS}})."
-";
-
- for $tmp (qw/
- INST_HTMLPRIVLIBDIR INSTALLHTMLPRIVLIBDIR
- INST_HTMLSITELIBDIR INSTALLHTMLSITELIBDIR
- INST_HTMLSCRIPTDIR INSTALLHTMLSCRIPTDIR
- INST_HTMLLIBDIR HTMLEXT
- INST_MAN1DIR INSTALLMAN1DIR MAN1EXT
- INST_MAN3DIR INSTALLMAN3DIR MAN3EXT
- /) {
- next unless defined $self->{$tmp};
- push @m, "$tmp = $self->{$tmp}\n";
- }
+ # Set the path to CodeWarrior binaries which might not have been set in
+ # any other place
+ $self->{PATH} = '$(PATH);$(TOOLPATH)';
- push @m, qq{
-.USESHELL :
-} if $DMAKE;
-
- push @m, q{
-.NO_CONFIG_REC: Makefile
-} if $ENV{CLEARCASE_ROOT};
-
- # why not q{} ? -- emacs
- push @m, qq{
-# work around a famous dec-osf make(1) feature(?):
-makemakerdflt: all
-
-.SUFFIXES: .xs .c .C .cpp .cxx .cc \$(OBJ_EXT)
-
-# Nick wanted to get rid of .PRECIOUS. I don't remember why. I seem to recall, that
-# some make implementations will delete the Makefile when we rebuild it. Because
-# we call false(1) when we rebuild it. So make(1) is not completely wrong when it
-# does so. Our milage may vary.
-# .PRECIOUS: Makefile # seems to be not necessary anymore
-
-.PHONY: all config static dynamic test linkext manifest
-
-# Where is the Config information that we are using/depend on
-CONFIGDEP = \$(PERL_ARCHLIB)\\Config.pm \$(PERL_INC)\\config.h
-};
-
- my @parentdir = split(/::/, $self->{PARENT_NAME});
- push @m, q{
-# Where to put things:
-INST_LIBDIR = }. $self->catdir('$(INST_LIB)',@parentdir) .q{
-INST_ARCHLIBDIR = }. $self->catdir('$(INST_ARCHLIB)',@parentdir) .q{
-
-INST_AUTODIR = }. $self->catdir('$(INST_LIB)','auto','$(FULLEXT)') .q{
-INST_ARCHAUTODIR = }. $self->catdir('$(INST_ARCHLIB)','auto','$(FULLEXT)') .q{
-};
-
- if ($self->has_link_code()) {
- push @m, '
-INST_STATIC = $(INST_ARCHAUTODIR)\$(BASEEXT)$(LIB_EXT)
-INST_DYNAMIC = $(INST_ARCHAUTODIR)\$(DLBASE).$(DLEXT)
-INST_BOOT = $(INST_ARCHAUTODIR)\$(BASEEXT).bs
-';
- } else {
- push @m, '
-INST_STATIC =
-INST_DYNAMIC =
-INST_BOOT =
-';
- }
+ $self->{MM_NW5_VERSION} = $VERSION;
+}
- $tmp = $self->export_list;
- push @m, "
-EXPORT_LIST = $tmp
-";
- $tmp = $self->perl_archive;
- push @m, "
-PERL_ARCHIVE = $tmp
-";
+sub platform_constants {
+ my($self) = shift;
+ my $make_frag = '';
+
+ # Setup Win32's constants.
+ $make_frag .= $self->SUPER::platform_constants;
+
+ foreach my $macro (qw(LIBPTH BASE_IMPORT NLM_VERSION MPKTOOL
+ TOOLPATH BOOT_SYMBOL NLM_SHORT_NAME INCLUDE PATH
+ MM_NW5_VERSION
+ ))
+ {
+ next unless defined $self->{$macro};
+ $make_frag .= "$macro = $self->{$macro}\n";
+ }
-# push @m, q{
-#INST_PM = }.join(" \\\n\t", sort values %{$self->{PM}}).q{
-#
-#PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
-#};
+ return $make_frag;
+}
- push @m, q{
-TO_INST_PM = }.join(" \\\n\t", sort keys %{$self->{PM}}).q{
-PM_TO_BLIB = }.join(" \\\n\t", %{$self->{PM}}).q{
-};
+=item const_cccmd (o)
- join('',@m);
-}
+=cut
+sub const_cccmd {
+ my($self,$libperl)=@_;
+ return $self->{CONST_CCCMD} if $self->{CONST_CCCMD};
+ return '' unless $self->needs_linking();
+ return $self->{CONST_CCCMD} = <<'MAKE_FRAG';
+CCCMD = $(CC) $(CCFLAGS) $(INC) $(OPTIMIZE) \
+ $(PERLTYPE) $(MPOLLUTE) -o $@ \
+ -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(XS_VERSION)\"
+MAKE_FRAG
-sub path {
- my($self) = @_;
- my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'};
- my @path = split(';',$path);
- foreach(@path) { $_ = '.' if $_ eq '' }
- @path;
}
-=item static_lib (o)
-Defines how to produce the *.a (or equivalent) files.
+=item static_lib (o)
=cut
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');
-$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)\.exists
+ my $m = <<'END';
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) blibdirs
$(RM_RF) $@
END
- # If this extension has its own library (eg SDBM_File)
+ # 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};
-
- push @m,
-q{ $(AR) }.($BORLAND ? '$@ $(OBJECT:^"+")'
- : ($GCC ? '-ru $@ $(OBJECT)'
- : '-out:$@ $(OBJECT)')).q{
- }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
- $(CHMOD) 755 $@
-};
-
-# Old mechanism - still available:
-
- push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs}."\n\n"
- if $self->{PERL_SRC};
+ $m .= <<'END' if $self->{MYEXTLIB};
+ $self->{CP} $(MYEXTLIB) $@
+END
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
- join('', "\n",@m);
-}
+ my $ar_arg;
+ if( $BORLAND ) {
+ $ar_arg = '$@ $(OBJECT:^"+")';
+ }
+ elsif( $GCC ) {
+ $ar_arg = '-ru $@ $(OBJECT)';
+ }
+ else {
+ $ar_arg = '-type library -o $@ $(OBJECT)';
+ }
-=item dynamic_bs (o)
+ $m .= sprintf <<'END', $ar_arg;
+ $(AR) %s
+ $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)\extralibs.ld
+ $(CHMOD) 755 $@
+END
-Defines targets for bootstrap files.
+ $m .= <<'END' if $self->{PERL_SRC};
+ $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)\ext.libs
-=cut
-sub dynamic_bs {
- my($self, %attribs) = @_;
- return '
-BOOTSTRAP =
-' unless $self->has_link_code();
-
- return '
-BOOTSTRAP = '."$self->{BASEEXT}.bs".'
-
-# As Mkbootstrap might not write a file (if none is required)
-# we use touch to prevent make continually trying to remake it.
-# The DynaLoader only reads a non-empty file.
-$(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)\.exists
- '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
- '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
- -MExtUtils::Mkbootstrap \
- -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
- '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
- $(CHMOD) 644 $@
-
-$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)\.exists
- '."$self->{NOECHO}$self->{RM_RF}".' $(INST_BOOT)
- -'.$self->{CP}.' $(BOOTSTRAP) $(INST_BOOT)
- $(CHMOD) 644 $@
-';
+END
+ return $m;
}
=item dynamic_lib (o)
=cut
sub dynamic_lib {
- my($self, %attribs) = @_;
+ my($self, %attribs) = @_;
return '' unless $self->needs_linking(); #might be because of a subdir
return '' unless $self->has_link_code;
my($otherldflags) = $attribs{OTHERLDFLAGS} || ($BORLAND ? 'c0d32.obj': '');
my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
my($ldfrom) = '$(LDFROM)';
- my(@m);
- (my $boot = $self->{NAME}) =~ s/:/_/g;
- my ($mpk);
- push(@m,'
+
+ (my $boot = $self->{NAME}) =~ s/:/_/g;
+
+ my $m = <<'MAKE_FRAG';
# This section creates the dynamically loadable $(INST_DYNAMIC)
# from $(OBJECT) and possibly $(MYEXTLIB).
OTHERLDFLAGS = '.$otherldflags.'
INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
+# Create xdc data for an MT safe NLM in case of mpk build
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP)
-');
-# push(@m,
-# q{ $(LD) -out:$@ $(LDDLFLAGS) }.$ldfrom.q{ $(OTHERLDFLAGS) }
-# .q{$(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)});
-
- # Create xdc data for an MT safe NLM in case of mpk build
- if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) {
- $mpk=1;
- push @m, ' $(MPKTOOL) $(BASEEXT).xdc
-';
- } else {
- $mpk=0;
- }
-
- push(@m,
- q{ $(LD) Form Novell NLM '$(DISTNAME) Extension, XS_VERSION=$(XS_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.
- push(@m,
- q{ Name $(NLM_SHORT_NAME).$(DLEXT)}
- );
- } else {
- push(@m,
- q{ Name $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)}
- );
- }
-
- push(@m,
- q{ Option Quiet Option Version = $(NLM_VERSION) Option Caseexact Option NoDefaultLibs Option screenname 'none' Option Synchronize }
- );
-
- if ($mpk) {
- push (@m,
- q{ Option XDCDATA=$(BASEEXT).xdc }
- );
- }
-
- # Add additional lib files if any (SDBM_File)
- if($self->{MYEXTLIB}) {
- push(@m,
- q{ Library $(MYEXTLIB) }
- );
- }
-
-#For now lets comment all the Watcom lib calls
-#q{ LibPath $(LIBPTH) Library plib3s.lib Library math3s.lib Library clib3s.lib Library emu387.lib Library $(PERL_ARCHIVE) Library $(PERL_INC)\Main.lib}
-
- push(@m,
- q{ Library $(PERL_ARCHIVE) Library $(PERL_INC)\Main.lib}
- .q{ Export boot_$(BOOT_SYMBOL) $(BASE_IMPORT) }
- .q{ FILE $(OBJECT:.obj=,)}
- );
-
- # If it is having a short name, rename it
- if($self->{NLM_SHORT_NAME}) {
- push @m, '
- if exist $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT) del $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)';
- push @m, '
- rename $(NLM_SHORT_NAME).$(DLEXT) $(BASEEXT).$(DLEXT)';
- push @m, '
- move $(BASEEXT).$(DLEXT) $(INST_AUTODIR)';
- }
-
- push @m, '
- $(CHMOD) 755 $@
-';
-
- push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
- join('',@m);
-}
-
-sub perl_archive
-{
- my ($self) = @_;
- return '$(PERL_INC)\\'.$Config{'libperl'};
-}
-
-sub export_list
-{
- my ($self) = @_;
- return "$self->{BASEEXT}.def";
-}
-
-=item canonpath
-
-No physical check on the filesystem, but a logical cleanup of a
-path. On UNIX eliminated successive slashes and successive "/.".
-
-=cut
-
-sub canonpath {
- my($self,$path) = @_;
- $path =~ s/^([a-z]:)/\u$1/;
- $path =~ s|/|\\|g;
- $path =~ s|(.)\\+|$1\\|g ; # xx////xx -> xx/xx
- $path =~ s|(\\\.)+\\|\\|g ; # xx/././xx -> xx/xx
- $path =~ s|^(\.\\)+|| unless $path eq ".\\"; # ./xx -> xx
- $path =~ s|\\$||
- unless $path =~ m#^([a-z]:)?\\#; # xx/ -> xx
- $path .= '.' if $path =~ m#\\$#;
- $path;
-}
-
-=item perl_script
-
-Takes one argument, a file name, and returns the file name, if the
-argument is likely to be a perl script. On MM_Unix this is true for
-any ordinary, readable file.
-
-=cut
-
-sub perl_script {
- my($self,$file) = @_;
- return $file if -r $file && -f _;
- return "$file.pl" if -r "$file.pl" && -f _;
- return "$file.bat" if -r "$file.bat" && -f _;
- return;
-}
-
-=item pm_to_blib
-
-Defines target that copies all files in the hash PM to their
-destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
-
-=cut
-
-sub pm_to_blib {
- my $self = shift;
- my($autodir) = $self->catdir('$(INST_LIB)','auto');
- return q{
-pm_to_blib: $(TO_INST_PM)
- }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
- "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
- -e "pm_to_blib(}.
- ($NMAKE ? 'qw[ <<pmfiles.dat ],'
- : $DMAKE ? 'qw[ $(mktmp,pmfiles.dat $(PM_TO_BLIB:s,\\,\\\\,)\n) ],'
- : '{ qw[$(PM_TO_BLIB)] },'
- ).q{'}.$autodir.q{')"
- }. ($NMAKE ? q{
-$(PM_TO_BLIB)
-<<
- } : '') . $self->{NOECHO}.q{$(TOUCH) $@
-};
-}
-
-=item test_via_harness (o)
-
-Helper method to write the test targets
-
-=cut
-
-sub test_via_harness {
- my($self, $perl, $tests) = @_;
- "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n";
-}
-
-
-=item tool_autosplit (override)
-
-Use Win32 quoting on command line.
-
-=cut
-
-sub tool_autosplit{
- my($self, %attribs) = @_;
- my($asl) = "";
- $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
- q{
-# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
-AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
-};
-}
-
-=item tools_other (o)
-
-Win32 overrides.
-
-Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
-the Makefile. Also defines the perl programs MKPATH,
-WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
-
-=cut
-
-sub tools_other {
- my($self) = shift;
- my @m;
- my $bin_sh = $Config{sh} || 'cmd /c';
- push @m, qq{
-SHELL = $bin_sh
-} unless $DMAKE; # dmake determines its own shell
-
- for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
- push @m, "$_ = $self->{$_}\n";
- }
+ $(NOECHO) $(ECHO) Export boot_$(BOOT_SYMBOL) > $(BASEEXT).def
+ $(NOECHO) $(ECHO) $(BASE_IMPORT) >> $(BASEEXT).def
+ $(NOECHO) $(ECHO) Import @$(PERL_INC)\perl.imp >> $(BASEEXT).def
+MAKE_FRAG
- push @m, q{
-# The following is a portable way to say mkdir -p
-# To see which directories are created, change the if 0 to if 1
-MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
-# This helps us to minimize the effect of the .exists files A yet
-# better solution would be to have a stable file in the perl
-# distribution with a timestamp of zero. But this solution doesn't
-# need any changes to the core distribution and works with older perls
-EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
-};
-
-
- return join "", @m if $self->{PARENT};
-
- push @m, q{
-# Here we warn users that an old packlist file was found somewhere,
-# and that they should call some uninstall routine
-WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\
--e "print 'WARNING: I have found an old package in';" \\
--e "print ' ', $$ARGV[0], '.';" \\
--e "print 'Please make sure the two installations are not conflicting';"
-
-UNINST=0
-VERBINST=1
-
-MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
--e "install({ @ARGV },'$(VERBINST)',0,'$(UNINST)');"
-
-DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \
--e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', shift, '>';" \
--e "print '=over 4';" \
--e "while (defined($$key = shift) and defined($$val = shift)) { print '=item *';print 'C<', \"$$key: $$val\", '>'; }" \
--e "print '=back';"
-
-UNINSTALL = $(PERL) -MExtUtils::Install \
--e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \
--e "print \" packlist above carefully.\n There may be errors. Remove the\";" \
--e "print \" appropriate files manually.\n Sorry for the inconveniences.\n\""
-};
-
- return join "", @m;
-}
-
-=item xs_o (o)
-
-Defines suffix rules to go from XS to object files directly. This is
-only intended for broken make implementations.
-
-=cut
-
-sub xs_o { # many makes are too dumb to use xs_c then c_o
- my($self) = shift;
- return ''
-}
-
-=item top_targets (o)
-
-Defines the targets all, subdirs, config, and O_FILES
-
-=cut
-
-sub top_targets {
-# --- Target Sections ---
-
- my($self) = shift;
- my(@m);
- push @m, '
-#all :: config $(INST_PM) subdirs linkext manifypods
-';
-
- push @m, '
-all :: pure_all htmlifypods manifypods
- '.$self->{NOECHO}.'$(NOOP)
-'
- unless $self->{SKIPHASH}{'all'};
-
- push @m, '
-pure_all :: config pm_to_blib subdirs linkext
- '.$self->{NOECHO}.'$(NOOP)
-
-subdirs :: $(MYEXTLIB)
- '.$self->{NOECHO}.'$(NOOP)
-
-config :: '.$self->{MAKEFILE}.' $(INST_LIBDIR)\.exists
- '.$self->{NOECHO}.'$(NOOP)
-
-config :: $(INST_ARCHAUTODIR)\.exists
- '.$self->{NOECHO}.'$(NOOP)
-
-config :: $(INST_AUTODIR)\.exists
- '.$self->{NOECHO}.'$(NOOP)
-';
-
- push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]);
-
- if (%{$self->{HTMLLIBPODS}}) {
- push @m, qq[
-config :: \$(INST_HTMLLIBDIR)/.exists
- $self->{NOECHO}\$(NOOP)
-
-];
- push @m, $self->dir_target(qw[$(INST_HTMLLIBDIR)]);
+ if ( $self->{CCFLAGS} =~ m/ -DMPK_ON /) {
+ $m .= <<'MAKE_FRAG';
+ $(MPKTOOL) $(XDCFLAGS) $(BASEEXT).xdc
+ $(NOECHO) $(ECHO) xdcdata $(BASEEXT).xdc >> $(BASEEXT).def
+MAKE_FRAG
}
- if (%{$self->{HTMLSCRIPTPODS}}) {
- push @m, qq[
-config :: \$(INST_HTMLSCRIPTDIR)/.exists
- $self->{NOECHO}\$(NOOP)
+ # 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;
-];
- push @m, $self->dir_target(qw[$(INST_HTMLSCRIPTDIR)]);
- }
-
- if (%{$self->{MAN1PODS}}) {
- push @m, qq[
-config :: \$(INST_MAN1DIR)\\.exists
- $self->{NOECHO}\$(NOOP)
-
-];
- push @m, $self->dir_target(qw[$(INST_MAN1DIR)]);
- }
- if (%{$self->{MAN3PODS}}) {
- push @m, qq[
-config :: \$(INST_MAN3DIR)\\.exists
- $self->{NOECHO}\$(NOOP)
-
-];
- push @m, $self->dir_target(qw[$(INST_MAN3DIR)]);
- }
-
- push @m, '
-$(O_FILES): $(H_FILES)
-' if @{$self->{O_FILES} || []} && @{$self->{H} || []};
-
- push @m, q{
-help:
- perldoc ExtUtils::MakeMaker
-};
-
- push @m, q{
-Version_check:
- }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
- -MExtUtils::MakeMaker=Version_check \
- -e "Version_check('$(MM_VERSION)')"
-};
-
- join('',@m);
-}
-
-=item htmlifypods (o)
-
-Defines targets and routines to translate the pods into HTML manpages
-and put them into the INST_HTMLLIBDIR and INST_HTMLSCRIPTDIR
-directories.
-
-Same as MM_Unix version (changes command-line quoting).
-
-=cut
-
-sub htmlifypods {
- my($self, %attribs) = @_;
- return "\nhtmlifypods : pure_all\n\t$self->{NOECHO}\$(NOOP)\n" unless
- %{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}};
- my($dist);
- my($pod2html_exe);
- if (defined $self->{PERL_SRC}) {
- $pod2html_exe = $self->catfile($self->{PERL_SRC},'pod','pod2html');
+ # 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.
+ $m .= q{ -o $(NLM_SHORT_NAME).$(DLEXT)}
} else {
- $pod2html_exe = $self->catfile($Config{scriptdirexp},'pod2html');
- }
- unless ($pod2html_exe = $self->perl_script($pod2html_exe)) {
- # No pod2html but some HTMLxxxPODS to be installed
- print <<END;
-
-Warning: I could not locate your pod2html program. Please make sure,
- your pod2html program is in your PATH before you execute 'make'
-
-END
- $pod2html_exe = "-S pod2html";
+ $m .= q{ -o $(INST_AUTODIR)\\$(BASEEXT).$(DLEXT)}
}
- my(@m);
- push @m,
-qq[POD2HTML_EXE = $pod2html_exe\n],
-qq[POD2HTML = \$(PERL) -we "use File::Basename; use File::Path qw(mkpath); %m=\@ARGV;for (keys %m){" \\\n],
-q[-e "next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M '],
- $self->{MAKEFILE}, q[';" \\
--e "print qq(Htmlifying $$m{$$_}\n);" \\
--e "$$dir = dirname($$m{$$_}); mkpath($$dir) unless -d $$dir;" \\
--e "system(qq[$$^X ].q["-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" $(POD2HTML_EXE) ].qq[$$_>$$m{$$_}])==0 or warn qq(Couldn\\047t install $$m{$$_}\n);" \\
--e "chmod(oct($(PERM_RW))), $$m{$$_} or warn qq(chmod $(PERM_RW) $$m{$$_}: $$!\n);}"
-];
- push @m, "\nhtmlifypods : pure_all ";
- push @m, join " \\\n\t", keys %{$self->{HTMLLIBPODS}}, keys %{$self->{HTMLSCRIPTPODS}};
-
- push(@m,"\n");
- if (%{$self->{HTMLLIBPODS}} || %{$self->{HTMLSCRIPTPODS}}) {
- push @m, "\t$self->{NOECHO}\$(POD2HTML) \\\n\t";
- push @m, join " \\\n\t", %{$self->{HTMLLIBPODS}}, %{$self->{HTMLSCRIPTPODS}};
- }
- join('', @m);
-}
-=item manifypods (o)
+ # Add additional lib files if any (SDBM_File)
+ $m .= q{ $(MYEXTLIB) } if $self->{MYEXTLIB};
-We don't want manpage process.
+ $m .= q{ $(PERL_INC)\Main.lib -commandfile $(BASEEXT).def}."\n";
-=cut
-
-sub manifypods {
- my($self) = shift;
- return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
-}
-
-=item dist_ci (o)
-
-Same as MM_Unix version (changes command-line quoting).
-
-=cut
-
-sub dist_ci {
- my($self) = shift;
- my @m;
- push @m, q{
-ci :
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
- -e "@all = keys %{ maniread() };" \\
- -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
- -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
-};
- join "", @m;
-}
-
-=item dist_core (o)
-
-Same as MM_Unix version (changes command-line quoting).
-
-=cut
-
-sub dist_core {
- my($self) = shift;
- my @m;
- push @m, q{
-dist : $(DIST_DEFAULT)
- }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \
- -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"
-
-tardist : $(DISTVNAME).tar$(SUFFIX)
-
-zipdist : $(DISTVNAME).zip
-
-$(DISTVNAME).tar$(SUFFIX) : distdir
- $(PREOP)
- $(TO_UNIX)
- $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
- $(RM_RF) $(DISTVNAME)
- $(COMPRESS) $(DISTVNAME).tar
- $(POSTOP)
-
-$(DISTVNAME).zip : distdir
- $(PREOP)
- $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
- $(RM_RF) $(DISTVNAME)
- $(POSTOP)
-
-uutardist : $(DISTVNAME).tar$(SUFFIX)
- uuencode $(DISTVNAME).tar$(SUFFIX) \\
- $(DISTVNAME).tar$(SUFFIX) > \\
- $(DISTVNAME).tar$(SUFFIX)_uu
-
-shdist : distdir
- $(PREOP)
- $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
- $(RM_RF) $(DISTVNAME)
- $(POSTOP)
-};
- join "", @m;
-}
-
-=item pasthru (o)
+ if($self->{NLM_SHORT_NAME}) {
+ $m .= <<'MAKE_FRAG';
+ if exist $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT) del $(INST_AUTODIR)\$(NLM_SHORT_NAME).$(DLEXT)
+ move $(NLM_SHORT_NAME).$(DLEXT) $(INST_AUTODIR)
+MAKE_FRAG
+ }
-Defines the string that is passed to recursive make calls in
-subdirectories.
+ $m .= <<'MAKE_FRAG';
-=cut
+ $(CHMOD) 755 $@
+MAKE_FRAG
-sub pasthru {
- my($self) = shift;
- return "PASTHRU = " . ($NMAKE ? "-nologo" : "");
+ return $m;
}
-
1;
__END__