$Enough_limit
= 5;
sub
TIEHASH {
bless
{
SECRETHASH
=>
$_
[1]};
}
sub
FETCH {
print
"Warning (non-fatal): Importing of
%att
is deprecated [
$_
[1]]
use
\
$self
instead\n"
unless
++
$Enough
>
$Enough_limit
;
print
"Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n"
if
$Enough
==
$Enough_limit
;
$_
[0]->{SECRETHASH}->{
$_
[1]};
}
sub
STORE {
print
"Warning (non-fatal): Importing of
%att
is deprecated [
$_
[1]][
$_
[2]]
use
\
$self
instead\n"
unless
++
$Enough
>
$Enough_limit
;
print
"Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n"
if
$Enough
==
$Enough_limit
;
$_
[0]->{SECRETHASH}->{
$_
[1]} =
$_
[2];
}
sub
FIRSTKEY {
print
"Warning (non-fatal): Importing of
%att
is deprecated [FIRSTKEY]
use
\
$self
instead\n"
unless
++
$Enough
>
$Enough_limit
;
print
"Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n"
if
$Enough
==
$Enough_limit
;
each
%{
$_
[0]->{SECRETHASH}};
}
sub
NEXTKEY {
each
%{
$_
[0]->{SECRETHASH}};
}
sub
DESTROY {
}
sub
warndirectuse {
my
(
$caller
) =
@_
;
return
if
$Enough
>
$Enough_limit
;
print
STDOUT
"Warning (non-fatal): Direct use of class methods deprecated; use\n"
;
my
(
$method
) =
$caller
=~ /.*:(\w+)$/;
print
STDOUT
'
my
$self
=
shift
;
$self
->MM::',
$method
, "();
instead\n";
print
"Further ExtUtils::MakeMaker::TieAtt warnings suppressed\n"
if
++
$Enough
==
$Enough_limit
;
}
$Version
=
$VERSION
=
"5.15"
;
$ExtUtils::MakeMaker::Version_OK
= 4.13;
%NORMAL_INC
=
%INC
;
@ISA
=
qw(Exporter)
;
@EXPORT
=
qw(&WriteMakefile &writeMakefile $Verbose &prompt)
;
@EXPORT_OK
=
qw($Version $VERSION &Version_check
&help &neatvalue &mkbootstrap &mksymlists
%att ## Import of %att is deprecated, please use OO features!
)
;
if
(
$Is_VMS
= (
$Config::Config
{osname} eq
'VMS'
)) {
import
VMS::Filespec
'&vmsify'
;
}
$Is_OS2
=
$Config::Config
{osname} =~ m|^os/?2$|i ;
$ENV
{EMXSHELL} =
'sh'
if
$Is_OS2
;
$ExtUtils::MakeMaker::Verbose
= 0
unless
defined
$ExtUtils::MakeMaker::Verbose
;
$^W=1;
$SIG
{__WARN__} =
sub
{
$_
[0] =~ /^Use of uninitialized value/ &&
return
;
$_
[0] =~ /used only once/ &&
return
;
$_
[0] =~ /^Subroutine\s+[\w:]+\s+redefined/ &&
return
;
warn
@_
;
};
unshift
(
@MY::ISA
,
qw(MM)
);
@MM::ISA
=
qw[MM_Unix ExtUtils::MakeMaker]
;
unshift
@MM::ISA
,
'ExtUtils::MM_VMS'
if
$Is_VMS
;
unshift
@MM::ISA
,
'ExtUtils::MM_OS2'
if
$Is_OS2
;
@ExtUtils::MakeMaker::MM_Sections_spec
= (
post_initialize
=> {},
const_config
=> {},
constants
=> {},
const_loadlibs
=> {},
const_cccmd
=> {},
tool_autosplit
=> {},
tool_xsubpp
=> {},
tools_other
=> {},
dist
=> {},
macro
=> {},
post_constants
=> {},
pasthru
=> {},
c_o
=> {},
xs_c
=> {},
xs_o
=> {},
top_targets
=> {},
linkext
=> {},
dlsyms
=> {},
dynamic
=> {},
dynamic_bs
=> {},
dynamic_lib
=> {},
static
=> {},
static_lib
=> {},
installpm
=> {},
manifypods
=> {},
processPL
=> {},
installbin
=> {},
subdirs
=> {},
clean
=> {},
realclean
=> {},
dist_basics
=> {},
dist_core
=> {},
dist_dir
=> {},
dist_test
=> {},
dist_ci
=> {},
install
=> {},
force
=> {},
perldepend
=> {},
makefile
=> {},
staticmake
=> {},
test
=> {},
postamble
=> {},
selfdocument
=> {},
);
%ExtUtils::MakeMaker::MM_Sections
=
@ExtUtils::MakeMaker::MM_Sections_spec
;
@ExtUtils::MakeMaker::MM_Sections
=
grep
(!
ref
,
@ExtUtils::MakeMaker::MM_Sections_spec
);
%ExtUtils::MakeMaker::Recognized_Att_Keys
=
%ExtUtils::MakeMaker::MM_Sections
;
@ExtUtils::MakeMaker::Get_from_Config
=
qw(
ar
cc
cccdlflags
ccdlflags
dlext
dlsrc
ld
lddlflags
ldflags
libc
lib_ext
obj_ext
ranlib
so
)
;
my
$item
;
foreach
$item
(
split
(/\n/,attrib_help())){
next
unless
$item
=~ m/^=item\s+(\w+)\s*$/;
$ExtUtils::MakeMaker::Recognized_Att_Keys
{$1} = $2;
print
"Attribute '$1' => '$2'\n"
if
(
$ExtUtils::MakeMaker::Verbose
>= 2);
}
foreach
$item
(
@ExtUtils::MakeMaker::Get_from_Config
) {
next
unless
$Config::Config
{
$item
};
$ExtUtils::MakeMaker::Recognized_Att_Keys
{
uc
$item
} =
$Config::Config
{
$item
};
print
"Attribute '\U$item\E' => '$Config::Config{$item}'\n"
if
(
$ExtUtils::MakeMaker::Verbose
>= 2);
}
%ExtUtils::MakeMaker::Prepend_dot_dot
=
qw(
INST_LIB 1 INST_ARCHLIB 1 INST_EXE 1 MAP_TARGET 1 INST_MAN1DIR 1 INST_MAN3DIR 1
PERL_SRC 1 PERL 1 FULLPERL 1
)
;
$PACKNAME
=
"PACK000"
;
sub
writeMakefile {
die
<<END;
The extension you are trying to build apparently is rather old and
most probably outdated. We detect that from the fact, that a
subroutine "writeMakefile" is called, and this subroutine is not
supported anymore since about October 1994.
Please contact the author or look into CPAN (details about CPAN can be
found in the FAQ and at http:/www.perl.com) for a more recent version
of the extension. If you're really desperate, you can try to change
the subroutine name from writeMakefile to WriteMakefile and rerun
'perl Makefile.PL', but you're most probably left alone, when you do
so.
The MakeMaker team
END
}
sub
WriteMakefile {
Carp::croak
"WriteMakefile: Need even number of args"
if
@_
% 2;
my
%att
=
@_
;
MM->new(\
%att
)->flush;
}
sub
new {
my
(
$class
,
$self
) =
@_
;
my
(
$key
);
print
STDOUT
"MakeMaker (v$ExtUtils::MakeMaker::VERSION)\n"
if
$ExtUtils::MakeMaker::Verbose
;
if
(-f
"MANIFEST"
&& ! -f
"Makefile"
){
check_manifest();
}
$self
= {}
unless
(
defined
$self
);
check_hints(
$self
);
my
(
%initial_att
) =
%$self
;
if
(
defined
$self
->{CONFIGURE}) {
if
(
ref
$self
->{CONFIGURE} eq
'CODE'
) {
$self
= {
%$self
, %{&{
$self
->{CONFIGURE}}}};
}
else
{
croak
"Attribute 'CONFIGURE' to WriteMakefile() not a code reference\n"
;
}
}
if
( Carp::longmess(
""
) =~ /runsubdirpl/s ){
$self
->{Correct_relativ_directories}++;
}
else
{
$self
->{Correct_relativ_directories}=0;
}
my
$class
= ++
$PACKNAME
;
{
print
"Blessing Object into class [$class]\n"
if
$ExtUtils::MakeMaker::Verbose
;
mv_all_methods(
"MY"
,
$class
);
bless
$self
,
$class
;
push
@ExtUtils::MakeMaker::Parent
,
$self
;
@{
"$class\:\:ISA"
} =
'MM'
;
}
if
(
defined
$ExtUtils::MakeMaker::Parent
[-2]){
$self
->{PARENT} =
$ExtUtils::MakeMaker::Parent
[-2];
my
$key
;
for
$key
(
keys
%ExtUtils::MakeMaker::Prepend_dot_dot
) {
next
unless
defined
$self
->{PARENT}{
$key
};
$self
->{
$key
} =
$self
->{PARENT}{
$key
};
$self
->{
$key
} =
$self
->catdir(
".."
,
$self
->{
$key
})
unless
$self
->{
$key
} =~ m!^/!;
}
$self
->{PARENT}->{CHILDREN}->{
$class
} =
$self
if
$self
->{PARENT};
}
else
{
parse_args(
$self
,
@ARGV
);
}
$self
->{NAME} ||=
$self
->guess_name;
(
$self
->{NAME_SYM} =
$self
->{NAME}) =~ s/\W+/_/g;
$self
->init_main();
if
(!
$self
->{PERL_SRC} ) {
my
(
$pthinks
) =
$INC
{
'Config.pm'
};
$pthinks
= vmsify(
$pthinks
)
if
$Is_VMS
;
if
(
$pthinks
ne
$self
->catfile(
$Config::Config
{archlibexp},
'Config.pm'
)){
$pthinks
=~ s!/Config\.pm$!!;
$pthinks
=~ s!.*/!!;
print
STDOUT
<<END;
Your perl and your Config.pm seem to have different ideas about the architecture
they are running on.
Perl thinks: [$pthinks]
Config says: [$Config::Config{archname}]
This may or may not cause problems. Please check your installation of perl if you
have problems building this extension.
END
}
}
$self
->init_dirscan();
$self
->init_others();
push
@{
$self
->{RESULT}},
<<END;
# This Makefile is for the $self->{NAME} extension to perl.
#
# It was generated automatically by MakeMaker version $ExtUtils::MakeMaker::VERSION from the contents
# of Makefile.PL. Don't edit this file, edit Makefile.PL instead.
#
# ANY CHANGES MADE HERE WILL BE LOST!
#
# MakeMaker Parameters:
END
foreach
$key
(
sort
keys
%initial_att
){
my
(
$v
) = neatvalue(
$initial_att
{
$key
});
$v
=~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
$v
=~
tr
/\n/ /s;
push
@{
$self
->{RESULT}},
"# $key => $v"
;
}
my
(
%skip
,
$skip
);
for
$skip
(@{
$self
->{SKIP} || []}) {
$self
->{SKIPHASH}{
$skip
} = 1;
}
my
(
$dir
);
unless
(
$self
->{NORECURS}) {
foreach
$dir
(@{
$self
->{DIR}}){
chdir
$dir
;
local
*FH
;
open
FH,
"Makefile.PL"
;
eval
join
""
, <FH>;
close
FH;
chdir
".."
;
}
}
tie
%::att, ExtUtils::MakeMaker::TieAtt,
$self
;
my
$section
;
foreach
$section
(
@ExtUtils::MakeMaker::MM_Sections
){
print
"Processing Makefile '$section' section\n"
if
(
$ExtUtils::MakeMaker::Verbose
>= 2);
my
(
$skipit
) =
$self
->skipcheck(
$section
);
if
(
$skipit
){
push
@{
$self
->{RESULT}},
"\n# --- MakeMaker $section section $skipit."
;
}
else
{
my
(
%a
) = %{
$self
->{
$section
} || {}};
push
@{
$self
->{RESULT}},
"\n# --- MakeMaker $section section:"
;
push
@{
$self
->{RESULT}},
"# "
.
join
", "
,
%a
if
$ExtUtils::MakeMaker::Verbose
&&
%a
;
push
@{
$self
->{RESULT}},
$self
->nicetext(
$self
->
$section
(
%a
));
}
}
push
@{
$self
->{RESULT}},
"\n# End."
;
pop
@ExtUtils::MakeMaker::Parent
;
$self
;
}
sub
check_manifest {
if
($@){
print
STDOUT "Warning: you have not installed the ExtUtils::Manifest
module -- skipping check of the MANIFEST file\n";
}
else
{
print
STDOUT
"Checking if your kit is complete...\n"
;
$ExtUtils::Manifest::Quiet
=
$ExtUtils::Manifest::Quiet
=1;
my
(
@missed
)=ExtUtils::Manifest::manicheck();
if
(
@missed
){
print
STDOUT
"Warning: the following files are missing in your kit:\n"
;
print
"\t"
,
join
"\n\t"
,
@missed
;
print
STDOUT
"\n"
;
print
STDOUT
"Please inform the author.\n"
;
}
else
{
print
STDOUT
"Looks good\n"
;
}
}
}
sub
parse_args{
my
(
$self
,
@args
) =
@_
;
foreach
(
@args
){
unless
(m/(.*?)=(.*)/){
help(),
exit
1
if
m/^help$/;
++
$ExtUtils::MakeMaker::Verbose
if
m/^verb/;
next
;
}
my
(
$name
,
$value
) = ($1, $2);
if
(
$value
=~ m/^~(\w+)?/){
$value
=~ s [^~(\w*)]
[$1 ?
((
getpwnam
($1))[7] ||
"~$1"
) :
(
getpwuid
($>))[7]
]ex;
}
if
(
$self
->{Correct_relativ_directories}){
$value
=
$self
->catdir(
".."
,
$value
)
if
$ExtUtils::MakeMaker::Prepend_dot_dot
{
$name
} && !
$value
=~ m!^/!;
}
$self
->{
$name
} =
$value
;
}
delete
$self
->{Correct_relativ_directories};
if
(
defined
$self
->{potential_libs}){
my
(
$msg
)=
"'potential_libs' => '$self->{potential_libs}' should be"
;
if
(
$self
->{potential_libs}){
print
STDOUT
"$msg changed to:\n\t'LIBS' => ['$self->{potential_libs}']\n"
;
}
else
{
print
STDOUT
"$msg deleted.\n"
;
}
$self
->{LIBS} = [
$self
->{potential_libs}];
delete
$self
->{potential_libs};
}
if
(
defined
$self
->{ARMAYBE}){
my
(
$armaybe
) =
$self
->{ARMAYBE};
print
STDOUT
"ARMAYBE => '$armaybe' should be changed to:\n"
,
"\t'dynamic_lib' => {ARMAYBE => '$armaybe'}\n"
;
my
(
%dl
) = %{
$self
->{dynamic_lib} || {}};
$self
->{dynamic_lib} = {
%dl
,
ARMAYBE
=>
$armaybe
};
delete
$self
->{ARMAYBE};
}
if
(
defined
$self
->{LDTARGET}){
print
STDOUT
"LDTARGET should be changed to LDFROM\n"
;
$self
->{LDFROM} =
$self
->{LDTARGET};
delete
$self
->{LDTARGET};
}
if
(
defined
$self
->{DIR} &&
ref
\
$self
->{DIR} eq
'SCALAR'
) {
$self
->{DIR} = [
grep
$_
,
split
":"
,
$self
->{DIR}];
}
my
$mmkey
;
foreach
$mmkey
(
sort
keys
%$self
){
print
STDOUT
" $mmkey => "
, neatvalue(
$self
->{
$mmkey
}),
"\n"
if
$ExtUtils::MakeMaker::Verbose
;
print
STDOUT
"'$mmkey' is not a known MakeMaker parameter name.\n"
unless
exists
$ExtUtils::MakeMaker::Recognized_Att_Keys
{
$mmkey
};
}
}
sub
check_hints {
my
(
$self
) =
@_
;
return
unless
-d
"hints"
;
my
(
@goodhints
);
my
(
$hint
)=
"$Config::Config{osname}_$Config::Config{osvers}"
;
$hint
=~ s/\./_/g;
$hint
=~ s/_$//;
return
unless
$hint
;
while
(1) {
last
if
-f
"hints/$hint.pl"
;
}
continue
{
last
unless
$hint
=~ s/_[^_]*$//;
}
return
unless
-f
"hints/$hint.pl"
;
local
*HINTS
;
open
HINTS,
"hints/$hint.pl"
;
@goodhints
= <HINTS>;
close
HINTS;
print
STDOUT
"Processing hints file hints/$hint.pl\n"
;
eval
join
(
''
,
@goodhints
);
print
STDOUT $@
if
$@;
}
sub
mv_all_methods {
my
(
$from
,
$to
) =
@_
;
my
(
$method
);
my
(
$symtab
) = \%{
"${from}::"
};
foreach
$method
(
@ExtUtils::MakeMaker::MM_Sections
,
qw[ dir_target
exescan fileparse fileparse_set_fstype installpm_x libscan makeaperl
mksymlists needs_linking runsubdirpl subdir_x test_via_harness
test_via_script writedoc ]
) {
*{
"${to}::$method"
} = \&{
"${from}::$method"
};
eval
"package MY; sub $method {local *$method; shift->MY::$method(\@_); }"
;
}
my
$inc
;
foreach
$inc
(
keys
%INC
) {
next
if
$ExtUtils::MakeMaker::NORMAL_INC
{
$inc
};
delete
$INC
{
$inc
};
}
}
sub
prompt {
my
(
$mess
,
$def
)=
@_
;
BEGIN {
$ISA_TTY
= -t STDIN && -t STDOUT }
Carp::confess(
"prompt function called without an argument"
)
unless
defined
$mess
;
$def
=
""
unless
defined
$def
;
my
$dispdef
=
"[$def] "
;
my
$ans
;
if
(
$ISA_TTY
) {
local
$|=1;
print
"$mess $dispdef"
;
chop
(
$ans
= <STDIN>);
}
return
$ans
if
defined
$ans
;
return
$def
;
}
sub
attrib_help {
return
$Attrib_Help
if
$Attrib_Help
;
my
$switch
= 0;
my
$help
;
my
$line
;
local
*POD
;
open
POD,
$INC
{
"ExtUtils/MakeMaker.pm"
}
or
die
"Open $INC{'ExtUtils/MakeMaker.pm'}: $!"
;
while
(
$line
= <POD>) {
$switch
||=
$line
=~ /^=item C\s*$/;
next
unless
$switch
;
last
if
$line
=~ /^=cut/;
$help
.=
$line
;
}
close
POD;
$Attrib_Help
=
$help
;
}
sub
help {
print
&attrib_help
,
"\n"
;}
sub
skipcheck{
my
(
$self
) =
shift
;
my
(
$section
) =
@_
;
if
(
$section
eq
'dynamic'
) {
print
STDOUT
"Warning (non-fatal): Target 'dynamic' depends on targets "
,
"in skipped section 'dynamic_bs'\n"
if
$self
->{SKIPHASH}{dynamic_bs} &&
$ExtUtils::MakeMaker::Verbose
;
print
STDOUT
"Warning (non-fatal): Target 'dynamic' depends on targets "
,
"in skipped section 'dynamic_lib'\n"
if
$self
->{SKIPHASH}{dynamic_lib} &&
$ExtUtils::MakeMaker::Verbose
;
}
if
(
$section
eq
'dynamic_lib'
) {
print
STDOUT
"Warning (non-fatal): Target '\$(INST_DYNAMIC)' depends on "
,
"targets in skipped section 'dynamic_bs'\n"
if
$self
->{SKIPHASH}{dynamic_bs} &&
$ExtUtils::MakeMaker::Verbose
;
}
if
(
$section
eq
'static'
) {
print
STDOUT
"Warning (non-fatal): Target 'static' depends on targets "
,
"in skipped section 'static_lib'\n"
if
$self
->{SKIPHASH}{static_lib} &&
$ExtUtils::MakeMaker::Verbose
;
}
return
'skipped'
if
$self
->{SKIPHASH}{
$section
};
return
''
;
}
sub
flush {
my
$self
=
shift
;
my
(
$chunk
);
local
*MAKE
;
print
STDOUT
"Writing $self->{MAKEFILE} for $self->{NAME}\n"
;
unlink
(
$self
->{MAKEFILE},
"MakeMaker.tmp"
,
$Is_VMS
?
'Descrip.MMS'
:
''
);
open
MAKE,
">MakeMaker.tmp"
or
die
"Unable to open MakeMaker.tmp: $!"
;
for
$chunk
(@{
$self
->{RESULT}}) {
print
MAKE
"$chunk\n"
;
}
close
MAKE;
my
(
$finalname
) =
$self
->{MAKEFILE};
rename
(
"MakeMaker.tmp"
,
$finalname
);
chmod
0644,
$finalname
unless
$Is_VMS
;
system
(
"$Config::Config{eunicefix} $finalname"
)
unless
$Config::Config
{eunicefix} eq
":"
;
}
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
<
$ExtUtils::MakeMaker::Version_OK
;
printf
STDOUT
"%s %s %s %s.\n"
,
"Makefile built with ExtUtils::MakeMaker v"
,
$checkversion
,
"Current Version is"
,
$ExtUtils::MakeMaker::VERSION
unless
$checkversion
==
$ExtUtils::MakeMaker::VERSION
;
}
sub
mksymlists {
my
$class
=
shift
;
my
$self
=
shift
;
bless
$self
,
$class
;
tie
%att
, ExtUtils::MakeMaker::TieAtt,
$self
;
$self
->parse_args(
@ARGV
);
$self
->mksymlists(
@_
);
}
sub
mkbootstrap {
die
<<END;
!!! Your Makefile has been built such a long time ago, !!!
!!! that is unlikely to work with current MakeMaker. !!!
!!! Please rebuild your Makefile !!!
END
}
sub
neatvalue {
my
(
$v
) =
@_
;
return
"undef"
unless
defined
$v
;
my
(
$t
) =
ref
$v
;
return
"'$v'"
unless
$t
;
if
(
$t
eq
'ARRAY'
) {
my
(
@m
,
$elem
,
@neat
);
push
@m
,
"["
;
foreach
$elem
(
@$v
) {
push
@neat
,
"'$elem'"
;
}
push
@m
,
join
", "
,
@neat
;
push
@m
,
"]"
;
return
join
""
,
@m
;
}
return
"$v"
unless
$t
eq
'HASH'
;
my
(
@m
,
$key
,
$val
);
push
(
@m
,
"$key=>"
.neatvalue(
$val
))
while
((
$key
,
$val
) =
each
%$v
);
return
"{ "
.
join
(
', '
,
@m
).
" }"
;
}
sub
selfdocument {
my
(
$self
) =
@_
;
my
(
@m
);
if
(
$ExtUtils::MakeMaker::Verbose
){
push
@m
,
"\n# Full list of MakeMaker attribute values:"
;
foreach
$key
(
sort
keys
%$self
){
next
if
$key
eq
'RESULT'
||
$key
=~ /^[A-Z][a-z]/;
my
(
$v
) = neatvalue(
$self
->{
$key
});
$v
=~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
$v
=~
tr
/\n/ /s;
push
@m
,
"# $key => $v"
;
}
}
join
"\n"
,
@m
;
}
Exporter::
import
(
'ExtUtils::MakeMaker'
,
qw( $Verbose)
);
@Other_Att_Keys
{
qw(EXTRALIBS BSLOADLIBS LDLOADLIBS)
} = (1) x 3;
if
(
$Is_VMS
=
$Config::Config
{osname} eq
'VMS'
) {
import
VMS::Filespec
qw( &vmsify )
;
}
$Is_OS2
=
$ExtUtils::MakeMaker::Is_OS2
;
sub
guess_name {
my
(
$self
) =
@_
;
my
$name
= fastcwd();
$name
=~ s:.*/::
unless
(
$name
=~ s:^.*/ext/::);
$name
=~ s
$name
=~ s
$name
;
}
sub
init_main {
my
(
$self
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
(
$self
->{FULLEXT} =
$self
->{NAME}) =~ s!::!/!g ;
my
(
@modparts
) =
split
(/::/,
$self
->{NAME});
my
(
$modfname
) =
$modparts
[-1];
if
(
defined
&DynaLoader::mod2fname
) {
$modfname
=
&DynaLoader::mod2fname
(\
@modparts
);
}
elsif
(
$Is_OS2
) {
$modfname
=
substr
(
$modfname
, 0, 7) .
'_'
;
}
(
$self
->{BASEEXT} =
$self
->{NAME}) =~ s!.*::!! ;
if
(
defined
&DynaLoader::mod2fname
or
$Is_OS2
) {
$self
->{DLBASE} =
$modfname
;
}
else
{
$self
->{DLBASE} =
'$(BASEEXT)'
;
}
(
$self
->{ROOTEXT} =
$self
->{FULLEXT}) =~ s
$self
->{ROOTEXT} = (
$Is_VMS
?
''
:
'/'
) .
$self
->{ROOTEXT}
if
$self
->{ROOTEXT};
my
$inc_config_dir
= dirname(
$INC
{
'Config.pm'
});
my
$inc_carp_dir
= dirname(
$INC
{
'Carp.pm'
});
unless
(
$self
->{PERL_SRC}){
my
(
$dir
);
foreach
$dir
(
qw(.. ../.. ../../..)
){
if
( -f
"$dir/config.sh"
&& -f
"$dir/perl.h"
&& -f
"$dir/lib/Exporter.pm"
) {
$self
->{PERL_SRC}=
$dir
;
last
;
}
}
}
if
(
$self
->{PERL_SRC}){
$self
->{PERL_LIB} ||=
$self
->catdir(
"$self->{PERL_SRC}"
,
"lib"
);
$self
->{PERL_ARCHLIB} =
$self
->{PERL_LIB};
$self
->{PERL_INC} =
$self
->{PERL_SRC};
warn
<<EOM unless -s "$self->{PERL_SRC}/cflags";
You cannot build extensions below the perl source tree after executing
a 'make clean' in the perl source tree.
To rebuild extensions distributed with the perl source you should
simply Configure (to include those extensions) and then build perl as
normal. After installing perl the source tree can be deleted. It is not
needed for building extensions.
It is recommended that you unpack and build additional extensions away
from the perl source tree.
EOM
}
else
{
$self
->{PERL_LIB} =
$Config::Config
{privlibexp}
unless
$self
->{PERL_LIB};
$self
->{PERL_ARCHLIB} =
$Config::Config
{archlibexp}
unless
$self
->{PERL_ARCHLIB};
$self
->{PERL_INC} =
$self
->catdir(
"$self->{PERL_ARCHLIB}"
,
"CORE"
);
my
$perl_h
;
die
<<EOM unless (-f ($perl_h = $self->catfile("$self->{PERL_INC}","perl.h")));
Error: Unable to locate installed Perl libraries or Perl source code.
It is recommended that you install perl in a standard location before
building extensions. You can say:
$^X Makefile.PL PERL_SRC=/path/to/perl/source/directory
if you have not yet installed perl but still want to build this
extension now.
(You get this message, because MakeMaker could not find "$perl_h")
EOM
}
unless
(
$self
->{INST_LIB}){
if
(
defined
$self
->{PERL_SRC}) {
$self
->{INST_LIB} =
$self
->{PERL_LIB};
}
else
{
$self
->{INST_LIB} =
$self
->catdir(
"."
,
"blib"
);
}
}
unless
(
$self
->{INST_ARCHLIB}){
my
(
%archmap
) = (
$self
->catdir(
"."
,
"blib"
) =>
$self
->catdir(
"."
,
"blib"
,
$Config::Config
{archname}),
$self
->{PERL_LIB} =>
$self
->{PERL_ARCHLIB},
$Config::Config
{privlibexp} =>
$Config::Config
{archlibexp},
$inc_carp_dir
=>
$inc_config_dir
,
);
$self
->{INST_ARCHLIB} =
$archmap
{
$self
->{INST_LIB}};
unless
(
$self
->{INST_ARCHLIB}){
my
(
$archname
) =
$Config::Config
{archname};
if
(-d
"$self->{INST_LIB}/$archname"
){
$self
->{INST_ARCHLIB} =
$self
->catdir(
"$self->{INST_LIB}"
,
"$archname"
);
print
STDOUT
"Defaulting INST_ARCHLIB to $self->{INST_ARCHLIB}\n"
;
}
else
{
$self
->{INST_ARCHLIB} =
$self
->{INST_LIB};
}
}
}
$self
->{INST_EXE} ||=
$self
->catdir(
'.'
,
'blib'
,
$Config::Config
{archname});
my
(
$prefix
) =
$Config
{
'prefix'
};
$prefix
= VMS::Filespec::unixify(
$prefix
)
if
$Is_VMS
;
unless
(
$self
->{PREFIX}){
$self
->{PREFIX} =
$prefix
;
}
$self
->{INSTALLPRIVLIB} =
$Config
{installprivlib};
$self
->{INSTALLPRIVLIB} = VMS::Filespec::unixpath(
$self
->{INSTALLPRIVLIB})
if
$Is_VMS
;
$self
->{INSTALLPRIVLIB} =~ s/\Q
$prefix
\E/\$(PREFIX)/;
$self
->{INSTALLBIN} =
$Config
{installbin};
$self
->{INSTALLBIN} = VMS::Filespec::unixpath(
$self
->{INSTALLBIN})
if
$Is_VMS
;
$self
->{INSTALLBIN} =~ s/\Q
$prefix
\E/\$(PREFIX)/;
$self
->{INSTALLMAN1DIR} =
$Config
{installman1dir};
$self
->{INSTALLMAN1DIR} = VMS::Filespec::unixpath(
$self
->{INSTALLMAN1DIR})
if
$Is_VMS
;
$self
->{INSTALLMAN1DIR} =~ s/\Q
$prefix
\E/\$(PREFIX)/;
$self
->{INSTALLMAN3DIR} =
$Config
{installman3dir};
$self
->{INSTALLMAN3DIR} = VMS::Filespec::unixpath(
$self
->{INSTALLMAN3DIR})
if
$Is_VMS
;
$self
->{INSTALLMAN3DIR} =~ s/\Q
$prefix
\E/\$(PREFIX)/;
if
(
$self
->{INSTALLPRIVLIB} && !
$self
->{INSTALLARCHLIB} ){
my
(
$installprivlib
) =
$Config
{
'installprivlib'
};
$installprivlib
= VMS::Filespec::unixify(
$installprivlib
)
if
$Is_VMS
;
$self
->{INSTALLARCHLIB} =
$Config
{installarchlib};
$self
->{INSTALLARCHLIB} = VMS::Filespec::unixpath(
$self
->{INSTALLARCHLIB})
if
$Is_VMS
;
$self
->{INSTALLARCHLIB} =~ s/\Q
$installprivlib
\E/
$self
->{INSTALLPRIVLIB}/;
if
(-d
$self
->{INSTALLARCHLIB}) {
print
STDOUT
"Defaulting INSTALLARCHLIB to $self->{INSTALLARCHLIB}\n"
;
}
else
{
$self
->{INSTALLARCHLIB} =
$self
->{INSTALLPRIVLIB};
}
}
$self
->{INSTALLPRIVLIB} ||=
$Config::Config
{installprivlib};
$self
->{INSTALLARCHLIB} ||=
$Config::Config
{installarchlib};
$self
->{INSTALLBIN} ||=
$Config::Config
{installbin};
$self
->{INSTALLMAN1DIR} =
$Config::Config
{installman1dir}
unless
defined
$self
->{INSTALLMAN1DIR};
unless
(
defined
$self
->{INST_MAN1DIR}){
if
(
$self
->{INSTALLMAN1DIR} =~ /^(none|\s*)$/){
$self
->{INST_MAN1DIR} =
$self
->{INSTALLMAN1DIR};
}
else
{
$self
->{INST_MAN1DIR} =
$self
->catdir(
'.'
,
'blib'
,
'man'
,
'man1'
);
}
}
$self
->{MAN1EXT} ||=
$Config::Config
{man1ext};
$self
->{INSTALLMAN3DIR} =
$Config::Config
{installman3dir}
unless
defined
$self
->{INSTALLMAN3DIR};
unless
(
defined
$self
->{INST_MAN3DIR}){
if
(
$self
->{INSTALLMAN3DIR} =~ /^(none|\s*)$/){
$self
->{INST_MAN3DIR} =
$self
->{INSTALLMAN3DIR};
}
else
{
$self
->{INST_MAN3DIR} =
$self
->catdir(
'.'
,
'blib'
,
'man'
,
'man3'
);
}
}
$self
->{MAN3EXT} ||=
$Config::Config
{man3ext};
print
STDOUT
"CONFIG must be an array ref\n"
if
(
$self
->{CONFIG} and
ref
$self
->{CONFIG} ne
'ARRAY'
);
$self
->{CONFIG} = []
unless
(
ref
$self
->{CONFIG});
push
(@{
$self
->{CONFIG}},
@ExtUtils::MakeMaker::Get_from_Config
);
push
(@{
$self
->{CONFIG}},
'shellflags'
)
if
$Config::Config
{shellflags};
my
(
%once_only
,
$m
);
foreach
$m
(@{
$self
->{CONFIG}}){
next
if
$once_only
{
$m
};
print
STDOUT
"CONFIG key '$m' does not exist in Config.pm\n"
unless
exists
$Config::Config
{
$m
};
$self
->{
uc
$m
} ||=
$Config::Config
{
$m
};
$once_only
{
$m
} = 1;
}
$self
->{LD} ||=
'ld'
;
$self
->{OBJ_EXT} ||=
'.o'
;
$self
->{LIB_EXT} ||=
'.a'
;
$self
->{MAP_TARGET} ||=
"perl"
;
unless
(
$self
->{LIBPERL_A}){
$self
->{LIBPERL_A} =
"libperl$self->{LIB_EXT}"
;
}
warn
"Warning: PERL_LIB (
$self
->{PERL_LIB}) seems not to be a perl library directory
(Exporter.pm not found)"
unless
(-f
$self
->catfile(
"$self->{PERL_LIB}"
,
"Exporter.pm"
));
(
$self
->{DISTNAME}=
$self
->{NAME}) =~ s
$self
->{VERSION} =
"0.10"
unless
$self
->{VERSION};
(
$self
->{VERSION_SYM} =
$self
->{VERSION}) =~ s/\W/_/g;
$self
->{XS_VERSION} ||=
$self
->{VERSION};
my
(
$component
,
@defpath
);
foreach
$component
(
$self
->{PERL_SRC},
$self
->path(),
$Config::Config
{binexp}) {
push
@defpath
,
$component
if
defined
$component
;
}
$self
->{PERL} =
$self
->find_perl(5.0, [ $^X,
'miniperl'
,
'perl'
,
'perl5'
,
"perl$]"
],
\
@defpath
,
$ExtUtils::MakeMaker::Verbose
)
unless
(
$self
->{PERL});
(
$self
->{FULLPERL} =
$self
->{PERL}) =~ s/miniperl/perl/i
unless
(
$self
->{FULLPERL});
}
sub
path {
my
(
$self
) =
@_
;
my
$path_sep
=
$Is_OS2
?
";"
:
$Is_VMS
?
"/"
:
":"
;
my
$path
=
$ENV
{PATH};
$path
=~ s:\\:/:g
if
$Is_OS2
;
my
@path
=
split
$path_sep
,
$path
;
}
sub
init_dirscan {
my
(
$self
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$name
,
%dir
,
%xs
,
%c
,
%h
,
%ignore
,
%pl_files
,
%manifypods
);
local
(
%pm
);
$ignore
{
'test.pl'
} = 1;
$ignore
{
'makefile.pl'
} = 1
if
$Is_VMS
;
foreach
$name
(
$self
->lsdir(
"."
)){
next
if
(
$name
=~ /^\./ or
$ignore
{
$name
});
if
(-d
$name
){
$dir
{
$name
} =
$name
if
(-f
"$name/Makefile.PL"
);
}
elsif
(
$name
=~ /\.xs$/){
my
(
$c
); (
$c
=
$name
) =~ s/\.xs$/.c/;
$xs
{
$name
} =
$c
;
$c
{
$c
} = 1;
}
elsif
(
$name
=~ /\.c$/i){
$c
{
$name
} = 1
unless
$name
=~ m/perlmain\.c/;
}
elsif
(
$name
=~ /\.h$/i){
$h
{
$name
} = 1;
}
elsif
(
$name
=~ /\.(p[ml]|pod)$/){
$pm
{
$name
} =
$self
->catfile(
'$(INST_LIBDIR)'
,
"$name"
);
}
elsif
(
$name
=~ /\.PL$/ &&
$name
ne
"Makefile.PL"
) {
(
$pl_files
{
$name
} =
$name
) =~ s/\.PL$// ;
}
elsif
(
$Is_VMS
&&
$name
=~ /\.pl$/ &&
$name
ne
'makefile.pl'
&&
$name
ne
'test.pl'
) {
(
$pl_files
{
$name
} =
$name
) =~ s/\.pl$// ;
}
}
$self
->{PMLIBDIRS} = [
'lib'
,
$self
->{BASEEXT}]
unless
$self
->{PMLIBDIRS};
my
(
@pmlibdirs
) = @{
$self
->{PMLIBDIRS}};
my
(
$pmlibdir
);
@{
$self
->{PMLIBDIRS}} = ();
foreach
$pmlibdir
(
@pmlibdirs
) {
-d
$pmlibdir
&& !
$dir
{
$pmlibdir
} &&
push
@{
$self
->{PMLIBDIRS}},
$pmlibdir
;
}
if
(@{
$self
->{PMLIBDIRS}}){
print
"Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n"
if
(
$ExtUtils::MakeMaker::Verbose
>= 2);
File::Find::find(
sub
{
if
(-d
$_
){
if
(
$_
eq
"CVS"
||
$_
eq
"RCS"
){
$File::Find::prune
= 1;
}
return
;
}
my
(
$path
,
$prefix
) = (
$File::Find::name
,
'$(INST_LIBDIR)'
);
my
(
$striplibpath
,
$striplibname
);
$prefix
=
'$(INST_LIB)'
if
((
$striplibpath
=
$path
) =~ s:^(\W*)lib\W:$1:);
(
$striplibname
,
$striplibpath
) = fileparse(
$striplibpath
);
my
(
$inst
) =
$self
->catfile(
$self
->catdir(
$prefix
,
$striplibpath
),
$striplibname
);
local
(
$_
) =
$inst
;
$inst
=
$self
->libscan(
$inst
);
print
"libscan($path) => '$inst'\n"
if
(
$ExtUtils::MakeMaker::Verbose
>= 2);
return
unless
$inst
;
$pm
{
$path
} =
$inst
;
}, @{
$self
->{PMLIBDIRS}});
}
$self
->{DIR} = [
sort
keys
%dir
]
unless
$self
->{DIR};
$self
->{XS} = \
%xs
unless
$self
->{XS};
$self
->{PM} = \
%pm
unless
$self
->{PM};
$self
->{C} = [
sort
keys
%c
]
unless
$self
->{C};
my
(
@o_files
) = @{
$self
->{C}};
$self
->{O_FILES} = [
grep
s/\.c$/
$self
->{OBJ_EXT}/i,
@o_files
] ;
$self
->{H} = [
sort
keys
%h
]
unless
$self
->{H};
$self
->{PL_FILES} = \
%pl_files
unless
$self
->{PL_FILES};
if
(
$self
->{MAN1PODS}) {
}
elsif
(
$self
->{INST_MAN1DIR} =~ /^(none|\s*)$/ ) {
$self
->{MAN1PODS} = {};
}
else
{
my
%manifypods
= ();
if
(
exists
$self
->{EXE_FILES} ) {
foreach
$name
(@{
$self
->{EXE_FILES}}) {
local
(
*TESTPOD
);
my
(
$ispod
)=0;
if
(
open
(TESTPOD,
"<$name"
)) {
my
$testpodline
;
while
(
$testpodline
= <TESTPOD>) {
if
(
$testpodline
=~ /^=head1\s+\w+/) {
$ispod
=1;
last
;
}
}
close
(TESTPOD);
}
else
{
$ispod
= 1;
}
if
(
$ispod
) {
$manifypods
{
$name
} =
$self
->catfile(
'$(INST_MAN1DIR)'
,basename(
$name
).
'.$(MAN1EXT)'
);
}
}
}
$self
->{MAN1PODS} = \
%manifypods
;
}
if
(
$self
->{MAN3PODS}) {
}
elsif
(
$self
->{INST_MAN3DIR} =~ /^(none|\s*)$/ ) {
$self
->{MAN3PODS} = {};
}
else
{
my
%manifypods
= ();
foreach
$name
(
keys
%{
$self
->{PM}}) {
if
(
$name
=~ /\.pod$/ ) {
$manifypods
{
$name
} =
$self
->{PM}{
$name
};
}
elsif
(
$name
=~ /\.p[ml]$/ ) {
local
(
*TESTPOD
);
my
(
$ispod
)=0;
open
(TESTPOD,
"<$name"
);
my
$testpodline
;
while
(
$testpodline
= <TESTPOD>) {
if
(
$testpodline
=~ /^=head/) {
$ispod
=1;
last
;
}
}
close
(TESTPOD);
if
(
$ispod
) {
$manifypods
{
$name
} =
$self
->{PM}{
$name
};
}
}
}
foreach
$name
(
keys
%manifypods
) {
if
(
$name
=~ /(config|install|setup).*\.pm/i) {
delete
$manifypods
{
$name
};
next
;
}
my
(
$manpagename
) =
$name
;
unless
(
$manpagename
=~ s!^(\W*)lib\W!$1!) {
$manpagename
=
$self
->catfile(
$self
->{ROOTEXT},
$manpagename
);
}
$manpagename
=~ s/\.p(od|m|l)$//;
$manpagename
=~ s!^/+!!;
$manpagename
=
$self
->replace_manpage_separator(
$manpagename
);
$manifypods
{
$name
} =
$self
->catfile(
"\$(INST_MAN3DIR)"
,
"$manpagename.\$(MAN3EXT)"
);
}
$self
->{MAN3PODS} = \
%manifypods
;
}
}
sub
lsdir {
my
(
$self
) =
shift
;
my
(
$dir
,
$regex
) =
@_
;
local
(
*DIR
,
@ls
);
opendir
(DIR,
$dir
||
"."
) or
return
();
@ls
=
readdir
(DIR);
closedir
(DIR);
@ls
=
grep
(/
$regex
/,
@ls
)
if
$regex
;
@ls
;
}
sub
replace_manpage_separator {
my
(
$self
,
$man
) =
@_
;
$man
=~ s,/+,::,g;
$man
;
}
sub
libscan {
my
(
$self
,
$path
) =
@_
;
return
''
if
$path
=~ m:/(RCS|SCCS)/: ;
$path
;
}
sub
init_others {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
$self
->{LIBS}=[
''
]
unless
$self
->{LIBS};
$self
->{LIBS}=[
$self
->{LIBS}]
if
ref
\
$self
->{LIBS} eq SCALAR;
$self
->{LD_RUN_PATH} =
""
;
my
(
$libs
);
foreach
$libs
( @{
$self
->{LIBS}} ){
$libs
=~ s/^\s*(.*\S)\s*$/$1/;
my
(
@libs
) =
$self
->extliblist(
$libs
);
if
(
$libs
[0] or
$libs
[1] or
$libs
[2]){
(
$self
->{EXTRALIBS},
$self
->{BSLOADLIBS},
$self
->{LDLOADLIBS},
$self
->{LD_RUN_PATH}) =
@libs
;
last
;
}
}
unless
(
$self
->{OBJECT} ){
$self
->{OBJECT} =
'$(BASEEXT)$(OBJ_EXT)'
if
@{
$self
->{C}||[]};
}
$self
->{OBJECT} =~ s/\n+/ \\\n\t/g;
$self
->{BOOTDEP} = (-f
"$self->{BASEEXT}_BS"
) ?
"$self->{BASEEXT}_BS"
:
""
;
$self
->{PERLMAINCC} ||=
'$(CC)'
;
$self
->{LDFROM} =
'$(OBJECT)'
unless
$self
->{LDFROM};
if
(!
$self
->{LINKTYPE}) {
$self
->{LINKTYPE} =
grep
(/dynamic/,@{
$self
->{SKIP} || []})
?
'static'
: (
$Config::Config
{usedl} ?
'dynamic'
:
'static'
);
};
$self
->{NOOP} ||=
""
;
$self
->{FIRST_MAKEFILE} ||=
"Makefile"
;
$self
->{MAKEFILE} ||=
$self
->{FIRST_MAKEFILE};
$self
->{MAKE_APERL_FILE} ||=
"Makefile.aperl"
;
$self
->{RM_F} ||=
"rm -f"
;
$self
->{RM_RF} ||=
"rm -rf"
;
$self
->{TOUCH} ||=
"touch"
;
$self
->{CP} ||=
"cp"
;
$self
->{MV} ||=
"mv"
;
$self
->{CHMOD} ||=
"chmod"
;
$self
->{UMASK_NULL} ||=
"umask 0"
;
}
sub
find_perl {
my
(
$self
,
$ver
,
$names
,
$dirs
,
$trace
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
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
;
foreach
$name
(
@$names
){
my
$abs
;
if
(
$self
->file_name_is_absolute(
$name
)) {
$abs
=
$name
;
}
elsif
(
$name
=~ m|/|) {
$abs
=
$self
->catfile(
"."
,
$name
);
}
else
{
$abs
=
$self
->catfile(
$dir
,
$name
);
}
print
"Checking $abs\n"
if
(
$trace
>= 2);
next
unless
$self
->maybe_command(
$abs
);
print
"Executing $abs\n"
if
(
$trace
>= 2);
if
(`
$abs
-e
'require $ver; print "VER_OK\n" '
2>&1` =~ /VER_OK/) {
print
"Using PERL=$abs\n"
if
$trace
;
return
$abs
;
}
}
}
print
STDOUT
"Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"
;
0;
}
sub
maybe_command_in_dirs {
my
(
$self
,
$names
,
$dirs
,
$trace
,
$ver
) =
@_
;
my
(
$name
,
$dir
);
foreach
$dir
(
@$dirs
){
next
unless
defined
$dir
;
foreach
$name
(
@$names
){
my
(
$abs
,
$tryabs
);
if
(
$self
->file_name_is_absolute(
$name
)) {
$abs
=
$name
;
}
elsif
(
$name
=~ m|/|) {
$abs
=
$self
->catfile(
"."
,
$name
);
}
else
{
$abs
=
$self
->catfile(
$dir
,
$name
);
}
print
"Checking $abs for $name\n"
if
(
$trace
>= 2);
next
unless
$tryabs
=
$self
->maybe_command(
$abs
);
print
"Substituting $tryabs instead of $abs\n"
if
(
$trace
>= 2 and
$tryabs
ne
$abs
);
$abs
=
$tryabs
;
if
(
defined
$ver
) {
print
"Executing $abs\n"
if
(
$trace
>= 2);
if
(`
$abs
-e
'require $ver; print "VER_OK\n" '
2>&1` =~ /VER_OK/) {
print
"Using PERL=$abs\n"
if
$trace
;
return
$abs
;
}
}
else
{
return
$abs
;
}
}
}
}
sub
maybe_command {
my
(
$self
,
$file
) =
@_
;
return
$file
if
-x
$file
&& ! -d
$file
;
return
;
}
sub
perl_script {
my
(
$self
,
$file
) =
@_
;
return
1
if
-r
$file
&& ! -d
$file
;
return
;
}
sub
file_name_is_absolute {
my
(
$self
,
$file
) =
@_
;
$file
=~ m:^/: ;
}
sub
post_initialize {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
""
;
}
sub
const_config {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
,
$m
);
push
(
@m
,
"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n"
);
push
(
@m
,
"\n# They may have been overridden via Makefile.PL or on the command line\n"
);
my
(
%once_only
);
foreach
$m
(@{
$self
->{CONFIG}}){
next
if
$once_only
{
$m
};
push
@m
,
"\U$m\E = "
.
$self
->{
uc
$m
}.
"\n"
;
$once_only
{
$m
} = 1;
}
join
(
''
,
@m
);
}
sub
constants {
my
(
$self
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
,
$tmp
);
push
@m
, "
NAME =
$self
->{NAME}
DISTNAME =
$self
->{DISTNAME}
NAME_SYM =
$self
->{NAME_SYM}
VERSION =
$self
->{VERSION}
VERSION_SYM =
$self
->{VERSION_SYM}
VERSION_MACRO = VERSION
DEFINE_VERSION = -D\$(VERSION_MACRO)=\\\"\$(VERSION)\\\"
XS_VERSION =
$self
->{XS_VERSION}
XS_VERSION_MACRO = XS_VERSION
XS_DEFINE_VERSION = -D\$(XS_VERSION_MACRO)=\\\"\$(XS_VERSION)\\\"
INST_LIB =
$self
->{INST_LIB}
INST_ARCHLIB =
$self
->{INST_ARCHLIB}
INST_EXE =
$self
->{INST_EXE}
PREFIX =
$self
->{PREFIX}
INSTALLPRIVLIB =
$self
->{INSTALLPRIVLIB}
INSTALLARCHLIB =
$self
->{INSTALLARCHLIB}
INSTALLBIN =
$self
->{INSTALLBIN}
PERL_LIB =
$self
->{PERL_LIB}
PERL_ARCHLIB =
$self
->{PERL_ARCHLIB}
LIBPERL_A =
$self
->{LIBPERL_A}
MAKEMAKER = \$(PERL_LIB)/ExtUtils/MakeMaker.pm
MM_VERSION =
$ExtUtils::MakeMaker::VERSION
FIRST_MAKEFILE =
$self
->{FIRST_MAKEFILE}
MAKE_APERL_FILE =
$self
->{MAKE_APERL_FILE}
PERLMAINCC =
$self
->{PERLMAINCC}
";
push
@m
, "
PERL_SRC =
$self
->{PERL_SRC}\n"
if
$self
->{PERL_SRC};
push
@m
, "
PERL_INC =
$self
->{PERL_INC}
PERL =
$self
->{PERL}
FULLPERL =
$self
->{FULLPERL}
";
push
@m
, "
FULLEXT =
$self
->{FULLEXT}
BASEEXT =
$self
->{BASEEXT}
ROOTEXT =
$self
->{ROOTEXT}
DLBASE =
$self
->{DLBASE}
";
push
@m
, "
INC =
$self
->{INC}
DEFINE =
$self
->{DEFINE}
OBJECT =
$self
->{OBJECT}
LDFROM =
$self
->{LDFROM}
LINKTYPE =
$self
->{LINKTYPE}
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}})."
MAN1PODS =
".join("
\\\n\t
", sort keys %{$self->{MAN1PODS}})."
MAN3PODS =
".join("
\\\n\t
", sort keys %{$self->{MAN3PODS}})."
INST_MAN1DIR =
$self
->{INST_MAN1DIR}
INSTALLMAN1DIR =
$self
->{INSTALLMAN1DIR}
MAN1EXT =
$self
->{MAN1EXT}
INST_MAN3DIR =
$self
->{INST_MAN3DIR}
INSTALLMAN3DIR =
$self
->{INSTALLMAN3DIR}
MAN3EXT =
$self
->{MAN3EXT}
makemakerdflt: all
.SUFFIXES: .xs .c .C \$(OBJ_EXT)
.PHONY: all config static dynamic test linkext
MYEXTLIB =
$self
->{MYEXTLIB}
CONFIGDEP = \$(PERL_ARCHLIB)/Config.pm \$(PERL_INC)/config.h
";
push
@m
, '
INST_LIBDIR = $(INST_LIB)$(ROOTEXT)
INST_ARCHLIBDIR = $(INST_ARCHLIB)$(ROOTEXT)
INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
';
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 =
';
}
if
(
$Is_OS2
) {
$tmp
=
"$self->{BASEEXT}.def"
;
}
else
{
$tmp
=
""
;
}
push
@m
, "
EXPORT_LIST =
$tmp
";
if
(
$Is_OS2
) {
$tmp
=
"\$(PERL_INC)/libperl.lib"
;
}
else
{
$tmp
=
""
;
}
push
@m
, "
PERL_ARCHIVE =
$tmp
";
push
@m
, '
INST_PM =
'.join(" \\\n\t", sort values %{$self->{PM}}).'
';
join
(
''
,
@m
);
}
sub
const_loadlibs {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
""
unless
$self
->needs_linking;
"
EXTRALIBS =
$self
->{EXTRALIBS}
LDLOADLIBS =
$self
->{LDLOADLIBS}
BSLOADLIBS =
$self
->{BSLOADLIBS}
LD_RUN_PATH=
$self
->{LD_RUN_PATH}
";
}
sub
const_cccmd {
my
(
$self
,
$libperl
)=
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
$self
->{CONST_CCCMD}
if
$self
->{CONST_CCCMD};
return
''
unless
$self
->needs_linking();
$libperl
or
$libperl
=
$self
->{LIBPERL_A} ||
"libperl$self->{LIB_EXT}"
;
$libperl
=~ s/\.\$\(A\)$/
$self
->{LIB_EXT}/;
my
(
$cc
,
$ccflags
,
$optimize
,
$large
,
$split
,
$shflags
)
=
@Config
{
qw(cc ccflags optimize large split shellflags)
};
my
(
$optdebug
) =
""
;
$shflags
=
''
unless
$shflags
;
my
(
$prog
,
$uc
,
$perltype
);
my
(
%map
) = (
D
=>
'-DDEBUGGING'
,
E
=>
'-DEMBED'
,
DE
=>
'-DDEBUGGING -DEMBED'
,
M
=>
'-DEMBED -DMULTIPLICITY'
,
DM
=>
'-DDEBUGGING -DEMBED -DMULTIPLICITY'
,
);
if
(
$libperl
=~ /libperl(\w*)\Q
$self
->{LIB_EXT}/){
$uc
=
uc
($1);
}
else
{
$uc
=
""
;
}
$perltype
=
$map
{
$uc
} ?
$map
{
$uc
} :
""
;
if
(
$uc
=~ /^D/) {
$optdebug
=
"-g"
;
}
my
(
$name
);
(
$name
=
$self
->{NAME} .
"_cflags"
) =~ s/:/_/g ;
if
(
$prog
=
$Config::Config
{
$name
}) {
print
STDOUT
"Processing $name hint:\n"
if
$ExtUtils::MakeMaker::Verbose
;
my
(
@o
)=`cc=\"
$cc
\"
ccflags=\"
$ccflags
\"
optimize=\"
$optimize
\"
perltype=\"
$perltype
\"
optdebug=\"
$optdebug
\"
large=\"
$large
\"
split
=\"
$split
\"
eval
'$prog'
echo cc=\
$cc
echo ccflags=\
$ccflags
echo optimize=\
$optimize
echo perltype=\
$perltype
echo optdebug=\
$optdebug
echo large=\
$large
echo
split
=\
$split
`;
my
(
%cflags
,
$line
);
foreach
$line
(
@o
){
chomp
$line
;
if
(
$line
=~ /(.*?)=\s*(.*)\s*$/){
$cflags
{$1} = $2;
print
STDOUT
" $1 = $2\n"
if
$ExtUtils::MakeMaker::Verbose
;
}
else
{
print
STDOUT
"Unrecognised result from hint: '$line'\n"
;
}
}
(
$cc
,
$ccflags
,
$perltype
,
$optdebug
,
$optimize
,
$large
,
$split
)=
@cflags
{
qw( cc ccflags perltype optdebug optimize large split)
};
}
if
(
$optdebug
) {
$optimize
=
$optdebug
;
}
my
(
$new
) =
"$cc -c \$(INC) $ccflags $optimize $perltype $large $split"
;
$new
=~ s/^\s+//;
$new
=~ s/\s+/ /g;
$new
=~ s/\s+$//;
my
(
$cccmd
) =
$new
;
$cccmd
=~ s/^\s*\Q
$Config::Config
{cc}\E\s/\$(CC) /;
$cccmd
.=
" \$(DEFINE_VERSION) \$(XS_DEFINE_VERSION)"
;
$self
->{CONST_CCCMD} =
"CCCMD = $cccmd\n"
;
}
sub
tool_autosplit {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$asl
) =
""
;
$asl
=
"\$AutoSplit::Maxlen=$attribs{MAXLEN};"
if
$attribs
{MAXLEN};
q{
# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -e 'use AutoSplit;}
.
$asl
.
q{autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1) ;'
}
;
}
sub
tool_xsubpp {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$xsdir
) =
"$self->{PERL_LIB}/ExtUtils"
;
$xsdir
=
"$self->{PERL_SRC}/ext"
unless
(-f
"$self->{PERL_LIB}/ExtUtils/xsubpp"
);
my
(
@tmdeps
) = (
'$(XSUBPPDIR)/typemap'
);
if
(
$self
->{TYPEMAPS} ){
my
$typemap
;
foreach
$typemap
(@{
$self
->{TYPEMAPS}}){
if
( ! -f
$typemap
){
warn
"Typemap $typemap not found.\n"
;
}
else
{
push
(
@tmdeps
,
$typemap
);
}
}
}
push
(
@tmdeps
,
"typemap"
)
if
-f
"typemap"
;
my
(
@tmargs
) =
map
(
"-typemap $_"
,
@tmdeps
);
if
(
exists
$self
->{XSOPT} ){
unshift
(
@tmargs
,
$self
->{XSOPT} );
}
my
$xsubpp_version
=
$self
->xsubpp_version(
"$xsdir/xsubpp"
);
if
(
$xsubpp_version
> 1.923 ){
$self
->{XSPROTOARG} =
""
unless
defined
$self
->{XSPROTOARG};
}
else
{
if
(
defined
$self
->{XSPROTOARG} &&
$self
->{XSPROTOARG} =~ /\-prototypes/) {
print
STDOUT
qq{Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
Your version of xsubpp is $xsubpp_version and cannot handle this.
Please upgrade to a more recent version of xsubpp.
}
;
}
else
{
$self
->{XSPROTOARG} =
""
;
}
}
"
XSUBPPDIR =
$xsdir
XSUBPP = \$(XSUBPPDIR)/xsubpp
XSPROTOARG =
$self
->{XSPROTOARG}
XSUBPPDEPS =
@tmdeps
XSUBPPARGS =
@tmargs
";
};
sub
xsubpp_version
{
my
(
$self
,
$xsubpp
) =
@_
;
my
(
$version
) ;
my
$command
=
"$self->{PERL} $xsubpp -v 2>&1"
;
print
"Running: $command\n"
if
$Verbose
;
$version
= `
$command
` ;
warn
"Running '$command' exits with status "
. ($?>>8)
if
$?;
chop
$version
;
return
$1
if
$version
=~ /^xsubpp version (.*)/ ;
my
$counter
=
'000'
;
my
(
$file
) =
'temp'
;
$counter
++
while
-e
"$file$counter"
;
$file
.=
$counter
;
open
(F,
">$file"
) or
die
"Cannot open file '$file': $!\n"
;
print
F
<<EOM ;
MODULE = fred PACKAGE = fred
int
fred(a)
int a;
EOM
close
F ;
$command
=
"$self->{PERL} $xsubpp $file 2>&1"
;
print
"Running: $command\n"
if
$Verbose
;
my
$text
= `
$command
` ;
warn
"Running '$command' exits with status "
. ($?>>8)
if
$?;
unlink
$file
;
return
$1
if
$text
=~ /automatically by xsubpp version ([\S]+)\s*/ ;
return
1.1
if
$text
=~ /^Warning: ignored semicolon/ ;
return
"1.0"
;
}
sub
tools_other {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
"
SHELL = /bin/sh
LD =
$self
->{LD}
TOUCH =
$self
->{TOUCH}
CP =
$self
->{CP}
MV =
$self
->{MV}
RM_F =
$self
->{RM_F}
RM_RF =
$self
->{RM_RF}
CHMOD =
$self
->{CHMOD}
UMASK_NULL =
$self
->{UMASK_NULL}
".
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) -wle '$$"="/"; foreach $$p (@ARGV){' \\
-e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
-e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
-e 'mkdir("@p",0777)||die $$! }
}
exit
0;'
};
}
sub
dist {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
);
my
(
$name
) =
$attribs
{NAME} ||
'$(DISTVNAME)'
;
my
(
$tar
) =
$attribs
{TAR} ||
'tar'
;
my
(
$tarflags
) =
$attribs
{TARFLAGS} ||
'cvf'
;
my
(
$compress
) =
$attribs
{COMPRESS} ||
'compress'
;
my
(
$suffix
) =
$attribs
{SUFFIX} ||
'Z'
;
my
(
$shar
) =
$attribs
{SHAR} ||
'shar'
;
my
(
$preop
) =
$attribs
{PREOP} ||
'@true'
;
my
(
$postop
) =
$attribs
{POSTOP} ||
'@true'
;
my
(
$ci
) =
$attribs
{CI} ||
'ci -u'
;
my
(
$rcs_label
)=
$attribs
{RCS_LABEL}||
'rcs -Nv$(VERSION_SYM): -q'
;
my
(
$dist_cp
) =
$attribs
{DIST_CP} ||
'best'
;
my
(
$dist_default
) =
$attribs
{DIST_DEFAULT} ||
'tardist'
;
push
@m
, "
DISTVNAME = \$(DISTNAME)-\$(VERSION)
TAR =
$tar
TARFLAGS =
$tarflags
COMPRESS =
$compress
SUFFIX =
$suffix
SHAR =
$shar
PREOP =
$preop
POSTOP =
$postop
CI =
$ci
RCS_LABEL =
$rcs_label
DIST_CP =
$dist_cp
DIST_DEFAULT =
$dist_default
";
join
""
,
@m
;
}
sub
macro {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
,
$key
,
$val
);
while
((
$key
,
$val
) =
each
%attribs
){
push
@m
,
"$key = $val\n"
;
}
join
""
,
@m
;
}
sub
post_constants{
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
""
;
}
sub
pasthru {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
,
$key
);
my
(
@pasthru
);
foreach
$key
(
qw(INSTALLPRIVLIB INSTALLARCHLIB INSTALLBIN
INSTALLMAN1DIR INSTALLMAN3DIR LIBPERL_A
LINKTYPE)
){
push
@pasthru
,
"$key=\"\$($key)\""
;
}
push
@m
,
"\nPASTHRU = "
,
join
(
"\\\n\t"
,
@pasthru
),
"\n"
;
join
""
,
@m
;
}
sub
c_o {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
''
unless
$self
->needs_linking();
my
(
@m
);
push
@m
, '
.c$(OBJ_EXT):
$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
.C$(OBJ_EXT):
$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.C
';
join
""
,
@m
;
}
sub
xs_c {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
''
unless
$self
->needs_linking();
'
.xs.c:
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
';
}
sub
xs_o {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
''
unless
$self
->needs_linking();
'
.xs$(OBJ_EXT):
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
';
}
sub
top_targets {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
);
push
@m
, '
all :: config $(INST_PM) subdirs linkext manifypods
subdirs :: $(MYEXTLIB)
'.$self->{NOOP}.'
config ::
'.$self->{MAKEFILE}.'
$(INST_LIBDIR)/.
exists
config :: $(INST_ARCHAUTODIR)/.
exists
Version_check
config :: $(INST_AUTODIR)/.
exists
';
push
@m
,
$self
->dir_target(
qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]
);
if
(%{
$self
->{MAN1PODS}}) {
push
@m
,
q[
config :: $(INST_MAN1DIR)/.exists
]
;
push
@m
,
$self
->dir_target(
qw[$(INST_MAN1DIR)]
);
}
if
(%{
$self
->{MAN3PODS}}) {
push
@m
,
q[
config :: $(INST_MAN3DIR)/.exists
]
;
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:
@$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
-e 'use ExtUtils::MakeMaker qw($$Version &Version_check);' \
-e '&Version_check("$(MM_VERSION)")'
}
;
join
(
''
,
@m
);
}
sub
linkext {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$linktype
) =
defined
$attribs
{LINKTYPE} ?
$attribs
{LINKTYPE} :
'$(LINKTYPE)'
;
"
linkext ::
$linktype
$self
->{NOOP}
";
}
sub
dlsyms {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
''
unless
(
$Config::Config
{osname} eq
'aix'
&&
$self
->needs_linking() );
my
(
$funcs
) =
$attribs
{DL_FUNCS} ||
$self
->{DL_FUNCS} || {};
my
(
$vars
) =
$attribs
{DL_VARS} ||
$self
->{DL_VARS} || [];
my
(
@m
);
push
(
@m
,"
dynamic ::
$self
->{BASEEXT}.
exp
")
unless
$self
->{SKIPHASH}{dynamic};
push
(
@m
,"
static ::
$self
->{BASEEXT}.
exp
")
unless
$self
->{SKIPHASH}{static};
push
(
@m
,"
$self
->{BASEEXT}.
exp
: Makefile.PL
",' $(PERL) "
-I$(PERL_ARCHLIB)
" "
-I$(PERL_LIB)" -e \'
use
ExtUtils::MakeMaker
qw(&mksymlists)
; \\
MM->new({
NAME
=>
"'.$self->{NAME}.'"
})->mksymlists({
DL_FUNCS
=> ',
%$funcs
? neatvalue(
$funcs
) :
'""'
,
', DL_VARS => '
,
@$vars
? neatvalue(
$vars
) :
'""'
, ",
NAME
=> \"
$self
->{NAME}\"})'
");
join
(
''
,
@m
);
}
sub
dynamic {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
'
dynamic ::
'.$self->{MAKEFILE}.'
$(INST_DYNAMIC) $(INST_BOOT) $(INST_PM)
'.$self->{NOOP}.'
';
}
sub
dynamic_bs {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
'
BOOTSTRAP =
'
unless
$self
->has_link_code();
return
'
BOOTSTRAP =
'."$self->{BASEEXT}.bs".'
$(BOOTSTRAP):
'."$self->{MAKEFILE} $self->{BOOTDEP}".'
$(INST_ARCHAUTODIR)/.
exists
@ echo
"Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
@ $(PERL)
"-I$(PERL_ARCHLIB)"
"-I$(PERL_LIB)"
\
-e \'Mkbootstrap(
"$(BASEEXT)"
,
"$(BSLOADLIBS)"
);\'
@ $(TOUCH) $(BOOTSTRAP)
$(CHMOD) 644 $@
@echo
$@ >> $(INST_ARCHAUTODIR)/.packlist
$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.
exists
@
'.$self->{RM_RF}.'
$(INST_BOOT)
-
'.$self->{CP}.'
$(BOOTSTRAP) $(INST_BOOT)
$(CHMOD) 644 $@
@echo
$@ >> $(INST_ARCHAUTODIR)/.packlist
';
}
sub
dynamic_lib {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
''
unless
$self
->needs_linking();
return
''
unless
$self
->has_link_code;
my
(
$otherldflags
) =
$attribs
{OTHERLDFLAGS} ||
""
;
my
(
$armaybe
) =
$attribs
{ARMAYBE} ||
$self
->{ARMAYBE} ||
":"
;
my
(
$ldfrom
) =
'$(LDFROM)'
;
my
(
$osname
) =
$Config::Config
{osname};
$armaybe
=
'ar'
if
(
$osname
eq
'dec_osf'
and
$armaybe
eq
':'
);
my
(
@m
);
push
(
@m
,'
ARMAYBE =
'.$armaybe.'
OTHERLDFLAGS =
'.$otherldflags.'
$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.
exists
$(EXPORT_LIST) $(PERL_ARCHIVE)
');
if
(
$armaybe
ne
':'
){
$ldfrom
=
'tmp$(LIB_EXT)'
;
push
(
@m
,
' $(ARMAYBE) cr '
.
$ldfrom
.
' $(OBJECT)'
.
"\n"
);
push
(
@m
,
' $(RANLIB) '
.
"$ldfrom\n"
);
}
$ldfrom
=
"-all $ldfrom -none"
if
(
$osname
eq
'dec_osf'
);
push
(
@m
,
' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) -o $@ $(LDDLFLAGS) '
.
$ldfrom
.
' $(OTHERLDFLAGS) $(MYEXTLIB) $(LDLOADLIBS) $(EXPORT_LIST) $(PERL_ARCHIVE)'
);
push
@m
, '
$(CHMOD) 755 $@
@echo
$@ >> $(INST_ARCHAUTODIR)/.packlist
';
push
@m
,
$self
->dir_target(
'$(INST_ARCHAUTODIR)'
);
join
(
''
,
@m
);
}
sub
static {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
'
static ::
'.$self->{MAKEFILE}.'
$(INST_STATIC) $(INST_PM)
'.$self->{NOOP}.'
';
}
sub
static_lib {
my
(
$self
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
''
unless
$self
->has_link_code;
my
(
@m
);
push
(
@m
,
<<'END');
$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
END
push
(
@m
,
" $self->{CP} \$(MYEXTLIB) \$\@\n"
)
if
$self
->{MYEXTLIB};
push
(
@m
,
<<'END');
$(AR) cr $@ $(OBJECT) && $(RANLIB) $@
@echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
$(CHMOD) 755 $@
@echo $@ >> $(INST_ARCHAUTODIR)/.packlist
END
push
(
@m
,
<<'END') if $self->{PERL_SRC};
@ echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs
END
push
@m
,
$self
->dir_target(
'$(INST_ARCHAUTODIR)'
);
join
(
''
,
"\n"
,
@m
);
}
sub
installpm {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$splitlib
) =
'$(INST_LIB)'
;
$splitlib
=
$attribs
{SPLITLIB}
if
exists
$attribs
{SPLITLIB};
my
(
@m
,
$dist
);
push
@m
,
"inst_pm :: \$(INST_PM)\n\n"
;
foreach
$dist
(
sort
keys
%{
$self
->{PM}}){
my
(
$inst
) =
$self
->{PM}->{
$dist
};
push
(
@m
,
"\n# installpm: $dist => $inst, splitlib=$splitlib\n"
);
push
(
@m
,
$self
->installpm_x(
$dist
,
$inst
,
$splitlib
));
push
(
@m
,
"\n"
);
}
join
(
''
,
@m
);
}
sub
installpm_x {
my
(
$self
,
$dist
,
$inst
,
$splitlib
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
warn
"Warning: Most probably 'make' will have problems processing this file: $inst\n"
if
$inst
=~ m![:
my
(
$instdir
) =
$inst
=~ m|(.*)/|;
my
(
@m
);
push
(
@m
,"
$inst
:
$dist
$self
->{MAKEFILE}
$instdir
/.
exists
\$(INST_ARCHAUTODIR)/.
exists
".
' @'
.
$self
->{RM_F}.' $@
$(UMASK_NULL) &&
'."$self->{CP} $dist".'
$@
@echo
$@ >> $(INST_ARCHAUTODIR)/.packlist
');
push
(
@m
,
"\t\@\$(AUTOSPLITFILE) \$@ $splitlib/auto\n"
)
if
(
$splitlib
and
$inst
=~ m/\.pm$/);
push
@m
,
$self
->dir_target(
$instdir
);
join
(
''
,
@m
);
}
sub
manifypods {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
"\nmanifypods :\n"
unless
%{
$self
->{MAN3PODS}};
my
(
$dist
);
my
(
$pod2man_exe
);
if
(
defined
$self
->{PERL_SRC}) {
$pod2man_exe
=
$self
->catfile(
$self
->{PERL_SRC},
'pod'
,
'pod2man'
);
}
else
{
$pod2man_exe
=
$self
->catfile(
$Config
{bin},
'pod2man'
);
}
unless
(
$self
->perl_script(
$pod2man_exe
)) {
print
<<END;
Warning: I could not locate your pod2man program. Please make sure,
your pod2man program is in your PATH before you execute 'make'
END
$pod2man_exe
=
"-S pod2man"
;
}
my
(
@m
);
push
@m
,
qq[POD2MAN_EXE = $pod2man_exe\n]
,
q[POD2MAN = $(PERL) -we '%m=@ARGV;for (keys %m){' \\
-e 'next if -e $$m{$$_} && -M $$m{$$_} < -M $$_ && -M $$m{$$_} < -M "]
.
$self
->{MAKEFILE}.
q[";' \\
-e 'print "Installing $$m{$$_}\n";' \\
-e 'system("$$^X $(POD2MAN_EXE) $$_>$$m{$$_}")==0 or warn "Couldn\\047t install $$m{$$_}\n";' \\
-e 'chmod 0644, $$m{$$_} or warn "chmod 644 $$m{$$_}: $$!\n";}'
]
;
push
@m
,
"\nmanifypods : "
;
push
@m
,
join
" \\\n\t"
,
keys
%{
$self
->{MAN1PODS}},
keys
%{
$self
->{MAN3PODS}};
push
(
@m
,
"\n"
);
if
(%{
$self
->{MAN1PODS}} || %{
$self
->{MAN3PODS}}) {
push
@m
,
"\t\@\$(POD2MAN) \\\n\t"
;
push
@m
,
join
" \\\n\t"
, %{
$self
->{MAN1PODS}}, %{
$self
->{MAN3PODS}};
}
join
(
''
,
@m
);
}
sub
processPL {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
return
""
unless
$self
->{PL_FILES};
my
(
@m
,
$plfile
);
foreach
$plfile
(
sort
keys
%{
$self
->{PL_FILES}}) {
push
@m
, "
all ::
$self
->{PL_FILES}->{
$plfile
}
$self
->{PL_FILES}->{
$plfile
} ::
$plfile
\$(PERL) -I\$(INST_ARCHLIB) -I\$(INST_LIB) -I\$(PERL_ARCHLIB) -I\$(PERL_LIB)
$plfile
";
}
join
""
,
@m
;
}
sub
installbin {
my
(
$self
) =
shift
;
return
""
unless
$self
->{EXE_FILES} &&
ref
$self
->{EXE_FILES} eq
"ARRAY"
;
return
""
unless
@{
$self
->{EXE_FILES}};
my
(
@m
,
$from
,
$to
,
%fromto
,
@to
);
push
@m
,
$self
->dir_target(
qw[$(INST_EXE)]
);
for
$from
(@{
$self
->{EXE_FILES}}) {
my
(
$path
)=
'$(INST_EXE)/'
. basename(
$from
);
local
(
$_
) =
$path
;
$to
=
$self
->exescan(
$path
);
print
"exescan($from) => '$to'\n"
if
(
$ExtUtils::MakeMaker::Verbose
>=2);
$fromto
{
$from
}=
$to
;
}
@to
=
values
%fromto
;
push
(
@m
, "
EXE_FILES = @{
$self
->{EXE_FILES}}
all ::
@to
realclean ::
$self
->{RM_F}
@to
");
while
((
$from
,
$to
) =
each
%fromto
) {
my
$todir
= dirname(
$to
);
push
@m
, "
$to
:
$from
$self
->{MAKEFILE}
$todir
/.
exists
$self
->{CP}
$from
$to
";
}
join
""
,
@m
;
}
sub
exescan {
my
(
$self
,
$path
) =
@_
;
$path
;
}
sub
subdirs {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
,
$dir
);
foreach
$dir
(@{
$self
->{DIR}}){
push
(
@m
,
$self
->subdir_x(
$dir
));
}
if
(
@m
){
unshift
(
@m
, "
");
}
else
{
push
(
@m
,
"\n# none"
)
}
join
(
''
,
@m
);
}
sub
runsubdirpl{
my
(
$self
,
$subdir
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
chdir
(
$subdir
) or
die
"chdir($subdir): $!"
;
require
"Makefile.PL"
;
}
sub
subdir_x {
my
(
$self
,
$subdir
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
);
qq{
subdirs ::
\@-cd $subdir && \$(MAKE) all \$(PASTHRU)
}
;
}
sub
clean {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
,
$dir
);
push
(
@m
, '
clean ::
');
for
$dir
(@{
$self
->{DIR}}) {
push
@m
,
"\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n"
;
}
my
(
@otherfiles
) =
values
%{
$self
->{XS}};
push
(
@otherfiles
,
$attribs
{FILES})
if
$attribs
{FILES};
push
(
@otherfiles
,
qw[./blib Makeaperlfile $(INST_ARCHAUTODIR)/extralibs.all
perlmain.c mon.out core so_locations
*~ */*~ */*/*~
*$(OBJ_EXT) *$(LIB_EXT)
perl.exe $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def $(BASEEXT).exp
]
);
push
@m
,
"\t-$self->{RM_RF} @otherfiles\n"
;
push
(
@m
,
"\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n"
);
push
(
@m
,
"\t$attribs{POSTOP}\n"
)
if
$attribs
{POSTOP};
join
(
""
,
@m
);
}
sub
realclean {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
);
push
(
@m
,'
realclean purge :: clean
');
my
$sub
=
"\t-cd %s && test -f %s && \$(MAKE) %s realclean\n"
;
foreach
(@{
$self
->{DIR}}){
push
(
@m
,
sprintf
(
$sub
,
$_
,
"$self->{MAKEFILE}.old"
,
"-f $self->{MAKEFILE}.old"
));
push
(
@m
,
sprintf
(
$sub
,
$_
,
"$self->{MAKEFILE}"
,
''
));
}
push
(
@m
,
" $self->{RM_RF} \$(INST_AUTODIR) \$(INST_ARCHAUTODIR)\n"
);
push
(
@m
,
" $self->{RM_F} \$(INST_DYNAMIC) \$(INST_BOOT)\n"
);
push
(
@m
,
" $self->{RM_F} \$(INST_STATIC) \$(INST_PM)\n"
);
my
(
@otherfiles
) = (
$self
->{MAKEFILE},
"$self->{MAKEFILE}.old"
);
push
(
@otherfiles
,
$attribs
{FILES})
if
$attribs
{FILES};
push
(
@m
,
" $self->{RM_RF} @otherfiles\n"
)
if
@otherfiles
;
push
(
@m
,
" $attribs{POSTOP}\n"
)
if
$attribs
{POSTOP};
join
(
""
,
@m
);
}
sub
dist_basics {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
@m
;
push
@m
,
q{
distclean :: realclean distcheck
}
;
push
@m
,
q{
distcheck :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
-e 'fullcheck();'
}
;
push
@m
,
q{
skipcheck :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\
-e 'skipcheck();'
}
;
push
@m
,
q{
manifest :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
-e 'mkmanifest();'
}
;
join
""
,
@m
;
}
sub
dist_core {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
@m
;
push
@m
,
q{
dist : $(DIST_DEFAULT)
tardist : $(DISTVNAME).tar.$(SUFFIX)
$(DISTVNAME).tar.$(SUFFIX) : distdir
$(PREOP)
$(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
$(RM_RF) $(DISTVNAME)
$(COMPRESS) $(DISTVNAME).tar
$(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
;
}
sub
dist_dir {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
@m
;
push
@m
,
q{
distdir :
$(RM_RF) $(DISTVNAME)
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "/mani/";' \\
-e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
}
;
join
""
,
@m
;
}
sub
dist_test {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
@m
;
push
@m
,
q{
disttest : distdir
cd $(DISTVNAME) && $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) Makefile.PL
cd $(DISTVNAME) && $(MAKE)
cd $(DISTVNAME) && $(MAKE) test
}
;
join
""
,
@m
;
}
sub
dist_ci {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
@m
;
push
@m
,
q{
ci :
$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::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
;
}
sub
install {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
);
push
@m
,
q{
doc_install ::
@ echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
@ $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \\
-e "use ExtUtils::MakeMaker; MY->new({}
)->writedoc(
'Module'
,
'$(NAME)'
, \\
'LINKTYPE=$(LINKTYPE)'
,
'VERSION=$(VERSION)'
,
'XS_VERSION=$(XS_VERSION)'
, \\
'EXE_FILES=$(EXE_FILES)'
)" >> $(INSTALLARCHLIB)/perllocal.pod
};
push
(
@m
, "
install :: pure_install doc_install
pure_install ::
");
push
(
@m
,
map
(
"\tcd $_ && test -f $self->{MAKEFILE} && \$(MAKE) install\n"
,
@{
$self
->{DIR}}));
push
(
@m
, "\t\@\$(PERL) \"-I\$(PERL_ARCHLIB)\" \"-I\$(PERL_LIB)\" -e
'require File::Path;'
\\
-e
'\$\$message = q[ You do not have permissions to install into];'
\\
-e
'File::Path::mkpath(\@ARGV);'
\\
-e
'foreach (\@ARGV){ die qq{ \$\$message \$\$_\\n} unless -w \$\$_}'
\\
\$(INSTALLPRIVLIB) \$(INSTALLARCHLIB)
\$(MAKE) INST_LIB=\$(INSTALLPRIVLIB) INST_ARCHLIB=\$(INSTALLARCHLIB) INST_EXE=\$(INSTALLBIN) INST_MAN1DIR=\$(INSTALLMAN1DIR) INST_MAN3DIR=\$(INSTALLMAN3DIR) all
");
push
@m
, '
uninstall ::
';
push
(
@m
,
map
(
"\tcd $_ && test -f $self->{MAKEFILE} && \$(MAKE) uninstall\n"
,
@{
$self
->{DIR}}));
push
@m
,
"\t"
.'$(RM_RF) `cat $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist`
';
join
(
""
,
@m
);
}
sub
force {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
'
FORCE:
';
}
sub
perldepend {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
);
push
(
@m
,'
PERL_HDRS = $(PERL_INC)/EXTERN.h $(PERL_INC)/INTERN.h \
$(PERL_INC)/XSUB.h $(PERL_INC)/av.h $(PERL_INC)/cop.h \
$(PERL_INC)/cv.h $(PERL_INC)/dosish.h $(PERL_INC)/embed.h \
$(PERL_INC)/form.h $(PERL_INC)/gv.h $(PERL_INC)/handy.h \
$(PERL_INC)/hv.h $(PERL_INC)/keywords.h $(PERL_INC)/mg.h \
$(PERL_INC)/op.h $(PERL_INC)/opcode.h $(PERL_INC)/patchlevel.h \
$(PERL_INC)/perl.h $(PERL_INC)/perly.h $(PERL_INC)/pp.h \
$(PERL_INC)/proto.h $(PERL_INC)/regcomp.h $(PERL_INC)/regexp.h \
$(PERL_INC)/scope.h $(PERL_INC)/sv.h $(PERL_INC)/unixish.h \
$(PERL_INC)/util.h $(PERL_INC)/config.h
');
push
@m
, '
$(OBJECT) : $(PERL_HDRS)
'
if
$self
->{OBJECT};
push
(
@m
,'
$(PERL_INC)/config.h: $(PERL_SRC)/config.sh
-
@echo
"Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"
; false
$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh
@echo
"Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh"
cd $(PERL_SRC) && $(MAKE) lib/Config.pm
')
if
$self
->{PERL_SRC};
push
(
@m
,
join
(
" "
,
values
%{
$self
->{XS}}).
" : \$(XSUBPPDEPS)\n"
)
if
%{
$self
->{XS}};
join
(
"\n"
,
@m
);
}
sub
makefile {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
@m
;
push
@m
, '
$(OBJECT) : $(FIRST_MAKEFILE)
'
if
$self
->{OBJECT};
push
@m
, '
'.$self->{MAKEFILE}.'
: Makefile.PL $(CONFIGDEP)
@echo
"Makefile out-of-date with respect to $?"
@echo
"Cleaning current config before rebuilding Makefile..."
-
@mv
'."$self->{MAKEFILE} $self->{MAKEFILE}.old".'
-$(MAKE) -f
'.$self->{MAKEFILE}.'
.old clean >/dev/null 2>&1 || true
$(PERL)
"-I$(PERL_ARCHLIB)"
"-I$(PERL_LIB)"
Makefile.PL
'."@ARGV".'
@echo
">>> Your Makefile has been rebuilt. <<<"
@echo
">>> Please rerun the make command. <<<"
; false
';
join
""
,
@m
;
}
sub
staticmake {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@static
);
my
(
%searchdirs
)=(
$self
->{PERL_ARCHLIB} => 1,
$self
->{INST_ARCHLIB} => 1);
my
(
@searchdirs
)=
keys
%searchdirs
;
if
(@{
$self
->{C}}) {
@static
=
"$self->{INST_ARCHLIB}/auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}"
;
}
my
(
@perlinc
) = (
$self
->{INST_ARCHLIB},
$self
->{INST_LIB},
$self
->{PERL_ARCHLIB},
$self
->{PERL_LIB});
$self
->makeaperl(
MAKE
=>
$self
->{MAKEFILE},
DIRS
=> \
@searchdirs
,
STAT
=> \
@static
,
INCL
=> \
@perlinc
,
TARGET
=>
$self
->{MAP_TARGET},
TMP
=>
""
,
LIBPERL
=>
$self
->{LIBPERL_A}
);
}
sub
test {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$tests
) =
$attribs
{TESTS} || (-d
"t"
?
"t/*.t"
:
""
);
my
(
@m
);
push
(
@m
,"
TEST_VERBOSE=0
TEST_TYPE=test_\$(LINKTYPE)
test :: \$(TEST_TYPE)
");
push
(
@m
,
map
(
"\t\@cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n"
,
@{
$self
->{DIR}}));
push
(
@m
,
"\t\@echo 'No tests defined for \$(NAME) extension.'\n"
)
unless
$tests
or -f
"test.pl"
or @{
$self
->{DIR}};
push
(
@m
,
"\n"
);
push
(
@m
,
"test_dynamic :: all\n"
);
push
(
@m
,
$self
->test_via_harness(
'$(FULLPERL)'
,
$tests
))
if
$tests
;
push
(
@m
,
$self
->test_via_script(
'$(FULLPERL)'
,
'test.pl'
))
if
-f
"test.pl"
;
push
(
@m
,
"\n"
);
push
@m
,
"test_ : test_dynamic\n\n"
;
if
(
$self
->needs_linking()) {
push
(
@m
,
"test_static :: all \$(MAP_TARGET)\n"
);
push
(
@m
,
$self
->test_via_harness(
'./$(MAP_TARGET)'
,
$tests
))
if
$tests
;
push
(
@m
,
$self
->test_via_script(
'./$(MAP_TARGET)'
,
'test.pl'
))
if
-f
"test.pl"
;
push
(
@m
,
"\n"
);
}
else
{
push
@m
,
"test_static :: test_dynamic\n"
;
}
join
(
""
,
@m
);
}
sub
test_via_harness {
my
(
$self
,
$perl
,
$tests
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
"\tPERL_DL_NONLAZY=1 $perl"
.
q! -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;' !
.
"$tests\n"
;
}
sub
test_via_script {
my
(
$self
,
$perl
,
$script
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
"\tPERL_DL_NONLAZY=1 $perl"
.' -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) test.pl
';
}
sub
postamble {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
""
;
}
sub
makeaperl {
my
(
$self
,
%attribs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$makefilename
,
$searchdirs
,
$static
,
$extra
,
$perlinc
,
$target
,
$tmp
,
$libperl
) =
@attribs
{
qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)
};
my
(
@m
);
push
@m
, "
MAP_TARGET =
$target
FULLPERL =
$self
->{FULLPERL}
";
return
join
''
,
@m
if
$self
->{PARENT};
my
(
$dir
) =
join
":"
, @{
$self
->{DIR}};
unless
(
$self
->{MAKEAPERL}) {
push
@m
,
q{
$(MAP_TARGET) :: $(MAKE_APERL_FILE)
$(MAKE) -f Makefile.aperl static $@
$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
@ echo Writing \"Makefile.aperl\" for this $(MAP_TARGET)
@ $(PERL) -I$(INST_ARCHLIB) -I$(INST_LIB) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
Makefile.PL DIR=}
,
$dir
,
q{ \
MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=}
;
push
@m
,
map
(
" \\\n\t\t$_"
,
@ARGV
);
push
@m
,
"\n"
;
return
join
''
,
@m
;
}
my
(
$cccmd
,
$linkcmd
,
$lperl
);
$cccmd
=
$self
->const_cccmd(
$libperl
);
$cccmd
=~ s/^CCCMD\s*=\s*//;
$cccmd
=~ s/\$\(INC\)/ -I
$self
->{PERL_INC} /;
$cccmd
.=
" $Config::Config{cccdlflags}"
if
(
$Config::Config
{d_shrplib});
$cccmd
=~ s/\n/ /g;
$cccmd
=~ s/\(CC\)/\(PERLMAINCC\)/;
$linkcmd
=
join
' '
,
"\$(CC)"
,
grep
(
$_
,
@Config
{
qw(large split ldflags ccdlflags)
});
$linkcmd
=~ s/\s+/ /g;
local
(
%static
);
File::Find::find(
sub
{
return
unless
m/\Q
$self
->{LIB_EXT}\E$/;
return
if
m/^libperl/;
return
if
$File::Find::name
=~ m:auto/
$self
->{FULLEXT}/
$self
->{BASEEXT}
$self
->{LIB_EXT}$:;
$static
{fastcwd() .
"/"
.
$_
}++;
},
grep
( -d
$_
, @{
$searchdirs
|| []}) );
$static
= []
unless
$static
;
@static
{@{
$static
}} = (1) x @{
$static
};
$extra
= []
unless
$extra
&&
ref
$extra
eq
'ARRAY'
;
for
(
sort
keys
%static
) {
next
unless
/\Q
$self
->{LIB_EXT}\E$/;
$_
= dirname(
$_
) .
"/extralibs.ld"
;
push
@$extra
,
$_
;
}
grep
(s/^/-I/, @{
$perlinc
|| []});
$target
=
"perl"
unless
$target
;
$tmp
=
"."
unless
$tmp
;
push
@m
, "
MAP_LINKCMD =
$linkcmd
MAP_PERLINC = @{
$perlinc
|| []}
MAP_STATIC = ",
join
(
" \\\n\t"
,
reverse
sort
keys
%static
), "
MAP_PRELIBS =
$Config::Config
{libs}
$Config::Config
{cryptlib}
";
if
(
defined
$libperl
) {
(
$lperl
=
$libperl
) =~ s/\$\(A\)/
$self
->{LIB_EXT}/;
}
unless
(
$libperl
&& -f
$lperl
) {
my
$dir
=
$self
->{PERL_SRC} ||
"$self->{PERL_ARCHLIB}/CORE"
;
$libperl
||=
"libperl$self->{LIB_EXT}"
;
$libperl
=
"$dir/$libperl"
;
$lperl
||=
"libperl$self->{LIB_EXT}"
;
$lperl
=
"$dir/$lperl"
;
print
STDOUT "Warning:
$libperl
not found
If you're going to build a static perl binary, make sure perl is installed
otherwise ignore this warning\n"
unless
(-f
$lperl
||
defined
(
$self
->{PERL_SRC}));
}
push
@m
, "
MAP_LIBPERL =
$libperl
";
push
@m
, "
\$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)/.
exists
".join("
\\\n\t
", @$extra)."
\@
$self
->{RM_F} \$\@
\@ \$(TOUCH) \$\@
";
my
$catfile
;
foreach
$catfile
(
@$extra
){
push
@m
,
"\tcat $catfile >> \$\@\n"
;
}
push
@m
, "
\$(MAP_TARGET) ::
$tmp
/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all
\$(MAP_LINKCMD) -o \$\@
$tmp
/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS)
@ echo
'To install the new \"\$(MAP_TARGET)\" binary, call'
@ echo
' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)'
@ echo
'To remove the intermediate files say'
@ echo
' make -f $makefilename map_clean'
$tmp
/perlmain\$(OBJ_EXT):
$tmp
/perlmain.c
";
push
@m
,
"\tcd $tmp && $cccmd -I\$(PERL_INC) perlmain.c\n"
;
push
@m
,
qq{
$tmp/perlmain.c: $makefilename}
,
q{
@ echo Writing $@
@ $(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@.tmp && mv $@.tmp $@
}
;
push
@m
,
q{
doc_inst_perl:
@ echo Appending installation info to $(INSTALLARCHLIB)/perllocal.pod
@ $(FULLPERL) -e 'use ExtUtils::MakeMaker; MY->new->writedoc("Perl binary",' \\
-e '"$(MAP_TARGET)", "MAP_STATIC=$(MAP_STATIC)",' \\
-e '"MAP_EXTRA=@ARGV", "MAP_LIBPERL=$(MAP_LIBPERL)")' \\
-- `cat $(INST_ARCHAUTODIR)/extralibs.all` >> $(INSTALLARCHLIB)/perllocal.pod
}
;
push
@m
,
qq{
inst_perl: pure_inst_perl doc_inst_perl
pure_inst_perl: \$(MAP_TARGET)
$self->{CP}
\$(MAP_TARGET) \$(INSTALLBIN)/\$(MAP_TARGET)
clean :: map_clean
map_clean :
$self
->{RM_F}
$tmp
/perlmain\$(OBJ_EXT)
$tmp
/perlmain.c \$(MAP_TARGET)
$makefilename
\$(INST_ARCHAUTODIR)/extralibs.all
};
join
''
,
@m
;
}
sub
extliblist {
my
(
$self
,
$libs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
ExtUtils::Liblist::ext(
$libs
,
$ExtUtils::MakeMaker::Verbose
);
}
sub
mksymlists {
my
(
$self
) =
shift
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$pkg
);
return
''
unless
$Config::Config
{osname} eq
'aix'
;
$self
->init_main(
@ARGV
)
unless
defined
$self
->{BASEEXT};
if
(!
$self
->{DL_FUNCS}) {
my
(
$bootfunc
);
(
$bootfunc
=
$self
->{NAME}) =~ s/\W/_/g;
$self
->{DL_FUNCS} = {
$self
->{BASEEXT} => [
"boot_$bootfunc"
]};
}
rename
"$self->{BASEEXT}.exp"
,
"$self->{BASEEXT}.exp_old"
;
open
(EXP,
">$self->{BASEEXT}.exp"
) or
die
$!;
print
EXP
join
(
"\n"
,@{
$self
->{DL_VARS}},
"\n"
)
if
$self
->{DL_VARS};
foreach
$pkg
(
keys
%{
$self
->{DL_FUNCS}}) {
(
my
(
$prefix
) =
$pkg
) =~ s/\W/_/g;
my
$func
;
foreach
$func
(@{
$self
->{DL_FUNCS}->{
$pkg
}}) {
$func
=
"XS_${prefix}_$func"
unless
$func
=~ /^boot_/;
print
EXP
"$func\n"
;
}
}
close
EXP;
}
sub
dir_target {
my
(
$self
,
@dirs
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
@m
,
$dir
);
foreach
$dir
(
@dirs
) {
next
if
$self
->{DIR_TARGET}{
$self
}{
$dir
}++;
push
@m
, "
$dir
/.
exists
:: \$(PERL)
\@\$(MKPATH)
$dir
\@\$(TOUCH)
$dir
/.
exists
\@-\$(CHMOD) 755
$dir
";
}
join
""
,
@m
;
}
sub
nicetext {
my
(
$self
,
$text
) =
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
$text
;
}
sub
needs_linking {
my
(
$self
) =
shift
;
my
(
$child
,
$caller
);
$caller
= (
caller
(0))[3];
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse(
$caller
);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
Carp::confess(
"Needs_linking called too early"
)
if
$caller
=~ /^ExtUtils::MakeMaker::/;
return
$self
->{NEEDS_LINKING}
if
defined
$self
->{NEEDS_LINKING};
if
(
$self
->has_link_code or
$self
->{MAKEAPERL}){
$self
->{NEEDS_LINKING} = 1;
return
1;
}
foreach
$child
(
keys
%{
$self
->{CHILDREN}}) {
if
(
$self
->{CHILDREN}->{
$child
}->needs_linking) {
$self
->{NEEDS_LINKING} = 1;
return
1;
}
}
return
$self
->{NEEDS_LINKING} = 0;
}
sub
has_link_code {
my
(
$self
) =
shift
;
return
$self
->{HAS_LINK_CODE}
if
defined
$self
->{HAS_LINK_CODE};
if
(
$self
->{OBJECT} or @{
$self
->{C} || []} or
$self
->{MYEXTLIB}){
$self
->{HAS_LINK_CODE} = 1;
return
1;
}
return
$self
->{HAS_LINK_CODE} = 0;
}
sub
writedoc {
my
(
$self
,
$what
,
$name
,
@attribs
)=
@_
;
unless
(
ref
$self
){
ExtUtils::MakeMaker::TieAtt::warndirectuse((
caller
(0))[3]);
$self
=
$ExtUtils::MakeMaker::Parent
[-1];
}
my
(
$time
) =
localtime
;
print
"=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n"
;
print
join
"\n\n=item *\n\n"
,
map
(
"C<$_>"
,
@attribs
);
print
"\n\n=back\n\n"
;
}
sub
catdir {
shift
;
my
$result
=
join
(
'/'
,
@_
);
$result
=~ s:/+:/:g;
$result
; }
sub
catfile {
shift
;
my
$result
=
join
(
'/'
,
@_
);
$result
=~ s:/+:/:g;
$result
; }
Exporter::
import
(
'ExtUtils::MakeMaker'
,
qw( $Verbose)
);
sub
dlsyms {
my
(
$self
,
%attribs
) =
@_
;
my
(
$funcs
) =
$attribs
{DL_FUNCS} ||
$self
->{DL_FUNCS} || {};
my
(
$vars
) =
$attribs
{DL_VARS} ||
$self
->{DL_VARS} || [];
my
(
@m
);
(
my
$boot
=
$self
->{NAME}) =~ s/:/_/g;
if
(not
$self
->{SKIPHASH}{
'dynamic'
}) {
push
(
@m
,"
$self
->{BASEEXT}.def: Makefile.PL"
. '
echo
"LIBRARY ' . "
'
$self
->{DLBASE}
'" . '
INITINSTANCE TERMINSTANCE" > $@ ; \\
echo
"CODE LOADONCALL"
>> $@ ; \\
echo
"DATA LOADONCALL NONSHARED MULTIPLE"
>> $@ ; \\
echo
"EXPORTS"
>> $@ ; \\
echo
" ' . "
boot_
$boot
" . '"
>> $@');
foreach
$sym
(
keys
%$funcs
,
@$vars
) {
push
(
@m
, " ; \\
echo \
" $sym\" >> \$@"
);
}
push
(
@m
,
"\n"
);
}
join
(
''
,
@m
);
}
sub
replace_manpage_separator {
my
(
$self
,
$man
) =
@_
;
$man
=~ s,/+,.,g;
$man
;
}
sub
maybe_command {
my
(
$self
,
$file
) =
@_
;
return
$file
if
-x
$file
&& ! -d _;
return
"$file.exe"
if
-x
"$file.exe"
&& ! -d _;
return
"$file.cmd"
if
-x
"$file.cmd"
&& ! -d _;
return
;
}
sub
file_name_is_absolute {
my
(
$self
,
$file
) =
@_
;
$file
=~ m{^([a-z]:)?[\\/]}i ;
}
1;