home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BURKS 2
/
BURKS_AUG97.ISO
/
SLAKWARE
/
D12
/
PERL1.TGZ
/
perl1.tar
/
usr
/
lib
/
perl5
/
ExtUtils
/
MakeMaker.pm
< prev
next >
Wrap
Text File
|
1996-06-28
|
55KB
|
1,809 lines
BEGIN {require 5.002;} # MakeMaker 5.17 was the last MakeMaker that was compatible with perl5.001m
package ExtUtils::MakeMaker;
$Version = $VERSION = "5.34";
$Version_OK = "5.17"; # Makefiles older than $Version_OK will die
# (Will be checked from MakeMaker version 4.13 onwards)
($Revision = substr(q$Revision: 1.202 $, 10)) =~ s/\s+$//;
require Exporter;
use Config;
use Carp ();
#use FileHandle ();
use vars qw(
@ISA @EXPORT @EXPORT_OK $AUTOLOAD
$ISA_TTY $Is_Mac $Is_OS2 $Is_VMS $Revision $Setup_done
$VERSION $Verbose $Version_OK %Config %Keep_after_flush
%MM_Sections %Prepend_dot_dot %Recognized_Att_Keys
@Get_from_Config @MM_Sections @Overridable @Parent
);
# use strict;
eval {require DynaLoader;}; # Get mod2fname, if defined. Will fail
# with miniperl.
#
# Set up the inheritance before we pull in the MM_* packages, because they
# import variables and functions from here
#
@ISA = qw(Exporter);
@EXPORT = qw(&WriteMakefile &writeMakefile $Verbose &prompt);
@EXPORT_OK = qw($VERSION &Version_check &neatvalue &mkbootstrap &mksymlists
$Version);
# $Version in mixed case will go away!
#
# Dummy package MM inherits actual methods from OS-specific
# default packages. We use this intermediate package so
# MY::XYZ->func() can call MM->func() and get the proper
# default routine without having to know under what OS
# it's running.
#
@MM::ISA = qw[ExtUtils::MM_Unix ExtUtils::Liblist ExtUtils::MakeMaker];
#
# Setup dummy package:
# MY exists for overriding methods to be defined within
#
{
package MY;
@MY::ISA = qw(MM);
### sub AUTOLOAD { use Devel::Symdump; print Devel::Symdump->rnew->as_string; Carp::confess "hey why? $AUTOLOAD" }
package MM;
sub DESTROY {}
}
# "predeclare the package: we only load it via AUTOLOAD
# but we have already mentioned it in @ISA
package ExtUtils::Liblist;
package ExtUtils::MakeMaker;
#
# Now we can can pull in the friends
#
$Is_VMS = $^O eq 'VMS';
$Is_OS2 = $^O =~ m|^os/?2$|i;
$Is_Mac = $^O eq 'MacOS';
require ExtUtils::MM_Unix;
if ($Is_VMS) {
require ExtUtils::MM_VMS;
require VMS::Filespec; # is a noop as long as we require it within MM_VMS
}
if ($Is_OS2) {
require ExtUtils::MM_OS2;
}
if ($Is_Mac) {
require ExtUtils::MM_Mac;
}
# The SelfLoader would bring a lot of overhead for MakeMaker, because
# we know for sure we will use most of the autoloaded functions once
# we have to use one of them. So we write our own loader
sub AUTOLOAD {
my $code;
if (defined fileno(DATA)) {
my $fh = select DATA;
my $o = $/; # For future reads from the file.
$/ = "\n__END__\n";
$code = <DATA>;
$/ = $o;
select $fh;
close DATA;
eval $code;
if ($@) {
$@ =~ s/ at .*\n//;
Carp::croak $@;
}
} else {
warn "AUTOLOAD called unexpectedly for $AUTOLOAD";
}
defined(&$AUTOLOAD) or die "Myloader inconsistency error";
goto &$AUTOLOAD;
}
# The only subroutine we do not SelfLoad is Version_Check because it's
# called so often. Loading this minimum still requires 1.2 secs on my
# Indy :-(
sub Version_check {
my($checkversion) = @_;
die "Your Makefile was built with ExtUtils::MakeMaker v $checkversion.
Current Version is $ExtUtils::MakeMaker::VERSION. There have been considerable
changes in the meantime.
Please rerun 'perl Makefile.PL' to regenerate the Makefile.\n"
if $checkversion < $Version_OK;
printf STDOUT "%s %s %s %s.\n", "Makefile built with ExtUtils::MakeMaker v",
$checkversion, "Current Version is", $VERSION
unless $checkversion == $VERSION;
}
sub warnhandler {
$_[0] =~ /^Use of uninitialized value/ && return;
$_[0] =~ /used only once/ && return;
$_[0] =~ /^Subroutine\s+[\w:]+\s+redefined/ && return;
warn @_;
}
sub ExtUtils::MakeMaker::eval_in_subdirs ;
sub ExtUtils::MakeMaker::eval_in_x ;
sub ExtUtils::MakeMaker::full_setup ;
sub ExtUtils::MakeMaker::writeMakefile ;
sub ExtUtils::MakeMaker::new ;
sub ExtUtils::MakeMaker::check_manifest ;
sub ExtUtils::MakeMaker::parse_args ;
sub ExtUtils::MakeMaker::check_hints ;
sub ExtUtils::MakeMaker::mv_all_methods ;
sub ExtUtils::MakeMaker::skipcheck ;
sub ExtUtils::MakeMaker::flush ;
sub ExtUtils::MakeMaker::mkbootstrap ;
sub ExtUtils::MakeMaker::mksymlists ;
sub ExtUtils::MakeMaker::neatvalue ;
sub ExtUtils::MakeMaker::selfdocument ;
sub ExtUtils::MakeMaker::WriteMakefile ;
sub ExtUtils::MakeMaker::prompt ;
1;
#__DATA__
package ExtUtils::MakeMaker;
sub WriteMakefile {
Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
local $SIG{__WARN__} = \&warnhandler;
unless ($Setup_done++){
full_setup();
undef &ExtUtils::MakeMaker::full_setup; #safe memory
}
my %att = @_;
MM->new(\%att)->flush;
}
sub prompt ($;$) {
my($mess,$def)=@_;
$ISA_TTY = -t STDIN && -t STDOUT ;
Carp::confess("prompt function called without an argument") unless defined $mess;
my $dispdef = defined $def ? "[$def] " : " ";
$def = defined $def ? $def : "";
my $ans;
if ($ISA_TTY) {
local $|=1;
print "$mess $dispdef";
chomp($ans = <STDIN>);
}
return $ans || $def;
}
sub eval_in_subdirs {
my($self) = @_;
my($dir);
use Cwd 'cwd';
my $pwd = cwd();
foreach $dir (@{$self->{DIR}}){
my($abs) = $self->catdir($pwd,$dir);
$self->eval_in_x($abs);
}
chdir $pwd;
}
sub eval_in_x {
my($self,$dir) = @_;
package main;
chdir $dir or Carp::carp("Couldn't change to directory $dir: $!");
# use FileHandle ();
# my $fh = new FileHandle;
# $fh->open("Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir");
local *FH;
open(FH,"Makefile.PL") or Carp::carp("Couldn't open Makefile.PL in $dir");
# my $eval = join "", <$fh>;
my $eval = join "", <FH>;
# $fh->close;
close FH;
eval $eval;
if ($@) {
# if ($@ =~ /prerequisites/) {
# die "MakeMaker WARNING: $@";
# } else {
# warn "WARNING from evaluation of $dir/Makefile.PL: $@";
# }
warn "WARNING from evaluation of $dir/Makefile.PL: $@";
}
}
sub full_setup {
$Verbose ||= 0;
$^W=1;
# package name for the classes into which the first object will be blessed
$PACKNAME = "PACK000";
@Attrib_help = qw/
C CONFIG CONFIGURE DEFINE DIR DISTNAME DL_FUNCS DL_VARS EXE_FILES
EXCLUDE_EXT INCLUDE_EXT NO_VC FIRST_MAKEFILE FULLPERL H INC
INSTALLARCHLIB INSTALLBIN INSTALLDIRS INSTALLMAN1DIR
INSTALLMAN3DIR INSTALLPRIVLIB INSTALLSCRIPT INSTALLSITEARCH
INSTALLSITELIB INST_ARCHLIB INST_BIN INST_EXE INST_LIB
INST_MAN1DIR INST_MAN3DIR INST_SCRIPT LDFROM LIBPERL_A LIBS
LINKTYPE MAKEAPERL MAKEFILE MAN1PODS MAN3PODS MAP_TARGET MYEXTLIB
NAME NEEDS_LINKING NOECHO NORECURS OBJECT OPTIMIZE PERL PERLMAINCC
PERL_ARCHLIB PERL_LIB PERL_SRC PL_FILES PM PMLIBDIRS PREFIX
PREREQ_PM SKIP TYPEMAPS VERSION VERSION_FROM XS XSOPT XSPROTOARG
XS_VERSION clean depend dist dynamic_lib linkext macro realclean
tool_autosplit
installpm
/;
# ^^^ installpm is deprecated, will go about Summer 96
# @Overridable is close to @MM_Sections but not identical. The
# order is important. Many subroutines declare macros. These
# depend on each other. Let's try to collect the macros up front,
# then pasthru, then the rules.
# MM_Sections are the sections we have to call explicitly
# in Overridable we have subroutines that are used indirectly
@MM_Sections =
qw(
post_initialize const_config constants tool_autosplit tool_xsubpp
tools_other dist macro depend cflags const_loadlibs const_cccmd
post_constants
pasthru
c_o xs_c xs_o top_targets linkext dlsyms dynamic dynamic_bs
dynamic_lib static static_lib manifypods processPL installbin subdirs
clean realclean dist_basics dist_core dist_dir dist_test dist_ci
install force perldepend makefile staticmake test
); # loses section ordering
@Overridable = @MM_Sections;
push @Overridable, qw[
dir_target libscan makeaperl needs_linking subdir_x test_via_harness
test_via_script
];
push @MM_Sections, qw[
pm_to_blib selfdocument
];
# Postamble needs to be the last that was always the case
push @MM