1*0Sstevel@tonic-gatepackage ExtUtils::MM_Unix; 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gaterequire 5.005_03; # Maybe further back, dunno 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gateuse strict; 6*0Sstevel@tonic-gate 7*0Sstevel@tonic-gateuse Exporter (); 8*0Sstevel@tonic-gateuse Carp; 9*0Sstevel@tonic-gateuse Config qw(%Config); 10*0Sstevel@tonic-gateuse File::Basename qw(basename dirname fileparse); 11*0Sstevel@tonic-gateuse DirHandle; 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gateuse vars qw($VERSION @ISA 14*0Sstevel@tonic-gate $Is_Mac $Is_OS2 $Is_VMS $Is_Win32 $Is_Win95 $Is_Dos $Is_VOS 15*0Sstevel@tonic-gate $Is_QNX $Is_AIX $Is_OSF $Is_IRIX $Is_NetBSD $Is_BSD 16*0Sstevel@tonic-gate $Is_SunOS4 $Is_Solaris $Is_SunOS 17*0Sstevel@tonic-gate $Verbose %pm %static 18*0Sstevel@tonic-gate %Config_Override 19*0Sstevel@tonic-gate ); 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gateuse ExtUtils::MakeMaker qw($Verbose neatvalue); 22*0Sstevel@tonic-gate 23*0Sstevel@tonic-gate$VERSION = '1.42'; 24*0Sstevel@tonic-gate 25*0Sstevel@tonic-gaterequire ExtUtils::MM_Any; 26*0Sstevel@tonic-gate@ISA = qw(ExtUtils::MM_Any); 27*0Sstevel@tonic-gate 28*0Sstevel@tonic-gate$Is_OS2 = $^O eq 'os2'; 29*0Sstevel@tonic-gate$Is_Mac = $^O eq 'MacOS'; 30*0Sstevel@tonic-gate$Is_Win32 = $^O eq 'MSWin32' || $Config{osname} eq 'NetWare'; 31*0Sstevel@tonic-gate$Is_Win95 = $Is_Win32 && Win32::IsWin95(); 32*0Sstevel@tonic-gate$Is_Dos = $^O eq 'dos'; 33*0Sstevel@tonic-gate$Is_VOS = $^O eq 'vos'; 34*0Sstevel@tonic-gate$Is_VMS = $^O eq 'VMS'; 35*0Sstevel@tonic-gate$Is_QNX = $^O eq 'qnx'; 36*0Sstevel@tonic-gate$Is_AIX = $^O eq 'aix'; 37*0Sstevel@tonic-gate$Is_OSF = $^O eq 'dec_osf'; 38*0Sstevel@tonic-gate$Is_IRIX = $^O eq 'irix'; 39*0Sstevel@tonic-gate$Is_NetBSD = $^O eq 'netbsd'; 40*0Sstevel@tonic-gate$Is_SunOS4 = $^O eq 'sunos'; 41*0Sstevel@tonic-gate$Is_Solaris = $^O eq 'solaris'; 42*0Sstevel@tonic-gate$Is_SunOS = $Is_SunOS4 || $Is_Solaris; 43*0Sstevel@tonic-gate$Is_BSD = $^O =~ /^(?:free|net|open)bsd|bsdos$/; 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate=head1 NAME 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gateExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate=head1 SYNOPSIS 51*0Sstevel@tonic-gate 52*0Sstevel@tonic-gateC<require ExtUtils::MM_Unix;> 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate=head1 DESCRIPTION 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gateThe methods provided by this package are designed to be used in 57*0Sstevel@tonic-gateconjunction with ExtUtils::MakeMaker. When MakeMaker writes a 58*0Sstevel@tonic-gateMakefile, it creates one or more objects that inherit their methods 59*0Sstevel@tonic-gatefrom a package C<MM>. MM itself doesn't provide any methods, but it 60*0Sstevel@tonic-gateISA ExtUtils::MM_Unix class. The inheritance tree of MM lets operating 61*0Sstevel@tonic-gatespecific packages take the responsibility for all the methods provided 62*0Sstevel@tonic-gateby MM_Unix. We are trying to reduce the number of the necessary 63*0Sstevel@tonic-gateoverrides by defining rather primitive operations within 64*0Sstevel@tonic-gateExtUtils::MM_Unix. 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gateIf you are going to write a platform specific MM package, please try 67*0Sstevel@tonic-gateto limit the necessary overrides to primitive methods, and if it is not 68*0Sstevel@tonic-gatepossible to do so, let's work out how to achieve that gain. 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gateIf you are overriding any of these methods in your Makefile.PL (in the 71*0Sstevel@tonic-gateMY class), please report that to the makemaker mailing list. We are 72*0Sstevel@tonic-gatetrying to minimize the necessary method overrides and switch to data 73*0Sstevel@tonic-gatedriven Makefile.PLs wherever possible. In the long run less methods 74*0Sstevel@tonic-gatewill be overridable via the MY class. 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate=head1 METHODS 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gateThe following description of methods is still under 79*0Sstevel@tonic-gatedevelopment. Please refer to the code for not suitably documented 80*0Sstevel@tonic-gatesections and complain loudly to the makemaker@perl.org mailing list. 81*0Sstevel@tonic-gateBetter yet, provide a patch. 82*0Sstevel@tonic-gate 83*0Sstevel@tonic-gateNot all of the methods below are overridable in a 84*0Sstevel@tonic-gateMakefile.PL. Overridable methods are marked as (o). All methods are 85*0Sstevel@tonic-gateoverridable by a platform specific MM_*.pm file (See 86*0Sstevel@tonic-gateL<ExtUtils::MM_VMS>) and L<ExtUtils::MM_OS2>). 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate=cut 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate# So we don't have to keep calling the methods over and over again, 91*0Sstevel@tonic-gate# we have these globals to cache the values. Faster and shrtr. 92*0Sstevel@tonic-gatemy $Curdir = __PACKAGE__->curdir; 93*0Sstevel@tonic-gatemy $Rootdir = __PACKAGE__->rootdir; 94*0Sstevel@tonic-gatemy $Updir = __PACKAGE__->updir; 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate 97*0Sstevel@tonic-gate=head2 Methods 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate=over 4 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate=item os_flavor (o) 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gateSimply says that we're Unix. 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate=cut 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gatesub os_flavor { 108*0Sstevel@tonic-gate return('Unix'); 109*0Sstevel@tonic-gate} 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate=item c_o (o) 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gateDefines the suffix rules to compile different flavors of C files to 115*0Sstevel@tonic-gateobject files. 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate=cut 118*0Sstevel@tonic-gate 119*0Sstevel@tonic-gatesub c_o { 120*0Sstevel@tonic-gate# --- Translation Sections --- 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate my($self) = shift; 123*0Sstevel@tonic-gate return '' unless $self->needs_linking(); 124*0Sstevel@tonic-gate my(@m); 125*0Sstevel@tonic-gate if (my $cpp = $Config{cpprun}) { 126*0Sstevel@tonic-gate my $cpp_cmd = $self->const_cccmd; 127*0Sstevel@tonic-gate $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/; 128*0Sstevel@tonic-gate push @m, ' 129*0Sstevel@tonic-gate.c.i: 130*0Sstevel@tonic-gate '. $cpp_cmd . ' $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i 131*0Sstevel@tonic-gate'; 132*0Sstevel@tonic-gate } 133*0Sstevel@tonic-gate push @m, ' 134*0Sstevel@tonic-gate.c.s: 135*0Sstevel@tonic-gate $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c 136*0Sstevel@tonic-gate'; 137*0Sstevel@tonic-gate push @m, ' 138*0Sstevel@tonic-gate.c$(OBJ_EXT): 139*0Sstevel@tonic-gate $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c 140*0Sstevel@tonic-gate'; 141*0Sstevel@tonic-gate push @m, ' 142*0Sstevel@tonic-gate.C$(OBJ_EXT): 143*0Sstevel@tonic-gate $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.C 144*0Sstevel@tonic-gate' if !$Is_OS2 and !$Is_Win32 and !$Is_Dos; #Case-specific 145*0Sstevel@tonic-gate push @m, ' 146*0Sstevel@tonic-gate.cpp$(OBJ_EXT): 147*0Sstevel@tonic-gate $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cpp 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate.cxx$(OBJ_EXT): 150*0Sstevel@tonic-gate $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cxx 151*0Sstevel@tonic-gate 152*0Sstevel@tonic-gate.cc$(OBJ_EXT): 153*0Sstevel@tonic-gate $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cc 154*0Sstevel@tonic-gate'; 155*0Sstevel@tonic-gate join "", @m; 156*0Sstevel@tonic-gate} 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate=item cflags (o) 159*0Sstevel@tonic-gate 160*0Sstevel@tonic-gateDoes very much the same as the cflags script in the perl 161*0Sstevel@tonic-gatedistribution. It doesn't return the whole compiler command line, but 162*0Sstevel@tonic-gateinitializes all of its parts. The const_cccmd method then actually 163*0Sstevel@tonic-gatereturns the definition of the CCCMD macro which uses these parts. 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate=cut 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate#' 168*0Sstevel@tonic-gate 169*0Sstevel@tonic-gatesub cflags { 170*0Sstevel@tonic-gate my($self,$libperl)=@_; 171*0Sstevel@tonic-gate return $self->{CFLAGS} if $self->{CFLAGS}; 172*0Sstevel@tonic-gate return '' unless $self->needs_linking(); 173*0Sstevel@tonic-gate 174*0Sstevel@tonic-gate my($prog, $uc, $perltype, %cflags); 175*0Sstevel@tonic-gate $libperl ||= $self->{LIBPERL_A} || "libperl$self->{LIB_EXT}" ; 176*0Sstevel@tonic-gate $libperl =~ s/\.\$\(A\)$/$self->{LIB_EXT}/; 177*0Sstevel@tonic-gate 178*0Sstevel@tonic-gate @cflags{qw(cc ccflags optimize shellflags)} 179*0Sstevel@tonic-gate = @Config{qw(cc ccflags optimize shellflags)}; 180*0Sstevel@tonic-gate my($optdebug) = ""; 181*0Sstevel@tonic-gate 182*0Sstevel@tonic-gate $cflags{shellflags} ||= ''; 183*0Sstevel@tonic-gate 184*0Sstevel@tonic-gate my(%map) = ( 185*0Sstevel@tonic-gate D => '-DDEBUGGING', 186*0Sstevel@tonic-gate E => '-DEMBED', 187*0Sstevel@tonic-gate DE => '-DDEBUGGING -DEMBED', 188*0Sstevel@tonic-gate M => '-DEMBED -DMULTIPLICITY', 189*0Sstevel@tonic-gate DM => '-DDEBUGGING -DEMBED -DMULTIPLICITY', 190*0Sstevel@tonic-gate ); 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate if ($libperl =~ /libperl(\w*)\Q$self->{LIB_EXT}/){ 193*0Sstevel@tonic-gate $uc = uc($1); 194*0Sstevel@tonic-gate } else { 195*0Sstevel@tonic-gate $uc = ""; # avoid warning 196*0Sstevel@tonic-gate } 197*0Sstevel@tonic-gate $perltype = $map{$uc} ? $map{$uc} : ""; 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate if ($uc =~ /^D/) { 200*0Sstevel@tonic-gate $optdebug = "-g"; 201*0Sstevel@tonic-gate } 202*0Sstevel@tonic-gate 203*0Sstevel@tonic-gate 204*0Sstevel@tonic-gate my($name); 205*0Sstevel@tonic-gate ( $name = $self->{NAME} . "_cflags" ) =~ s/:/_/g ; 206*0Sstevel@tonic-gate if ($prog = $Config{$name}) { 207*0Sstevel@tonic-gate # Expand hints for this extension via the shell 208*0Sstevel@tonic-gate print STDOUT "Processing $name hint:\n" if $Verbose; 209*0Sstevel@tonic-gate my(@o)=`cc=\"$cflags{cc}\" 210*0Sstevel@tonic-gate ccflags=\"$cflags{ccflags}\" 211*0Sstevel@tonic-gate optimize=\"$cflags{optimize}\" 212*0Sstevel@tonic-gate perltype=\"$cflags{perltype}\" 213*0Sstevel@tonic-gate optdebug=\"$cflags{optdebug}\" 214*0Sstevel@tonic-gate eval '$prog' 215*0Sstevel@tonic-gate echo cc=\$cc 216*0Sstevel@tonic-gate echo ccflags=\$ccflags 217*0Sstevel@tonic-gate echo optimize=\$optimize 218*0Sstevel@tonic-gate echo perltype=\$perltype 219*0Sstevel@tonic-gate echo optdebug=\$optdebug 220*0Sstevel@tonic-gate `; 221*0Sstevel@tonic-gate my($line); 222*0Sstevel@tonic-gate foreach $line (@o){ 223*0Sstevel@tonic-gate chomp $line; 224*0Sstevel@tonic-gate if ($line =~ /(.*?)=\s*(.*)\s*$/){ 225*0Sstevel@tonic-gate $cflags{$1} = $2; 226*0Sstevel@tonic-gate print STDOUT " $1 = $2\n" if $Verbose; 227*0Sstevel@tonic-gate } else { 228*0Sstevel@tonic-gate print STDOUT "Unrecognised result from hint: '$line'\n"; 229*0Sstevel@tonic-gate } 230*0Sstevel@tonic-gate } 231*0Sstevel@tonic-gate } 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate if ($optdebug) { 234*0Sstevel@tonic-gate $cflags{optimize} = $optdebug; 235*0Sstevel@tonic-gate } 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate for (qw(ccflags optimize perltype)) { 238*0Sstevel@tonic-gate $cflags{$_} ||= ''; 239*0Sstevel@tonic-gate $cflags{$_} =~ s/^\s+//; 240*0Sstevel@tonic-gate $cflags{$_} =~ s/\s+/ /g; 241*0Sstevel@tonic-gate $cflags{$_} =~ s/\s+$//; 242*0Sstevel@tonic-gate $self->{uc $_} ||= $cflags{$_}; 243*0Sstevel@tonic-gate } 244*0Sstevel@tonic-gate 245*0Sstevel@tonic-gate if ($self->{POLLUTE}) { 246*0Sstevel@tonic-gate $self->{CCFLAGS} .= ' -DPERL_POLLUTE '; 247*0Sstevel@tonic-gate } 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate my $pollute = ''; 250*0Sstevel@tonic-gate if ($Config{usemymalloc} and not $Config{bincompat5005} 251*0Sstevel@tonic-gate and not $Config{ccflags} =~ /-DPERL_POLLUTE_MALLOC\b/ 252*0Sstevel@tonic-gate and $self->{PERL_MALLOC_OK}) { 253*0Sstevel@tonic-gate $pollute = '$(PERL_MALLOC_DEF)'; 254*0Sstevel@tonic-gate } 255*0Sstevel@tonic-gate 256*0Sstevel@tonic-gate $self->{CCFLAGS} = quote_paren($self->{CCFLAGS}); 257*0Sstevel@tonic-gate $self->{OPTIMIZE} = quote_paren($self->{OPTIMIZE}); 258*0Sstevel@tonic-gate 259*0Sstevel@tonic-gate return $self->{CFLAGS} = qq{ 260*0Sstevel@tonic-gateCCFLAGS = $self->{CCFLAGS} 261*0Sstevel@tonic-gateOPTIMIZE = $self->{OPTIMIZE} 262*0Sstevel@tonic-gatePERLTYPE = $self->{PERLTYPE} 263*0Sstevel@tonic-gateMPOLLUTE = $pollute 264*0Sstevel@tonic-gate}; 265*0Sstevel@tonic-gate 266*0Sstevel@tonic-gate} 267*0Sstevel@tonic-gate 268*0Sstevel@tonic-gate=item clean (o) 269*0Sstevel@tonic-gate 270*0Sstevel@tonic-gateDefines the clean target. 271*0Sstevel@tonic-gate 272*0Sstevel@tonic-gate=cut 273*0Sstevel@tonic-gate 274*0Sstevel@tonic-gatesub clean { 275*0Sstevel@tonic-gate# --- Cleanup and Distribution Sections --- 276*0Sstevel@tonic-gate 277*0Sstevel@tonic-gate my($self, %attribs) = @_; 278*0Sstevel@tonic-gate my(@m,$dir); 279*0Sstevel@tonic-gate push(@m, ' 280*0Sstevel@tonic-gate# Delete temporary files but do not touch installed files. We don\'t delete 281*0Sstevel@tonic-gate# the Makefile here so a later make realclean still has a makefile to use. 282*0Sstevel@tonic-gate 283*0Sstevel@tonic-gateclean :: clean_subdirs 284*0Sstevel@tonic-gate'); 285*0Sstevel@tonic-gate 286*0Sstevel@tonic-gate my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files 287*0Sstevel@tonic-gate if ( $Is_QNX ) { 288*0Sstevel@tonic-gate my @errfiles = @{$self->{C}}; 289*0Sstevel@tonic-gate for ( @errfiles ) { 290*0Sstevel@tonic-gate s/.c$/.err/; 291*0Sstevel@tonic-gate } 292*0Sstevel@tonic-gate push( @otherfiles, @errfiles, 'perlmain.err' ); 293*0Sstevel@tonic-gate } 294*0Sstevel@tonic-gate push(@otherfiles, $attribs{FILES}) if $attribs{FILES}; 295*0Sstevel@tonic-gate push(@otherfiles, qw[./blib $(MAKE_APERL_FILE) 296*0Sstevel@tonic-gate $(INST_ARCHAUTODIR)/extralibs.all 297*0Sstevel@tonic-gate $(INST_ARCHAUTODIR)/extralibs.ld 298*0Sstevel@tonic-gate perlmain.c tmon.out mon.out so_locations pm_to_blib 299*0Sstevel@tonic-gate *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) 300*0Sstevel@tonic-gate $(BOOTSTRAP) $(BASEEXT).bso 301*0Sstevel@tonic-gate $(BASEEXT).def lib$(BASEEXT).def 302*0Sstevel@tonic-gate $(BASEEXT).exp $(BASEEXT).x 303*0Sstevel@tonic-gate ]); 304*0Sstevel@tonic-gate if( $Is_VOS ) { 305*0Sstevel@tonic-gate push(@otherfiles, qw[*.kp]); 306*0Sstevel@tonic-gate } 307*0Sstevel@tonic-gate else { 308*0Sstevel@tonic-gate push(@otherfiles, qw[core core.*perl.*.? *perl.core]); 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gate # core.\d+ 311*0Sstevel@tonic-gate push(@otherfiles, map { "core." . "[0-9]"x$_ } (1..5)); 312*0Sstevel@tonic-gate } 313*0Sstevel@tonic-gate 314*0Sstevel@tonic-gate push @m, "\t-\$(RM_RF) @otherfiles\n"; 315*0Sstevel@tonic-gate # See realclean and ext/utils/make_ext for usage of Makefile.old 316*0Sstevel@tonic-gate push(@m, 317*0Sstevel@tonic-gate "\t-\$(MV) \$(FIRST_MAKEFILE) \$(MAKEFILE_OLD) \$(DEV_NULL)\n"); 318*0Sstevel@tonic-gate push(@m, 319*0Sstevel@tonic-gate "\t$attribs{POSTOP}\n") if $attribs{POSTOP}; 320*0Sstevel@tonic-gate join("", @m); 321*0Sstevel@tonic-gate} 322*0Sstevel@tonic-gate 323*0Sstevel@tonic-gate 324*0Sstevel@tonic-gate=item clean_subdirs_target 325*0Sstevel@tonic-gate 326*0Sstevel@tonic-gate my $make_frag = $MM->clean_subdirs_target; 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gateReturns the clean_subdirs target. This is used by the clean target to 329*0Sstevel@tonic-gatecall clean on any subdirectories which contain Makefiles. 330*0Sstevel@tonic-gate 331*0Sstevel@tonic-gate=cut 332*0Sstevel@tonic-gate 333*0Sstevel@tonic-gatesub clean_subdirs_target { 334*0Sstevel@tonic-gate my($self) = shift; 335*0Sstevel@tonic-gate 336*0Sstevel@tonic-gate # No subdirectories, no cleaning. 337*0Sstevel@tonic-gate return <<'NOOP_FRAG' unless @{$self->{DIR}}; 338*0Sstevel@tonic-gateclean_subdirs : 339*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 340*0Sstevel@tonic-gateNOOP_FRAG 341*0Sstevel@tonic-gate 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate my $clean = "clean_subdirs :\n"; 344*0Sstevel@tonic-gate 345*0Sstevel@tonic-gate for my $dir (@{$self->{DIR}}) { 346*0Sstevel@tonic-gate $clean .= sprintf <<'MAKE_FRAG', $dir; 347*0Sstevel@tonic-gate -cd %s && $(TEST_F) $(FIRST_MAKEFILE) && $(MAKE) clean 348*0Sstevel@tonic-gateMAKE_FRAG 349*0Sstevel@tonic-gate } 350*0Sstevel@tonic-gate 351*0Sstevel@tonic-gate return $clean; 352*0Sstevel@tonic-gate} 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate 355*0Sstevel@tonic-gate=item const_cccmd (o) 356*0Sstevel@tonic-gate 357*0Sstevel@tonic-gateReturns the full compiler call for C programs and stores the 358*0Sstevel@tonic-gatedefinition in CONST_CCCMD. 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate=cut 361*0Sstevel@tonic-gate 362*0Sstevel@tonic-gatesub const_cccmd { 363*0Sstevel@tonic-gate my($self,$libperl)=@_; 364*0Sstevel@tonic-gate return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; 365*0Sstevel@tonic-gate return '' unless $self->needs_linking(); 366*0Sstevel@tonic-gate return $self->{CONST_CCCMD} = 367*0Sstevel@tonic-gate q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\ 368*0Sstevel@tonic-gate $(CCFLAGS) $(OPTIMIZE) \\ 369*0Sstevel@tonic-gate $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\ 370*0Sstevel@tonic-gate $(XS_DEFINE_VERSION)}; 371*0Sstevel@tonic-gate} 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate=item const_config (o) 374*0Sstevel@tonic-gate 375*0Sstevel@tonic-gateDefines a couple of constants in the Makefile that are imported from 376*0Sstevel@tonic-gate%Config. 377*0Sstevel@tonic-gate 378*0Sstevel@tonic-gate=cut 379*0Sstevel@tonic-gate 380*0Sstevel@tonic-gatesub const_config { 381*0Sstevel@tonic-gate# --- Constants Sections --- 382*0Sstevel@tonic-gate 383*0Sstevel@tonic-gate my($self) = shift; 384*0Sstevel@tonic-gate my(@m,$m); 385*0Sstevel@tonic-gate push(@m,"\n# These definitions are from config.sh (via $INC{'Config.pm'})\n"); 386*0Sstevel@tonic-gate push(@m,"\n# They may have been overridden via Makefile.PL or on the command line\n"); 387*0Sstevel@tonic-gate my(%once_only); 388*0Sstevel@tonic-gate foreach $m (@{$self->{CONFIG}}){ 389*0Sstevel@tonic-gate # SITE*EXP macros are defined in &constants; avoid duplicates here 390*0Sstevel@tonic-gate next if $once_only{$m}; 391*0Sstevel@tonic-gate $self->{uc $m} = quote_paren($self->{uc $m}); 392*0Sstevel@tonic-gate push @m, uc($m) , ' = ' , $self->{uc $m}, "\n"; 393*0Sstevel@tonic-gate $once_only{$m} = 1; 394*0Sstevel@tonic-gate } 395*0Sstevel@tonic-gate join('', @m); 396*0Sstevel@tonic-gate} 397*0Sstevel@tonic-gate 398*0Sstevel@tonic-gate=item const_loadlibs (o) 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gateDefines EXTRALIBS, LDLOADLIBS, BSLOADLIBS, LD_RUN_PATH. See 401*0Sstevel@tonic-gateL<ExtUtils::Liblist> for details. 402*0Sstevel@tonic-gate 403*0Sstevel@tonic-gate=cut 404*0Sstevel@tonic-gate 405*0Sstevel@tonic-gatesub const_loadlibs { 406*0Sstevel@tonic-gate my($self) = shift; 407*0Sstevel@tonic-gate return "" unless $self->needs_linking; 408*0Sstevel@tonic-gate my @m; 409*0Sstevel@tonic-gate push @m, qq{ 410*0Sstevel@tonic-gate# $self->{NAME} might depend on some other libraries: 411*0Sstevel@tonic-gate# See ExtUtils::Liblist for details 412*0Sstevel@tonic-gate# 413*0Sstevel@tonic-gate}; 414*0Sstevel@tonic-gate my($tmp); 415*0Sstevel@tonic-gate for $tmp (qw/ 416*0Sstevel@tonic-gate EXTRALIBS LDLOADLIBS BSLOADLIBS LD_RUN_PATH 417*0Sstevel@tonic-gate /) { 418*0Sstevel@tonic-gate next unless defined $self->{$tmp}; 419*0Sstevel@tonic-gate push @m, "$tmp = $self->{$tmp}\n"; 420*0Sstevel@tonic-gate } 421*0Sstevel@tonic-gate return join "", @m; 422*0Sstevel@tonic-gate} 423*0Sstevel@tonic-gate 424*0Sstevel@tonic-gate=item constants (o) 425*0Sstevel@tonic-gate 426*0Sstevel@tonic-gate my $make_frag = $mm->constants; 427*0Sstevel@tonic-gate 428*0Sstevel@tonic-gatePrints out macros for lots of constants. 429*0Sstevel@tonic-gate 430*0Sstevel@tonic-gate=cut 431*0Sstevel@tonic-gate 432*0Sstevel@tonic-gatesub constants { 433*0Sstevel@tonic-gate my($self) = @_; 434*0Sstevel@tonic-gate my @m = (); 435*0Sstevel@tonic-gate 436*0Sstevel@tonic-gate for my $macro (qw( 437*0Sstevel@tonic-gate 438*0Sstevel@tonic-gate AR_STATIC_ARGS DIRFILESEP 439*0Sstevel@tonic-gate NAME NAME_SYM 440*0Sstevel@tonic-gate VERSION VERSION_MACRO VERSION_SYM DEFINE_VERSION 441*0Sstevel@tonic-gate XS_VERSION XS_VERSION_MACRO XS_DEFINE_VERSION 442*0Sstevel@tonic-gate INST_ARCHLIB INST_SCRIPT INST_BIN INST_LIB 443*0Sstevel@tonic-gate INST_MAN1DIR INST_MAN3DIR 444*0Sstevel@tonic-gate MAN1EXT MAN3EXT 445*0Sstevel@tonic-gate INSTALLDIRS 446*0Sstevel@tonic-gate DESTDIR PREFIX 447*0Sstevel@tonic-gate PERLPREFIX SITEPREFIX VENDORPREFIX 448*0Sstevel@tonic-gate ), 449*0Sstevel@tonic-gate (map { ("INSTALL".$_, 450*0Sstevel@tonic-gate "DESTINSTALL".$_) 451*0Sstevel@tonic-gate } $self->installvars), 452*0Sstevel@tonic-gate qw( 453*0Sstevel@tonic-gate PERL_LIB 454*0Sstevel@tonic-gate PERL_ARCHLIB 455*0Sstevel@tonic-gate LIBPERL_A MYEXTLIB 456*0Sstevel@tonic-gate FIRST_MAKEFILE MAKEFILE_OLD MAKE_APERL_FILE 457*0Sstevel@tonic-gate PERLMAINCC PERL_SRC PERL_INC 458*0Sstevel@tonic-gate PERL FULLPERL ABSPERL 459*0Sstevel@tonic-gate PERLRUN FULLPERLRUN ABSPERLRUN 460*0Sstevel@tonic-gate PERLRUNINST FULLPERLRUNINST ABSPERLRUNINST 461*0Sstevel@tonic-gate PERL_CORE 462*0Sstevel@tonic-gate PERM_RW PERM_RWX 463*0Sstevel@tonic-gate 464*0Sstevel@tonic-gate ) ) 465*0Sstevel@tonic-gate { 466*0Sstevel@tonic-gate next unless defined $self->{$macro}; 467*0Sstevel@tonic-gate 468*0Sstevel@tonic-gate # pathnames can have sharp signs in them; escape them so 469*0Sstevel@tonic-gate # make doesn't think it is a comment-start character. 470*0Sstevel@tonic-gate $self->{$macro} =~ s/#/\\#/g; 471*0Sstevel@tonic-gate push @m, "$macro = $self->{$macro}\n"; 472*0Sstevel@tonic-gate } 473*0Sstevel@tonic-gate 474*0Sstevel@tonic-gate push @m, qq{ 475*0Sstevel@tonic-gateMAKEMAKER = $self->{MAKEMAKER} 476*0Sstevel@tonic-gateMM_VERSION = $self->{MM_VERSION} 477*0Sstevel@tonic-gateMM_REVISION = $self->{MM_REVISION} 478*0Sstevel@tonic-gate}; 479*0Sstevel@tonic-gate 480*0Sstevel@tonic-gate push @m, q{ 481*0Sstevel@tonic-gate# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle). 482*0Sstevel@tonic-gate# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle) 483*0Sstevel@tonic-gate# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar) 484*0Sstevel@tonic-gate# DLBASE = Basename part of dynamic library. May be just equal BASEEXT. 485*0Sstevel@tonic-gate}; 486*0Sstevel@tonic-gate 487*0Sstevel@tonic-gate for my $macro (qw/ 488*0Sstevel@tonic-gate FULLEXT BASEEXT PARENT_NAME DLBASE VERSION_FROM INC DEFINE OBJECT 489*0Sstevel@tonic-gate LDFROM LINKTYPE PM_FILTER 490*0Sstevel@tonic-gate / ) 491*0Sstevel@tonic-gate { 492*0Sstevel@tonic-gate next unless defined $self->{$macro}; 493*0Sstevel@tonic-gate push @m, "$macro = $self->{$macro}\n"; 494*0Sstevel@tonic-gate } 495*0Sstevel@tonic-gate 496*0Sstevel@tonic-gate push @m, " 497*0Sstevel@tonic-gate# Handy lists of source code files: 498*0Sstevel@tonic-gateXS_FILES = ".$self->wraplist(sort keys %{$self->{XS}})." 499*0Sstevel@tonic-gateC_FILES = ".$self->wraplist(@{$self->{C}})." 500*0Sstevel@tonic-gateO_FILES = ".$self->wraplist(@{$self->{O_FILES}})." 501*0Sstevel@tonic-gateH_FILES = ".$self->wraplist(@{$self->{H}})." 502*0Sstevel@tonic-gateMAN1PODS = ".$self->wraplist(sort keys %{$self->{MAN1PODS}})." 503*0Sstevel@tonic-gateMAN3PODS = ".$self->wraplist(sort keys %{$self->{MAN3PODS}})." 504*0Sstevel@tonic-gate"; 505*0Sstevel@tonic-gate 506*0Sstevel@tonic-gate 507*0Sstevel@tonic-gate push @m, q{ 508*0Sstevel@tonic-gate# Where is the Config information that we are using/depend on 509*0Sstevel@tonic-gateCONFIGDEP = $(PERL_ARCHLIB)$(DIRFILESEP)Config.pm $(PERL_INC)$(DIRFILESEP)config.h 510*0Sstevel@tonic-gate}; 511*0Sstevel@tonic-gate 512*0Sstevel@tonic-gate 513*0Sstevel@tonic-gate push @m, qq{ 514*0Sstevel@tonic-gate# Where to build things 515*0Sstevel@tonic-gateINST_LIBDIR = $self->{INST_LIBDIR} 516*0Sstevel@tonic-gateINST_ARCHLIBDIR = $self->{INST_ARCHLIBDIR} 517*0Sstevel@tonic-gate 518*0Sstevel@tonic-gateINST_AUTODIR = $self->{INST_AUTODIR} 519*0Sstevel@tonic-gateINST_ARCHAUTODIR = $self->{INST_ARCHAUTODIR} 520*0Sstevel@tonic-gate 521*0Sstevel@tonic-gateINST_STATIC = $self->{INST_STATIC} 522*0Sstevel@tonic-gateINST_DYNAMIC = $self->{INST_DYNAMIC} 523*0Sstevel@tonic-gateINST_BOOT = $self->{INST_BOOT} 524*0Sstevel@tonic-gate}; 525*0Sstevel@tonic-gate 526*0Sstevel@tonic-gate 527*0Sstevel@tonic-gate push @m, qq{ 528*0Sstevel@tonic-gate# Extra linker info 529*0Sstevel@tonic-gateEXPORT_LIST = $self->{EXPORT_LIST} 530*0Sstevel@tonic-gatePERL_ARCHIVE = $self->{PERL_ARCHIVE} 531*0Sstevel@tonic-gatePERL_ARCHIVE_AFTER = $self->{PERL_ARCHIVE_AFTER} 532*0Sstevel@tonic-gate}; 533*0Sstevel@tonic-gate 534*0Sstevel@tonic-gate push @m, " 535*0Sstevel@tonic-gate 536*0Sstevel@tonic-gateTO_INST_PM = ".$self->wraplist(sort keys %{$self->{PM}})." 537*0Sstevel@tonic-gate 538*0Sstevel@tonic-gatePM_TO_BLIB = ".$self->wraplist(%{$self->{PM}})." 539*0Sstevel@tonic-gate"; 540*0Sstevel@tonic-gate 541*0Sstevel@tonic-gate join('',@m); 542*0Sstevel@tonic-gate} 543*0Sstevel@tonic-gate 544*0Sstevel@tonic-gate 545*0Sstevel@tonic-gate=item depend (o) 546*0Sstevel@tonic-gate 547*0Sstevel@tonic-gateSame as macro for the depend attribute. 548*0Sstevel@tonic-gate 549*0Sstevel@tonic-gate=cut 550*0Sstevel@tonic-gate 551*0Sstevel@tonic-gatesub depend { 552*0Sstevel@tonic-gate my($self,%attribs) = @_; 553*0Sstevel@tonic-gate my(@m,$key,$val); 554*0Sstevel@tonic-gate while (($key,$val) = each %attribs){ 555*0Sstevel@tonic-gate last unless defined $key; 556*0Sstevel@tonic-gate push @m, "$key : $val\n"; 557*0Sstevel@tonic-gate } 558*0Sstevel@tonic-gate join "", @m; 559*0Sstevel@tonic-gate} 560*0Sstevel@tonic-gate 561*0Sstevel@tonic-gate=item dir_target (o) 562*0Sstevel@tonic-gate 563*0Sstevel@tonic-gateTakes an array of directories that need to exist and returns a 564*0Sstevel@tonic-gateMakefile entry for a .exists file in these directories. Returns 565*0Sstevel@tonic-gatenothing, if the entry has already been processed. We're helpless 566*0Sstevel@tonic-gatethough, if the same directory comes as $(FOO) _and_ as "bar". Both of 567*0Sstevel@tonic-gatethem get an entry, that's why we use "::". 568*0Sstevel@tonic-gate 569*0Sstevel@tonic-gate=cut 570*0Sstevel@tonic-gate 571*0Sstevel@tonic-gatesub dir_target { 572*0Sstevel@tonic-gate# --- Make-Directories section (internal method) --- 573*0Sstevel@tonic-gate# dir_target(@array) returns a Makefile entry for the file .exists in each 574*0Sstevel@tonic-gate# named directory. Returns nothing, if the entry has already been processed. 575*0Sstevel@tonic-gate# We're helpless though, if the same directory comes as $(FOO) _and_ as "bar". 576*0Sstevel@tonic-gate# Both of them get an entry, that's why we use "::". I chose '$(PERL)' as the 577*0Sstevel@tonic-gate# prerequisite, because there has to be one, something that doesn't change 578*0Sstevel@tonic-gate# too often :) 579*0Sstevel@tonic-gate 580*0Sstevel@tonic-gate my($self,@dirs) = @_; 581*0Sstevel@tonic-gate my(@m,$dir,$targdir); 582*0Sstevel@tonic-gate foreach $dir (@dirs) { 583*0Sstevel@tonic-gate my($src) = $self->catfile($self->{PERL_INC},'perl.h'); 584*0Sstevel@tonic-gate my($targ) = $self->catfile($dir,'.exists'); 585*0Sstevel@tonic-gate # catfile may have adapted syntax of $dir to target OS, so... 586*0Sstevel@tonic-gate if ($Is_VMS) { # Just remove file name; dirspec is often in macro 587*0Sstevel@tonic-gate ($targdir = $targ) =~ s:/?\.exists\z::; 588*0Sstevel@tonic-gate } 589*0Sstevel@tonic-gate else { # while elsewhere we expect to see the dir separator in $targ 590*0Sstevel@tonic-gate $targdir = dirname($targ); 591*0Sstevel@tonic-gate } 592*0Sstevel@tonic-gate next if $self->{DIR_TARGET}{$self}{$targdir}++; 593*0Sstevel@tonic-gate push @m, qq{ 594*0Sstevel@tonic-gate$targ :: $src 595*0Sstevel@tonic-gate \$(NOECHO) \$(MKPATH) $targdir 596*0Sstevel@tonic-gate \$(NOECHO) \$(EQUALIZE_TIMESTAMP) $src $targ 597*0Sstevel@tonic-gate}; 598*0Sstevel@tonic-gate push(@m, qq{ 599*0Sstevel@tonic-gate -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $targdir 600*0Sstevel@tonic-gate}) unless $Is_VMS; 601*0Sstevel@tonic-gate } 602*0Sstevel@tonic-gate join "", @m; 603*0Sstevel@tonic-gate} 604*0Sstevel@tonic-gate 605*0Sstevel@tonic-gate=item init_DEST 606*0Sstevel@tonic-gate 607*0Sstevel@tonic-gate $mm->init_DEST 608*0Sstevel@tonic-gate 609*0Sstevel@tonic-gateDefines the DESTDIR and DEST* variables paralleling the INSTALL*. 610*0Sstevel@tonic-gate 611*0Sstevel@tonic-gate=cut 612*0Sstevel@tonic-gate 613*0Sstevel@tonic-gatesub init_DEST { 614*0Sstevel@tonic-gate my $self = shift; 615*0Sstevel@tonic-gate 616*0Sstevel@tonic-gate # Initialize DESTDIR 617*0Sstevel@tonic-gate $self->{DESTDIR} ||= ''; 618*0Sstevel@tonic-gate 619*0Sstevel@tonic-gate # Make DEST variables. 620*0Sstevel@tonic-gate foreach my $var ($self->installvars) { 621*0Sstevel@tonic-gate my $destvar = 'DESTINSTALL'.$var; 622*0Sstevel@tonic-gate $self->{$destvar} ||= '$(DESTDIR)$(INSTALL'.$var.')'; 623*0Sstevel@tonic-gate } 624*0Sstevel@tonic-gate} 625*0Sstevel@tonic-gate 626*0Sstevel@tonic-gate 627*0Sstevel@tonic-gate=item init_dist 628*0Sstevel@tonic-gate 629*0Sstevel@tonic-gate $mm->init_dist; 630*0Sstevel@tonic-gate 631*0Sstevel@tonic-gateDefines a lot of macros for distribution support. 632*0Sstevel@tonic-gate 633*0Sstevel@tonic-gate macro description default 634*0Sstevel@tonic-gate 635*0Sstevel@tonic-gate TAR tar command to use tar 636*0Sstevel@tonic-gate TARFLAGS flags to pass to TAR cvf 637*0Sstevel@tonic-gate 638*0Sstevel@tonic-gate ZIP zip command to use zip 639*0Sstevel@tonic-gate ZIPFLAGS flags to pass to ZIP -r 640*0Sstevel@tonic-gate 641*0Sstevel@tonic-gate COMPRESS compression command to gzip --best 642*0Sstevel@tonic-gate use for tarfiles 643*0Sstevel@tonic-gate SUFFIX suffix to put on .gz 644*0Sstevel@tonic-gate compressed files 645*0Sstevel@tonic-gate 646*0Sstevel@tonic-gate SHAR shar command to use shar 647*0Sstevel@tonic-gate 648*0Sstevel@tonic-gate PREOP extra commands to run before 649*0Sstevel@tonic-gate making the archive 650*0Sstevel@tonic-gate POSTOP extra commands to run after 651*0Sstevel@tonic-gate making the archive 652*0Sstevel@tonic-gate 653*0Sstevel@tonic-gate TO_UNIX a command to convert linefeeds 654*0Sstevel@tonic-gate to Unix style in your archive 655*0Sstevel@tonic-gate 656*0Sstevel@tonic-gate CI command to checkin your ci -u 657*0Sstevel@tonic-gate sources to version control 658*0Sstevel@tonic-gate RCS_LABEL command to label your sources rcs -Nv$(VERSION_SYM): -q 659*0Sstevel@tonic-gate just after CI is run 660*0Sstevel@tonic-gate 661*0Sstevel@tonic-gate DIST_CP $how argument to manicopy() best 662*0Sstevel@tonic-gate when the distdir is created 663*0Sstevel@tonic-gate 664*0Sstevel@tonic-gate DIST_DEFAULT default target to use to tardist 665*0Sstevel@tonic-gate create a distribution 666*0Sstevel@tonic-gate 667*0Sstevel@tonic-gate DISTVNAME name of the resulting archive $(DISTNAME)-$(VERSION) 668*0Sstevel@tonic-gate (minus suffixes) 669*0Sstevel@tonic-gate 670*0Sstevel@tonic-gate=cut 671*0Sstevel@tonic-gate 672*0Sstevel@tonic-gatesub init_dist { 673*0Sstevel@tonic-gate my $self = shift; 674*0Sstevel@tonic-gate 675*0Sstevel@tonic-gate $self->{TAR} ||= 'tar'; 676*0Sstevel@tonic-gate $self->{TARFLAGS} ||= 'cvf'; 677*0Sstevel@tonic-gate $self->{ZIP} ||= 'zip'; 678*0Sstevel@tonic-gate $self->{ZIPFLAGS} ||= '-r'; 679*0Sstevel@tonic-gate $self->{COMPRESS} ||= 'gzip --best'; 680*0Sstevel@tonic-gate $self->{SUFFIX} ||= '.gz'; 681*0Sstevel@tonic-gate $self->{SHAR} ||= 'shar'; 682*0Sstevel@tonic-gate $self->{PREOP} ||= '$(NOECHO) $(NOOP)'; # eg update MANIFEST 683*0Sstevel@tonic-gate $self->{POSTOP} ||= '$(NOECHO) $(NOOP)'; # eg remove the distdir 684*0Sstevel@tonic-gate $self->{TO_UNIX} ||= '$(NOECHO) $(NOOP)'; 685*0Sstevel@tonic-gate 686*0Sstevel@tonic-gate $self->{CI} ||= 'ci -u'; 687*0Sstevel@tonic-gate $self->{RCS_LABEL}||= 'rcs -Nv$(VERSION_SYM): -q'; 688*0Sstevel@tonic-gate $self->{DIST_CP} ||= 'best'; 689*0Sstevel@tonic-gate $self->{DIST_DEFAULT} ||= 'tardist'; 690*0Sstevel@tonic-gate 691*0Sstevel@tonic-gate ($self->{DISTNAME} = $self->{NAME}) =~ s{::}{-}g unless $self->{DISTNAME}; 692*0Sstevel@tonic-gate $self->{DISTVNAME} ||= $self->{DISTNAME}.'-'.$self->{VERSION}; 693*0Sstevel@tonic-gate 694*0Sstevel@tonic-gate} 695*0Sstevel@tonic-gate 696*0Sstevel@tonic-gate=item dist (o) 697*0Sstevel@tonic-gate 698*0Sstevel@tonic-gate my $dist_macros = $mm->dist(%overrides); 699*0Sstevel@tonic-gate 700*0Sstevel@tonic-gateGenerates a make fragment defining all the macros initialized in 701*0Sstevel@tonic-gateinit_dist. 702*0Sstevel@tonic-gate 703*0Sstevel@tonic-gate%overrides can be used to override any of the above. 704*0Sstevel@tonic-gate 705*0Sstevel@tonic-gate=cut 706*0Sstevel@tonic-gate 707*0Sstevel@tonic-gatesub dist { 708*0Sstevel@tonic-gate my($self, %attribs) = @_; 709*0Sstevel@tonic-gate 710*0Sstevel@tonic-gate my $make = ''; 711*0Sstevel@tonic-gate foreach my $key (qw( 712*0Sstevel@tonic-gate TAR TARFLAGS ZIP ZIPFLAGS COMPRESS SUFFIX SHAR 713*0Sstevel@tonic-gate PREOP POSTOP TO_UNIX 714*0Sstevel@tonic-gate CI RCS_LABEL DIST_CP DIST_DEFAULT 715*0Sstevel@tonic-gate DISTNAME DISTVNAME 716*0Sstevel@tonic-gate )) 717*0Sstevel@tonic-gate { 718*0Sstevel@tonic-gate my $value = $attribs{$key} || $self->{$key}; 719*0Sstevel@tonic-gate $make .= "$key = $value\n"; 720*0Sstevel@tonic-gate } 721*0Sstevel@tonic-gate 722*0Sstevel@tonic-gate return $make; 723*0Sstevel@tonic-gate} 724*0Sstevel@tonic-gate 725*0Sstevel@tonic-gate=item dist_basics (o) 726*0Sstevel@tonic-gate 727*0Sstevel@tonic-gateDefines the targets distclean, distcheck, skipcheck, manifest, veryclean. 728*0Sstevel@tonic-gate 729*0Sstevel@tonic-gate=cut 730*0Sstevel@tonic-gate 731*0Sstevel@tonic-gatesub dist_basics { 732*0Sstevel@tonic-gate my($self) = shift; 733*0Sstevel@tonic-gate 734*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 735*0Sstevel@tonic-gatedistclean :: realclean distcheck 736*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 737*0Sstevel@tonic-gate 738*0Sstevel@tonic-gatedistcheck : 739*0Sstevel@tonic-gate $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck 740*0Sstevel@tonic-gate 741*0Sstevel@tonic-gateskipcheck : 742*0Sstevel@tonic-gate $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck 743*0Sstevel@tonic-gate 744*0Sstevel@tonic-gatemanifest : 745*0Sstevel@tonic-gate $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest 746*0Sstevel@tonic-gate 747*0Sstevel@tonic-gateveryclean : realclean 748*0Sstevel@tonic-gate $(RM_F) *~ *.orig */*~ */*.orig 749*0Sstevel@tonic-gate 750*0Sstevel@tonic-gateMAKE_FRAG 751*0Sstevel@tonic-gate 752*0Sstevel@tonic-gate} 753*0Sstevel@tonic-gate 754*0Sstevel@tonic-gate=item dist_ci (o) 755*0Sstevel@tonic-gate 756*0Sstevel@tonic-gateDefines a check in target for RCS. 757*0Sstevel@tonic-gate 758*0Sstevel@tonic-gate=cut 759*0Sstevel@tonic-gate 760*0Sstevel@tonic-gatesub dist_ci { 761*0Sstevel@tonic-gate my($self) = shift; 762*0Sstevel@tonic-gate return q{ 763*0Sstevel@tonic-gateci : 764*0Sstevel@tonic-gate $(PERLRUN) "-MExtUtils::Manifest=maniread" \\ 765*0Sstevel@tonic-gate -e "@all = keys %{ maniread() };" \\ 766*0Sstevel@tonic-gate -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \\ 767*0Sstevel@tonic-gate -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});" 768*0Sstevel@tonic-gate}; 769*0Sstevel@tonic-gate} 770*0Sstevel@tonic-gate 771*0Sstevel@tonic-gate=item dist_core (o) 772*0Sstevel@tonic-gate 773*0Sstevel@tonic-gate my $dist_make_fragment = $MM->dist_core; 774*0Sstevel@tonic-gate 775*0Sstevel@tonic-gatePuts the targets necessary for 'make dist' together into one make 776*0Sstevel@tonic-gatefragment. 777*0Sstevel@tonic-gate 778*0Sstevel@tonic-gate=cut 779*0Sstevel@tonic-gate 780*0Sstevel@tonic-gatesub dist_core { 781*0Sstevel@tonic-gate my($self) = shift; 782*0Sstevel@tonic-gate 783*0Sstevel@tonic-gate my $make_frag = ''; 784*0Sstevel@tonic-gate foreach my $target (qw(dist tardist uutardist tarfile zipdist zipfile 785*0Sstevel@tonic-gate shdist)) 786*0Sstevel@tonic-gate { 787*0Sstevel@tonic-gate my $method = $target.'_target'; 788*0Sstevel@tonic-gate $make_frag .= "\n"; 789*0Sstevel@tonic-gate $make_frag .= $self->$method(); 790*0Sstevel@tonic-gate } 791*0Sstevel@tonic-gate 792*0Sstevel@tonic-gate return $make_frag; 793*0Sstevel@tonic-gate} 794*0Sstevel@tonic-gate 795*0Sstevel@tonic-gate 796*0Sstevel@tonic-gate=item B<dist_target> 797*0Sstevel@tonic-gate 798*0Sstevel@tonic-gate my $make_frag = $MM->dist_target; 799*0Sstevel@tonic-gate 800*0Sstevel@tonic-gateReturns the 'dist' target to make an archive for distribution. This 801*0Sstevel@tonic-gatetarget simply checks to make sure the Makefile is up-to-date and 802*0Sstevel@tonic-gatedepends on $(DIST_DEFAULT). 803*0Sstevel@tonic-gate 804*0Sstevel@tonic-gate=cut 805*0Sstevel@tonic-gate 806*0Sstevel@tonic-gatesub dist_target { 807*0Sstevel@tonic-gate my($self) = shift; 808*0Sstevel@tonic-gate 809*0Sstevel@tonic-gate my $date_check = $self->oneliner(<<'CODE', ['-l']); 810*0Sstevel@tonic-gateprint 'Warning: Makefile possibly out of date with $(VERSION_FROM)' 811*0Sstevel@tonic-gate if -e '$(VERSION_FROM)' and -M '$(VERSION_FROM)' < -M '$(FIRST_MAKEFILE)'; 812*0Sstevel@tonic-gateCODE 813*0Sstevel@tonic-gate 814*0Sstevel@tonic-gate return sprintf <<'MAKE_FRAG', $date_check; 815*0Sstevel@tonic-gatedist : $(DIST_DEFAULT) $(FIRST_MAKEFILE) 816*0Sstevel@tonic-gate $(NOECHO) %s 817*0Sstevel@tonic-gateMAKE_FRAG 818*0Sstevel@tonic-gate} 819*0Sstevel@tonic-gate 820*0Sstevel@tonic-gate=item B<tardist_target> 821*0Sstevel@tonic-gate 822*0Sstevel@tonic-gate my $make_frag = $MM->tardist_target; 823*0Sstevel@tonic-gate 824*0Sstevel@tonic-gateReturns the 'tardist' target which is simply so 'make tardist' works. 825*0Sstevel@tonic-gateThe real work is done by the dynamically named tardistfile_target() 826*0Sstevel@tonic-gatemethod, tardist should have that as a dependency. 827*0Sstevel@tonic-gate 828*0Sstevel@tonic-gate=cut 829*0Sstevel@tonic-gate 830*0Sstevel@tonic-gatesub tardist_target { 831*0Sstevel@tonic-gate my($self) = shift; 832*0Sstevel@tonic-gate 833*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 834*0Sstevel@tonic-gatetardist : $(DISTVNAME).tar$(SUFFIX) 835*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 836*0Sstevel@tonic-gateMAKE_FRAG 837*0Sstevel@tonic-gate} 838*0Sstevel@tonic-gate 839*0Sstevel@tonic-gate=item B<zipdist_target> 840*0Sstevel@tonic-gate 841*0Sstevel@tonic-gate my $make_frag = $MM->zipdist_target; 842*0Sstevel@tonic-gate 843*0Sstevel@tonic-gateReturns the 'zipdist' target which is simply so 'make zipdist' works. 844*0Sstevel@tonic-gateThe real work is done by the dynamically named zipdistfile_target() 845*0Sstevel@tonic-gatemethod, zipdist should have that as a dependency. 846*0Sstevel@tonic-gate 847*0Sstevel@tonic-gate=cut 848*0Sstevel@tonic-gate 849*0Sstevel@tonic-gatesub zipdist_target { 850*0Sstevel@tonic-gate my($self) = shift; 851*0Sstevel@tonic-gate 852*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 853*0Sstevel@tonic-gatezipdist : $(DISTVNAME).zip 854*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 855*0Sstevel@tonic-gateMAKE_FRAG 856*0Sstevel@tonic-gate} 857*0Sstevel@tonic-gate 858*0Sstevel@tonic-gate=item B<tarfile_target> 859*0Sstevel@tonic-gate 860*0Sstevel@tonic-gate my $make_frag = $MM->tarfile_target; 861*0Sstevel@tonic-gate 862*0Sstevel@tonic-gateThe name of this target is the name of the tarball generated by 863*0Sstevel@tonic-gatetardist. This target does the actual work of turning the distdir into 864*0Sstevel@tonic-gatea tarball. 865*0Sstevel@tonic-gate 866*0Sstevel@tonic-gate=cut 867*0Sstevel@tonic-gate 868*0Sstevel@tonic-gatesub tarfile_target { 869*0Sstevel@tonic-gate my($self) = shift; 870*0Sstevel@tonic-gate 871*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 872*0Sstevel@tonic-gate$(DISTVNAME).tar$(SUFFIX) : distdir 873*0Sstevel@tonic-gate $(PREOP) 874*0Sstevel@tonic-gate $(TO_UNIX) 875*0Sstevel@tonic-gate $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME) 876*0Sstevel@tonic-gate $(RM_RF) $(DISTVNAME) 877*0Sstevel@tonic-gate $(COMPRESS) $(DISTVNAME).tar 878*0Sstevel@tonic-gate $(POSTOP) 879*0Sstevel@tonic-gateMAKE_FRAG 880*0Sstevel@tonic-gate} 881*0Sstevel@tonic-gate 882*0Sstevel@tonic-gate=item zipfile_target 883*0Sstevel@tonic-gate 884*0Sstevel@tonic-gate my $make_frag = $MM->zipfile_target; 885*0Sstevel@tonic-gate 886*0Sstevel@tonic-gateThe name of this target is the name of the zip file generated by 887*0Sstevel@tonic-gatezipdist. This target does the actual work of turning the distdir into 888*0Sstevel@tonic-gatea zip file. 889*0Sstevel@tonic-gate 890*0Sstevel@tonic-gate=cut 891*0Sstevel@tonic-gate 892*0Sstevel@tonic-gatesub zipfile_target { 893*0Sstevel@tonic-gate my($self) = shift; 894*0Sstevel@tonic-gate 895*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 896*0Sstevel@tonic-gate$(DISTVNAME).zip : distdir 897*0Sstevel@tonic-gate $(PREOP) 898*0Sstevel@tonic-gate $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME) 899*0Sstevel@tonic-gate $(RM_RF) $(DISTVNAME) 900*0Sstevel@tonic-gate $(POSTOP) 901*0Sstevel@tonic-gateMAKE_FRAG 902*0Sstevel@tonic-gate} 903*0Sstevel@tonic-gate 904*0Sstevel@tonic-gate=item uutardist_target 905*0Sstevel@tonic-gate 906*0Sstevel@tonic-gate my $make_frag = $MM->uutardist_target; 907*0Sstevel@tonic-gate 908*0Sstevel@tonic-gateConverts the tarfile into a uuencoded file 909*0Sstevel@tonic-gate 910*0Sstevel@tonic-gate=cut 911*0Sstevel@tonic-gate 912*0Sstevel@tonic-gatesub uutardist_target { 913*0Sstevel@tonic-gate my($self) = shift; 914*0Sstevel@tonic-gate 915*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 916*0Sstevel@tonic-gateuutardist : $(DISTVNAME).tar$(SUFFIX) 917*0Sstevel@tonic-gate uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu 918*0Sstevel@tonic-gateMAKE_FRAG 919*0Sstevel@tonic-gate} 920*0Sstevel@tonic-gate 921*0Sstevel@tonic-gate 922*0Sstevel@tonic-gate=item shdist_target 923*0Sstevel@tonic-gate 924*0Sstevel@tonic-gate my $make_frag = $MM->shdist_target; 925*0Sstevel@tonic-gate 926*0Sstevel@tonic-gateConverts the distdir into a shell archive. 927*0Sstevel@tonic-gate 928*0Sstevel@tonic-gate=cut 929*0Sstevel@tonic-gate 930*0Sstevel@tonic-gatesub shdist_target { 931*0Sstevel@tonic-gate my($self) = shift; 932*0Sstevel@tonic-gate 933*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 934*0Sstevel@tonic-gateshdist : distdir 935*0Sstevel@tonic-gate $(PREOP) 936*0Sstevel@tonic-gate $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar 937*0Sstevel@tonic-gate $(RM_RF) $(DISTVNAME) 938*0Sstevel@tonic-gate $(POSTOP) 939*0Sstevel@tonic-gateMAKE_FRAG 940*0Sstevel@tonic-gate} 941*0Sstevel@tonic-gate 942*0Sstevel@tonic-gate=item distdir 943*0Sstevel@tonic-gate 944*0Sstevel@tonic-gateDefines the scratch directory target that will hold the distribution 945*0Sstevel@tonic-gatebefore tar-ing (or shar-ing). 946*0Sstevel@tonic-gate 947*0Sstevel@tonic-gate=cut 948*0Sstevel@tonic-gate 949*0Sstevel@tonic-gate# For backwards compatibility. 950*0Sstevel@tonic-gate*dist_dir = *distdir; 951*0Sstevel@tonic-gate 952*0Sstevel@tonic-gatesub distdir { 953*0Sstevel@tonic-gate my($self) = shift; 954*0Sstevel@tonic-gate 955*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 956*0Sstevel@tonic-gatedistdir : metafile metafile_addtomanifest 957*0Sstevel@tonic-gate $(RM_RF) $(DISTVNAME) 958*0Sstevel@tonic-gate $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \ 959*0Sstevel@tonic-gate -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');" 960*0Sstevel@tonic-gate 961*0Sstevel@tonic-gateMAKE_FRAG 962*0Sstevel@tonic-gate 963*0Sstevel@tonic-gate} 964*0Sstevel@tonic-gate 965*0Sstevel@tonic-gate=item dist_test 966*0Sstevel@tonic-gate 967*0Sstevel@tonic-gateDefines a target that produces the distribution in the 968*0Sstevel@tonic-gatescratchdirectory, and runs 'perl Makefile.PL; make ;make test' in that 969*0Sstevel@tonic-gatesubdirectory. 970*0Sstevel@tonic-gate 971*0Sstevel@tonic-gate=cut 972*0Sstevel@tonic-gate 973*0Sstevel@tonic-gatesub dist_test { 974*0Sstevel@tonic-gate my($self) = shift; 975*0Sstevel@tonic-gate my @m; 976*0Sstevel@tonic-gate push @m, q{ 977*0Sstevel@tonic-gatedisttest : distdir 978*0Sstevel@tonic-gate cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL 979*0Sstevel@tonic-gate cd $(DISTVNAME) && $(MAKE) $(PASTHRU) 980*0Sstevel@tonic-gate cd $(DISTVNAME) && $(MAKE) test $(PASTHRU) 981*0Sstevel@tonic-gate}; 982*0Sstevel@tonic-gate join "", @m; 983*0Sstevel@tonic-gate} 984*0Sstevel@tonic-gate 985*0Sstevel@tonic-gate=item dlsyms (o) 986*0Sstevel@tonic-gate 987*0Sstevel@tonic-gateUsed by AIX and VMS to define DL_FUNCS and DL_VARS and write the *.exp 988*0Sstevel@tonic-gatefiles. 989*0Sstevel@tonic-gate 990*0Sstevel@tonic-gate=cut 991*0Sstevel@tonic-gate 992*0Sstevel@tonic-gatesub dlsyms { 993*0Sstevel@tonic-gate my($self,%attribs) = @_; 994*0Sstevel@tonic-gate 995*0Sstevel@tonic-gate return '' unless ($Is_AIX && $self->needs_linking() ); 996*0Sstevel@tonic-gate 997*0Sstevel@tonic-gate my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {}; 998*0Sstevel@tonic-gate my($vars) = $attribs{DL_VARS} || $self->{DL_VARS} || []; 999*0Sstevel@tonic-gate my($funclist) = $attribs{FUNCLIST} || $self->{FUNCLIST} || []; 1000*0Sstevel@tonic-gate my(@m); 1001*0Sstevel@tonic-gate 1002*0Sstevel@tonic-gate push(@m," 1003*0Sstevel@tonic-gatedynamic :: $self->{BASEEXT}.exp 1004*0Sstevel@tonic-gate 1005*0Sstevel@tonic-gate") unless $self->{SKIPHASH}{'dynamic'}; # dynamic and static are subs, so... 1006*0Sstevel@tonic-gate 1007*0Sstevel@tonic-gate push(@m," 1008*0Sstevel@tonic-gatestatic :: $self->{BASEEXT}.exp 1009*0Sstevel@tonic-gate 1010*0Sstevel@tonic-gate") unless $self->{SKIPHASH}{'static'}; # we avoid a warning if we tick them 1011*0Sstevel@tonic-gate 1012*0Sstevel@tonic-gate push(@m," 1013*0Sstevel@tonic-gate$self->{BASEEXT}.exp: Makefile.PL 1014*0Sstevel@tonic-gate",' $(PERLRUN) -e \'use ExtUtils::Mksymlists; \\ 1015*0Sstevel@tonic-gate Mksymlists("NAME" => "',$self->{NAME},'", "DL_FUNCS" => ', 1016*0Sstevel@tonic-gate neatvalue($funcs), ', "FUNCLIST" => ', neatvalue($funclist), 1017*0Sstevel@tonic-gate ', "DL_VARS" => ', neatvalue($vars), ');\' 1018*0Sstevel@tonic-gate'); 1019*0Sstevel@tonic-gate 1020*0Sstevel@tonic-gate join('',@m); 1021*0Sstevel@tonic-gate} 1022*0Sstevel@tonic-gate 1023*0Sstevel@tonic-gate=item dynamic (o) 1024*0Sstevel@tonic-gate 1025*0Sstevel@tonic-gateDefines the dynamic target. 1026*0Sstevel@tonic-gate 1027*0Sstevel@tonic-gate=cut 1028*0Sstevel@tonic-gate 1029*0Sstevel@tonic-gatesub dynamic { 1030*0Sstevel@tonic-gate# --- Dynamic Loading Sections --- 1031*0Sstevel@tonic-gate 1032*0Sstevel@tonic-gate my($self) = shift; 1033*0Sstevel@tonic-gate ' 1034*0Sstevel@tonic-gatedynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT) 1035*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 1036*0Sstevel@tonic-gate'; 1037*0Sstevel@tonic-gate} 1038*0Sstevel@tonic-gate 1039*0Sstevel@tonic-gate=item dynamic_bs (o) 1040*0Sstevel@tonic-gate 1041*0Sstevel@tonic-gateDefines targets for bootstrap files. 1042*0Sstevel@tonic-gate 1043*0Sstevel@tonic-gate=cut 1044*0Sstevel@tonic-gate 1045*0Sstevel@tonic-gatesub dynamic_bs { 1046*0Sstevel@tonic-gate my($self, %attribs) = @_; 1047*0Sstevel@tonic-gate return ' 1048*0Sstevel@tonic-gateBOOTSTRAP = 1049*0Sstevel@tonic-gate' unless $self->has_link_code(); 1050*0Sstevel@tonic-gate 1051*0Sstevel@tonic-gate return <<'MAKE_FRAG'; 1052*0Sstevel@tonic-gateBOOTSTRAP = $(BASEEXT).bs 1053*0Sstevel@tonic-gate 1054*0Sstevel@tonic-gate# As Mkbootstrap might not write a file (if none is required) 1055*0Sstevel@tonic-gate# we use touch to prevent make continually trying to remake it. 1056*0Sstevel@tonic-gate# The DynaLoader only reads a non-empty file. 1057*0Sstevel@tonic-gate$(BOOTSTRAP): $(FIRST_MAKEFILE) $(BOOTDEP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists 1058*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))" 1059*0Sstevel@tonic-gate $(NOECHO) $(PERLRUN) \ 1060*0Sstevel@tonic-gate "-MExtUtils::Mkbootstrap" \ 1061*0Sstevel@tonic-gate -e "Mkbootstrap('$(BASEEXT)','$(BSLOADLIBS)');" 1062*0Sstevel@tonic-gate $(NOECHO) $(TOUCH) $(BOOTSTRAP) 1063*0Sstevel@tonic-gate $(CHMOD) $(PERM_RW) $@ 1064*0Sstevel@tonic-gate 1065*0Sstevel@tonic-gate$(INST_BOOT): $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists 1066*0Sstevel@tonic-gate $(NOECHO) $(RM_RF) $(INST_BOOT) 1067*0Sstevel@tonic-gate -$(CP) $(BOOTSTRAP) $(INST_BOOT) 1068*0Sstevel@tonic-gate $(CHMOD) $(PERM_RW) $@ 1069*0Sstevel@tonic-gateMAKE_FRAG 1070*0Sstevel@tonic-gate} 1071*0Sstevel@tonic-gate 1072*0Sstevel@tonic-gate=item dynamic_lib (o) 1073*0Sstevel@tonic-gate 1074*0Sstevel@tonic-gateDefines how to produce the *.so (or equivalent) files. 1075*0Sstevel@tonic-gate 1076*0Sstevel@tonic-gate=cut 1077*0Sstevel@tonic-gate 1078*0Sstevel@tonic-gatesub dynamic_lib { 1079*0Sstevel@tonic-gate my($self, %attribs) = @_; 1080*0Sstevel@tonic-gate return '' unless $self->needs_linking(); #might be because of a subdir 1081*0Sstevel@tonic-gate 1082*0Sstevel@tonic-gate return '' unless $self->has_link_code; 1083*0Sstevel@tonic-gate 1084*0Sstevel@tonic-gate my($otherldflags) = $attribs{OTHERLDFLAGS} || ""; 1085*0Sstevel@tonic-gate my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || ""; 1086*0Sstevel@tonic-gate my($armaybe) = $attribs{ARMAYBE} || $self->{ARMAYBE} || ":"; 1087*0Sstevel@tonic-gate my($ldfrom) = '$(LDFROM)'; 1088*0Sstevel@tonic-gate $armaybe = 'ar' if ($Is_OSF and $armaybe eq ':'); 1089*0Sstevel@tonic-gate my(@m); 1090*0Sstevel@tonic-gate my $ld_opt = $Is_OS2 ? '$(OPTIMIZE) ' : ''; # Useful on other systems too? 1091*0Sstevel@tonic-gate my $ld_fix = $Is_OS2 ? '|| ( $(RM_F) $@ && sh -c false )' : ''; 1092*0Sstevel@tonic-gate push(@m,' 1093*0Sstevel@tonic-gate# This section creates the dynamically loadable $(INST_DYNAMIC) 1094*0Sstevel@tonic-gate# from $(OBJECT) and possibly $(MYEXTLIB). 1095*0Sstevel@tonic-gateARMAYBE = '.$armaybe.' 1096*0Sstevel@tonic-gateOTHERLDFLAGS = '.$ld_opt.$otherldflags.' 1097*0Sstevel@tonic-gateINST_DYNAMIC_DEP = '.$inst_dynamic_dep.' 1098*0Sstevel@tonic-gateINST_DYNAMIC_FIX = '.$ld_fix.' 1099*0Sstevel@tonic-gate 1100*0Sstevel@tonic-gate$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP) 1101*0Sstevel@tonic-gate'); 1102*0Sstevel@tonic-gate if ($armaybe ne ':'){ 1103*0Sstevel@tonic-gate $ldfrom = 'tmp$(LIB_EXT)'; 1104*0Sstevel@tonic-gate push(@m,' $(ARMAYBE) cr '.$ldfrom.' $(OBJECT)'."\n"); 1105*0Sstevel@tonic-gate push(@m,' $(RANLIB) '."$ldfrom\n"); 1106*0Sstevel@tonic-gate } 1107*0Sstevel@tonic-gate $ldfrom = "-all $ldfrom -none" if $Is_OSF; 1108*0Sstevel@tonic-gate 1109*0Sstevel@tonic-gate # The IRIX linker doesn't use LD_RUN_PATH 1110*0Sstevel@tonic-gate my $ldrun = $Is_IRIX && $self->{LD_RUN_PATH} ? 1111*0Sstevel@tonic-gate qq{-rpath "$self->{LD_RUN_PATH}"} : ''; 1112*0Sstevel@tonic-gate 1113*0Sstevel@tonic-gate # For example in AIX the shared objects/libraries from previous builds 1114*0Sstevel@tonic-gate # linger quite a while in the shared dynalinker cache even when nobody 1115*0Sstevel@tonic-gate # is using them. This is painful if one for instance tries to restart 1116*0Sstevel@tonic-gate # a failed build because the link command will fail unnecessarily 'cos 1117*0Sstevel@tonic-gate # the shared object/library is 'busy'. 1118*0Sstevel@tonic-gate push(@m,' $(RM_F) $@ 1119*0Sstevel@tonic-gate'); 1120*0Sstevel@tonic-gate 1121*0Sstevel@tonic-gate my $libs = '$(LDLOADLIBS)'; 1122*0Sstevel@tonic-gate 1123*0Sstevel@tonic-gate if ($Is_NetBSD) { 1124*0Sstevel@tonic-gate # Use nothing on static perl platforms, and to the flags needed 1125*0Sstevel@tonic-gate # to link against the shared libperl library on shared perl 1126*0Sstevel@tonic-gate # platforms. We peek at lddlflags to see if we need -Wl,-R 1127*0Sstevel@tonic-gate # or -R to add paths to the run-time library search path. 1128*0Sstevel@tonic-gate if ($Config{'useshrplib'}) { 1129*0Sstevel@tonic-gate if ($Config{'lddlflags'} =~ /-Wl,-R/) { 1130*0Sstevel@tonic-gate $libs .= ' -L$(PERL_INC) -Wl,-R$(INSTALLARCHLIB)/CORE -lperl'; 1131*0Sstevel@tonic-gate } elsif ($Config{'lddlflags'} =~ /-R/) { 1132*0Sstevel@tonic-gate $libs .= ' -L$(PERL_INC) -R$(INSTALLARCHLIB)/CORE -lperl'; 1133*0Sstevel@tonic-gate } 1134*0Sstevel@tonic-gate } 1135*0Sstevel@tonic-gate } 1136*0Sstevel@tonic-gate 1137*0Sstevel@tonic-gate push(@m, 1138*0Sstevel@tonic-gate' LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) '.$ldrun.' $(LDDLFLAGS) '.$ldfrom. 1139*0Sstevel@tonic-gate' $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) '.$libs.' $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $(INST_DYNAMIC_FIX)'); 1140*0Sstevel@tonic-gate push @m, ' 1141*0Sstevel@tonic-gate $(CHMOD) $(PERM_RWX) $@ 1142*0Sstevel@tonic-gate'; 1143*0Sstevel@tonic-gate 1144*0Sstevel@tonic-gate push @m, $self->dir_target('$(INST_ARCHAUTODIR)'); 1145*0Sstevel@tonic-gate join('',@m); 1146*0Sstevel@tonic-gate} 1147*0Sstevel@tonic-gate 1148*0Sstevel@tonic-gate=item exescan 1149*0Sstevel@tonic-gate 1150*0Sstevel@tonic-gateDeprecated method. Use libscan instead. 1151*0Sstevel@tonic-gate 1152*0Sstevel@tonic-gate=cut 1153*0Sstevel@tonic-gate 1154*0Sstevel@tonic-gatesub exescan { 1155*0Sstevel@tonic-gate my($self,$path) = @_; 1156*0Sstevel@tonic-gate $path; 1157*0Sstevel@tonic-gate} 1158*0Sstevel@tonic-gate 1159*0Sstevel@tonic-gate=item extliblist 1160*0Sstevel@tonic-gate 1161*0Sstevel@tonic-gateCalled by init_others, and calls ext ExtUtils::Liblist. See 1162*0Sstevel@tonic-gateL<ExtUtils::Liblist> for details. 1163*0Sstevel@tonic-gate 1164*0Sstevel@tonic-gate=cut 1165*0Sstevel@tonic-gate 1166*0Sstevel@tonic-gatesub extliblist { 1167*0Sstevel@tonic-gate my($self,$libs) = @_; 1168*0Sstevel@tonic-gate require ExtUtils::Liblist; 1169*0Sstevel@tonic-gate $self->ext($libs, $Verbose); 1170*0Sstevel@tonic-gate} 1171*0Sstevel@tonic-gate 1172*0Sstevel@tonic-gate=item find_perl 1173*0Sstevel@tonic-gate 1174*0Sstevel@tonic-gateFinds the executables PERL and FULLPERL 1175*0Sstevel@tonic-gate 1176*0Sstevel@tonic-gate=cut 1177*0Sstevel@tonic-gate 1178*0Sstevel@tonic-gatesub find_perl { 1179*0Sstevel@tonic-gate my($self, $ver, $names, $dirs, $trace) = @_; 1180*0Sstevel@tonic-gate my($name, $dir); 1181*0Sstevel@tonic-gate if ($trace >= 2){ 1182*0Sstevel@tonic-gate print "Looking for perl $ver by these names: 1183*0Sstevel@tonic-gate@$names 1184*0Sstevel@tonic-gatein these dirs: 1185*0Sstevel@tonic-gate@$dirs 1186*0Sstevel@tonic-gate"; 1187*0Sstevel@tonic-gate } 1188*0Sstevel@tonic-gate 1189*0Sstevel@tonic-gate my $stderr_duped = 0; 1190*0Sstevel@tonic-gate local *STDERR_COPY; 1191*0Sstevel@tonic-gate unless ($Is_BSD) { 1192*0Sstevel@tonic-gate if( open(STDERR_COPY, '>&STDERR') ) { 1193*0Sstevel@tonic-gate $stderr_duped = 1; 1194*0Sstevel@tonic-gate } 1195*0Sstevel@tonic-gate else { 1196*0Sstevel@tonic-gate warn <<WARNING; 1197*0Sstevel@tonic-gatefind_perl() can't dup STDERR: $! 1198*0Sstevel@tonic-gateYou might see some garbage while we search for Perl 1199*0Sstevel@tonic-gateWARNING 1200*0Sstevel@tonic-gate } 1201*0Sstevel@tonic-gate } 1202*0Sstevel@tonic-gate 1203*0Sstevel@tonic-gate foreach $name (@$names){ 1204*0Sstevel@tonic-gate foreach $dir (@$dirs){ 1205*0Sstevel@tonic-gate next unless defined $dir; # $self->{PERL_SRC} may be undefined 1206*0Sstevel@tonic-gate my ($abs, $val); 1207*0Sstevel@tonic-gate if ($self->file_name_is_absolute($name)) { # /foo/bar 1208*0Sstevel@tonic-gate $abs = $name; 1209*0Sstevel@tonic-gate } elsif ($self->canonpath($name) eq 1210*0Sstevel@tonic-gate $self->canonpath(basename($name))) { # foo 1211*0Sstevel@tonic-gate $abs = $self->catfile($dir, $name); 1212*0Sstevel@tonic-gate } else { # foo/bar 1213*0Sstevel@tonic-gate $abs = $self->catfile($Curdir, $name); 1214*0Sstevel@tonic-gate } 1215*0Sstevel@tonic-gate print "Checking $abs\n" if ($trace >= 2); 1216*0Sstevel@tonic-gate next unless $self->maybe_command($abs); 1217*0Sstevel@tonic-gate print "Executing $abs\n" if ($trace >= 2); 1218*0Sstevel@tonic-gate 1219*0Sstevel@tonic-gate my $version_check = qq{$abs -e "require $ver; print qq{VER_OK\n}"}; 1220*0Sstevel@tonic-gate # To avoid using the unportable 2>&1 to supress STDERR, 1221*0Sstevel@tonic-gate # we close it before running the command. 1222*0Sstevel@tonic-gate # However, thanks to a thread library bug in many BSDs 1223*0Sstevel@tonic-gate # ( http://www.freebsd.org/cgi/query-pr.cgi?pr=51535 ) 1224*0Sstevel@tonic-gate # we cannot use the fancier more portable way in here 1225*0Sstevel@tonic-gate # but instead need to use the traditional 2>&1 construct. 1226*0Sstevel@tonic-gate if ($Is_BSD) { 1227*0Sstevel@tonic-gate $val = `$version_check 2>&1`; 1228*0Sstevel@tonic-gate } else { 1229*0Sstevel@tonic-gate close STDERR if $stderr_duped; 1230*0Sstevel@tonic-gate $val = `$version_check`; 1231*0Sstevel@tonic-gate open STDERR, '>&STDERR_COPY' if $stderr_duped; 1232*0Sstevel@tonic-gate } 1233*0Sstevel@tonic-gate 1234*0Sstevel@tonic-gate if ($val =~ /^VER_OK/) { 1235*0Sstevel@tonic-gate print "Using PERL=$abs\n" if $trace; 1236*0Sstevel@tonic-gate return $abs; 1237*0Sstevel@tonic-gate } elsif ($trace >= 2) { 1238*0Sstevel@tonic-gate print "Result: '$val'\n"; 1239*0Sstevel@tonic-gate } 1240*0Sstevel@tonic-gate } 1241*0Sstevel@tonic-gate } 1242*0Sstevel@tonic-gate print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n"; 1243*0Sstevel@tonic-gate 0; # false and not empty 1244*0Sstevel@tonic-gate} 1245*0Sstevel@tonic-gate 1246*0Sstevel@tonic-gate=item find_tests 1247*0Sstevel@tonic-gate 1248*0Sstevel@tonic-gate my $test = $mm->find_tests; 1249*0Sstevel@tonic-gate 1250*0Sstevel@tonic-gateReturns a string suitable for feeding to the shell to return all 1251*0Sstevel@tonic-gatetests in t/*.t. 1252*0Sstevel@tonic-gate 1253*0Sstevel@tonic-gate=cut 1254*0Sstevel@tonic-gate 1255*0Sstevel@tonic-gatesub find_tests { 1256*0Sstevel@tonic-gate my($self) = shift; 1257*0Sstevel@tonic-gate return 't/*.t'; 1258*0Sstevel@tonic-gate} 1259*0Sstevel@tonic-gate 1260*0Sstevel@tonic-gate=back 1261*0Sstevel@tonic-gate 1262*0Sstevel@tonic-gate=head2 Methods to actually produce chunks of text for the Makefile 1263*0Sstevel@tonic-gate 1264*0Sstevel@tonic-gateThe methods here are called for each MakeMaker object in the order 1265*0Sstevel@tonic-gatespecified by @ExtUtils::MakeMaker::MM_Sections. 1266*0Sstevel@tonic-gate 1267*0Sstevel@tonic-gate=over 2 1268*0Sstevel@tonic-gate 1269*0Sstevel@tonic-gate=item fixin 1270*0Sstevel@tonic-gate 1271*0Sstevel@tonic-gate $mm->fixin(@files); 1272*0Sstevel@tonic-gate 1273*0Sstevel@tonic-gateInserts the sharpbang or equivalent magic number to a set of @files. 1274*0Sstevel@tonic-gate 1275*0Sstevel@tonic-gate=cut 1276*0Sstevel@tonic-gate 1277*0Sstevel@tonic-gatesub fixin { # stolen from the pink Camel book, more or less 1278*0Sstevel@tonic-gate my($self, @files) = @_; 1279*0Sstevel@tonic-gate 1280*0Sstevel@tonic-gate my($does_shbang) = $Config{'sharpbang'} =~ /^\s*\#\!/; 1281*0Sstevel@tonic-gate for my $file (@files) { 1282*0Sstevel@tonic-gate my $file_new = "$file.new"; 1283*0Sstevel@tonic-gate my $file_bak = "$file.bak"; 1284*0Sstevel@tonic-gate 1285*0Sstevel@tonic-gate local(*FIXIN); 1286*0Sstevel@tonic-gate local(*FIXOUT); 1287*0Sstevel@tonic-gate open(FIXIN, $file) or croak "Can't process '$file': $!"; 1288*0Sstevel@tonic-gate local $/ = "\n"; 1289*0Sstevel@tonic-gate chomp(my $line = <FIXIN>); 1290*0Sstevel@tonic-gate next unless $line =~ s/^\s*\#!\s*//; # Not a shbang file. 1291*0Sstevel@tonic-gate # Now figure out the interpreter name. 1292*0Sstevel@tonic-gate my($cmd,$arg) = split ' ', $line, 2; 1293*0Sstevel@tonic-gate $cmd =~ s!^.*/!!; 1294*0Sstevel@tonic-gate 1295*0Sstevel@tonic-gate # Now look (in reverse) for interpreter in absolute PATH (unless perl). 1296*0Sstevel@tonic-gate my $interpreter; 1297*0Sstevel@tonic-gate if ($cmd eq "perl") { 1298*0Sstevel@tonic-gate if ($Config{startperl} =~ m,^\#!.*/perl,) { 1299*0Sstevel@tonic-gate $interpreter = $Config{startperl}; 1300*0Sstevel@tonic-gate $interpreter =~ s,^\#!,,; 1301*0Sstevel@tonic-gate } else { 1302*0Sstevel@tonic-gate $interpreter = $Config{perlpath}; 1303*0Sstevel@tonic-gate } 1304*0Sstevel@tonic-gate } else { 1305*0Sstevel@tonic-gate my(@absdirs) = reverse grep {$self->file_name_is_absolute} $self->path; 1306*0Sstevel@tonic-gate $interpreter = ''; 1307*0Sstevel@tonic-gate my($dir); 1308*0Sstevel@tonic-gate foreach $dir (@absdirs) { 1309*0Sstevel@tonic-gate if ($self->maybe_command($cmd)) { 1310*0Sstevel@tonic-gate warn "Ignoring $interpreter in $file\n" if $Verbose && $interpreter; 1311*0Sstevel@tonic-gate $interpreter = $self->catfile($dir,$cmd); 1312*0Sstevel@tonic-gate } 1313*0Sstevel@tonic-gate } 1314*0Sstevel@tonic-gate } 1315*0Sstevel@tonic-gate # Figure out how to invoke interpreter on this machine. 1316*0Sstevel@tonic-gate 1317*0Sstevel@tonic-gate my($shb) = ""; 1318*0Sstevel@tonic-gate if ($interpreter) { 1319*0Sstevel@tonic-gate print STDOUT "Changing sharpbang in $file to $interpreter" if $Verbose; 1320*0Sstevel@tonic-gate # this is probably value-free on DOSISH platforms 1321*0Sstevel@tonic-gate if ($does_shbang) { 1322*0Sstevel@tonic-gate $shb .= "$Config{'sharpbang'}$interpreter"; 1323*0Sstevel@tonic-gate $shb .= ' ' . $arg if defined $arg; 1324*0Sstevel@tonic-gate $shb .= "\n"; 1325*0Sstevel@tonic-gate } 1326*0Sstevel@tonic-gate $shb .= qq{ 1327*0Sstevel@tonic-gateeval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}' 1328*0Sstevel@tonic-gate if 0; # not running under some shell 1329*0Sstevel@tonic-gate} unless $Is_Win32; # this won't work on win32, so don't 1330*0Sstevel@tonic-gate } else { 1331*0Sstevel@tonic-gate warn "Can't find $cmd in PATH, $file unchanged" 1332*0Sstevel@tonic-gate if $Verbose; 1333*0Sstevel@tonic-gate next; 1334*0Sstevel@tonic-gate } 1335*0Sstevel@tonic-gate 1336*0Sstevel@tonic-gate unless ( open(FIXOUT,">$file_new") ) { 1337*0Sstevel@tonic-gate warn "Can't create new $file: $!\n"; 1338*0Sstevel@tonic-gate next; 1339*0Sstevel@tonic-gate } 1340*0Sstevel@tonic-gate 1341*0Sstevel@tonic-gate # Print out the new #! line (or equivalent). 1342*0Sstevel@tonic-gate local $\; 1343*0Sstevel@tonic-gate undef $/; 1344*0Sstevel@tonic-gate print FIXOUT $shb, <FIXIN>; 1345*0Sstevel@tonic-gate close FIXIN; 1346*0Sstevel@tonic-gate close FIXOUT; 1347*0Sstevel@tonic-gate 1348*0Sstevel@tonic-gate chmod 0666, $file_bak; 1349*0Sstevel@tonic-gate unlink $file_bak; 1350*0Sstevel@tonic-gate unless ( rename($file, $file_bak) ) { 1351*0Sstevel@tonic-gate warn "Can't rename $file to $file_bak: $!"; 1352*0Sstevel@tonic-gate next; 1353*0Sstevel@tonic-gate } 1354*0Sstevel@tonic-gate unless ( rename($file_new, $file) ) { 1355*0Sstevel@tonic-gate warn "Can't rename $file_new to $file: $!"; 1356*0Sstevel@tonic-gate unless ( rename($file_bak, $file) ) { 1357*0Sstevel@tonic-gate warn "Can't rename $file_bak back to $file either: $!"; 1358*0Sstevel@tonic-gate warn "Leaving $file renamed as $file_bak\n"; 1359*0Sstevel@tonic-gate } 1360*0Sstevel@tonic-gate next; 1361*0Sstevel@tonic-gate } 1362*0Sstevel@tonic-gate unlink $file_bak; 1363*0Sstevel@tonic-gate } continue { 1364*0Sstevel@tonic-gate close(FIXIN) if fileno(FIXIN); 1365*0Sstevel@tonic-gate system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';; 1366*0Sstevel@tonic-gate } 1367*0Sstevel@tonic-gate} 1368*0Sstevel@tonic-gate 1369*0Sstevel@tonic-gate=item force (o) 1370*0Sstevel@tonic-gate 1371*0Sstevel@tonic-gateJust writes FORCE: 1372*0Sstevel@tonic-gate 1373*0Sstevel@tonic-gate=cut 1374*0Sstevel@tonic-gate 1375*0Sstevel@tonic-gatesub force { 1376*0Sstevel@tonic-gate my($self) = shift; 1377*0Sstevel@tonic-gate '# Phony target to force checking subdirectories. 1378*0Sstevel@tonic-gateFORCE: 1379*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 1380*0Sstevel@tonic-gate'; 1381*0Sstevel@tonic-gate} 1382*0Sstevel@tonic-gate 1383*0Sstevel@tonic-gate=item guess_name 1384*0Sstevel@tonic-gate 1385*0Sstevel@tonic-gateGuess the name of this package by examining the working directory's 1386*0Sstevel@tonic-gatename. MakeMaker calls this only if the developer has not supplied a 1387*0Sstevel@tonic-gateNAME attribute. 1388*0Sstevel@tonic-gate 1389*0Sstevel@tonic-gate=cut 1390*0Sstevel@tonic-gate 1391*0Sstevel@tonic-gate# '; 1392*0Sstevel@tonic-gate 1393*0Sstevel@tonic-gatesub guess_name { 1394*0Sstevel@tonic-gate my($self) = @_; 1395*0Sstevel@tonic-gate use Cwd 'cwd'; 1396*0Sstevel@tonic-gate my $name = basename(cwd()); 1397*0Sstevel@tonic-gate $name =~ s|[\-_][\d\.\-]+\z||; # this is new with MM 5.00, we 1398*0Sstevel@tonic-gate # strip minus or underline 1399*0Sstevel@tonic-gate # followed by a float or some such 1400*0Sstevel@tonic-gate print "Warning: Guessing NAME [$name] from current directory name.\n"; 1401*0Sstevel@tonic-gate $name; 1402*0Sstevel@tonic-gate} 1403*0Sstevel@tonic-gate 1404*0Sstevel@tonic-gate=item has_link_code 1405*0Sstevel@tonic-gate 1406*0Sstevel@tonic-gateReturns true if C, XS, MYEXTLIB or similar objects exist within this 1407*0Sstevel@tonic-gateobject that need a compiler. Does not descend into subdirectories as 1408*0Sstevel@tonic-gateneeds_linking() does. 1409*0Sstevel@tonic-gate 1410*0Sstevel@tonic-gate=cut 1411*0Sstevel@tonic-gate 1412*0Sstevel@tonic-gatesub has_link_code { 1413*0Sstevel@tonic-gate my($self) = shift; 1414*0Sstevel@tonic-gate return $self->{HAS_LINK_CODE} if defined $self->{HAS_LINK_CODE}; 1415*0Sstevel@tonic-gate if ($self->{OBJECT} or @{$self->{C} || []} or $self->{MYEXTLIB}){ 1416*0Sstevel@tonic-gate $self->{HAS_LINK_CODE} = 1; 1417*0Sstevel@tonic-gate return 1; 1418*0Sstevel@tonic-gate } 1419*0Sstevel@tonic-gate return $self->{HAS_LINK_CODE} = 0; 1420*0Sstevel@tonic-gate} 1421*0Sstevel@tonic-gate 1422*0Sstevel@tonic-gate 1423*0Sstevel@tonic-gate=item init_dirscan 1424*0Sstevel@tonic-gate 1425*0Sstevel@tonic-gateScans the directory structure and initializes DIR, XS, XS_FILES, PM, 1426*0Sstevel@tonic-gateC, C_FILES, O_FILES, H, H_FILES, PL_FILES, MAN*PODS, EXE_FILES. 1427*0Sstevel@tonic-gate 1428*0Sstevel@tonic-gateCalled by init_main. 1429*0Sstevel@tonic-gate 1430*0Sstevel@tonic-gate=cut 1431*0Sstevel@tonic-gate 1432*0Sstevel@tonic-gatesub init_dirscan { # --- File and Directory Lists (.xs .pm .pod etc) 1433*0Sstevel@tonic-gate my($self) = @_; 1434*0Sstevel@tonic-gate my($name, %dir, %xs, %c, %h, %ignore, %pl_files, %manifypods); 1435*0Sstevel@tonic-gate my %pm; 1436*0Sstevel@tonic-gate 1437*0Sstevel@tonic-gate @ignore{qw(Makefile.PL test.pl t)} = (1,1,1); 1438*0Sstevel@tonic-gate 1439*0Sstevel@tonic-gate # ignore the distdir 1440*0Sstevel@tonic-gate $Is_VMS ? $ignore{"$self->{DISTVNAME}.dir"} = 1 1441*0Sstevel@tonic-gate : $ignore{$self->{DISTVNAME}} = 1; 1442*0Sstevel@tonic-gate 1443*0Sstevel@tonic-gate @ignore{map lc, keys %ignore} = values %ignore if $Is_VMS; 1444*0Sstevel@tonic-gate 1445*0Sstevel@tonic-gate foreach $name ($self->lsdir($Curdir)){ 1446*0Sstevel@tonic-gate next if $name =~ /\#/; 1447*0Sstevel@tonic-gate next if $name eq $Curdir or $name eq $Updir or $ignore{$name}; 1448*0Sstevel@tonic-gate next unless $self->libscan($name); 1449*0Sstevel@tonic-gate if (-d $name){ 1450*0Sstevel@tonic-gate next if -l $name; # We do not support symlinks at all 1451*0Sstevel@tonic-gate next if $self->{NORECURS}; 1452*0Sstevel@tonic-gate $dir{$name} = $name if (-f $self->catfile($name,"Makefile.PL")); 1453*0Sstevel@tonic-gate } elsif ($name =~ /\.xs\z/){ 1454*0Sstevel@tonic-gate my($c); ($c = $name) =~ s/\.xs\z/.c/; 1455*0Sstevel@tonic-gate $xs{$name} = $c; 1456*0Sstevel@tonic-gate $c{$c} = 1; 1457*0Sstevel@tonic-gate } elsif ($name =~ /\.c(pp|xx|c)?\z/i){ # .c .C .cpp .cxx .cc 1458*0Sstevel@tonic-gate $c{$name} = 1 1459*0Sstevel@tonic-gate unless $name =~ m/perlmain\.c/; # See MAP_TARGET 1460*0Sstevel@tonic-gate } elsif ($name =~ /\.h\z/i){ 1461*0Sstevel@tonic-gate $h{$name} = 1; 1462*0Sstevel@tonic-gate } elsif ($name =~ /\.PL\z/) { 1463*0Sstevel@tonic-gate ($pl_files{$name} = $name) =~ s/\.PL\z// ; 1464*0Sstevel@tonic-gate } elsif (($Is_VMS || $Is_Dos) && $name =~ /[._]pl$/i) { 1465*0Sstevel@tonic-gate # case-insensitive filesystem, one dot per name, so foo.h.PL 1466*0Sstevel@tonic-gate # under Unix appears as foo.h_pl under VMS or fooh.pl on Dos 1467*0Sstevel@tonic-gate local($/); open(PL,$name); my $txt = <PL>; close PL; 1468*0Sstevel@tonic-gate if ($txt =~ /Extracting \S+ \(with variable substitutions/) { 1469*0Sstevel@tonic-gate ($pl_files{$name} = $name) =~ s/[._]pl\z//i ; 1470*0Sstevel@tonic-gate } 1471*0Sstevel@tonic-gate else { 1472*0Sstevel@tonic-gate $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); 1473*0Sstevel@tonic-gate } 1474*0Sstevel@tonic-gate } elsif ($name =~ /\.(p[ml]|pod)\z/){ 1475*0Sstevel@tonic-gate $pm{$name} = $self->catfile($self->{INST_LIBDIR},$name); 1476*0Sstevel@tonic-gate } 1477*0Sstevel@tonic-gate } 1478*0Sstevel@tonic-gate 1479*0Sstevel@tonic-gate # Some larger extensions often wish to install a number of *.pm/pl 1480*0Sstevel@tonic-gate # files into the library in various locations. 1481*0Sstevel@tonic-gate 1482*0Sstevel@tonic-gate # The attribute PMLIBDIRS holds an array reference which lists 1483*0Sstevel@tonic-gate # subdirectories which we should search for library files to 1484*0Sstevel@tonic-gate # install. PMLIBDIRS defaults to [ 'lib', $self->{BASEEXT} ]. We 1485*0Sstevel@tonic-gate # recursively search through the named directories (skipping any 1486*0Sstevel@tonic-gate # which don't exist or contain Makefile.PL files). 1487*0Sstevel@tonic-gate 1488*0Sstevel@tonic-gate # For each *.pm or *.pl file found $self->libscan() is called with 1489*0Sstevel@tonic-gate # the default installation path in $_[1]. The return value of 1490*0Sstevel@tonic-gate # libscan defines the actual installation location. The default 1491*0Sstevel@tonic-gate # libscan function simply returns the path. The file is skipped 1492*0Sstevel@tonic-gate # if libscan returns false. 1493*0Sstevel@tonic-gate 1494*0Sstevel@tonic-gate # The default installation location passed to libscan in $_[1] is: 1495*0Sstevel@tonic-gate # 1496*0Sstevel@tonic-gate # ./*.pm => $(INST_LIBDIR)/*.pm 1497*0Sstevel@tonic-gate # ./xyz/... => $(INST_LIBDIR)/xyz/... 1498*0Sstevel@tonic-gate # ./lib/... => $(INST_LIB)/... 1499*0Sstevel@tonic-gate # 1500*0Sstevel@tonic-gate # In this way the 'lib' directory is seen as the root of the actual 1501*0Sstevel@tonic-gate # perl library whereas the others are relative to INST_LIBDIR 1502*0Sstevel@tonic-gate # (which includes PARENT_NAME). This is a subtle distinction but one 1503*0Sstevel@tonic-gate # that's important for nested modules. 1504*0Sstevel@tonic-gate 1505*0Sstevel@tonic-gate unless( $self->{PMLIBDIRS} ) { 1506*0Sstevel@tonic-gate if( $Is_VMS ) { 1507*0Sstevel@tonic-gate # Avoid logical name vs directory collisions 1508*0Sstevel@tonic-gate $self->{PMLIBDIRS} = ['./lib', "./$self->{BASEEXT}"]; 1509*0Sstevel@tonic-gate } 1510*0Sstevel@tonic-gate else { 1511*0Sstevel@tonic-gate $self->{PMLIBDIRS} = ['lib', $self->{BASEEXT}]; 1512*0Sstevel@tonic-gate } 1513*0Sstevel@tonic-gate } 1514*0Sstevel@tonic-gate 1515*0Sstevel@tonic-gate #only existing directories that aren't in $dir are allowed 1516*0Sstevel@tonic-gate 1517*0Sstevel@tonic-gate # Avoid $_ wherever possible: 1518*0Sstevel@tonic-gate # @{$self->{PMLIBDIRS}} = grep -d && !$dir{$_}, @{$self->{PMLIBDIRS}}; 1519*0Sstevel@tonic-gate my (@pmlibdirs) = @{$self->{PMLIBDIRS}}; 1520*0Sstevel@tonic-gate my ($pmlibdir); 1521*0Sstevel@tonic-gate @{$self->{PMLIBDIRS}} = (); 1522*0Sstevel@tonic-gate foreach $pmlibdir (@pmlibdirs) { 1523*0Sstevel@tonic-gate -d $pmlibdir && !$dir{$pmlibdir} && push @{$self->{PMLIBDIRS}}, $pmlibdir; 1524*0Sstevel@tonic-gate } 1525*0Sstevel@tonic-gate 1526*0Sstevel@tonic-gate if (@{$self->{PMLIBDIRS}}){ 1527*0Sstevel@tonic-gate print "Searching PMLIBDIRS: @{$self->{PMLIBDIRS}}\n" 1528*0Sstevel@tonic-gate if ($Verbose >= 2); 1529*0Sstevel@tonic-gate require File::Find; 1530*0Sstevel@tonic-gate File::Find::find(sub { 1531*0Sstevel@tonic-gate if (-d $_){ 1532*0Sstevel@tonic-gate unless ($self->libscan($_)){ 1533*0Sstevel@tonic-gate $File::Find::prune = 1; 1534*0Sstevel@tonic-gate } 1535*0Sstevel@tonic-gate return; 1536*0Sstevel@tonic-gate } 1537*0Sstevel@tonic-gate return if /\#/; 1538*0Sstevel@tonic-gate return if /~$/; # emacs temp files 1539*0Sstevel@tonic-gate return if /,v$/; # RCS files 1540*0Sstevel@tonic-gate 1541*0Sstevel@tonic-gate my $path = $File::Find::name; 1542*0Sstevel@tonic-gate my $prefix = $self->{INST_LIBDIR}; 1543*0Sstevel@tonic-gate my $striplibpath; 1544*0Sstevel@tonic-gate 1545*0Sstevel@tonic-gate $prefix = $self->{INST_LIB} 1546*0Sstevel@tonic-gate if ($striplibpath = $path) =~ s:^(\W*)lib\W:$1:i; 1547*0Sstevel@tonic-gate 1548*0Sstevel@tonic-gate my($inst) = $self->catfile($prefix,$striplibpath); 1549*0Sstevel@tonic-gate local($_) = $inst; # for backwards compatibility 1550*0Sstevel@tonic-gate $inst = $self->libscan($inst); 1551*0Sstevel@tonic-gate print "libscan($path) => '$inst'\n" if ($Verbose >= 2); 1552*0Sstevel@tonic-gate return unless $inst; 1553*0Sstevel@tonic-gate $pm{$path} = $inst; 1554*0Sstevel@tonic-gate }, @{$self->{PMLIBDIRS}}); 1555*0Sstevel@tonic-gate } 1556*0Sstevel@tonic-gate 1557*0Sstevel@tonic-gate $self->{PM} ||= \%pm; 1558*0Sstevel@tonic-gate $self->{PL_FILES} ||= \%pl_files; 1559*0Sstevel@tonic-gate 1560*0Sstevel@tonic-gate $self->{DIR} ||= [sort keys %dir]; 1561*0Sstevel@tonic-gate 1562*0Sstevel@tonic-gate $self->{XS} ||= \%xs; 1563*0Sstevel@tonic-gate $self->{C} ||= [sort keys %c]; 1564*0Sstevel@tonic-gate my @o_files = @{$self->{C}}; 1565*0Sstevel@tonic-gate $self->{O_FILES} = [grep s/\.c(pp|xx|c)?\z/$self->{OBJ_EXT}/i, @o_files]; 1566*0Sstevel@tonic-gate 1567*0Sstevel@tonic-gate $self->{H} ||= [sort keys %h]; 1568*0Sstevel@tonic-gate 1569*0Sstevel@tonic-gate # Set up names of manual pages to generate from pods 1570*0Sstevel@tonic-gate my %pods; 1571*0Sstevel@tonic-gate foreach my $man (qw(MAN1 MAN3)) { 1572*0Sstevel@tonic-gate unless ($self->{"${man}PODS"}) { 1573*0Sstevel@tonic-gate $self->{"${man}PODS"} = {}; 1574*0Sstevel@tonic-gate $pods{$man} = 1 unless 1575*0Sstevel@tonic-gate $self->{"INSTALL${man}DIR"} =~ /^(none|\s*)$/; 1576*0Sstevel@tonic-gate } 1577*0Sstevel@tonic-gate } 1578*0Sstevel@tonic-gate 1579*0Sstevel@tonic-gate if ($pods{MAN1}) { 1580*0Sstevel@tonic-gate if ( exists $self->{EXE_FILES} ) { 1581*0Sstevel@tonic-gate foreach $name (@{$self->{EXE_FILES}}) { 1582*0Sstevel@tonic-gate local *FH; 1583*0Sstevel@tonic-gate my($ispod)=0; 1584*0Sstevel@tonic-gate if (open(FH,"<$name")) { 1585*0Sstevel@tonic-gate while (<FH>) { 1586*0Sstevel@tonic-gate if (/^=(?:head\d+|item|pod)\b/) { 1587*0Sstevel@tonic-gate $ispod=1; 1588*0Sstevel@tonic-gate last; 1589*0Sstevel@tonic-gate } 1590*0Sstevel@tonic-gate } 1591*0Sstevel@tonic-gate close FH; 1592*0Sstevel@tonic-gate } else { 1593*0Sstevel@tonic-gate # If it doesn't exist yet, we assume, it has pods in it 1594*0Sstevel@tonic-gate $ispod = 1; 1595*0Sstevel@tonic-gate } 1596*0Sstevel@tonic-gate next unless $ispod; 1597*0Sstevel@tonic-gate if ($pods{MAN1}) { 1598*0Sstevel@tonic-gate $self->{MAN1PODS}->{$name} = 1599*0Sstevel@tonic-gate $self->catfile("\$(INST_MAN1DIR)", basename($name).".\$(MAN1EXT)"); 1600*0Sstevel@tonic-gate } 1601*0Sstevel@tonic-gate } 1602*0Sstevel@tonic-gate } 1603*0Sstevel@tonic-gate } 1604*0Sstevel@tonic-gate if ($pods{MAN3}) { 1605*0Sstevel@tonic-gate my %manifypods = (); # we collect the keys first, i.e. the files 1606*0Sstevel@tonic-gate # we have to convert to pod 1607*0Sstevel@tonic-gate foreach $name (keys %{$self->{PM}}) { 1608*0Sstevel@tonic-gate if ($name =~ /\.pod\z/ ) { 1609*0Sstevel@tonic-gate $manifypods{$name} = $self->{PM}{$name}; 1610*0Sstevel@tonic-gate } elsif ($name =~ /\.p[ml]\z/ ) { 1611*0Sstevel@tonic-gate local *FH; 1612*0Sstevel@tonic-gate my($ispod)=0; 1613*0Sstevel@tonic-gate if (open(FH,"<$name")) { 1614*0Sstevel@tonic-gate while (<FH>) { 1615*0Sstevel@tonic-gate if (/^=head1\s+\w+/) { 1616*0Sstevel@tonic-gate $ispod=1; 1617*0Sstevel@tonic-gate last; 1618*0Sstevel@tonic-gate } 1619*0Sstevel@tonic-gate } 1620*0Sstevel@tonic-gate close FH; 1621*0Sstevel@tonic-gate } else { 1622*0Sstevel@tonic-gate $ispod = 1; 1623*0Sstevel@tonic-gate } 1624*0Sstevel@tonic-gate if( $ispod ) { 1625*0Sstevel@tonic-gate $manifypods{$name} = $self->{PM}{$name}; 1626*0Sstevel@tonic-gate } 1627*0Sstevel@tonic-gate } 1628*0Sstevel@tonic-gate } 1629*0Sstevel@tonic-gate 1630*0Sstevel@tonic-gate # Remove "Configure.pm" and similar, if it's not the only pod listed 1631*0Sstevel@tonic-gate # To force inclusion, just name it "Configure.pod", or override 1632*0Sstevel@tonic-gate # MAN3PODS 1633*0Sstevel@tonic-gate foreach $name (keys %manifypods) { 1634*0Sstevel@tonic-gate if ($self->{PERL_CORE} and $name =~ /(config|setup).*\.pm/is) { 1635*0Sstevel@tonic-gate delete $manifypods{$name}; 1636*0Sstevel@tonic-gate next; 1637*0Sstevel@tonic-gate } 1638*0Sstevel@tonic-gate my($manpagename) = $name; 1639*0Sstevel@tonic-gate $manpagename =~ s/\.p(od|m|l)\z//; 1640*0Sstevel@tonic-gate # everything below lib is ok 1641*0Sstevel@tonic-gate unless($manpagename =~ s!^\W*lib\W+!!s) { 1642*0Sstevel@tonic-gate $manpagename = $self->catfile( 1643*0Sstevel@tonic-gate split(/::/,$self->{PARENT_NAME}),$manpagename 1644*0Sstevel@tonic-gate ); 1645*0Sstevel@tonic-gate } 1646*0Sstevel@tonic-gate if ($pods{MAN3}) { 1647*0Sstevel@tonic-gate $manpagename = $self->replace_manpage_separator($manpagename); 1648*0Sstevel@tonic-gate $self->{MAN3PODS}->{$name} = 1649*0Sstevel@tonic-gate $self->catfile("\$(INST_MAN3DIR)", "$manpagename.\$(MAN3EXT)"); 1650*0Sstevel@tonic-gate } 1651*0Sstevel@tonic-gate } 1652*0Sstevel@tonic-gate } 1653*0Sstevel@tonic-gate} 1654*0Sstevel@tonic-gate 1655*0Sstevel@tonic-gate=item init_DIRFILESEP 1656*0Sstevel@tonic-gate 1657*0Sstevel@tonic-gateUsing / for Unix. Called by init_main. 1658*0Sstevel@tonic-gate 1659*0Sstevel@tonic-gate=cut 1660*0Sstevel@tonic-gate 1661*0Sstevel@tonic-gatesub init_DIRFILESEP { 1662*0Sstevel@tonic-gate my($self) = shift; 1663*0Sstevel@tonic-gate 1664*0Sstevel@tonic-gate $self->{DIRFILESEP} = '/'; 1665*0Sstevel@tonic-gate} 1666*0Sstevel@tonic-gate 1667*0Sstevel@tonic-gate 1668*0Sstevel@tonic-gate=item init_main 1669*0Sstevel@tonic-gate 1670*0Sstevel@tonic-gateInitializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE, 1671*0Sstevel@tonic-gateEXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*, 1672*0Sstevel@tonic-gateINSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME, 1673*0Sstevel@tonic-gateOBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB, 1674*0Sstevel@tonic-gatePERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION, 1675*0Sstevel@tonic-gateVERSION_SYM, XS_VERSION. 1676*0Sstevel@tonic-gate 1677*0Sstevel@tonic-gate=cut 1678*0Sstevel@tonic-gate 1679*0Sstevel@tonic-gatesub init_main { 1680*0Sstevel@tonic-gate my($self) = @_; 1681*0Sstevel@tonic-gate 1682*0Sstevel@tonic-gate # --- Initialize Module Name and Paths 1683*0Sstevel@tonic-gate 1684*0Sstevel@tonic-gate # NAME = Foo::Bar::Oracle 1685*0Sstevel@tonic-gate # FULLEXT = Foo/Bar/Oracle 1686*0Sstevel@tonic-gate # BASEEXT = Oracle 1687*0Sstevel@tonic-gate # PARENT_NAME = Foo::Bar 1688*0Sstevel@tonic-gate### Only UNIX: 1689*0Sstevel@tonic-gate### ($self->{FULLEXT} = 1690*0Sstevel@tonic-gate### $self->{NAME}) =~ s!::!/!g ; #eg. BSD/Foo/Socket 1691*0Sstevel@tonic-gate $self->{FULLEXT} = $self->catdir(split /::/, $self->{NAME}); 1692*0Sstevel@tonic-gate 1693*0Sstevel@tonic-gate 1694*0Sstevel@tonic-gate # Copied from DynaLoader: 1695*0Sstevel@tonic-gate 1696*0Sstevel@tonic-gate my(@modparts) = split(/::/,$self->{NAME}); 1697*0Sstevel@tonic-gate my($modfname) = $modparts[-1]; 1698*0Sstevel@tonic-gate 1699*0Sstevel@tonic-gate # Some systems have restrictions on files names for DLL's etc. 1700*0Sstevel@tonic-gate # mod2fname returns appropriate file base name (typically truncated) 1701*0Sstevel@tonic-gate # It may also edit @modparts if required. 1702*0Sstevel@tonic-gate if (defined &DynaLoader::mod2fname) { 1703*0Sstevel@tonic-gate $modfname = &DynaLoader::mod2fname(\@modparts); 1704*0Sstevel@tonic-gate } 1705*0Sstevel@tonic-gate 1706*0Sstevel@tonic-gate ($self->{PARENT_NAME}, $self->{BASEEXT}) = $self->{NAME} =~ m!(?:([\w:]+)::)?(\w+)\z! ; 1707*0Sstevel@tonic-gate $self->{PARENT_NAME} ||= ''; 1708*0Sstevel@tonic-gate 1709*0Sstevel@tonic-gate if (defined &DynaLoader::mod2fname) { 1710*0Sstevel@tonic-gate # As of 5.001m, dl_os2 appends '_' 1711*0Sstevel@tonic-gate $self->{DLBASE} = $modfname; 1712*0Sstevel@tonic-gate } else { 1713*0Sstevel@tonic-gate $self->{DLBASE} = '$(BASEEXT)'; 1714*0Sstevel@tonic-gate } 1715*0Sstevel@tonic-gate 1716*0Sstevel@tonic-gate 1717*0Sstevel@tonic-gate # --- Initialize PERL_LIB, PERL_SRC 1718*0Sstevel@tonic-gate 1719*0Sstevel@tonic-gate # *Real* information: where did we get these two from? ... 1720*0Sstevel@tonic-gate my $inc_config_dir = dirname($INC{'Config.pm'}); 1721*0Sstevel@tonic-gate my $inc_carp_dir = dirname($INC{'Carp.pm'}); 1722*0Sstevel@tonic-gate 1723*0Sstevel@tonic-gate unless ($self->{PERL_SRC}){ 1724*0Sstevel@tonic-gate my($dir); 1725*0Sstevel@tonic-gate foreach $dir ($Updir, 1726*0Sstevel@tonic-gate $self->catdir($Updir,$Updir), 1727*0Sstevel@tonic-gate $self->catdir($Updir,$Updir,$Updir), 1728*0Sstevel@tonic-gate $self->catdir($Updir,$Updir,$Updir,$Updir), 1729*0Sstevel@tonic-gate $self->catdir($Updir,$Updir,$Updir,$Updir,$Updir)) 1730*0Sstevel@tonic-gate { 1731*0Sstevel@tonic-gate if ( 1732*0Sstevel@tonic-gate -f $self->catfile($dir,"config_h.SH") 1733*0Sstevel@tonic-gate && 1734*0Sstevel@tonic-gate -f $self->catfile($dir,"perl.h") 1735*0Sstevel@tonic-gate && 1736*0Sstevel@tonic-gate -f $self->catfile($dir,"lib","Exporter.pm") 1737*0Sstevel@tonic-gate ) { 1738*0Sstevel@tonic-gate $self->{PERL_SRC}=$dir ; 1739*0Sstevel@tonic-gate last; 1740*0Sstevel@tonic-gate } 1741*0Sstevel@tonic-gate } 1742*0Sstevel@tonic-gate } 1743*0Sstevel@tonic-gate 1744*0Sstevel@tonic-gate warn "PERL_CORE is set but I can't find your PERL_SRC!\n" if 1745*0Sstevel@tonic-gate $self->{PERL_CORE} and !$self->{PERL_SRC}; 1746*0Sstevel@tonic-gate 1747*0Sstevel@tonic-gate if ($self->{PERL_SRC}){ 1748*0Sstevel@tonic-gate $self->{PERL_LIB} ||= $self->catdir("$self->{PERL_SRC}","lib"); 1749*0Sstevel@tonic-gate 1750*0Sstevel@tonic-gate if (defined $Cross::platform) { 1751*0Sstevel@tonic-gate $self->{PERL_ARCHLIB} = 1752*0Sstevel@tonic-gate $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform); 1753*0Sstevel@tonic-gate $self->{PERL_INC} = 1754*0Sstevel@tonic-gate $self->catdir("$self->{PERL_SRC}","xlib",$Cross::platform, 1755*0Sstevel@tonic-gate $Is_Win32?("CORE"):()); 1756*0Sstevel@tonic-gate } 1757*0Sstevel@tonic-gate else { 1758*0Sstevel@tonic-gate $self->{PERL_ARCHLIB} = $self->{PERL_LIB}; 1759*0Sstevel@tonic-gate $self->{PERL_INC} = ($Is_Win32) ? 1760*0Sstevel@tonic-gate $self->catdir($self->{PERL_LIB},"CORE") : $self->{PERL_SRC}; 1761*0Sstevel@tonic-gate } 1762*0Sstevel@tonic-gate 1763*0Sstevel@tonic-gate # catch a situation that has occurred a few times in the past: 1764*0Sstevel@tonic-gate unless ( 1765*0Sstevel@tonic-gate -s $self->catfile($self->{PERL_SRC},'cflags') 1766*0Sstevel@tonic-gate or 1767*0Sstevel@tonic-gate $Is_VMS 1768*0Sstevel@tonic-gate && 1769*0Sstevel@tonic-gate -s $self->catfile($self->{PERL_SRC},'perlshr_attr.opt') 1770*0Sstevel@tonic-gate or 1771*0Sstevel@tonic-gate $Is_Mac 1772*0Sstevel@tonic-gate or 1773*0Sstevel@tonic-gate $Is_Win32 1774*0Sstevel@tonic-gate ){ 1775*0Sstevel@tonic-gate warn qq{ 1776*0Sstevel@tonic-gateYou cannot build extensions below the perl source tree after executing 1777*0Sstevel@tonic-gatea 'make clean' in the perl source tree. 1778*0Sstevel@tonic-gate 1779*0Sstevel@tonic-gateTo rebuild extensions distributed with the perl source you should 1780*0Sstevel@tonic-gatesimply Configure (to include those extensions) and then build perl as 1781*0Sstevel@tonic-gatenormal. After installing perl the source tree can be deleted. It is 1782*0Sstevel@tonic-gatenot needed for building extensions by running 'perl Makefile.PL' 1783*0Sstevel@tonic-gateusually without extra arguments. 1784*0Sstevel@tonic-gate 1785*0Sstevel@tonic-gateIt is recommended that you unpack and build additional extensions away 1786*0Sstevel@tonic-gatefrom the perl source tree. 1787*0Sstevel@tonic-gate}; 1788*0Sstevel@tonic-gate } 1789*0Sstevel@tonic-gate } else { 1790*0Sstevel@tonic-gate # we should also consider $ENV{PERL5LIB} here 1791*0Sstevel@tonic-gate my $old = $self->{PERL_LIB} || $self->{PERL_ARCHLIB} || $self->{PERL_INC}; 1792*0Sstevel@tonic-gate $self->{PERL_LIB} ||= $Config{privlibexp}; 1793*0Sstevel@tonic-gate $self->{PERL_ARCHLIB} ||= $Config{archlibexp}; 1794*0Sstevel@tonic-gate $self->{PERL_INC} = $self->catdir("$self->{PERL_ARCHLIB}","CORE"); # wild guess for now 1795*0Sstevel@tonic-gate my $perl_h; 1796*0Sstevel@tonic-gate 1797*0Sstevel@tonic-gate if (not -f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h")) 1798*0Sstevel@tonic-gate and not $old){ 1799*0Sstevel@tonic-gate # Maybe somebody tries to build an extension with an 1800*0Sstevel@tonic-gate # uninstalled Perl outside of Perl build tree 1801*0Sstevel@tonic-gate my $found; 1802*0Sstevel@tonic-gate for my $dir (@INC) { 1803*0Sstevel@tonic-gate $found = $dir, last if -e $self->catdir($dir, "Config.pm"); 1804*0Sstevel@tonic-gate } 1805*0Sstevel@tonic-gate if ($found) { 1806*0Sstevel@tonic-gate my $inc = dirname $found; 1807*0Sstevel@tonic-gate if (-e $self->catdir($inc, "perl.h")) { 1808*0Sstevel@tonic-gate $self->{PERL_LIB} = $found; 1809*0Sstevel@tonic-gate $self->{PERL_ARCHLIB} = $found; 1810*0Sstevel@tonic-gate $self->{PERL_INC} = $inc; 1811*0Sstevel@tonic-gate $self->{UNINSTALLED_PERL} = 1; 1812*0Sstevel@tonic-gate print STDOUT <<EOP; 1813*0Sstevel@tonic-gate... Detected uninstalled Perl. Trying to continue. 1814*0Sstevel@tonic-gateEOP 1815*0Sstevel@tonic-gate } 1816*0Sstevel@tonic-gate } 1817*0Sstevel@tonic-gate } 1818*0Sstevel@tonic-gate 1819*0Sstevel@tonic-gate unless(-f ($perl_h = $self->catfile($self->{PERL_INC},"perl.h"))) 1820*0Sstevel@tonic-gate { 1821*0Sstevel@tonic-gate die qq{ 1822*0Sstevel@tonic-gateError: Unable to locate installed Perl libraries or Perl source code. 1823*0Sstevel@tonic-gate 1824*0Sstevel@tonic-gateIt is recommended that you install perl in a standard location before 1825*0Sstevel@tonic-gatebuilding extensions. Some precompiled versions of perl do not contain 1826*0Sstevel@tonic-gatethese header files, so you cannot build extensions. In such a case, 1827*0Sstevel@tonic-gateplease build and install your perl from a fresh perl distribution. It 1828*0Sstevel@tonic-gateusually solves this kind of problem. 1829*0Sstevel@tonic-gate 1830*0Sstevel@tonic-gate\(You get this message, because MakeMaker could not find "$perl_h"\) 1831*0Sstevel@tonic-gate}; 1832*0Sstevel@tonic-gate } 1833*0Sstevel@tonic-gate# print STDOUT "Using header files found in $self->{PERL_INC}\n" 1834*0Sstevel@tonic-gate# if $Verbose && $self->needs_linking(); 1835*0Sstevel@tonic-gate 1836*0Sstevel@tonic-gate } 1837*0Sstevel@tonic-gate 1838*0Sstevel@tonic-gate # We get SITELIBEXP and SITEARCHEXP directly via 1839*0Sstevel@tonic-gate # Get_from_Config. When we are running standard modules, these 1840*0Sstevel@tonic-gate # won't matter, we will set INSTALLDIRS to "perl". Otherwise we 1841*0Sstevel@tonic-gate # set it to "site". I prefer that INSTALLDIRS be set from outside 1842*0Sstevel@tonic-gate # MakeMaker. 1843*0Sstevel@tonic-gate $self->{INSTALLDIRS} ||= "site"; 1844*0Sstevel@tonic-gate 1845*0Sstevel@tonic-gate $self->{MAN1EXT} ||= $Config{man1ext}; 1846*0Sstevel@tonic-gate $self->{MAN3EXT} ||= $Config{man3ext}; 1847*0Sstevel@tonic-gate 1848*0Sstevel@tonic-gate # Get some stuff out of %Config if we haven't yet done so 1849*0Sstevel@tonic-gate print STDOUT "CONFIG must be an array ref\n" 1850*0Sstevel@tonic-gate if ($self->{CONFIG} and ref $self->{CONFIG} ne 'ARRAY'); 1851*0Sstevel@tonic-gate $self->{CONFIG} = [] unless (ref $self->{CONFIG}); 1852*0Sstevel@tonic-gate push(@{$self->{CONFIG}}, @ExtUtils::MakeMaker::Get_from_Config); 1853*0Sstevel@tonic-gate push(@{$self->{CONFIG}}, 'shellflags') if $Config{shellflags}; 1854*0Sstevel@tonic-gate my(%once_only); 1855*0Sstevel@tonic-gate foreach my $m (@{$self->{CONFIG}}){ 1856*0Sstevel@tonic-gate next if $once_only{$m}; 1857*0Sstevel@tonic-gate print STDOUT "CONFIG key '$m' does not exist in Config.pm\n" 1858*0Sstevel@tonic-gate unless exists $Config{$m}; 1859*0Sstevel@tonic-gate $self->{uc $m} ||= $Config{$m}; 1860*0Sstevel@tonic-gate $once_only{$m} = 1; 1861*0Sstevel@tonic-gate } 1862*0Sstevel@tonic-gate 1863*0Sstevel@tonic-gate# This is too dangerous: 1864*0Sstevel@tonic-gate# if ($^O eq "next") { 1865*0Sstevel@tonic-gate# $self->{AR} = "libtool"; 1866*0Sstevel@tonic-gate# $self->{AR_STATIC_ARGS} = "-o"; 1867*0Sstevel@tonic-gate# } 1868*0Sstevel@tonic-gate# But I leave it as a placeholder 1869*0Sstevel@tonic-gate 1870*0Sstevel@tonic-gate $self->{AR_STATIC_ARGS} ||= "cr"; 1871*0Sstevel@tonic-gate 1872*0Sstevel@tonic-gate # These should never be needed 1873*0Sstevel@tonic-gate $self->{OBJ_EXT} ||= '.o'; 1874*0Sstevel@tonic-gate $self->{LIB_EXT} ||= '.a'; 1875*0Sstevel@tonic-gate 1876*0Sstevel@tonic-gate $self->{MAP_TARGET} ||= "perl"; 1877*0Sstevel@tonic-gate 1878*0Sstevel@tonic-gate $self->{LIBPERL_A} ||= "libperl$self->{LIB_EXT}"; 1879*0Sstevel@tonic-gate 1880*0Sstevel@tonic-gate # make a simple check if we find Exporter 1881*0Sstevel@tonic-gate warn "Warning: PERL_LIB ($self->{PERL_LIB}) seems not to be a perl library directory 1882*0Sstevel@tonic-gate (Exporter.pm not found)" 1883*0Sstevel@tonic-gate unless -f $self->catfile("$self->{PERL_LIB}","Exporter.pm") || 1884*0Sstevel@tonic-gate $self->{NAME} eq "ExtUtils::MakeMaker"; 1885*0Sstevel@tonic-gate} 1886*0Sstevel@tonic-gate 1887*0Sstevel@tonic-gate=item init_others 1888*0Sstevel@tonic-gate 1889*0Sstevel@tonic-gateInitializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, LD, 1890*0Sstevel@tonic-gateOBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP, 1891*0Sstevel@tonic-gateFIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F, 1892*0Sstevel@tonic-gateTOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N 1893*0Sstevel@tonic-gate 1894*0Sstevel@tonic-gate=cut 1895*0Sstevel@tonic-gate 1896*0Sstevel@tonic-gatesub init_others { # --- Initialize Other Attributes 1897*0Sstevel@tonic-gate my($self) = shift; 1898*0Sstevel@tonic-gate 1899*0Sstevel@tonic-gate $self->{LD} ||= 'ld'; 1900*0Sstevel@tonic-gate 1901*0Sstevel@tonic-gate # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS} 1902*0Sstevel@tonic-gate # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or 1903*0Sstevel@tonic-gate # undefined. In any case we turn it into an anon array: 1904*0Sstevel@tonic-gate 1905*0Sstevel@tonic-gate # May check $Config{libs} too, thus not empty. 1906*0Sstevel@tonic-gate $self->{LIBS} = [$self->{LIBS}] unless ref $self->{LIBS}; 1907*0Sstevel@tonic-gate 1908*0Sstevel@tonic-gate $self->{LIBS} = [''] unless @{$self->{LIBS}} && defined $self->{LIBS}[0]; 1909*0Sstevel@tonic-gate $self->{LD_RUN_PATH} = ""; 1910*0Sstevel@tonic-gate my($libs); 1911*0Sstevel@tonic-gate foreach $libs ( @{$self->{LIBS}} ){ 1912*0Sstevel@tonic-gate $libs =~ s/^\s*(.*\S)\s*$/$1/; # remove leading and trailing whitespace 1913*0Sstevel@tonic-gate my(@libs) = $self->extliblist($libs); 1914*0Sstevel@tonic-gate if ($libs[0] or $libs[1] or $libs[2]){ 1915*0Sstevel@tonic-gate # LD_RUN_PATH now computed by ExtUtils::Liblist 1916*0Sstevel@tonic-gate ($self->{EXTRALIBS}, $self->{BSLOADLIBS}, 1917*0Sstevel@tonic-gate $self->{LDLOADLIBS}, $self->{LD_RUN_PATH}) = @libs; 1918*0Sstevel@tonic-gate last; 1919*0Sstevel@tonic-gate } 1920*0Sstevel@tonic-gate } 1921*0Sstevel@tonic-gate 1922*0Sstevel@tonic-gate if ( $self->{OBJECT} ) { 1923*0Sstevel@tonic-gate $self->{OBJECT} =~ s!\.o(bj)?\b!\$(OBJ_EXT)!g; 1924*0Sstevel@tonic-gate } else { 1925*0Sstevel@tonic-gate # init_dirscan should have found out, if we have C files 1926*0Sstevel@tonic-gate $self->{OBJECT} = ""; 1927*0Sstevel@tonic-gate $self->{OBJECT} = '$(BASEEXT)$(OBJ_EXT)' if @{$self->{C}||[]}; 1928*0Sstevel@tonic-gate } 1929*0Sstevel@tonic-gate $self->{OBJECT} =~ s/\n+/ \\\n\t/g; 1930*0Sstevel@tonic-gate $self->{BOOTDEP} = (-f "$self->{BASEEXT}_BS") ? "$self->{BASEEXT}_BS" : ""; 1931*0Sstevel@tonic-gate $self->{PERLMAINCC} ||= '$(CC)'; 1932*0Sstevel@tonic-gate $self->{LDFROM} = '$(OBJECT)' unless $self->{LDFROM}; 1933*0Sstevel@tonic-gate 1934*0Sstevel@tonic-gate # Sanity check: don't define LINKTYPE = dynamic if we're skipping 1935*0Sstevel@tonic-gate # the 'dynamic' section of MM. We don't have this problem with 1936*0Sstevel@tonic-gate # 'static', since we either must use it (%Config says we can't 1937*0Sstevel@tonic-gate # use dynamic loading) or the caller asked for it explicitly. 1938*0Sstevel@tonic-gate if (!$self->{LINKTYPE}) { 1939*0Sstevel@tonic-gate $self->{LINKTYPE} = $self->{SKIPHASH}{'dynamic'} 1940*0Sstevel@tonic-gate ? 'static' 1941*0Sstevel@tonic-gate : ($Config{usedl} ? 'dynamic' : 'static'); 1942*0Sstevel@tonic-gate }; 1943*0Sstevel@tonic-gate 1944*0Sstevel@tonic-gate $self->{NOOP} ||= '$(SHELL) -c true'; 1945*0Sstevel@tonic-gate $self->{NOECHO} = '@' unless defined $self->{NOECHO}; 1946*0Sstevel@tonic-gate 1947*0Sstevel@tonic-gate $self->{MAKEFILE} ||= 'Makefile'; 1948*0Sstevel@tonic-gate $self->{FIRST_MAKEFILE} ||= $self->{MAKEFILE}; 1949*0Sstevel@tonic-gate $self->{MAKEFILE_OLD} ||= '$(FIRST_MAKEFILE).old'; 1950*0Sstevel@tonic-gate $self->{MAKE_APERL_FILE} ||= '$(FIRST_MAKEFILE).aperl'; 1951*0Sstevel@tonic-gate 1952*0Sstevel@tonic-gate $self->{SHELL} ||= $Config{sh} || '/bin/sh'; 1953*0Sstevel@tonic-gate 1954*0Sstevel@tonic-gate $self->{ECHO} ||= 'echo'; 1955*0Sstevel@tonic-gate $self->{ECHO_N} ||= 'echo -n'; 1956*0Sstevel@tonic-gate $self->{RM_F} ||= "rm -f"; 1957*0Sstevel@tonic-gate $self->{RM_RF} ||= "rm -rf"; 1958*0Sstevel@tonic-gate $self->{TOUCH} ||= "touch"; 1959*0Sstevel@tonic-gate $self->{TEST_F} ||= "test -f"; 1960*0Sstevel@tonic-gate $self->{CP} ||= "cp"; 1961*0Sstevel@tonic-gate $self->{MV} ||= "mv"; 1962*0Sstevel@tonic-gate $self->{CHMOD} ||= "chmod"; 1963*0Sstevel@tonic-gate $self->{MKPATH} ||= '$(PERLRUN) "-MExtUtils::Command" -e mkpath'; 1964*0Sstevel@tonic-gate $self->{EQUALIZE_TIMESTAMP} ||= 1965*0Sstevel@tonic-gate '$(PERLRUN) "-MExtUtils::Command" -e eqtime'; 1966*0Sstevel@tonic-gate 1967*0Sstevel@tonic-gate $self->{UNINST} ||= 0; 1968*0Sstevel@tonic-gate $self->{VERBINST} ||= 0; 1969*0Sstevel@tonic-gate $self->{MOD_INSTALL} ||= 1970*0Sstevel@tonic-gate $self->oneliner(<<'CODE', ['-MExtUtils::Install']); 1971*0Sstevel@tonic-gateinstall({@ARGV}, '$(VERBINST)', 0, '$(UNINST)'); 1972*0Sstevel@tonic-gateCODE 1973*0Sstevel@tonic-gate $self->{DOC_INSTALL} ||= 1974*0Sstevel@tonic-gate '$(PERLRUN) "-MExtUtils::Command::MM" -e perllocal_install'; 1975*0Sstevel@tonic-gate $self->{UNINSTALL} ||= 1976*0Sstevel@tonic-gate '$(PERLRUN) "-MExtUtils::Command::MM" -e uninstall'; 1977*0Sstevel@tonic-gate $self->{WARN_IF_OLD_PACKLIST} ||= 1978*0Sstevel@tonic-gate '$(PERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist'; 1979*0Sstevel@tonic-gate 1980*0Sstevel@tonic-gate $self->{UMASK_NULL} ||= "umask 0"; 1981*0Sstevel@tonic-gate $self->{DEV_NULL} ||= "> /dev/null 2>&1"; 1982*0Sstevel@tonic-gate 1983*0Sstevel@tonic-gate return 1; 1984*0Sstevel@tonic-gate} 1985*0Sstevel@tonic-gate 1986*0Sstevel@tonic-gate=item init_INST 1987*0Sstevel@tonic-gate 1988*0Sstevel@tonic-gate $mm->init_INST; 1989*0Sstevel@tonic-gate 1990*0Sstevel@tonic-gateCalled by init_main. Sets up all INST_* variables except those related 1991*0Sstevel@tonic-gateto XS code. Those are handled in init_xs. 1992*0Sstevel@tonic-gate 1993*0Sstevel@tonic-gate=cut 1994*0Sstevel@tonic-gate 1995*0Sstevel@tonic-gatesub init_INST { 1996*0Sstevel@tonic-gate my($self) = shift; 1997*0Sstevel@tonic-gate 1998*0Sstevel@tonic-gate $self->{INST_ARCHLIB} ||= $self->catdir($Curdir,"blib","arch"); 1999*0Sstevel@tonic-gate $self->{INST_BIN} ||= $self->catdir($Curdir,'blib','bin'); 2000*0Sstevel@tonic-gate 2001*0Sstevel@tonic-gate # INST_LIB typically pre-set if building an extension after 2002*0Sstevel@tonic-gate # perl has been built and installed. Setting INST_LIB allows 2003*0Sstevel@tonic-gate # you to build directly into, say $Config{privlibexp}. 2004*0Sstevel@tonic-gate unless ($self->{INST_LIB}){ 2005*0Sstevel@tonic-gate if ($self->{PERL_CORE}) { 2006*0Sstevel@tonic-gate if (defined $Cross::platform) { 2007*0Sstevel@tonic-gate $self->{INST_LIB} = $self->{INST_ARCHLIB} = 2008*0Sstevel@tonic-gate $self->catdir($self->{PERL_LIB},"..","xlib", 2009*0Sstevel@tonic-gate $Cross::platform); 2010*0Sstevel@tonic-gate } 2011*0Sstevel@tonic-gate else { 2012*0Sstevel@tonic-gate $self->{INST_LIB} = $self->{INST_ARCHLIB} = $self->{PERL_LIB}; 2013*0Sstevel@tonic-gate } 2014*0Sstevel@tonic-gate } else { 2015*0Sstevel@tonic-gate $self->{INST_LIB} = $self->catdir($Curdir,"blib","lib"); 2016*0Sstevel@tonic-gate } 2017*0Sstevel@tonic-gate } 2018*0Sstevel@tonic-gate 2019*0Sstevel@tonic-gate my @parentdir = split(/::/, $self->{PARENT_NAME}); 2020*0Sstevel@tonic-gate $self->{INST_LIBDIR} = $self->catdir('$(INST_LIB)', @parentdir); 2021*0Sstevel@tonic-gate $self->{INST_ARCHLIBDIR} = $self->catdir('$(INST_ARCHLIB)', @parentdir); 2022*0Sstevel@tonic-gate $self->{INST_AUTODIR} = $self->catdir('$(INST_LIB)', 'auto', 2023*0Sstevel@tonic-gate '$(FULLEXT)'); 2024*0Sstevel@tonic-gate $self->{INST_ARCHAUTODIR} = $self->catdir('$(INST_ARCHLIB)', 'auto', 2025*0Sstevel@tonic-gate '$(FULLEXT)'); 2026*0Sstevel@tonic-gate 2027*0Sstevel@tonic-gate $self->{INST_SCRIPT} ||= $self->catdir($Curdir,'blib','script'); 2028*0Sstevel@tonic-gate 2029*0Sstevel@tonic-gate $self->{INST_MAN1DIR} ||= $self->catdir($Curdir,'blib','man1'); 2030*0Sstevel@tonic-gate $self->{INST_MAN3DIR} ||= $self->catdir($Curdir,'blib','man3'); 2031*0Sstevel@tonic-gate 2032*0Sstevel@tonic-gate return 1; 2033*0Sstevel@tonic-gate} 2034*0Sstevel@tonic-gate 2035*0Sstevel@tonic-gate=item init_INSTALL 2036*0Sstevel@tonic-gate 2037*0Sstevel@tonic-gate $mm->init_INSTALL; 2038*0Sstevel@tonic-gate 2039*0Sstevel@tonic-gateCalled by init_main. Sets up all INSTALL_* variables (except 2040*0Sstevel@tonic-gateINSTALLDIRS) and *PREFIX. 2041*0Sstevel@tonic-gate 2042*0Sstevel@tonic-gate=cut 2043*0Sstevel@tonic-gate 2044*0Sstevel@tonic-gatesub init_INSTALL { 2045*0Sstevel@tonic-gate my($self) = shift; 2046*0Sstevel@tonic-gate 2047*0Sstevel@tonic-gate $self->init_lib2arch; 2048*0Sstevel@tonic-gate 2049*0Sstevel@tonic-gate # Initialize installvendorman*dir if necessary 2050*0Sstevel@tonic-gate foreach my $num (1, 3) { 2051*0Sstevel@tonic-gate my $k = 'installvendorman'.$num.'dir'; 2052*0Sstevel@tonic-gate 2053*0Sstevel@tonic-gate unless ($Config{$k}) { 2054*0Sstevel@tonic-gate $Config_Override{$k} = $Config{usevendorprefix} ? 2055*0Sstevel@tonic-gate $self->catdir($Config{vendorprefixexp}, 'man', "man$num") : 2056*0Sstevel@tonic-gate ''; 2057*0Sstevel@tonic-gate } 2058*0Sstevel@tonic-gate } 2059*0Sstevel@tonic-gate 2060*0Sstevel@tonic-gate my $iprefix = $Config{installprefixexp} || $Config{installprefix} || 2061*0Sstevel@tonic-gate $Config{prefixexp} || $Config{prefix} || ''; 2062*0Sstevel@tonic-gate my $vprefix = $Config{usevendorprefix} ? $Config{vendorprefixexp} : ''; 2063*0Sstevel@tonic-gate my $sprefix = $Config{siteprefixexp} || ''; 2064*0Sstevel@tonic-gate 2065*0Sstevel@tonic-gate # 5.005_03 doesn't have a siteprefix. 2066*0Sstevel@tonic-gate $sprefix = $iprefix unless $sprefix; 2067*0Sstevel@tonic-gate 2068*0Sstevel@tonic-gate # There are often no Config.pm defaults for these, but we can make 2069*0Sstevel@tonic-gate # it up. 2070*0Sstevel@tonic-gate unless( $Config{installsiteman1dir} ) { 2071*0Sstevel@tonic-gate $Config_Override{installsiteman1dir} = 2072*0Sstevel@tonic-gate $self->catdir($sprefix, 'man', 'man1'); 2073*0Sstevel@tonic-gate } 2074*0Sstevel@tonic-gate 2075*0Sstevel@tonic-gate unless( $Config{installsiteman3dir} ) { 2076*0Sstevel@tonic-gate $Config_Override{installsiteman3dir} = 2077*0Sstevel@tonic-gate $self->catdir($sprefix, 'man', 'man3'); 2078*0Sstevel@tonic-gate } 2079*0Sstevel@tonic-gate 2080*0Sstevel@tonic-gate unless( $Config{installsitebin} ) { 2081*0Sstevel@tonic-gate $Config_Override{installsitebin} = 2082*0Sstevel@tonic-gate $self->catdir($sprefix, 'bin'); 2083*0Sstevel@tonic-gate } 2084*0Sstevel@tonic-gate 2085*0Sstevel@tonic-gate $self->{PREFIX} ||= ''; 2086*0Sstevel@tonic-gate 2087*0Sstevel@tonic-gate if( $self->{PREFIX} ) { 2088*0Sstevel@tonic-gate @{$self}{qw(PERLPREFIX SITEPREFIX VENDORPREFIX)} = 2089*0Sstevel@tonic-gate ('$(PREFIX)') x 3; 2090*0Sstevel@tonic-gate } 2091*0Sstevel@tonic-gate else { 2092*0Sstevel@tonic-gate $self->{PERLPREFIX} ||= $iprefix; 2093*0Sstevel@tonic-gate $self->{SITEPREFIX} ||= $sprefix; 2094*0Sstevel@tonic-gate $self->{VENDORPREFIX} ||= $vprefix; 2095*0Sstevel@tonic-gate } 2096*0Sstevel@tonic-gate 2097*0Sstevel@tonic-gate my $arch = $Config{archname}; 2098*0Sstevel@tonic-gate my $version = $Config{version}; 2099*0Sstevel@tonic-gate 2100*0Sstevel@tonic-gate # default style 2101*0Sstevel@tonic-gate my $libstyle = $Config{installstyle} || 'lib/perl5'; 2102*0Sstevel@tonic-gate my $manstyle = ''; 2103*0Sstevel@tonic-gate 2104*0Sstevel@tonic-gate if( $self->{LIBSTYLE} ) { 2105*0Sstevel@tonic-gate $libstyle = $self->{LIBSTYLE}; 2106*0Sstevel@tonic-gate $manstyle = $self->{LIBSTYLE} eq 'lib/perl5' ? 'lib/perl5' : ''; 2107*0Sstevel@tonic-gate } 2108*0Sstevel@tonic-gate 2109*0Sstevel@tonic-gate # Some systems, like VOS, set installman*dir to '' if they can't 2110*0Sstevel@tonic-gate # read man pages. 2111*0Sstevel@tonic-gate for my $num (1, 3) { 2112*0Sstevel@tonic-gate $self->{'INSTALLMAN'.$num.'DIR'} ||= 'none' 2113*0Sstevel@tonic-gate unless $Config{'installman'.$num.'dir'}; 2114*0Sstevel@tonic-gate } 2115*0Sstevel@tonic-gate 2116*0Sstevel@tonic-gate my %bin_layouts = 2117*0Sstevel@tonic-gate ( 2118*0Sstevel@tonic-gate bin => { s => $iprefix, 2119*0Sstevel@tonic-gate t => 'perl', 2120*0Sstevel@tonic-gate d => 'bin' }, 2121*0Sstevel@tonic-gate vendorbin => { s => $vprefix, 2122*0Sstevel@tonic-gate t => 'vendor', 2123*0Sstevel@tonic-gate d => 'bin' }, 2124*0Sstevel@tonic-gate sitebin => { s => $sprefix, 2125*0Sstevel@tonic-gate t => 'site', 2126*0Sstevel@tonic-gate d => 'bin' }, 2127*0Sstevel@tonic-gate script => { s => $iprefix, 2128*0Sstevel@tonic-gate t => 'perl', 2129*0Sstevel@tonic-gate d => 'bin' }, 2130*0Sstevel@tonic-gate ); 2131*0Sstevel@tonic-gate 2132*0Sstevel@tonic-gate my %man_layouts = 2133*0Sstevel@tonic-gate ( 2134*0Sstevel@tonic-gate man1dir => { s => $iprefix, 2135*0Sstevel@tonic-gate t => 'perl', 2136*0Sstevel@tonic-gate d => 'man/man1', 2137*0Sstevel@tonic-gate style => $manstyle, }, 2138*0Sstevel@tonic-gate siteman1dir => { s => $sprefix, 2139*0Sstevel@tonic-gate t => 'site', 2140*0Sstevel@tonic-gate d => 'man/man1', 2141*0Sstevel@tonic-gate style => $manstyle, }, 2142*0Sstevel@tonic-gate vendorman1dir => { s => $vprefix, 2143*0Sstevel@tonic-gate t => 'vendor', 2144*0Sstevel@tonic-gate d => 'man/man1', 2145*0Sstevel@tonic-gate style => $manstyle, }, 2146*0Sstevel@tonic-gate 2147*0Sstevel@tonic-gate man3dir => { s => $iprefix, 2148*0Sstevel@tonic-gate t => 'perl', 2149*0Sstevel@tonic-gate d => 'man/man3', 2150*0Sstevel@tonic-gate style => $manstyle, }, 2151*0Sstevel@tonic-gate siteman3dir => { s => $sprefix, 2152*0Sstevel@tonic-gate t => 'site', 2153*0Sstevel@tonic-gate d => 'man/man3', 2154*0Sstevel@tonic-gate style => $manstyle, }, 2155*0Sstevel@tonic-gate vendorman3dir => { s => $vprefix, 2156*0Sstevel@tonic-gate t => 'vendor', 2157*0Sstevel@tonic-gate d => 'man/man3', 2158*0Sstevel@tonic-gate style => $manstyle, }, 2159*0Sstevel@tonic-gate ); 2160*0Sstevel@tonic-gate 2161*0Sstevel@tonic-gate my %lib_layouts = 2162*0Sstevel@tonic-gate ( 2163*0Sstevel@tonic-gate privlib => { s => $iprefix, 2164*0Sstevel@tonic-gate t => 'perl', 2165*0Sstevel@tonic-gate d => '', 2166*0Sstevel@tonic-gate style => $libstyle, }, 2167*0Sstevel@tonic-gate vendorlib => { s => $vprefix, 2168*0Sstevel@tonic-gate t => 'vendor', 2169*0Sstevel@tonic-gate d => '', 2170*0Sstevel@tonic-gate style => $libstyle, }, 2171*0Sstevel@tonic-gate sitelib => { s => $sprefix, 2172*0Sstevel@tonic-gate t => 'site', 2173*0Sstevel@tonic-gate d => 'site_perl', 2174*0Sstevel@tonic-gate style => $libstyle, }, 2175*0Sstevel@tonic-gate 2176*0Sstevel@tonic-gate archlib => { s => $iprefix, 2177*0Sstevel@tonic-gate t => 'perl', 2178*0Sstevel@tonic-gate d => "$version/$arch", 2179*0Sstevel@tonic-gate style => $libstyle }, 2180*0Sstevel@tonic-gate vendorarch => { s => $vprefix, 2181*0Sstevel@tonic-gate t => 'vendor', 2182*0Sstevel@tonic-gate d => "$version/$arch", 2183*0Sstevel@tonic-gate style => $libstyle }, 2184*0Sstevel@tonic-gate sitearch => { s => $sprefix, 2185*0Sstevel@tonic-gate t => 'site', 2186*0Sstevel@tonic-gate d => "site_perl/$version/$arch", 2187*0Sstevel@tonic-gate style => $libstyle }, 2188*0Sstevel@tonic-gate ); 2189*0Sstevel@tonic-gate 2190*0Sstevel@tonic-gate 2191*0Sstevel@tonic-gate # Special case for LIB. 2192*0Sstevel@tonic-gate if( $self->{LIB} ) { 2193*0Sstevel@tonic-gate foreach my $var (keys %lib_layouts) { 2194*0Sstevel@tonic-gate my $Installvar = uc "install$var"; 2195*0Sstevel@tonic-gate 2196*0Sstevel@tonic-gate if( $var =~ /arch/ ) { 2197*0Sstevel@tonic-gate $self->{$Installvar} ||= 2198*0Sstevel@tonic-gate $self->catdir($self->{LIB}, $Config{archname}); 2199*0Sstevel@tonic-gate } 2200*0Sstevel@tonic-gate else { 2201*0Sstevel@tonic-gate $self->{$Installvar} ||= $self->{LIB}; 2202*0Sstevel@tonic-gate } 2203*0Sstevel@tonic-gate } 2204*0Sstevel@tonic-gate } 2205*0Sstevel@tonic-gate 2206*0Sstevel@tonic-gate my %type2prefix = ( perl => 'PERLPREFIX', 2207*0Sstevel@tonic-gate site => 'SITEPREFIX', 2208*0Sstevel@tonic-gate vendor => 'VENDORPREFIX' 2209*0Sstevel@tonic-gate ); 2210*0Sstevel@tonic-gate 2211*0Sstevel@tonic-gate my %layouts = (%bin_layouts, %man_layouts, %lib_layouts); 2212*0Sstevel@tonic-gate while( my($var, $layout) = each(%layouts) ) { 2213*0Sstevel@tonic-gate my($s, $t, $d, $style) = @{$layout}{qw(s t d style)}; 2214*0Sstevel@tonic-gate my $r = '$('.$type2prefix{$t}.')'; 2215*0Sstevel@tonic-gate 2216*0Sstevel@tonic-gate print STDERR "Prefixing $var\n" if $Verbose >= 2; 2217*0Sstevel@tonic-gate 2218*0Sstevel@tonic-gate my $installvar = "install$var"; 2219*0Sstevel@tonic-gate my $Installvar = uc $installvar; 2220*0Sstevel@tonic-gate next if $self->{$Installvar}; 2221*0Sstevel@tonic-gate 2222*0Sstevel@tonic-gate $d = "$style/$d" if $style; 2223*0Sstevel@tonic-gate $self->prefixify($installvar, $s, $r, $d); 2224*0Sstevel@tonic-gate 2225*0Sstevel@tonic-gate print STDERR " $Installvar == $self->{$Installvar}\n" 2226*0Sstevel@tonic-gate if $Verbose >= 2; 2227*0Sstevel@tonic-gate } 2228*0Sstevel@tonic-gate 2229*0Sstevel@tonic-gate # Generate these if they weren't figured out. 2230*0Sstevel@tonic-gate $self->{VENDORARCHEXP} ||= $self->{INSTALLVENDORARCH}; 2231*0Sstevel@tonic-gate $self->{VENDORLIBEXP} ||= $self->{INSTALLVENDORLIB}; 2232*0Sstevel@tonic-gate 2233*0Sstevel@tonic-gate return 1; 2234*0Sstevel@tonic-gate} 2235*0Sstevel@tonic-gate 2236*0Sstevel@tonic-gate=item init_linker 2237*0Sstevel@tonic-gate 2238*0Sstevel@tonic-gateUnix has no need of special linker flags. 2239*0Sstevel@tonic-gate 2240*0Sstevel@tonic-gate=cut 2241*0Sstevel@tonic-gate 2242*0Sstevel@tonic-gatesub init_linker { 2243*0Sstevel@tonic-gate my($self) = shift; 2244*0Sstevel@tonic-gate $self->{PERL_ARCHIVE} ||= ''; 2245*0Sstevel@tonic-gate $self->{PERL_ARCHIVE_AFTER} ||= ''; 2246*0Sstevel@tonic-gate $self->{EXPORT_LIST} ||= ''; 2247*0Sstevel@tonic-gate} 2248*0Sstevel@tonic-gate 2249*0Sstevel@tonic-gate 2250*0Sstevel@tonic-gate=begin _protected 2251*0Sstevel@tonic-gate 2252*0Sstevel@tonic-gate=item init_lib2arch 2253*0Sstevel@tonic-gate 2254*0Sstevel@tonic-gate $mm->init_lib2arch 2255*0Sstevel@tonic-gate 2256*0Sstevel@tonic-gate=end _protected 2257*0Sstevel@tonic-gate 2258*0Sstevel@tonic-gate=cut 2259*0Sstevel@tonic-gate 2260*0Sstevel@tonic-gatesub init_lib2arch { 2261*0Sstevel@tonic-gate my($self) = shift; 2262*0Sstevel@tonic-gate 2263*0Sstevel@tonic-gate # The user who requests an installation directory explicitly 2264*0Sstevel@tonic-gate # should not have to tell us an architecture installation directory 2265*0Sstevel@tonic-gate # as well. We look if a directory exists that is named after the 2266*0Sstevel@tonic-gate # architecture. If not we take it as a sign that it should be the 2267*0Sstevel@tonic-gate # same as the requested installation directory. Otherwise we take 2268*0Sstevel@tonic-gate # the found one. 2269*0Sstevel@tonic-gate for my $libpair ({l=>"privlib", a=>"archlib"}, 2270*0Sstevel@tonic-gate {l=>"sitelib", a=>"sitearch"}, 2271*0Sstevel@tonic-gate {l=>"vendorlib", a=>"vendorarch"}, 2272*0Sstevel@tonic-gate ) 2273*0Sstevel@tonic-gate { 2274*0Sstevel@tonic-gate my $lib = "install$libpair->{l}"; 2275*0Sstevel@tonic-gate my $Lib = uc $lib; 2276*0Sstevel@tonic-gate my $Arch = uc "install$libpair->{a}"; 2277*0Sstevel@tonic-gate if( $self->{$Lib} && ! $self->{$Arch} ){ 2278*0Sstevel@tonic-gate my($ilib) = $Config{$lib}; 2279*0Sstevel@tonic-gate 2280*0Sstevel@tonic-gate $self->prefixify($Arch,$ilib,$self->{$Lib}); 2281*0Sstevel@tonic-gate 2282*0Sstevel@tonic-gate unless (-d $self->{$Arch}) { 2283*0Sstevel@tonic-gate print STDOUT "Directory $self->{$Arch} not found\n" 2284*0Sstevel@tonic-gate if $Verbose; 2285*0Sstevel@tonic-gate $self->{$Arch} = $self->{$Lib}; 2286*0Sstevel@tonic-gate } 2287*0Sstevel@tonic-gate print STDOUT "Defaulting $Arch to $self->{$Arch}\n" if $Verbose; 2288*0Sstevel@tonic-gate } 2289*0Sstevel@tonic-gate } 2290*0Sstevel@tonic-gate} 2291*0Sstevel@tonic-gate 2292*0Sstevel@tonic-gate 2293*0Sstevel@tonic-gate=item init_PERL 2294*0Sstevel@tonic-gate 2295*0Sstevel@tonic-gate $mm->init_PERL; 2296*0Sstevel@tonic-gate 2297*0Sstevel@tonic-gateCalled by init_main. Sets up ABSPERL, PERL, FULLPERL and all the 2298*0Sstevel@tonic-gate*PERLRUN* permutations. 2299*0Sstevel@tonic-gate 2300*0Sstevel@tonic-gate PERL is allowed to be miniperl 2301*0Sstevel@tonic-gate FULLPERL must be a complete perl 2302*0Sstevel@tonic-gate 2303*0Sstevel@tonic-gate ABSPERL is PERL converted to an absolute path 2304*0Sstevel@tonic-gate 2305*0Sstevel@tonic-gate *PERLRUN contains everything necessary to run perl, find it's 2306*0Sstevel@tonic-gate libraries, etc... 2307*0Sstevel@tonic-gate 2308*0Sstevel@tonic-gate *PERLRUNINST is *PERLRUN + everything necessary to find the 2309*0Sstevel@tonic-gate modules being built. 2310*0Sstevel@tonic-gate 2311*0Sstevel@tonic-gate=cut 2312*0Sstevel@tonic-gate 2313*0Sstevel@tonic-gatesub init_PERL { 2314*0Sstevel@tonic-gate my($self) = shift; 2315*0Sstevel@tonic-gate 2316*0Sstevel@tonic-gate my @defpath = (); 2317*0Sstevel@tonic-gate foreach my $component ($self->{PERL_SRC}, $self->path(), 2318*0Sstevel@tonic-gate $Config{binexp}) 2319*0Sstevel@tonic-gate { 2320*0Sstevel@tonic-gate push @defpath, $component if defined $component; 2321*0Sstevel@tonic-gate } 2322*0Sstevel@tonic-gate 2323*0Sstevel@tonic-gate # Build up a set of file names (not command names). 2324*0Sstevel@tonic-gate my $thisperl = $self->canonpath($^X); 2325*0Sstevel@tonic-gate $thisperl .= $Config{exe_ext} unless 2326*0Sstevel@tonic-gate # VMS might have a file version # at the end 2327*0Sstevel@tonic-gate $Is_VMS ? $thisperl =~ m/$Config{exe_ext}(;\d+)?$/i 2328*0Sstevel@tonic-gate : $thisperl =~ m/$Config{exe_ext}$/i; 2329*0Sstevel@tonic-gate 2330*0Sstevel@tonic-gate # We need a relative path to perl when in the core. 2331*0Sstevel@tonic-gate $thisperl = $self->abs2rel($thisperl) if $self->{PERL_CORE}; 2332*0Sstevel@tonic-gate 2333*0Sstevel@tonic-gate my @perls = ($thisperl); 2334*0Sstevel@tonic-gate push @perls, map { "$_$Config{exe_ext}" } 2335*0Sstevel@tonic-gate ('perl', 'perl5', "perl$Config{version}"); 2336*0Sstevel@tonic-gate 2337*0Sstevel@tonic-gate # miniperl has priority over all but the cannonical perl when in the 2338*0Sstevel@tonic-gate # core. Otherwise its a last resort. 2339*0Sstevel@tonic-gate my $miniperl = "miniperl$Config{exe_ext}"; 2340*0Sstevel@tonic-gate if( $self->{PERL_CORE} ) { 2341*0Sstevel@tonic-gate splice @perls, 1, 0, $miniperl; 2342*0Sstevel@tonic-gate } 2343*0Sstevel@tonic-gate else { 2344*0Sstevel@tonic-gate push @perls, $miniperl; 2345*0Sstevel@tonic-gate } 2346*0Sstevel@tonic-gate 2347*0Sstevel@tonic-gate $self->{PERL} ||= 2348*0Sstevel@tonic-gate $self->find_perl(5.0, \@perls, \@defpath, $Verbose ); 2349*0Sstevel@tonic-gate # don't check if perl is executable, maybe they have decided to 2350*0Sstevel@tonic-gate # supply switches with perl 2351*0Sstevel@tonic-gate 2352*0Sstevel@tonic-gate # When built for debugging, VMS doesn't create perl.exe but ndbgperl.exe. 2353*0Sstevel@tonic-gate my $perl_name = 'perl'; 2354*0Sstevel@tonic-gate $perl_name = 'ndbgperl' if $Is_VMS && 2355*0Sstevel@tonic-gate defined $Config{usevmsdebug} && $Config{usevmsdebug} eq 'define'; 2356*0Sstevel@tonic-gate 2357*0Sstevel@tonic-gate # XXX This logic is flawed. If "miniperl" is anywhere in the path 2358*0Sstevel@tonic-gate # it will get confused. It should be fixed to work only on the filename. 2359*0Sstevel@tonic-gate # Define 'FULLPERL' to be a non-miniperl (used in test: target) 2360*0Sstevel@tonic-gate ($self->{FULLPERL} = $self->{PERL}) =~ s/miniperl/$perl_name/i 2361*0Sstevel@tonic-gate unless $self->{FULLPERL}; 2362*0Sstevel@tonic-gate 2363*0Sstevel@tonic-gate # Little hack to get around VMS's find_perl putting "MCR" in front 2364*0Sstevel@tonic-gate # sometimes. 2365*0Sstevel@tonic-gate $self->{ABSPERL} = $self->{PERL}; 2366*0Sstevel@tonic-gate my $has_mcr = $self->{ABSPERL} =~ s/^MCR\s*//; 2367*0Sstevel@tonic-gate if( $self->file_name_is_absolute($self->{ABSPERL}) ) { 2368*0Sstevel@tonic-gate $self->{ABSPERL} = '$(PERL)'; 2369*0Sstevel@tonic-gate } 2370*0Sstevel@tonic-gate else { 2371*0Sstevel@tonic-gate $self->{ABSPERL} = $self->rel2abs($self->{ABSPERL}); 2372*0Sstevel@tonic-gate $self->{ABSPERL} = 'MCR '.$self->{ABSPERL} if $has_mcr; 2373*0Sstevel@tonic-gate } 2374*0Sstevel@tonic-gate 2375*0Sstevel@tonic-gate # Are we building the core? 2376*0Sstevel@tonic-gate $self->{PERL_CORE} = 0 unless exists $self->{PERL_CORE}; 2377*0Sstevel@tonic-gate 2378*0Sstevel@tonic-gate # How do we run perl? 2379*0Sstevel@tonic-gate foreach my $perl (qw(PERL FULLPERL ABSPERL)) { 2380*0Sstevel@tonic-gate my $run = $perl.'RUN'; 2381*0Sstevel@tonic-gate 2382*0Sstevel@tonic-gate $self->{$run} = "\$($perl)"; 2383*0Sstevel@tonic-gate 2384*0Sstevel@tonic-gate # Make sure perl can find itself before it's installed. 2385*0Sstevel@tonic-gate $self->{$run} .= q{ "-I$(PERL_LIB)" "-I$(PERL_ARCHLIB)"} 2386*0Sstevel@tonic-gate if $self->{UNINSTALLED_PERL} || $self->{PERL_CORE}; 2387*0Sstevel@tonic-gate 2388*0Sstevel@tonic-gate $self->{$perl.'RUNINST'} = 2389*0Sstevel@tonic-gate sprintf q{$(%sRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"}, $perl; 2390*0Sstevel@tonic-gate } 2391*0Sstevel@tonic-gate 2392*0Sstevel@tonic-gate return 1; 2393*0Sstevel@tonic-gate} 2394*0Sstevel@tonic-gate 2395*0Sstevel@tonic-gate 2396*0Sstevel@tonic-gate=item init_platform (o) 2397*0Sstevel@tonic-gate 2398*0Sstevel@tonic-gateAdd MM_Unix_VERSION. 2399*0Sstevel@tonic-gate 2400*0Sstevel@tonic-gate=item platform_constants (o) 2401*0Sstevel@tonic-gate 2402*0Sstevel@tonic-gate=cut 2403*0Sstevel@tonic-gate 2404*0Sstevel@tonic-gatesub init_platform { 2405*0Sstevel@tonic-gate my($self) = shift; 2406*0Sstevel@tonic-gate 2407*0Sstevel@tonic-gate $self->{MM_Unix_VERSION} = $VERSION; 2408*0Sstevel@tonic-gate $self->{PERL_MALLOC_DEF} = '-DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc '. 2409*0Sstevel@tonic-gate '-Dfree=Perl_mfree -Drealloc=Perl_realloc '. 2410*0Sstevel@tonic-gate '-Dcalloc=Perl_calloc'; 2411*0Sstevel@tonic-gate 2412*0Sstevel@tonic-gate} 2413*0Sstevel@tonic-gate 2414*0Sstevel@tonic-gatesub platform_constants { 2415*0Sstevel@tonic-gate my($self) = shift; 2416*0Sstevel@tonic-gate my $make_frag = ''; 2417*0Sstevel@tonic-gate 2418*0Sstevel@tonic-gate foreach my $macro (qw(MM_Unix_VERSION PERL_MALLOC_DEF)) 2419*0Sstevel@tonic-gate { 2420*0Sstevel@tonic-gate next unless defined $self->{$macro}; 2421*0Sstevel@tonic-gate $make_frag .= "$macro = $self->{$macro}\n"; 2422*0Sstevel@tonic-gate } 2423*0Sstevel@tonic-gate 2424*0Sstevel@tonic-gate return $make_frag; 2425*0Sstevel@tonic-gate} 2426*0Sstevel@tonic-gate 2427*0Sstevel@tonic-gate 2428*0Sstevel@tonic-gate=item init_PERM 2429*0Sstevel@tonic-gate 2430*0Sstevel@tonic-gate $mm->init_PERM 2431*0Sstevel@tonic-gate 2432*0Sstevel@tonic-gateCalled by init_main. Initializes PERL_* 2433*0Sstevel@tonic-gate 2434*0Sstevel@tonic-gate=cut 2435*0Sstevel@tonic-gate 2436*0Sstevel@tonic-gatesub init_PERM { 2437*0Sstevel@tonic-gate my($self) = shift; 2438*0Sstevel@tonic-gate 2439*0Sstevel@tonic-gate $self->{PERM_RW} = 644 unless defined $self->{PERM_RW}; 2440*0Sstevel@tonic-gate $self->{PERM_RWX} = 755 unless defined $self->{PERM_RWX}; 2441*0Sstevel@tonic-gate 2442*0Sstevel@tonic-gate return 1; 2443*0Sstevel@tonic-gate} 2444*0Sstevel@tonic-gate 2445*0Sstevel@tonic-gate 2446*0Sstevel@tonic-gate=item init_xs 2447*0Sstevel@tonic-gate 2448*0Sstevel@tonic-gate $mm->init_xs 2449*0Sstevel@tonic-gate 2450*0Sstevel@tonic-gateSets up macros having to do with XS code. Currently just INST_STATIC, 2451*0Sstevel@tonic-gateINST_DYNAMIC and INST_BOOT. 2452*0Sstevel@tonic-gate 2453*0Sstevel@tonic-gate=cut 2454*0Sstevel@tonic-gate 2455*0Sstevel@tonic-gatesub init_xs { 2456*0Sstevel@tonic-gate my $self = shift; 2457*0Sstevel@tonic-gate 2458*0Sstevel@tonic-gate if ($self->has_link_code()) { 2459*0Sstevel@tonic-gate $self->{INST_STATIC} = 2460*0Sstevel@tonic-gate $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT)$(LIB_EXT)'); 2461*0Sstevel@tonic-gate $self->{INST_DYNAMIC} = 2462*0Sstevel@tonic-gate $self->catfile('$(INST_ARCHAUTODIR)', '$(DLBASE).$(DLEXT)'); 2463*0Sstevel@tonic-gate $self->{INST_BOOT} = 2464*0Sstevel@tonic-gate $self->catfile('$(INST_ARCHAUTODIR)', '$(BASEEXT).bs'); 2465*0Sstevel@tonic-gate } else { 2466*0Sstevel@tonic-gate $self->{INST_STATIC} = ''; 2467*0Sstevel@tonic-gate $self->{INST_DYNAMIC} = ''; 2468*0Sstevel@tonic-gate $self->{INST_BOOT} = ''; 2469*0Sstevel@tonic-gate } 2470*0Sstevel@tonic-gate} 2471*0Sstevel@tonic-gate 2472*0Sstevel@tonic-gate=item install (o) 2473*0Sstevel@tonic-gate 2474*0Sstevel@tonic-gateDefines the install target. 2475*0Sstevel@tonic-gate 2476*0Sstevel@tonic-gate=cut 2477*0Sstevel@tonic-gate 2478*0Sstevel@tonic-gatesub install { 2479*0Sstevel@tonic-gate my($self, %attribs) = @_; 2480*0Sstevel@tonic-gate my(@m); 2481*0Sstevel@tonic-gate 2482*0Sstevel@tonic-gate push @m, q{ 2483*0Sstevel@tonic-gateinstall :: all pure_install doc_install 2484*0Sstevel@tonic-gate 2485*0Sstevel@tonic-gateinstall_perl :: all pure_perl_install doc_perl_install 2486*0Sstevel@tonic-gate 2487*0Sstevel@tonic-gateinstall_site :: all pure_site_install doc_site_install 2488*0Sstevel@tonic-gate 2489*0Sstevel@tonic-gateinstall_vendor :: all pure_vendor_install doc_vendor_install 2490*0Sstevel@tonic-gate 2491*0Sstevel@tonic-gatepure_install :: pure_$(INSTALLDIRS)_install 2492*0Sstevel@tonic-gate 2493*0Sstevel@tonic-gatedoc_install :: doc_$(INSTALLDIRS)_install 2494*0Sstevel@tonic-gate 2495*0Sstevel@tonic-gatepure__install : pure_site_install 2496*0Sstevel@tonic-gate $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site 2497*0Sstevel@tonic-gate 2498*0Sstevel@tonic-gatedoc__install : doc_site_install 2499*0Sstevel@tonic-gate $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site 2500*0Sstevel@tonic-gate 2501*0Sstevel@tonic-gatepure_perl_install :: 2502*0Sstevel@tonic-gate $(NOECHO) $(MOD_INSTALL) \ 2503*0Sstevel@tonic-gate read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \ 2504*0Sstevel@tonic-gate write }.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \ 2505*0Sstevel@tonic-gate $(INST_LIB) $(DESTINSTALLPRIVLIB) \ 2506*0Sstevel@tonic-gate $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \ 2507*0Sstevel@tonic-gate $(INST_BIN) $(DESTINSTALLBIN) \ 2508*0Sstevel@tonic-gate $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \ 2509*0Sstevel@tonic-gate $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \ 2510*0Sstevel@tonic-gate $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR) 2511*0Sstevel@tonic-gate $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ 2512*0Sstevel@tonic-gate }.$self->catdir('$(SITEARCHEXP)','auto','$(FULLEXT)').q{ 2513*0Sstevel@tonic-gate 2514*0Sstevel@tonic-gate 2515*0Sstevel@tonic-gatepure_site_install :: 2516*0Sstevel@tonic-gate $(NOECHO) $(MOD_INSTALL) \ 2517*0Sstevel@tonic-gate read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \ 2518*0Sstevel@tonic-gate write }.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \ 2519*0Sstevel@tonic-gate $(INST_LIB) $(DESTINSTALLSITELIB) \ 2520*0Sstevel@tonic-gate $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \ 2521*0Sstevel@tonic-gate $(INST_BIN) $(DESTINSTALLSITEBIN) \ 2522*0Sstevel@tonic-gate $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \ 2523*0Sstevel@tonic-gate $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \ 2524*0Sstevel@tonic-gate $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR) 2525*0Sstevel@tonic-gate $(NOECHO) $(WARN_IF_OLD_PACKLIST) \ 2526*0Sstevel@tonic-gate }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{ 2527*0Sstevel@tonic-gate 2528*0Sstevel@tonic-gatepure_vendor_install :: 2529*0Sstevel@tonic-gate $(NOECHO) $(MOD_INSTALL) \ 2530*0Sstevel@tonic-gate read }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \ 2531*0Sstevel@tonic-gate write }.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{ \ 2532*0Sstevel@tonic-gate $(INST_LIB) $(DESTINSTALLVENDORLIB) \ 2533*0Sstevel@tonic-gate $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \ 2534*0Sstevel@tonic-gate $(INST_BIN) $(DESTINSTALLVENDORBIN) \ 2535*0Sstevel@tonic-gate $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \ 2536*0Sstevel@tonic-gate $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \ 2537*0Sstevel@tonic-gate $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR) 2538*0Sstevel@tonic-gate 2539*0Sstevel@tonic-gatedoc_perl_install :: 2540*0Sstevel@tonic-gate $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod 2541*0Sstevel@tonic-gate -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) 2542*0Sstevel@tonic-gate -$(NOECHO) $(DOC_INSTALL) \ 2543*0Sstevel@tonic-gate "Module" "$(NAME)" \ 2544*0Sstevel@tonic-gate "installed into" "$(INSTALLPRIVLIB)" \ 2545*0Sstevel@tonic-gate LINKTYPE "$(LINKTYPE)" \ 2546*0Sstevel@tonic-gate VERSION "$(VERSION)" \ 2547*0Sstevel@tonic-gate EXE_FILES "$(EXE_FILES)" \ 2548*0Sstevel@tonic-gate >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ 2549*0Sstevel@tonic-gate 2550*0Sstevel@tonic-gatedoc_site_install :: 2551*0Sstevel@tonic-gate $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod 2552*0Sstevel@tonic-gate -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) 2553*0Sstevel@tonic-gate -$(NOECHO) $(DOC_INSTALL) \ 2554*0Sstevel@tonic-gate "Module" "$(NAME)" \ 2555*0Sstevel@tonic-gate "installed into" "$(INSTALLSITELIB)" \ 2556*0Sstevel@tonic-gate LINKTYPE "$(LINKTYPE)" \ 2557*0Sstevel@tonic-gate VERSION "$(VERSION)" \ 2558*0Sstevel@tonic-gate EXE_FILES "$(EXE_FILES)" \ 2559*0Sstevel@tonic-gate >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ 2560*0Sstevel@tonic-gate 2561*0Sstevel@tonic-gatedoc_vendor_install :: 2562*0Sstevel@tonic-gate $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod 2563*0Sstevel@tonic-gate -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) 2564*0Sstevel@tonic-gate -$(NOECHO) $(DOC_INSTALL) \ 2565*0Sstevel@tonic-gate "Module" "$(NAME)" \ 2566*0Sstevel@tonic-gate "installed into" "$(INSTALLVENDORLIB)" \ 2567*0Sstevel@tonic-gate LINKTYPE "$(LINKTYPE)" \ 2568*0Sstevel@tonic-gate VERSION "$(VERSION)" \ 2569*0Sstevel@tonic-gate EXE_FILES "$(EXE_FILES)" \ 2570*0Sstevel@tonic-gate >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ 2571*0Sstevel@tonic-gate 2572*0Sstevel@tonic-gate}; 2573*0Sstevel@tonic-gate 2574*0Sstevel@tonic-gate push @m, q{ 2575*0Sstevel@tonic-gateuninstall :: uninstall_from_$(INSTALLDIRS)dirs 2576*0Sstevel@tonic-gate 2577*0Sstevel@tonic-gateuninstall_from_perldirs :: 2578*0Sstevel@tonic-gate $(NOECHO) $(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ 2579*0Sstevel@tonic-gate 2580*0Sstevel@tonic-gateuninstall_from_sitedirs :: 2581*0Sstevel@tonic-gate $(NOECHO) $(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ 2582*0Sstevel@tonic-gate 2583*0Sstevel@tonic-gateuninstall_from_vendordirs :: 2584*0Sstevel@tonic-gate $(NOECHO) $(UNINSTALL) }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ 2585*0Sstevel@tonic-gate}; 2586*0Sstevel@tonic-gate 2587*0Sstevel@tonic-gate join("",@m); 2588*0Sstevel@tonic-gate} 2589*0Sstevel@tonic-gate 2590*0Sstevel@tonic-gate=item installbin (o) 2591*0Sstevel@tonic-gate 2592*0Sstevel@tonic-gateDefines targets to make and to install EXE_FILES. 2593*0Sstevel@tonic-gate 2594*0Sstevel@tonic-gate=cut 2595*0Sstevel@tonic-gate 2596*0Sstevel@tonic-gatesub installbin { 2597*0Sstevel@tonic-gate my($self) = shift; 2598*0Sstevel@tonic-gate return "" unless $self->{EXE_FILES} && ref $self->{EXE_FILES} eq "ARRAY"; 2599*0Sstevel@tonic-gate return "" unless @{$self->{EXE_FILES}}; 2600*0Sstevel@tonic-gate my(@m, $from, $to, %fromto, @to); 2601*0Sstevel@tonic-gate push @m, $self->dir_target(qw[$(INST_SCRIPT)]); 2602*0Sstevel@tonic-gate for $from (@{$self->{EXE_FILES}}) { 2603*0Sstevel@tonic-gate my($path)= $self->catfile('$(INST_SCRIPT)', basename($from)); 2604*0Sstevel@tonic-gate local($_) = $path; # for backwards compatibility 2605*0Sstevel@tonic-gate $to = $self->libscan($path); 2606*0Sstevel@tonic-gate print "libscan($from) => '$to'\n" if ($Verbose >=2); 2607*0Sstevel@tonic-gate $fromto{$from}=$to; 2608*0Sstevel@tonic-gate } 2609*0Sstevel@tonic-gate @to = values %fromto; 2610*0Sstevel@tonic-gate 2611*0Sstevel@tonic-gate my $fixin; 2612*0Sstevel@tonic-gate if( $Is_Win32 ) { 2613*0Sstevel@tonic-gate $fixin = $self->{PERL_CORE} ? '$(PERLRUN) ../../win32/bin/pl2bat.pl' 2614*0Sstevel@tonic-gate : 'pl2bat.bat'; 2615*0Sstevel@tonic-gate } 2616*0Sstevel@tonic-gate else { 2617*0Sstevel@tonic-gate $fixin = q{$(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"}; 2618*0Sstevel@tonic-gate } 2619*0Sstevel@tonic-gate 2620*0Sstevel@tonic-gate push(@m, qq{ 2621*0Sstevel@tonic-gateEXE_FILES = @{$self->{EXE_FILES}} 2622*0Sstevel@tonic-gate 2623*0Sstevel@tonic-gateFIXIN = $fixin 2624*0Sstevel@tonic-gate 2625*0Sstevel@tonic-gatepure_all :: @to 2626*0Sstevel@tonic-gate \$(NOECHO) \$(NOOP) 2627*0Sstevel@tonic-gate 2628*0Sstevel@tonic-gaterealclean :: 2629*0Sstevel@tonic-gate \$(RM_F) @to 2630*0Sstevel@tonic-gate}); 2631*0Sstevel@tonic-gate 2632*0Sstevel@tonic-gate while (($from,$to) = each %fromto) { 2633*0Sstevel@tonic-gate last unless defined $from; 2634*0Sstevel@tonic-gate my $todir = dirname($to); 2635*0Sstevel@tonic-gate push @m, " 2636*0Sstevel@tonic-gate$to: $from \$(FIRST_MAKEFILE) " . $self->catdir($todir,'.exists') . " 2637*0Sstevel@tonic-gate \$(NOECHO) \$(RM_F) $to 2638*0Sstevel@tonic-gate \$(CP) $from $to 2639*0Sstevel@tonic-gate \$(FIXIN) $to 2640*0Sstevel@tonic-gate -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $to 2641*0Sstevel@tonic-gate"; 2642*0Sstevel@tonic-gate } 2643*0Sstevel@tonic-gate join "", @m; 2644*0Sstevel@tonic-gate} 2645*0Sstevel@tonic-gate 2646*0Sstevel@tonic-gate 2647*0Sstevel@tonic-gate=item linkext (o) 2648*0Sstevel@tonic-gate 2649*0Sstevel@tonic-gateDefines the linkext target which in turn defines the LINKTYPE. 2650*0Sstevel@tonic-gate 2651*0Sstevel@tonic-gate=cut 2652*0Sstevel@tonic-gate 2653*0Sstevel@tonic-gatesub linkext { 2654*0Sstevel@tonic-gate my($self, %attribs) = @_; 2655*0Sstevel@tonic-gate # LINKTYPE => static or dynamic or '' 2656*0Sstevel@tonic-gate my($linktype) = defined $attribs{LINKTYPE} ? 2657*0Sstevel@tonic-gate $attribs{LINKTYPE} : '$(LINKTYPE)'; 2658*0Sstevel@tonic-gate " 2659*0Sstevel@tonic-gatelinkext :: $linktype 2660*0Sstevel@tonic-gate \$(NOECHO) \$(NOOP) 2661*0Sstevel@tonic-gate"; 2662*0Sstevel@tonic-gate} 2663*0Sstevel@tonic-gate 2664*0Sstevel@tonic-gate=item lsdir 2665*0Sstevel@tonic-gate 2666*0Sstevel@tonic-gateTakes as arguments a directory name and a regular expression. Returns 2667*0Sstevel@tonic-gateall entries in the directory that match the regular expression. 2668*0Sstevel@tonic-gate 2669*0Sstevel@tonic-gate=cut 2670*0Sstevel@tonic-gate 2671*0Sstevel@tonic-gatesub lsdir { 2672*0Sstevel@tonic-gate my($self) = shift; 2673*0Sstevel@tonic-gate my($dir, $regex) = @_; 2674*0Sstevel@tonic-gate my(@ls); 2675*0Sstevel@tonic-gate my $dh = new DirHandle; 2676*0Sstevel@tonic-gate $dh->open($dir || ".") or return (); 2677*0Sstevel@tonic-gate @ls = $dh->read; 2678*0Sstevel@tonic-gate $dh->close; 2679*0Sstevel@tonic-gate @ls = grep(/$regex/, @ls) if $regex; 2680*0Sstevel@tonic-gate @ls; 2681*0Sstevel@tonic-gate} 2682*0Sstevel@tonic-gate 2683*0Sstevel@tonic-gate=item macro (o) 2684*0Sstevel@tonic-gate 2685*0Sstevel@tonic-gateSimple subroutine to insert the macros defined by the macro attribute 2686*0Sstevel@tonic-gateinto the Makefile. 2687*0Sstevel@tonic-gate 2688*0Sstevel@tonic-gate=cut 2689*0Sstevel@tonic-gate 2690*0Sstevel@tonic-gatesub macro { 2691*0Sstevel@tonic-gate my($self,%attribs) = @_; 2692*0Sstevel@tonic-gate my(@m,$key,$val); 2693*0Sstevel@tonic-gate while (($key,$val) = each %attribs){ 2694*0Sstevel@tonic-gate last unless defined $key; 2695*0Sstevel@tonic-gate push @m, "$key = $val\n"; 2696*0Sstevel@tonic-gate } 2697*0Sstevel@tonic-gate join "", @m; 2698*0Sstevel@tonic-gate} 2699*0Sstevel@tonic-gate 2700*0Sstevel@tonic-gate=item makeaperl (o) 2701*0Sstevel@tonic-gate 2702*0Sstevel@tonic-gateCalled by staticmake. Defines how to write the Makefile to produce a 2703*0Sstevel@tonic-gatestatic new perl. 2704*0Sstevel@tonic-gate 2705*0Sstevel@tonic-gateBy default the Makefile produced includes all the static extensions in 2706*0Sstevel@tonic-gatethe perl library. (Purified versions of library files, e.g., 2707*0Sstevel@tonic-gateDynaLoader_pure_p1_c0_032.a are automatically ignored to avoid link errors.) 2708*0Sstevel@tonic-gate 2709*0Sstevel@tonic-gate=cut 2710*0Sstevel@tonic-gate 2711*0Sstevel@tonic-gatesub makeaperl { 2712*0Sstevel@tonic-gate my($self, %attribs) = @_; 2713*0Sstevel@tonic-gate my($makefilename, $searchdirs, $static, $extra, $perlinc, $target, $tmp, $libperl) = 2714*0Sstevel@tonic-gate @attribs{qw(MAKE DIRS STAT EXTRA INCL TARGET TMP LIBPERL)}; 2715*0Sstevel@tonic-gate my(@m); 2716*0Sstevel@tonic-gate push @m, " 2717*0Sstevel@tonic-gate# --- MakeMaker makeaperl section --- 2718*0Sstevel@tonic-gateMAP_TARGET = $target 2719*0Sstevel@tonic-gateFULLPERL = $self->{FULLPERL} 2720*0Sstevel@tonic-gate"; 2721*0Sstevel@tonic-gate return join '', @m if $self->{PARENT}; 2722*0Sstevel@tonic-gate 2723*0Sstevel@tonic-gate my($dir) = join ":", @{$self->{DIR}}; 2724*0Sstevel@tonic-gate 2725*0Sstevel@tonic-gate unless ($self->{MAKEAPERL}) { 2726*0Sstevel@tonic-gate push @m, q{ 2727*0Sstevel@tonic-gate$(MAP_TARGET) :: static $(MAKE_APERL_FILE) 2728*0Sstevel@tonic-gate $(MAKE) -f $(MAKE_APERL_FILE) $@ 2729*0Sstevel@tonic-gate 2730*0Sstevel@tonic-gate$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) 2731*0Sstevel@tonic-gate $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET) 2732*0Sstevel@tonic-gate $(NOECHO) $(PERLRUNINST) \ 2733*0Sstevel@tonic-gate Makefile.PL DIR=}, $dir, q{ \ 2734*0Sstevel@tonic-gate MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \ 2735*0Sstevel@tonic-gate MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=}; 2736*0Sstevel@tonic-gate 2737*0Sstevel@tonic-gate foreach (@ARGV){ 2738*0Sstevel@tonic-gate if( /\s/ ){ 2739*0Sstevel@tonic-gate s/=(.*)/='$1'/; 2740*0Sstevel@tonic-gate } 2741*0Sstevel@tonic-gate push @m, " \\\n\t\t$_"; 2742*0Sstevel@tonic-gate } 2743*0Sstevel@tonic-gate# push @m, map( " \\\n\t\t$_", @ARGV ); 2744*0Sstevel@tonic-gate push @m, "\n"; 2745*0Sstevel@tonic-gate 2746*0Sstevel@tonic-gate return join '', @m; 2747*0Sstevel@tonic-gate } 2748*0Sstevel@tonic-gate 2749*0Sstevel@tonic-gate 2750*0Sstevel@tonic-gate 2751*0Sstevel@tonic-gate my($cccmd, $linkcmd, $lperl); 2752*0Sstevel@tonic-gate 2753*0Sstevel@tonic-gate 2754*0Sstevel@tonic-gate $cccmd = $self->const_cccmd($libperl); 2755*0Sstevel@tonic-gate $cccmd =~ s/^CCCMD\s*=\s*//; 2756*0Sstevel@tonic-gate $cccmd =~ s/\$\(INC\)/ "-I$self->{PERL_INC}" /; 2757*0Sstevel@tonic-gate $cccmd .= " $Config{cccdlflags}" 2758*0Sstevel@tonic-gate if ($Config{useshrplib} eq 'true'); 2759*0Sstevel@tonic-gate $cccmd =~ s/\(CC\)/\(PERLMAINCC\)/; 2760*0Sstevel@tonic-gate 2761*0Sstevel@tonic-gate # The front matter of the linkcommand... 2762*0Sstevel@tonic-gate $linkcmd = join ' ', "\$(CC)", 2763*0Sstevel@tonic-gate grep($_, @Config{qw(ldflags ccdlflags)}); 2764*0Sstevel@tonic-gate $linkcmd =~ s/\s+/ /g; 2765*0Sstevel@tonic-gate $linkcmd =~ s,(perl\.exp),\$(PERL_INC)/$1,; 2766*0Sstevel@tonic-gate 2767*0Sstevel@tonic-gate # Which *.a files could we make use of... 2768*0Sstevel@tonic-gate local(%static); 2769*0Sstevel@tonic-gate require File::Find; 2770*0Sstevel@tonic-gate File::Find::find(sub { 2771*0Sstevel@tonic-gate return unless m/\Q$self->{LIB_EXT}\E$/; 2772*0Sstevel@tonic-gate return if m/^libperl/ or m/^perl\Q$self->{LIB_EXT}\E$/; 2773*0Sstevel@tonic-gate # Skip purified versions of libraries (e.g., DynaLoader_pure_p1_c0_032.a) 2774*0Sstevel@tonic-gate return if m/_pure_\w+_\w+_\w+\.\w+$/ and -f "$File::Find::dir/.pure"; 2775*0Sstevel@tonic-gate 2776*0Sstevel@tonic-gate if( exists $self->{INCLUDE_EXT} ){ 2777*0Sstevel@tonic-gate my $found = 0; 2778*0Sstevel@tonic-gate my $incl; 2779*0Sstevel@tonic-gate my $xx; 2780*0Sstevel@tonic-gate 2781*0Sstevel@tonic-gate ($xx = $File::Find::name) =~ s,.*?/auto/,,s; 2782*0Sstevel@tonic-gate $xx =~ s,/?$_,,; 2783*0Sstevel@tonic-gate $xx =~ s,/,::,g; 2784*0Sstevel@tonic-gate 2785*0Sstevel@tonic-gate # Throw away anything not explicitly marked for inclusion. 2786*0Sstevel@tonic-gate # DynaLoader is implied. 2787*0Sstevel@tonic-gate foreach $incl ((@{$self->{INCLUDE_EXT}},'DynaLoader')){ 2788*0Sstevel@tonic-gate if( $xx eq $incl ){ 2789*0Sstevel@tonic-gate $found++; 2790*0Sstevel@tonic-gate last; 2791*0Sstevel@tonic-gate } 2792*0Sstevel@tonic-gate } 2793*0Sstevel@tonic-gate return unless $found; 2794*0Sstevel@tonic-gate } 2795*0Sstevel@tonic-gate elsif( exists $self->{EXCLUDE_EXT} ){ 2796*0Sstevel@tonic-gate my $excl; 2797*0Sstevel@tonic-gate my $xx; 2798*0Sstevel@tonic-gate 2799*0Sstevel@tonic-gate ($xx = $File::Find::name) =~ s,.*?/auto/,,s; 2800*0Sstevel@tonic-gate $xx =~ s,/?$_,,; 2801*0Sstevel@tonic-gate $xx =~ s,/,::,g; 2802*0Sstevel@tonic-gate 2803*0Sstevel@tonic-gate # Throw away anything explicitly marked for exclusion 2804*0Sstevel@tonic-gate foreach $excl (@{$self->{EXCLUDE_EXT}}){ 2805*0Sstevel@tonic-gate return if( $xx eq $excl ); 2806*0Sstevel@tonic-gate } 2807*0Sstevel@tonic-gate } 2808*0Sstevel@tonic-gate 2809*0Sstevel@tonic-gate # don't include the installed version of this extension. I 2810*0Sstevel@tonic-gate # leave this line here, although it is not necessary anymore: 2811*0Sstevel@tonic-gate # I patched minimod.PL instead, so that Miniperl.pm won't 2812*0Sstevel@tonic-gate # enclude duplicates 2813*0Sstevel@tonic-gate 2814*0Sstevel@tonic-gate # Once the patch to minimod.PL is in the distribution, I can 2815*0Sstevel@tonic-gate # drop it 2816*0Sstevel@tonic-gate return if $File::Find::name =~ m:auto/$self->{FULLEXT}/$self->{BASEEXT}$self->{LIB_EXT}\z:; 2817*0Sstevel@tonic-gate use Cwd 'cwd'; 2818*0Sstevel@tonic-gate $static{cwd() . "/" . $_}++; 2819*0Sstevel@tonic-gate }, grep( -d $_, @{$searchdirs || []}) ); 2820*0Sstevel@tonic-gate 2821*0Sstevel@tonic-gate # We trust that what has been handed in as argument, will be buildable 2822*0Sstevel@tonic-gate $static = [] unless $static; 2823*0Sstevel@tonic-gate @static{@{$static}} = (1) x @{$static}; 2824*0Sstevel@tonic-gate 2825*0Sstevel@tonic-gate $extra = [] unless $extra && ref $extra eq 'ARRAY'; 2826*0Sstevel@tonic-gate for (sort keys %static) { 2827*0Sstevel@tonic-gate next unless /\Q$self->{LIB_EXT}\E\z/; 2828*0Sstevel@tonic-gate $_ = dirname($_) . "/extralibs.ld"; 2829*0Sstevel@tonic-gate push @$extra, $_; 2830*0Sstevel@tonic-gate } 2831*0Sstevel@tonic-gate 2832*0Sstevel@tonic-gate grep(s/^(.*)/"-I$1"/, @{$perlinc || []}); 2833*0Sstevel@tonic-gate 2834*0Sstevel@tonic-gate $target ||= "perl"; 2835*0Sstevel@tonic-gate $tmp ||= "."; 2836*0Sstevel@tonic-gate 2837*0Sstevel@tonic-gate# MAP_STATIC doesn't look into subdirs yet. Once "all" is made and we 2838*0Sstevel@tonic-gate# regenerate the Makefiles, MAP_STATIC and the dependencies for 2839*0Sstevel@tonic-gate# extralibs.all are computed correctly 2840*0Sstevel@tonic-gate push @m, " 2841*0Sstevel@tonic-gateMAP_LINKCMD = $linkcmd 2842*0Sstevel@tonic-gateMAP_PERLINC = @{$perlinc || []} 2843*0Sstevel@tonic-gateMAP_STATIC = ", 2844*0Sstevel@tonic-gatejoin(" \\\n\t", reverse sort keys %static), " 2845*0Sstevel@tonic-gate 2846*0Sstevel@tonic-gateMAP_PRELIBS = $Config{perllibs} $Config{cryptlib} 2847*0Sstevel@tonic-gate"; 2848*0Sstevel@tonic-gate 2849*0Sstevel@tonic-gate if (defined $libperl) { 2850*0Sstevel@tonic-gate ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/; 2851*0Sstevel@tonic-gate } 2852*0Sstevel@tonic-gate unless ($libperl && -f $lperl) { # Ilya's code... 2853*0Sstevel@tonic-gate my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE"; 2854*0Sstevel@tonic-gate $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL}; 2855*0Sstevel@tonic-gate $libperl ||= "libperl$self->{LIB_EXT}"; 2856*0Sstevel@tonic-gate $libperl = "$dir/$libperl"; 2857*0Sstevel@tonic-gate $lperl ||= "libperl$self->{LIB_EXT}"; 2858*0Sstevel@tonic-gate $lperl = "$dir/$lperl"; 2859*0Sstevel@tonic-gate 2860*0Sstevel@tonic-gate if (! -f $libperl and ! -f $lperl) { 2861*0Sstevel@tonic-gate # We did not find a static libperl. Maybe there is a shared one? 2862*0Sstevel@tonic-gate if ($Is_SunOS) { 2863*0Sstevel@tonic-gate $lperl = $libperl = "$dir/$Config{libperl}"; 2864*0Sstevel@tonic-gate # SUNOS ld does not take the full path to a shared library 2865*0Sstevel@tonic-gate $libperl = '' if $Is_SunOS4; 2866*0Sstevel@tonic-gate } 2867*0Sstevel@tonic-gate } 2868*0Sstevel@tonic-gate 2869*0Sstevel@tonic-gate print STDOUT "Warning: $libperl not found 2870*0Sstevel@tonic-gate If you're going to build a static perl binary, make sure perl is installed 2871*0Sstevel@tonic-gate otherwise ignore this warning\n" 2872*0Sstevel@tonic-gate unless (-f $lperl || defined($self->{PERL_SRC})); 2873*0Sstevel@tonic-gate } 2874*0Sstevel@tonic-gate 2875*0Sstevel@tonic-gate # SUNOS ld does not take the full path to a shared library 2876*0Sstevel@tonic-gate my $llibperl = $libperl ? '$(MAP_LIBPERL)' : '-lperl'; 2877*0Sstevel@tonic-gate 2878*0Sstevel@tonic-gate push @m, " 2879*0Sstevel@tonic-gateMAP_LIBPERL = $libperl 2880*0Sstevel@tonic-gateLLIBPERL = $llibperl 2881*0Sstevel@tonic-gate"; 2882*0Sstevel@tonic-gate 2883*0Sstevel@tonic-gate push @m, " 2884*0Sstevel@tonic-gate\$(INST_ARCHAUTODIR)/extralibs.all: \$(INST_ARCHAUTODIR)\$(DIRFILESEP).exists ".join(" \\\n\t", @$extra).' 2885*0Sstevel@tonic-gate $(NOECHO) $(RM_F) $@ 2886*0Sstevel@tonic-gate $(NOECHO) $(TOUCH) $@ 2887*0Sstevel@tonic-gate'; 2888*0Sstevel@tonic-gate 2889*0Sstevel@tonic-gate my $catfile; 2890*0Sstevel@tonic-gate foreach $catfile (@$extra){ 2891*0Sstevel@tonic-gate push @m, "\tcat $catfile >> \$\@\n"; 2892*0Sstevel@tonic-gate } 2893*0Sstevel@tonic-gate 2894*0Sstevel@tonic-gatepush @m, " 2895*0Sstevel@tonic-gate\$(MAP_TARGET) :: $tmp/perlmain\$(OBJ_EXT) \$(MAP_LIBPERL) \$(MAP_STATIC) \$(INST_ARCHAUTODIR)/extralibs.all 2896*0Sstevel@tonic-gate \$(MAP_LINKCMD) -o \$\@ \$(OPTIMIZE) $tmp/perlmain\$(OBJ_EXT) \$(LDFROM) \$(MAP_STATIC) \$(LLIBPERL) `cat \$(INST_ARCHAUTODIR)/extralibs.all` \$(MAP_PRELIBS) 2897*0Sstevel@tonic-gate \$(NOECHO) \$(ECHO) 'To install the new \"\$(MAP_TARGET)\" binary, call' 2898*0Sstevel@tonic-gate \$(NOECHO) \$(ECHO) ' make -f $makefilename inst_perl MAP_TARGET=\$(MAP_TARGET)' 2899*0Sstevel@tonic-gate \$(NOECHO) \$(ECHO) 'To remove the intermediate files say' 2900*0Sstevel@tonic-gate \$(NOECHO) \$(ECHO) ' make -f $makefilename map_clean' 2901*0Sstevel@tonic-gate 2902*0Sstevel@tonic-gate$tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c 2903*0Sstevel@tonic-gate"; 2904*0Sstevel@tonic-gate push @m, qq{\tcd $tmp && $cccmd "-I\$(PERL_INC)" perlmain.c\n}; 2905*0Sstevel@tonic-gate 2906*0Sstevel@tonic-gate push @m, qq{ 2907*0Sstevel@tonic-gate$tmp/perlmain.c: $makefilename}, q{ 2908*0Sstevel@tonic-gate $(NOECHO) $(ECHO) Writing $@ 2909*0Sstevel@tonic-gate $(NOECHO) $(PERL) $(MAP_PERLINC) "-MExtUtils::Miniperl" \\ 2910*0Sstevel@tonic-gate -e "writemain(grep s#.*/auto/##s, split(q| |, q|$(MAP_STATIC)|))" > $@t && $(MV) $@t $@ 2911*0Sstevel@tonic-gate 2912*0Sstevel@tonic-gate}; 2913*0Sstevel@tonic-gate push @m, "\t", q{$(NOECHO) $(PERL) $(INSTALLSCRIPT)/fixpmain 2914*0Sstevel@tonic-gate} if (defined (&Dos::UseLFN) && Dos::UseLFN()==0); 2915*0Sstevel@tonic-gate 2916*0Sstevel@tonic-gate 2917*0Sstevel@tonic-gate push @m, q{ 2918*0Sstevel@tonic-gatedoc_inst_perl: 2919*0Sstevel@tonic-gate $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod 2920*0Sstevel@tonic-gate -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) 2921*0Sstevel@tonic-gate -$(NOECHO) $(DOC_INSTALL) \ 2922*0Sstevel@tonic-gate "Perl binary" "$(MAP_TARGET)" \ 2923*0Sstevel@tonic-gate MAP_STATIC "$(MAP_STATIC)" \ 2924*0Sstevel@tonic-gate MAP_EXTRA "`cat $(INST_ARCHAUTODIR)/extralibs.all`" \ 2925*0Sstevel@tonic-gate MAP_LIBPERL "$(MAP_LIBPERL)" \ 2926*0Sstevel@tonic-gate >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ 2927*0Sstevel@tonic-gate 2928*0Sstevel@tonic-gate}; 2929*0Sstevel@tonic-gate 2930*0Sstevel@tonic-gate push @m, q{ 2931*0Sstevel@tonic-gateinst_perl: pure_inst_perl doc_inst_perl 2932*0Sstevel@tonic-gate 2933*0Sstevel@tonic-gatepure_inst_perl: $(MAP_TARGET) 2934*0Sstevel@tonic-gate }.$self->{CP}.q{ $(MAP_TARGET) }.$self->catfile('$(DESTINSTALLBIN)','$(MAP_TARGET)').q{ 2935*0Sstevel@tonic-gate 2936*0Sstevel@tonic-gateclean :: map_clean 2937*0Sstevel@tonic-gate 2938*0Sstevel@tonic-gatemap_clean : 2939*0Sstevel@tonic-gate }.$self->{RM_F}.qq{ $tmp/perlmain\$(OBJ_EXT) $tmp/perlmain.c \$(MAP_TARGET) $makefilename \$(INST_ARCHAUTODIR)/extralibs.all 2940*0Sstevel@tonic-gate}; 2941*0Sstevel@tonic-gate 2942*0Sstevel@tonic-gate join '', @m; 2943*0Sstevel@tonic-gate} 2944*0Sstevel@tonic-gate 2945*0Sstevel@tonic-gate=item makefile (o) 2946*0Sstevel@tonic-gate 2947*0Sstevel@tonic-gateDefines how to rewrite the Makefile. 2948*0Sstevel@tonic-gate 2949*0Sstevel@tonic-gate=cut 2950*0Sstevel@tonic-gate 2951*0Sstevel@tonic-gatesub makefile { 2952*0Sstevel@tonic-gate my($self) = shift; 2953*0Sstevel@tonic-gate my @m; 2954*0Sstevel@tonic-gate # We do not know what target was originally specified so we 2955*0Sstevel@tonic-gate # must force a manual rerun to be sure. But as it should only 2956*0Sstevel@tonic-gate # happen very rarely it is not a significant problem. 2957*0Sstevel@tonic-gate push @m, ' 2958*0Sstevel@tonic-gate$(OBJECT) : $(FIRST_MAKEFILE) 2959*0Sstevel@tonic-gate' if $self->{OBJECT}; 2960*0Sstevel@tonic-gate 2961*0Sstevel@tonic-gate push @m, q{ 2962*0Sstevel@tonic-gate# We take a very conservative approach here, but it's worth it. 2963*0Sstevel@tonic-gate# We move Makefile to Makefile.old here to avoid gnu make looping. 2964*0Sstevel@tonic-gate$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP) 2965*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?" 2966*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..." 2967*0Sstevel@tonic-gate $(NOECHO) $(RM_F) $(MAKEFILE_OLD) 2968*0Sstevel@tonic-gate $(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) 2969*0Sstevel@tonic-gate -$(MAKE) -f $(MAKEFILE_OLD) clean $(DEV_NULL) || $(NOOP) 2970*0Sstevel@tonic-gate $(PERLRUN) Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{ 2971*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <==" 2972*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "==> Please rerun the make command. <==" 2973*0Sstevel@tonic-gate false 2974*0Sstevel@tonic-gate 2975*0Sstevel@tonic-gate}; 2976*0Sstevel@tonic-gate 2977*0Sstevel@tonic-gate join "", @m; 2978*0Sstevel@tonic-gate} 2979*0Sstevel@tonic-gate 2980*0Sstevel@tonic-gate 2981*0Sstevel@tonic-gate=item maybe_command 2982*0Sstevel@tonic-gate 2983*0Sstevel@tonic-gateReturns true, if the argument is likely to be a command. 2984*0Sstevel@tonic-gate 2985*0Sstevel@tonic-gate=cut 2986*0Sstevel@tonic-gate 2987*0Sstevel@tonic-gatesub maybe_command { 2988*0Sstevel@tonic-gate my($self,$file) = @_; 2989*0Sstevel@tonic-gate return $file if -x $file && ! -d $file; 2990*0Sstevel@tonic-gate return; 2991*0Sstevel@tonic-gate} 2992*0Sstevel@tonic-gate 2993*0Sstevel@tonic-gate 2994*0Sstevel@tonic-gate=item needs_linking (o) 2995*0Sstevel@tonic-gate 2996*0Sstevel@tonic-gateDoes this module need linking? Looks into subdirectory objects (see 2997*0Sstevel@tonic-gatealso has_link_code()) 2998*0Sstevel@tonic-gate 2999*0Sstevel@tonic-gate=cut 3000*0Sstevel@tonic-gate 3001*0Sstevel@tonic-gatesub needs_linking { 3002*0Sstevel@tonic-gate my($self) = shift; 3003*0Sstevel@tonic-gate my($child,$caller); 3004*0Sstevel@tonic-gate $caller = (caller(0))[3]; 3005*0Sstevel@tonic-gate confess("needs_linking called too early") if 3006*0Sstevel@tonic-gate $caller =~ /^ExtUtils::MakeMaker::/; 3007*0Sstevel@tonic-gate return $self->{NEEDS_LINKING} if defined $self->{NEEDS_LINKING}; 3008*0Sstevel@tonic-gate if ($self->has_link_code or $self->{MAKEAPERL}){ 3009*0Sstevel@tonic-gate $self->{NEEDS_LINKING} = 1; 3010*0Sstevel@tonic-gate return 1; 3011*0Sstevel@tonic-gate } 3012*0Sstevel@tonic-gate foreach $child (keys %{$self->{CHILDREN}}) { 3013*0Sstevel@tonic-gate if ($self->{CHILDREN}->{$child}->needs_linking) { 3014*0Sstevel@tonic-gate $self->{NEEDS_LINKING} = 1; 3015*0Sstevel@tonic-gate return 1; 3016*0Sstevel@tonic-gate } 3017*0Sstevel@tonic-gate } 3018*0Sstevel@tonic-gate return $self->{NEEDS_LINKING} = 0; 3019*0Sstevel@tonic-gate} 3020*0Sstevel@tonic-gate 3021*0Sstevel@tonic-gate=item nicetext 3022*0Sstevel@tonic-gate 3023*0Sstevel@tonic-gatemisnamed method (will have to be changed). The MM_Unix method just 3024*0Sstevel@tonic-gatereturns the argument without further processing. 3025*0Sstevel@tonic-gate 3026*0Sstevel@tonic-gateOn VMS used to insure that colons marking targets are preceded by 3027*0Sstevel@tonic-gatespace - most Unix Makes don't need this, but it's necessary under VMS 3028*0Sstevel@tonic-gateto distinguish the target delimiter from a colon appearing as part of 3029*0Sstevel@tonic-gatea filespec. 3030*0Sstevel@tonic-gate 3031*0Sstevel@tonic-gate=cut 3032*0Sstevel@tonic-gate 3033*0Sstevel@tonic-gatesub nicetext { 3034*0Sstevel@tonic-gate my($self,$text) = @_; 3035*0Sstevel@tonic-gate $text; 3036*0Sstevel@tonic-gate} 3037*0Sstevel@tonic-gate 3038*0Sstevel@tonic-gate=item parse_abstract 3039*0Sstevel@tonic-gate 3040*0Sstevel@tonic-gateparse a file and return what you think is the ABSTRACT 3041*0Sstevel@tonic-gate 3042*0Sstevel@tonic-gate=cut 3043*0Sstevel@tonic-gate 3044*0Sstevel@tonic-gatesub parse_abstract { 3045*0Sstevel@tonic-gate my($self,$parsefile) = @_; 3046*0Sstevel@tonic-gate my $result; 3047*0Sstevel@tonic-gate local *FH; 3048*0Sstevel@tonic-gate local $/ = "\n"; 3049*0Sstevel@tonic-gate open(FH,$parsefile) or die "Could not open '$parsefile': $!"; 3050*0Sstevel@tonic-gate my $inpod = 0; 3051*0Sstevel@tonic-gate my $package = $self->{DISTNAME}; 3052*0Sstevel@tonic-gate $package =~ s/-/::/g; 3053*0Sstevel@tonic-gate while (<FH>) { 3054*0Sstevel@tonic-gate $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; 3055*0Sstevel@tonic-gate next if !$inpod; 3056*0Sstevel@tonic-gate chop; 3057*0Sstevel@tonic-gate next unless /^($package\s-\s)(.*)/; 3058*0Sstevel@tonic-gate $result = $2; 3059*0Sstevel@tonic-gate last; 3060*0Sstevel@tonic-gate } 3061*0Sstevel@tonic-gate close FH; 3062*0Sstevel@tonic-gate return $result; 3063*0Sstevel@tonic-gate} 3064*0Sstevel@tonic-gate 3065*0Sstevel@tonic-gate=item parse_version 3066*0Sstevel@tonic-gate 3067*0Sstevel@tonic-gateparse a file and return what you think is $VERSION in this file set to. 3068*0Sstevel@tonic-gateIt will return the string "undef" if it can't figure out what $VERSION 3069*0Sstevel@tonic-gateis. $VERSION should be for all to see, so our $VERSION or plain $VERSION 3070*0Sstevel@tonic-gateare okay, but my $VERSION is not. 3071*0Sstevel@tonic-gate 3072*0Sstevel@tonic-gate=cut 3073*0Sstevel@tonic-gate 3074*0Sstevel@tonic-gatesub parse_version { 3075*0Sstevel@tonic-gate my($self,$parsefile) = @_; 3076*0Sstevel@tonic-gate my $result; 3077*0Sstevel@tonic-gate local *FH; 3078*0Sstevel@tonic-gate local $/ = "\n"; 3079*0Sstevel@tonic-gate open(FH,$parsefile) or die "Could not open '$parsefile': $!"; 3080*0Sstevel@tonic-gate my $inpod = 0; 3081*0Sstevel@tonic-gate while (<FH>) { 3082*0Sstevel@tonic-gate $inpod = /^=(?!cut)/ ? 1 : /^=cut/ ? 0 : $inpod; 3083*0Sstevel@tonic-gate next if $inpod || /^\s*#/; 3084*0Sstevel@tonic-gate chop; 3085*0Sstevel@tonic-gate next unless /(?<!\\)([\$*])(([\w\:\']*)\bVERSION)\b.*\=/; 3086*0Sstevel@tonic-gate my $eval = qq{ 3087*0Sstevel@tonic-gate package ExtUtils::MakeMaker::_version; 3088*0Sstevel@tonic-gate no strict; 3089*0Sstevel@tonic-gate 3090*0Sstevel@tonic-gate local $1$2; 3091*0Sstevel@tonic-gate \$$2=undef; do { 3092*0Sstevel@tonic-gate $_ 3093*0Sstevel@tonic-gate }; \$$2 3094*0Sstevel@tonic-gate }; 3095*0Sstevel@tonic-gate local $^W = 0; 3096*0Sstevel@tonic-gate $result = eval($eval); 3097*0Sstevel@tonic-gate warn "Could not eval '$eval' in $parsefile: $@" if $@; 3098*0Sstevel@tonic-gate last; 3099*0Sstevel@tonic-gate } 3100*0Sstevel@tonic-gate close FH; 3101*0Sstevel@tonic-gate 3102*0Sstevel@tonic-gate $result = "undef" unless defined $result; 3103*0Sstevel@tonic-gate return $result; 3104*0Sstevel@tonic-gate} 3105*0Sstevel@tonic-gate 3106*0Sstevel@tonic-gate 3107*0Sstevel@tonic-gate=item pasthru (o) 3108*0Sstevel@tonic-gate 3109*0Sstevel@tonic-gateDefines the string that is passed to recursive make calls in 3110*0Sstevel@tonic-gatesubdirectories. 3111*0Sstevel@tonic-gate 3112*0Sstevel@tonic-gate=cut 3113*0Sstevel@tonic-gate 3114*0Sstevel@tonic-gatesub pasthru { 3115*0Sstevel@tonic-gate my($self) = shift; 3116*0Sstevel@tonic-gate my(@m,$key); 3117*0Sstevel@tonic-gate 3118*0Sstevel@tonic-gate my(@pasthru); 3119*0Sstevel@tonic-gate my($sep) = $Is_VMS ? ',' : ''; 3120*0Sstevel@tonic-gate $sep .= "\\\n\t"; 3121*0Sstevel@tonic-gate 3122*0Sstevel@tonic-gate foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE)) { 3123*0Sstevel@tonic-gate push @pasthru, "$key=\"\$($key)\""; 3124*0Sstevel@tonic-gate } 3125*0Sstevel@tonic-gate 3126*0Sstevel@tonic-gate foreach $key (qw(DEFINE INC)) { 3127*0Sstevel@tonic-gate push @pasthru, "PASTHRU_$key=\"\$(PASTHRU_$key)\""; 3128*0Sstevel@tonic-gate } 3129*0Sstevel@tonic-gate 3130*0Sstevel@tonic-gate push @m, "\nPASTHRU = ", join ($sep, @pasthru), "\n"; 3131*0Sstevel@tonic-gate join "", @m; 3132*0Sstevel@tonic-gate} 3133*0Sstevel@tonic-gate 3134*0Sstevel@tonic-gate=item perl_script 3135*0Sstevel@tonic-gate 3136*0Sstevel@tonic-gateTakes one argument, a file name, and returns the file name, if the 3137*0Sstevel@tonic-gateargument is likely to be a perl script. On MM_Unix this is true for 3138*0Sstevel@tonic-gateany ordinary, readable file. 3139*0Sstevel@tonic-gate 3140*0Sstevel@tonic-gate=cut 3141*0Sstevel@tonic-gate 3142*0Sstevel@tonic-gatesub perl_script { 3143*0Sstevel@tonic-gate my($self,$file) = @_; 3144*0Sstevel@tonic-gate return $file if -r $file && -f _; 3145*0Sstevel@tonic-gate return; 3146*0Sstevel@tonic-gate} 3147*0Sstevel@tonic-gate 3148*0Sstevel@tonic-gate=item perldepend (o) 3149*0Sstevel@tonic-gate 3150*0Sstevel@tonic-gateDefines the dependency from all *.h files that come with the perl 3151*0Sstevel@tonic-gatedistribution. 3152*0Sstevel@tonic-gate 3153*0Sstevel@tonic-gate=cut 3154*0Sstevel@tonic-gate 3155*0Sstevel@tonic-gatesub perldepend { 3156*0Sstevel@tonic-gate my($self) = shift; 3157*0Sstevel@tonic-gate my(@m); 3158*0Sstevel@tonic-gate push @m, q{ 3159*0Sstevel@tonic-gate# Check for unpropogated config.sh changes. Should never happen. 3160*0Sstevel@tonic-gate# We do NOT just update config.h because that is not sufficient. 3161*0Sstevel@tonic-gate# An out of date config.h is not fatal but complains loudly! 3162*0Sstevel@tonic-gate$(PERL_INC)/config.h: $(PERL_SRC)/config.sh 3163*0Sstevel@tonic-gate -$(NOECHO) $(ECHO) "Warning: $(PERL_INC)/config.h out of date with $(PERL_SRC)/config.sh"; false 3164*0Sstevel@tonic-gate 3165*0Sstevel@tonic-gate$(PERL_ARCHLIB)/Config.pm: $(PERL_SRC)/config.sh 3166*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "Warning: $(PERL_ARCHLIB)/Config.pm may be out of date with $(PERL_SRC)/config.sh" 3167*0Sstevel@tonic-gate cd $(PERL_SRC) && $(MAKE) lib/Config.pm 3168*0Sstevel@tonic-gate} if $self->{PERL_SRC}; 3169*0Sstevel@tonic-gate 3170*0Sstevel@tonic-gate return join "", @m unless $self->needs_linking; 3171*0Sstevel@tonic-gate 3172*0Sstevel@tonic-gate push @m, q{ 3173*0Sstevel@tonic-gatePERL_HDRS = \ 3174*0Sstevel@tonic-gate $(PERL_INC)/EXTERN.h \ 3175*0Sstevel@tonic-gate $(PERL_INC)/INTERN.h \ 3176*0Sstevel@tonic-gate $(PERL_INC)/XSUB.h \ 3177*0Sstevel@tonic-gate $(PERL_INC)/av.h \ 3178*0Sstevel@tonic-gate $(PERL_INC)/cc_runtime.h \ 3179*0Sstevel@tonic-gate $(PERL_INC)/config.h \ 3180*0Sstevel@tonic-gate $(PERL_INC)/cop.h \ 3181*0Sstevel@tonic-gate $(PERL_INC)/cv.h \ 3182*0Sstevel@tonic-gate $(PERL_INC)/dosish.h \ 3183*0Sstevel@tonic-gate $(PERL_INC)/embed.h \ 3184*0Sstevel@tonic-gate $(PERL_INC)/embedvar.h \ 3185*0Sstevel@tonic-gate $(PERL_INC)/fakethr.h \ 3186*0Sstevel@tonic-gate $(PERL_INC)/form.h \ 3187*0Sstevel@tonic-gate $(PERL_INC)/gv.h \ 3188*0Sstevel@tonic-gate $(PERL_INC)/handy.h \ 3189*0Sstevel@tonic-gate $(PERL_INC)/hv.h \ 3190*0Sstevel@tonic-gate $(PERL_INC)/intrpvar.h \ 3191*0Sstevel@tonic-gate $(PERL_INC)/iperlsys.h \ 3192*0Sstevel@tonic-gate $(PERL_INC)/keywords.h \ 3193*0Sstevel@tonic-gate $(PERL_INC)/mg.h \ 3194*0Sstevel@tonic-gate $(PERL_INC)/nostdio.h \ 3195*0Sstevel@tonic-gate $(PERL_INC)/op.h \ 3196*0Sstevel@tonic-gate $(PERL_INC)/opcode.h \ 3197*0Sstevel@tonic-gate $(PERL_INC)/patchlevel.h \ 3198*0Sstevel@tonic-gate $(PERL_INC)/perl.h \ 3199*0Sstevel@tonic-gate $(PERL_INC)/perlio.h \ 3200*0Sstevel@tonic-gate $(PERL_INC)/perlsdio.h \ 3201*0Sstevel@tonic-gate $(PERL_INC)/perlsfio.h \ 3202*0Sstevel@tonic-gate $(PERL_INC)/perlvars.h \ 3203*0Sstevel@tonic-gate $(PERL_INC)/perly.h \ 3204*0Sstevel@tonic-gate $(PERL_INC)/pp.h \ 3205*0Sstevel@tonic-gate $(PERL_INC)/pp_proto.h \ 3206*0Sstevel@tonic-gate $(PERL_INC)/proto.h \ 3207*0Sstevel@tonic-gate $(PERL_INC)/regcomp.h \ 3208*0Sstevel@tonic-gate $(PERL_INC)/regexp.h \ 3209*0Sstevel@tonic-gate $(PERL_INC)/regnodes.h \ 3210*0Sstevel@tonic-gate $(PERL_INC)/scope.h \ 3211*0Sstevel@tonic-gate $(PERL_INC)/sv.h \ 3212*0Sstevel@tonic-gate $(PERL_INC)/thrdvar.h \ 3213*0Sstevel@tonic-gate $(PERL_INC)/thread.h \ 3214*0Sstevel@tonic-gate $(PERL_INC)/unixish.h \ 3215*0Sstevel@tonic-gate $(PERL_INC)/util.h 3216*0Sstevel@tonic-gate 3217*0Sstevel@tonic-gate$(OBJECT) : $(PERL_HDRS) 3218*0Sstevel@tonic-gate} if $self->{OBJECT}; 3219*0Sstevel@tonic-gate 3220*0Sstevel@tonic-gate push @m, join(" ", values %{$self->{XS}})." : \$(XSUBPPDEPS)\n" if %{$self->{XS}}; 3221*0Sstevel@tonic-gate 3222*0Sstevel@tonic-gate join "\n", @m; 3223*0Sstevel@tonic-gate} 3224*0Sstevel@tonic-gate 3225*0Sstevel@tonic-gate 3226*0Sstevel@tonic-gate=item perm_rw (o) 3227*0Sstevel@tonic-gate 3228*0Sstevel@tonic-gateReturns the attribute C<PERM_RW> or the string C<644>. 3229*0Sstevel@tonic-gateUsed as the string that is passed 3230*0Sstevel@tonic-gateto the C<chmod> command to set the permissions for read/writeable files. 3231*0Sstevel@tonic-gateMakeMaker chooses C<644> because it has turned out in the past that 3232*0Sstevel@tonic-gaterelying on the umask provokes hard-to-track bug reports. 3233*0Sstevel@tonic-gateWhen the return value is used by the perl function C<chmod>, it is 3234*0Sstevel@tonic-gateinterpreted as an octal value. 3235*0Sstevel@tonic-gate 3236*0Sstevel@tonic-gate=cut 3237*0Sstevel@tonic-gate 3238*0Sstevel@tonic-gatesub perm_rw { 3239*0Sstevel@tonic-gate return shift->{PERM_RW}; 3240*0Sstevel@tonic-gate} 3241*0Sstevel@tonic-gate 3242*0Sstevel@tonic-gate=item perm_rwx (o) 3243*0Sstevel@tonic-gate 3244*0Sstevel@tonic-gateReturns the attribute C<PERM_RWX> or the string C<755>, 3245*0Sstevel@tonic-gatei.e. the string that is passed 3246*0Sstevel@tonic-gateto the C<chmod> command to set the permissions for executable files. 3247*0Sstevel@tonic-gateSee also perl_rw. 3248*0Sstevel@tonic-gate 3249*0Sstevel@tonic-gate=cut 3250*0Sstevel@tonic-gate 3251*0Sstevel@tonic-gatesub perm_rwx { 3252*0Sstevel@tonic-gate return shift->{PERM_RWX}; 3253*0Sstevel@tonic-gate} 3254*0Sstevel@tonic-gate 3255*0Sstevel@tonic-gate=item pm_to_blib 3256*0Sstevel@tonic-gate 3257*0Sstevel@tonic-gateDefines target that copies all files in the hash PM to their 3258*0Sstevel@tonic-gatedestination and autosplits them. See L<ExtUtils::Install/DESCRIPTION> 3259*0Sstevel@tonic-gate 3260*0Sstevel@tonic-gate=cut 3261*0Sstevel@tonic-gate 3262*0Sstevel@tonic-gatesub pm_to_blib { 3263*0Sstevel@tonic-gate my $self = shift; 3264*0Sstevel@tonic-gate my($autodir) = $self->catdir('$(INST_LIB)','auto'); 3265*0Sstevel@tonic-gate my $r = q{ 3266*0Sstevel@tonic-gatepm_to_blib: $(TO_INST_PM) 3267*0Sstevel@tonic-gate}; 3268*0Sstevel@tonic-gate 3269*0Sstevel@tonic-gate my $pm_to_blib = $self->oneliner(<<CODE, ['-MExtUtils::Install']); 3270*0Sstevel@tonic-gatepm_to_blib({\@ARGV}, '$autodir', '\$(PM_FILTER)') 3271*0Sstevel@tonic-gateCODE 3272*0Sstevel@tonic-gate 3273*0Sstevel@tonic-gate my @cmds = $self->split_command($pm_to_blib, %{$self->{PM}}); 3274*0Sstevel@tonic-gate 3275*0Sstevel@tonic-gate $r .= join '', map { "\t\$(NOECHO) $_\n" } @cmds; 3276*0Sstevel@tonic-gate $r .= q{ $(NOECHO) $(TOUCH) $@}; 3277*0Sstevel@tonic-gate 3278*0Sstevel@tonic-gate return $r; 3279*0Sstevel@tonic-gate} 3280*0Sstevel@tonic-gate 3281*0Sstevel@tonic-gate=item post_constants (o) 3282*0Sstevel@tonic-gate 3283*0Sstevel@tonic-gateReturns an empty string per default. Dedicated to overrides from 3284*0Sstevel@tonic-gatewithin Makefile.PL after all constants have been defined. 3285*0Sstevel@tonic-gate 3286*0Sstevel@tonic-gate=cut 3287*0Sstevel@tonic-gate 3288*0Sstevel@tonic-gatesub post_constants{ 3289*0Sstevel@tonic-gate ""; 3290*0Sstevel@tonic-gate} 3291*0Sstevel@tonic-gate 3292*0Sstevel@tonic-gate=item post_initialize (o) 3293*0Sstevel@tonic-gate 3294*0Sstevel@tonic-gateReturns an empty string per default. Used in Makefile.PLs to add some 3295*0Sstevel@tonic-gatechunk of text to the Makefile after the object is initialized. 3296*0Sstevel@tonic-gate 3297*0Sstevel@tonic-gate=cut 3298*0Sstevel@tonic-gate 3299*0Sstevel@tonic-gatesub post_initialize { 3300*0Sstevel@tonic-gate ""; 3301*0Sstevel@tonic-gate} 3302*0Sstevel@tonic-gate 3303*0Sstevel@tonic-gate=item postamble (o) 3304*0Sstevel@tonic-gate 3305*0Sstevel@tonic-gateReturns an empty string. Can be used in Makefile.PLs to write some 3306*0Sstevel@tonic-gatetext to the Makefile at the end. 3307*0Sstevel@tonic-gate 3308*0Sstevel@tonic-gate=cut 3309*0Sstevel@tonic-gate 3310*0Sstevel@tonic-gatesub postamble { 3311*0Sstevel@tonic-gate ""; 3312*0Sstevel@tonic-gate} 3313*0Sstevel@tonic-gate 3314*0Sstevel@tonic-gate=item ppd 3315*0Sstevel@tonic-gate 3316*0Sstevel@tonic-gateDefines target that creates a PPD (Perl Package Description) file 3317*0Sstevel@tonic-gatefor a binary distribution. 3318*0Sstevel@tonic-gate 3319*0Sstevel@tonic-gate=cut 3320*0Sstevel@tonic-gate 3321*0Sstevel@tonic-gatesub ppd { 3322*0Sstevel@tonic-gate my($self) = @_; 3323*0Sstevel@tonic-gate 3324*0Sstevel@tonic-gate if ($self->{ABSTRACT_FROM}){ 3325*0Sstevel@tonic-gate $self->{ABSTRACT} = $self->parse_abstract($self->{ABSTRACT_FROM}) or 3326*0Sstevel@tonic-gate carp "WARNING: Setting ABSTRACT via file ". 3327*0Sstevel@tonic-gate "'$self->{ABSTRACT_FROM}' failed\n"; 3328*0Sstevel@tonic-gate } 3329*0Sstevel@tonic-gate 3330*0Sstevel@tonic-gate my ($pack_ver) = join ",", (split (/\./, $self->{VERSION}), (0)x4)[0..3]; 3331*0Sstevel@tonic-gate 3332*0Sstevel@tonic-gate my $abstract = $self->{ABSTRACT} || ''; 3333*0Sstevel@tonic-gate $abstract =~ s/\n/\\n/sg; 3334*0Sstevel@tonic-gate $abstract =~ s/</</g; 3335*0Sstevel@tonic-gate $abstract =~ s/>/>/g; 3336*0Sstevel@tonic-gate 3337*0Sstevel@tonic-gate my $author = $self->{AUTHOR} || ''; 3338*0Sstevel@tonic-gate $author =~ s/</</g; 3339*0Sstevel@tonic-gate $author =~ s/>/>/g; 3340*0Sstevel@tonic-gate 3341*0Sstevel@tonic-gate my $ppd_xml = sprintf <<'PPD_HTML', $pack_ver, $abstract, $author; 3342*0Sstevel@tonic-gate<SOFTPKG NAME="$(DISTNAME)" VERSION="%s"> 3343*0Sstevel@tonic-gate <TITLE>$(DISTNAME)</TITLE> 3344*0Sstevel@tonic-gate <ABSTRACT>%s</ABSTRACT> 3345*0Sstevel@tonic-gate <AUTHOR>%s</AUTHOR> 3346*0Sstevel@tonic-gatePPD_HTML 3347*0Sstevel@tonic-gate 3348*0Sstevel@tonic-gate $ppd_xml .= " <IMPLEMENTATION>\n"; 3349*0Sstevel@tonic-gate foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) { 3350*0Sstevel@tonic-gate my $pre_req = $prereq; 3351*0Sstevel@tonic-gate $pre_req =~ s/::/-/g; 3352*0Sstevel@tonic-gate my ($dep_ver) = join ",", (split (/\./, $self->{PREREQ_PM}{$prereq}), 3353*0Sstevel@tonic-gate (0) x 4) [0 .. 3]; 3354*0Sstevel@tonic-gate $ppd_xml .= sprintf <<'PPD_OUT', $pre_req, $dep_ver; 3355*0Sstevel@tonic-gate <DEPENDENCY NAME="%s" VERSION="%s" /> 3356*0Sstevel@tonic-gatePPD_OUT 3357*0Sstevel@tonic-gate 3358*0Sstevel@tonic-gate } 3359*0Sstevel@tonic-gate 3360*0Sstevel@tonic-gate $ppd_xml .= sprintf <<'PPD_OUT', $Config{archname}; 3361*0Sstevel@tonic-gate <OS NAME="$(OSNAME)" /> 3362*0Sstevel@tonic-gate <ARCHITECTURE NAME="%s" /> 3363*0Sstevel@tonic-gatePPD_OUT 3364*0Sstevel@tonic-gate 3365*0Sstevel@tonic-gate if ($self->{PPM_INSTALL_SCRIPT}) { 3366*0Sstevel@tonic-gate if ($self->{PPM_INSTALL_EXEC}) { 3367*0Sstevel@tonic-gate $ppd_xml .= sprintf qq{ <INSTALL EXEC="%s">%s</INSTALL>\n}, 3368*0Sstevel@tonic-gate $self->{PPM_INSTALL_EXEC}, $self->{PPM_INSTALL_SCRIPT}; 3369*0Sstevel@tonic-gate } 3370*0Sstevel@tonic-gate else { 3371*0Sstevel@tonic-gate $ppd_xml .= sprintf qq{ <INSTALL>%s</INSTALL>\n}, 3372*0Sstevel@tonic-gate $self->{PPM_INSTALL_SCRIPT}; 3373*0Sstevel@tonic-gate } 3374*0Sstevel@tonic-gate } 3375*0Sstevel@tonic-gate 3376*0Sstevel@tonic-gate my ($bin_location) = $self->{BINARY_LOCATION} || ''; 3377*0Sstevel@tonic-gate $bin_location =~ s/\\/\\\\/g; 3378*0Sstevel@tonic-gate 3379*0Sstevel@tonic-gate $ppd_xml .= sprintf <<'PPD_XML', $bin_location; 3380*0Sstevel@tonic-gate <CODEBASE HREF="%s" /> 3381*0Sstevel@tonic-gate </IMPLEMENTATION> 3382*0Sstevel@tonic-gate</SOFTPKG> 3383*0Sstevel@tonic-gatePPD_XML 3384*0Sstevel@tonic-gate 3385*0Sstevel@tonic-gate my @ppd_cmds = $self->echo($ppd_xml, '$(DISTNAME).ppd'); 3386*0Sstevel@tonic-gate 3387*0Sstevel@tonic-gate return sprintf <<'PPD_OUT', join "\n\t", @ppd_cmds; 3388*0Sstevel@tonic-gate# Creates a PPD (Perl Package Description) for a binary distribution. 3389*0Sstevel@tonic-gateppd: 3390*0Sstevel@tonic-gate %s 3391*0Sstevel@tonic-gatePPD_OUT 3392*0Sstevel@tonic-gate 3393*0Sstevel@tonic-gate} 3394*0Sstevel@tonic-gate 3395*0Sstevel@tonic-gate=item prefixify 3396*0Sstevel@tonic-gate 3397*0Sstevel@tonic-gate $MM->prefixify($var, $prefix, $new_prefix, $default); 3398*0Sstevel@tonic-gate 3399*0Sstevel@tonic-gateUsing either $MM->{uc $var} || $Config{lc $var}, it will attempt to 3400*0Sstevel@tonic-gatereplace it's $prefix with a $new_prefix. 3401*0Sstevel@tonic-gate 3402*0Sstevel@tonic-gateShould the $prefix fail to match I<AND> a PREFIX was given as an 3403*0Sstevel@tonic-gateargument to WriteMakefile() it will set it to the $new_prefix + 3404*0Sstevel@tonic-gate$default. This is for systems whose file layouts don't neatly fit into 3405*0Sstevel@tonic-gateour ideas of prefixes. 3406*0Sstevel@tonic-gate 3407*0Sstevel@tonic-gateThis is for heuristics which attempt to create directory structures 3408*0Sstevel@tonic-gatethat mirror those of the installed perl. 3409*0Sstevel@tonic-gate 3410*0Sstevel@tonic-gateFor example: 3411*0Sstevel@tonic-gate 3412*0Sstevel@tonic-gate $MM->prefixify('installman1dir', '/usr', '/home/foo', 'man/man1'); 3413*0Sstevel@tonic-gate 3414*0Sstevel@tonic-gatethis will attempt to remove '/usr' from the front of the 3415*0Sstevel@tonic-gate$MM->{INSTALLMAN1DIR} path (initializing it to $Config{installman1dir} 3416*0Sstevel@tonic-gateif necessary) and replace it with '/home/foo'. If this fails it will 3417*0Sstevel@tonic-gatesimply use '/home/foo/man/man1'. 3418*0Sstevel@tonic-gate 3419*0Sstevel@tonic-gate=cut 3420*0Sstevel@tonic-gate 3421*0Sstevel@tonic-gatesub prefixify { 3422*0Sstevel@tonic-gate my($self,$var,$sprefix,$rprefix,$default) = @_; 3423*0Sstevel@tonic-gate 3424*0Sstevel@tonic-gate my $path = $self->{uc $var} || 3425*0Sstevel@tonic-gate $Config_Override{lc $var} || $Config{lc $var} || ''; 3426*0Sstevel@tonic-gate 3427*0Sstevel@tonic-gate $rprefix .= '/' if $sprefix =~ m|/$|; 3428*0Sstevel@tonic-gate 3429*0Sstevel@tonic-gate print STDERR " prefixify $var => $path\n" if $Verbose >= 2; 3430*0Sstevel@tonic-gate print STDERR " from $sprefix to $rprefix\n" if $Verbose >= 2; 3431*0Sstevel@tonic-gate 3432*0Sstevel@tonic-gate if( $path !~ s{^\Q$sprefix\E\b}{$rprefix}s && $self->{ARGS}{PREFIX} ) { 3433*0Sstevel@tonic-gate 3434*0Sstevel@tonic-gate print STDERR " cannot prefix, using default.\n" if $Verbose >= 2; 3435*0Sstevel@tonic-gate print STDERR " no default!\n" if !$default && $Verbose >= 2; 3436*0Sstevel@tonic-gate 3437*0Sstevel@tonic-gate $path = $self->catdir($rprefix, $default) if $default; 3438*0Sstevel@tonic-gate } 3439*0Sstevel@tonic-gate 3440*0Sstevel@tonic-gate print " now $path\n" if $Verbose >= 2; 3441*0Sstevel@tonic-gate return $self->{uc $var} = $path; 3442*0Sstevel@tonic-gate} 3443*0Sstevel@tonic-gate 3444*0Sstevel@tonic-gate 3445*0Sstevel@tonic-gate=item processPL (o) 3446*0Sstevel@tonic-gate 3447*0Sstevel@tonic-gateDefines targets to run *.PL files. 3448*0Sstevel@tonic-gate 3449*0Sstevel@tonic-gate=cut 3450*0Sstevel@tonic-gate 3451*0Sstevel@tonic-gatesub processPL { 3452*0Sstevel@tonic-gate my($self) = shift; 3453*0Sstevel@tonic-gate return "" unless $self->{PL_FILES}; 3454*0Sstevel@tonic-gate my(@m, $plfile); 3455*0Sstevel@tonic-gate foreach $plfile (sort keys %{$self->{PL_FILES}}) { 3456*0Sstevel@tonic-gate my $list = ref($self->{PL_FILES}->{$plfile}) 3457*0Sstevel@tonic-gate ? $self->{PL_FILES}->{$plfile} 3458*0Sstevel@tonic-gate : [$self->{PL_FILES}->{$plfile}]; 3459*0Sstevel@tonic-gate my $target; 3460*0Sstevel@tonic-gate foreach $target (@$list) { 3461*0Sstevel@tonic-gate push @m, " 3462*0Sstevel@tonic-gateall :: $target 3463*0Sstevel@tonic-gate \$(NOECHO) \$(NOOP) 3464*0Sstevel@tonic-gate 3465*0Sstevel@tonic-gate$target :: $plfile 3466*0Sstevel@tonic-gate \$(PERLRUNINST) $plfile $target 3467*0Sstevel@tonic-gate"; 3468*0Sstevel@tonic-gate } 3469*0Sstevel@tonic-gate } 3470*0Sstevel@tonic-gate join "", @m; 3471*0Sstevel@tonic-gate} 3472*0Sstevel@tonic-gate 3473*0Sstevel@tonic-gate=item quote_paren 3474*0Sstevel@tonic-gate 3475*0Sstevel@tonic-gateBackslashes parentheses C<()> in command line arguments. 3476*0Sstevel@tonic-gateDoesn't handle recursive Makefile C<$(...)> constructs, 3477*0Sstevel@tonic-gatebut handles simple ones. 3478*0Sstevel@tonic-gate 3479*0Sstevel@tonic-gate=cut 3480*0Sstevel@tonic-gate 3481*0Sstevel@tonic-gatesub quote_paren { 3482*0Sstevel@tonic-gate my $arg = shift; 3483*0Sstevel@tonic-gate $arg =~ s/\$\((.+?)\)/\$\\\\($1\\\\)/g; # protect $(...) 3484*0Sstevel@tonic-gate $arg =~ s/(?<!\\)([()])/\\$1/g; # quote unprotected 3485*0Sstevel@tonic-gate $arg =~ s/\$\\\\\((.+?)\\\\\)/\$($1)/g; # unprotect $(...) 3486*0Sstevel@tonic-gate return $arg; 3487*0Sstevel@tonic-gate} 3488*0Sstevel@tonic-gate 3489*0Sstevel@tonic-gate=item realclean (o) 3490*0Sstevel@tonic-gate 3491*0Sstevel@tonic-gateDefines the realclean target. 3492*0Sstevel@tonic-gate 3493*0Sstevel@tonic-gate=cut 3494*0Sstevel@tonic-gate 3495*0Sstevel@tonic-gatesub realclean { 3496*0Sstevel@tonic-gate my($self, %attribs) = @_; 3497*0Sstevel@tonic-gate my(@m); 3498*0Sstevel@tonic-gate 3499*0Sstevel@tonic-gate push(@m,' 3500*0Sstevel@tonic-gate# Delete temporary files (via clean) and also delete installed files 3501*0Sstevel@tonic-gaterealclean purge :: clean realclean_subdirs 3502*0Sstevel@tonic-gate $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR) 3503*0Sstevel@tonic-gate $(RM_RF) $(DISTVNAME) 3504*0Sstevel@tonic-gate'); 3505*0Sstevel@tonic-gate 3506*0Sstevel@tonic-gate if( $self->has_link_code ){ 3507*0Sstevel@tonic-gate push(@m, " \$(RM_F) \$(INST_DYNAMIC) \$(INST_BOOT)\n"); 3508*0Sstevel@tonic-gate push(@m, " \$(RM_F) \$(INST_STATIC)\n"); 3509*0Sstevel@tonic-gate } 3510*0Sstevel@tonic-gate 3511*0Sstevel@tonic-gate my @files = values %{$self->{PM}}; 3512*0Sstevel@tonic-gate push @files, $attribs{FILES} if $attribs{FILES}; 3513*0Sstevel@tonic-gate push @files, '$(FIRST_MAKEFILE)', '$(MAKEFILE_OLD)'; 3514*0Sstevel@tonic-gate 3515*0Sstevel@tonic-gate # Occasionally files are repeated several times from different sources 3516*0Sstevel@tonic-gate { my(%f) = map { ($_,1) } @files; @files = keys %f; } 3517*0Sstevel@tonic-gate 3518*0Sstevel@tonic-gate # Issue a several little RM_F commands rather than risk creating a 3519*0Sstevel@tonic-gate # very long command line (useful for extensions such as Encode 3520*0Sstevel@tonic-gate # that have many files). 3521*0Sstevel@tonic-gate my $line = ""; 3522*0Sstevel@tonic-gate foreach my $file (@files) { 3523*0Sstevel@tonic-gate if (length($line) + length($file) > 200) { 3524*0Sstevel@tonic-gate push @m, "\t\$(RM_F) $line\n"; 3525*0Sstevel@tonic-gate $line = $file; 3526*0Sstevel@tonic-gate } 3527*0Sstevel@tonic-gate else { 3528*0Sstevel@tonic-gate $line .= " $file"; 3529*0Sstevel@tonic-gate } 3530*0Sstevel@tonic-gate } 3531*0Sstevel@tonic-gate push @m, "\t\$(RM_F) $line\n" if $line; 3532*0Sstevel@tonic-gate push(@m, "\t$attribs{POSTOP}\n") if $attribs{POSTOP}; 3533*0Sstevel@tonic-gate 3534*0Sstevel@tonic-gate join("", @m); 3535*0Sstevel@tonic-gate} 3536*0Sstevel@tonic-gate 3537*0Sstevel@tonic-gate 3538*0Sstevel@tonic-gate=item realclean_subdirs_target 3539*0Sstevel@tonic-gate 3540*0Sstevel@tonic-gate my $make_frag = $MM->realclean_subdirs_target; 3541*0Sstevel@tonic-gate 3542*0Sstevel@tonic-gateReturns the realclean_subdirs target. This is used by the realclean 3543*0Sstevel@tonic-gatetarget to call realclean on any subdirectories which contain Makefiles. 3544*0Sstevel@tonic-gate 3545*0Sstevel@tonic-gate=cut 3546*0Sstevel@tonic-gate 3547*0Sstevel@tonic-gatesub realclean_subdirs_target { 3548*0Sstevel@tonic-gate my $self = shift; 3549*0Sstevel@tonic-gate 3550*0Sstevel@tonic-gate return <<'NOOP_FRAG' unless @{$self->{DIR}}; 3551*0Sstevel@tonic-gaterealclean_subdirs : 3552*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 3553*0Sstevel@tonic-gateNOOP_FRAG 3554*0Sstevel@tonic-gate 3555*0Sstevel@tonic-gate my $rclean = "realclean_subdirs :\n"; 3556*0Sstevel@tonic-gate 3557*0Sstevel@tonic-gate foreach my $dir (@{$self->{DIR}}){ 3558*0Sstevel@tonic-gate $rclean .= sprintf <<'RCLEAN', $dir, $dir; 3559*0Sstevel@tonic-gate -cd %s && $(TEST_F) $(MAKEFILE_OLD) && $(MAKE) -f $(MAKEFILE_OLD) realclean 3560*0Sstevel@tonic-gate -cd %s && $(TEST_F) $(FIRST_MAKEFILE) && $(MAKE) realclean 3561*0Sstevel@tonic-gateRCLEAN 3562*0Sstevel@tonic-gate 3563*0Sstevel@tonic-gate } 3564*0Sstevel@tonic-gate 3565*0Sstevel@tonic-gate return $rclean; 3566*0Sstevel@tonic-gate} 3567*0Sstevel@tonic-gate 3568*0Sstevel@tonic-gate 3569*0Sstevel@tonic-gate=item replace_manpage_separator 3570*0Sstevel@tonic-gate 3571*0Sstevel@tonic-gate my $man_name = $MM->replace_manpage_separator($file_path); 3572*0Sstevel@tonic-gate 3573*0Sstevel@tonic-gateTakes the name of a package, which may be a nested package, in the 3574*0Sstevel@tonic-gateform 'Foo/Bar.pm' and replaces the slash with C<::> or something else 3575*0Sstevel@tonic-gatesafe for a man page file name. Returns the replacement. 3576*0Sstevel@tonic-gate 3577*0Sstevel@tonic-gate=cut 3578*0Sstevel@tonic-gate 3579*0Sstevel@tonic-gatesub replace_manpage_separator { 3580*0Sstevel@tonic-gate my($self,$man) = @_; 3581*0Sstevel@tonic-gate 3582*0Sstevel@tonic-gate $man =~ s,/+,::,g; 3583*0Sstevel@tonic-gate return $man; 3584*0Sstevel@tonic-gate} 3585*0Sstevel@tonic-gate 3586*0Sstevel@tonic-gate 3587*0Sstevel@tonic-gate=item oneliner (o) 3588*0Sstevel@tonic-gate 3589*0Sstevel@tonic-gate=cut 3590*0Sstevel@tonic-gate 3591*0Sstevel@tonic-gatesub oneliner { 3592*0Sstevel@tonic-gate my($self, $cmd, $switches) = @_; 3593*0Sstevel@tonic-gate $switches = [] unless defined $switches; 3594*0Sstevel@tonic-gate 3595*0Sstevel@tonic-gate # Strip leading and trailing newlines 3596*0Sstevel@tonic-gate $cmd =~ s{^\n+}{}; 3597*0Sstevel@tonic-gate $cmd =~ s{\n+$}{}; 3598*0Sstevel@tonic-gate 3599*0Sstevel@tonic-gate my @cmds = split /\n/, $cmd; 3600*0Sstevel@tonic-gate $cmd = join " \n\t-e ", map $self->quote_literal($_), @cmds; 3601*0Sstevel@tonic-gate $cmd = $self->escape_newlines($cmd); 3602*0Sstevel@tonic-gate 3603*0Sstevel@tonic-gate $switches = join ' ', @$switches; 3604*0Sstevel@tonic-gate 3605*0Sstevel@tonic-gate return qq{\$(PERLRUN) $switches -e $cmd}; 3606*0Sstevel@tonic-gate} 3607*0Sstevel@tonic-gate 3608*0Sstevel@tonic-gate 3609*0Sstevel@tonic-gate=item quote_literal 3610*0Sstevel@tonic-gate 3611*0Sstevel@tonic-gate=cut 3612*0Sstevel@tonic-gate 3613*0Sstevel@tonic-gatesub quote_literal { 3614*0Sstevel@tonic-gate my($self, $text) = @_; 3615*0Sstevel@tonic-gate 3616*0Sstevel@tonic-gate # I think all we have to quote is single quotes and I think 3617*0Sstevel@tonic-gate # this is a safe way to do it. 3618*0Sstevel@tonic-gate $text =~ s{'}{'\\''}g; 3619*0Sstevel@tonic-gate 3620*0Sstevel@tonic-gate return "'$text'"; 3621*0Sstevel@tonic-gate} 3622*0Sstevel@tonic-gate 3623*0Sstevel@tonic-gate 3624*0Sstevel@tonic-gate=item escape_newlines 3625*0Sstevel@tonic-gate 3626*0Sstevel@tonic-gate=cut 3627*0Sstevel@tonic-gate 3628*0Sstevel@tonic-gatesub escape_newlines { 3629*0Sstevel@tonic-gate my($self, $text) = @_; 3630*0Sstevel@tonic-gate 3631*0Sstevel@tonic-gate $text =~ s{\n}{\\\n}g; 3632*0Sstevel@tonic-gate 3633*0Sstevel@tonic-gate return $text; 3634*0Sstevel@tonic-gate} 3635*0Sstevel@tonic-gate 3636*0Sstevel@tonic-gate 3637*0Sstevel@tonic-gate=item max_exec_len 3638*0Sstevel@tonic-gate 3639*0Sstevel@tonic-gateUsing POSIX::ARG_MAX. Otherwise falling back to 4096. 3640*0Sstevel@tonic-gate 3641*0Sstevel@tonic-gate=cut 3642*0Sstevel@tonic-gate 3643*0Sstevel@tonic-gatesub max_exec_len { 3644*0Sstevel@tonic-gate my $self = shift; 3645*0Sstevel@tonic-gate 3646*0Sstevel@tonic-gate if (!defined $self->{_MAX_EXEC_LEN}) { 3647*0Sstevel@tonic-gate if (my $arg_max = eval { require POSIX; &POSIX::ARG_MAX }) { 3648*0Sstevel@tonic-gate $self->{_MAX_EXEC_LEN} = $arg_max; 3649*0Sstevel@tonic-gate } 3650*0Sstevel@tonic-gate else { # POSIX minimum exec size 3651*0Sstevel@tonic-gate $self->{_MAX_EXEC_LEN} = 4096; 3652*0Sstevel@tonic-gate } 3653*0Sstevel@tonic-gate } 3654*0Sstevel@tonic-gate 3655*0Sstevel@tonic-gate return $self->{_MAX_EXEC_LEN}; 3656*0Sstevel@tonic-gate} 3657*0Sstevel@tonic-gate 3658*0Sstevel@tonic-gate 3659*0Sstevel@tonic-gate=item static (o) 3660*0Sstevel@tonic-gate 3661*0Sstevel@tonic-gateDefines the static target. 3662*0Sstevel@tonic-gate 3663*0Sstevel@tonic-gate=cut 3664*0Sstevel@tonic-gate 3665*0Sstevel@tonic-gatesub static { 3666*0Sstevel@tonic-gate# --- Static Loading Sections --- 3667*0Sstevel@tonic-gate 3668*0Sstevel@tonic-gate my($self) = shift; 3669*0Sstevel@tonic-gate ' 3670*0Sstevel@tonic-gate## $(INST_PM) has been moved to the all: target. 3671*0Sstevel@tonic-gate## It remains here for awhile to allow for old usage: "make static" 3672*0Sstevel@tonic-gatestatic :: $(FIRST_MAKEFILE) $(INST_STATIC) 3673*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 3674*0Sstevel@tonic-gate'; 3675*0Sstevel@tonic-gate} 3676*0Sstevel@tonic-gate 3677*0Sstevel@tonic-gate=item static_lib (o) 3678*0Sstevel@tonic-gate 3679*0Sstevel@tonic-gateDefines how to produce the *.a (or equivalent) files. 3680*0Sstevel@tonic-gate 3681*0Sstevel@tonic-gate=cut 3682*0Sstevel@tonic-gate 3683*0Sstevel@tonic-gatesub static_lib { 3684*0Sstevel@tonic-gate my($self) = @_; 3685*0Sstevel@tonic-gate return '' unless $self->has_link_code; 3686*0Sstevel@tonic-gate 3687*0Sstevel@tonic-gate my(@m); 3688*0Sstevel@tonic-gate push(@m, <<'END'); 3689*0Sstevel@tonic-gate 3690*0Sstevel@tonic-gate$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DIRFILESEP).exists 3691*0Sstevel@tonic-gate $(RM_RF) $@ 3692*0Sstevel@tonic-gateEND 3693*0Sstevel@tonic-gate 3694*0Sstevel@tonic-gate # If this extension has its own library (eg SDBM_File) 3695*0Sstevel@tonic-gate # then copy that to $(INST_STATIC) and add $(OBJECT) into it. 3696*0Sstevel@tonic-gate push(@m, <<'MAKE_FRAG') if $self->{MYEXTLIB}; 3697*0Sstevel@tonic-gate $(CP) $(MYEXTLIB) $@ 3698*0Sstevel@tonic-gateMAKE_FRAG 3699*0Sstevel@tonic-gate 3700*0Sstevel@tonic-gate my $ar; 3701*0Sstevel@tonic-gate if (exists $self->{FULL_AR} && -x $self->{FULL_AR}) { 3702*0Sstevel@tonic-gate # Prefer the absolute pathed ar if available so that PATH 3703*0Sstevel@tonic-gate # doesn't confuse us. Perl itself is built with the full_ar. 3704*0Sstevel@tonic-gate $ar = 'FULL_AR'; 3705*0Sstevel@tonic-gate } else { 3706*0Sstevel@tonic-gate $ar = 'AR'; 3707*0Sstevel@tonic-gate } 3708*0Sstevel@tonic-gate push @m, sprintf <<'MAKE_FRAG', $ar; 3709*0Sstevel@tonic-gate $(%s) $(AR_STATIC_ARGS) $@ $(OBJECT) && $(RANLIB) $@ 3710*0Sstevel@tonic-gate $(CHMOD) $(PERM_RWX) $@ 3711*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld 3712*0Sstevel@tonic-gateMAKE_FRAG 3713*0Sstevel@tonic-gate 3714*0Sstevel@tonic-gate # Old mechanism - still available: 3715*0Sstevel@tonic-gate push @m, <<'MAKE_FRAG' if $self->{PERL_SRC} && $self->{EXTRALIBS}; 3716*0Sstevel@tonic-gate $(NOECHO) $(ECHO) "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs 3717*0Sstevel@tonic-gateMAKE_FRAG 3718*0Sstevel@tonic-gate 3719*0Sstevel@tonic-gate push @m, "\n", $self->dir_target('$(INST_ARCHAUTODIR)'); 3720*0Sstevel@tonic-gate join('', @m); 3721*0Sstevel@tonic-gate} 3722*0Sstevel@tonic-gate 3723*0Sstevel@tonic-gate=item staticmake (o) 3724*0Sstevel@tonic-gate 3725*0Sstevel@tonic-gateCalls makeaperl. 3726*0Sstevel@tonic-gate 3727*0Sstevel@tonic-gate=cut 3728*0Sstevel@tonic-gate 3729*0Sstevel@tonic-gatesub staticmake { 3730*0Sstevel@tonic-gate my($self, %attribs) = @_; 3731*0Sstevel@tonic-gate my(@static); 3732*0Sstevel@tonic-gate 3733*0Sstevel@tonic-gate my(@searchdirs)=($self->{PERL_ARCHLIB}, $self->{SITEARCHEXP}, $self->{INST_ARCHLIB}); 3734*0Sstevel@tonic-gate 3735*0Sstevel@tonic-gate # And as it's not yet built, we add the current extension 3736*0Sstevel@tonic-gate # but only if it has some C code (or XS code, which implies C code) 3737*0Sstevel@tonic-gate if (@{$self->{C}}) { 3738*0Sstevel@tonic-gate @static = $self->catfile($self->{INST_ARCHLIB}, 3739*0Sstevel@tonic-gate "auto", 3740*0Sstevel@tonic-gate $self->{FULLEXT}, 3741*0Sstevel@tonic-gate "$self->{BASEEXT}$self->{LIB_EXT}" 3742*0Sstevel@tonic-gate ); 3743*0Sstevel@tonic-gate } 3744*0Sstevel@tonic-gate 3745*0Sstevel@tonic-gate # Either we determine now, which libraries we will produce in the 3746*0Sstevel@tonic-gate # subdirectories or we do it at runtime of the make. 3747*0Sstevel@tonic-gate 3748*0Sstevel@tonic-gate # We could ask all subdir objects, but I cannot imagine, why it 3749*0Sstevel@tonic-gate # would be necessary. 3750*0Sstevel@tonic-gate 3751*0Sstevel@tonic-gate # Instead we determine all libraries for the new perl at 3752*0Sstevel@tonic-gate # runtime. 3753*0Sstevel@tonic-gate my(@perlinc) = ($self->{INST_ARCHLIB}, $self->{INST_LIB}, $self->{PERL_ARCHLIB}, $self->{PERL_LIB}); 3754*0Sstevel@tonic-gate 3755*0Sstevel@tonic-gate $self->makeaperl(MAKE => $self->{MAKEFILE}, 3756*0Sstevel@tonic-gate DIRS => \@searchdirs, 3757*0Sstevel@tonic-gate STAT => \@static, 3758*0Sstevel@tonic-gate INCL => \@perlinc, 3759*0Sstevel@tonic-gate TARGET => $self->{MAP_TARGET}, 3760*0Sstevel@tonic-gate TMP => "", 3761*0Sstevel@tonic-gate LIBPERL => $self->{LIBPERL_A} 3762*0Sstevel@tonic-gate ); 3763*0Sstevel@tonic-gate} 3764*0Sstevel@tonic-gate 3765*0Sstevel@tonic-gate=item subdir_x (o) 3766*0Sstevel@tonic-gate 3767*0Sstevel@tonic-gateHelper subroutine for subdirs 3768*0Sstevel@tonic-gate 3769*0Sstevel@tonic-gate=cut 3770*0Sstevel@tonic-gate 3771*0Sstevel@tonic-gatesub subdir_x { 3772*0Sstevel@tonic-gate my($self, $subdir) = @_; 3773*0Sstevel@tonic-gate return sprintf <<'EOT', $subdir; 3774*0Sstevel@tonic-gate 3775*0Sstevel@tonic-gatesubdirs :: 3776*0Sstevel@tonic-gate $(NOECHO)cd %s && $(MAKE) -f $(FIRST_MAKEFILE) all $(PASTHRU) 3777*0Sstevel@tonic-gateEOT 3778*0Sstevel@tonic-gate} 3779*0Sstevel@tonic-gate 3780*0Sstevel@tonic-gate=item subdirs (o) 3781*0Sstevel@tonic-gate 3782*0Sstevel@tonic-gateDefines targets to process subdirectories. 3783*0Sstevel@tonic-gate 3784*0Sstevel@tonic-gate=cut 3785*0Sstevel@tonic-gate 3786*0Sstevel@tonic-gatesub subdirs { 3787*0Sstevel@tonic-gate# --- Sub-directory Sections --- 3788*0Sstevel@tonic-gate my($self) = shift; 3789*0Sstevel@tonic-gate my(@m,$dir); 3790*0Sstevel@tonic-gate # This method provides a mechanism to automatically deal with 3791*0Sstevel@tonic-gate # subdirectories containing further Makefile.PL scripts. 3792*0Sstevel@tonic-gate # It calls the subdir_x() method for each subdirectory. 3793*0Sstevel@tonic-gate foreach $dir (@{$self->{DIR}}){ 3794*0Sstevel@tonic-gate push(@m, $self->subdir_x($dir)); 3795*0Sstevel@tonic-gate#### print "Including $dir subdirectory\n"; 3796*0Sstevel@tonic-gate } 3797*0Sstevel@tonic-gate if (@m){ 3798*0Sstevel@tonic-gate unshift(@m, " 3799*0Sstevel@tonic-gate# The default clean, realclean and test targets in this Makefile 3800*0Sstevel@tonic-gate# have automatically been given entries for each subdir. 3801*0Sstevel@tonic-gate 3802*0Sstevel@tonic-gate"); 3803*0Sstevel@tonic-gate } else { 3804*0Sstevel@tonic-gate push(@m, "\n# none") 3805*0Sstevel@tonic-gate } 3806*0Sstevel@tonic-gate join('',@m); 3807*0Sstevel@tonic-gate} 3808*0Sstevel@tonic-gate 3809*0Sstevel@tonic-gate=item test (o) 3810*0Sstevel@tonic-gate 3811*0Sstevel@tonic-gateDefines the test targets. 3812*0Sstevel@tonic-gate 3813*0Sstevel@tonic-gate=cut 3814*0Sstevel@tonic-gate 3815*0Sstevel@tonic-gatesub test { 3816*0Sstevel@tonic-gate# --- Test and Installation Sections --- 3817*0Sstevel@tonic-gate 3818*0Sstevel@tonic-gate my($self, %attribs) = @_; 3819*0Sstevel@tonic-gate my $tests = $attribs{TESTS} || ''; 3820*0Sstevel@tonic-gate if (!$tests && -d 't') { 3821*0Sstevel@tonic-gate $tests = $self->find_tests; 3822*0Sstevel@tonic-gate } 3823*0Sstevel@tonic-gate # note: 'test.pl' name is also hardcoded in init_dirscan() 3824*0Sstevel@tonic-gate my(@m); 3825*0Sstevel@tonic-gate push(@m," 3826*0Sstevel@tonic-gateTEST_VERBOSE=0 3827*0Sstevel@tonic-gateTEST_TYPE=test_\$(LINKTYPE) 3828*0Sstevel@tonic-gateTEST_FILE = test.pl 3829*0Sstevel@tonic-gateTEST_FILES = $tests 3830*0Sstevel@tonic-gateTESTDB_SW = -d 3831*0Sstevel@tonic-gate 3832*0Sstevel@tonic-gatetestdb :: testdb_\$(LINKTYPE) 3833*0Sstevel@tonic-gate 3834*0Sstevel@tonic-gatetest :: \$(TEST_TYPE) 3835*0Sstevel@tonic-gate"); 3836*0Sstevel@tonic-gate 3837*0Sstevel@tonic-gate if ($Is_Win95) { 3838*0Sstevel@tonic-gate push(@m, map(qq{\t\$(NOECHO) \$(PERLRUN) -e "exit unless -f shift; chdir '$_'; system q{\$(MAKE) test \$(PASTHRU)}" \$(FIRST_MAKEFILE)\n}, @{$self->{DIR}})); 3839*0Sstevel@tonic-gate } 3840*0Sstevel@tonic-gate else { 3841*0Sstevel@tonic-gate push(@m, map("\t\$(NOECHO) cd $_ && \$(TEST_F) \$(FIRST_MAKEFILE) && \$(MAKE) test \$(PASTHRU)\n", @{$self->{DIR}})); 3842*0Sstevel@tonic-gate } 3843*0Sstevel@tonic-gate 3844*0Sstevel@tonic-gate push(@m, "\t\$(NOECHO) \$(ECHO) 'No tests defined for \$(NAME) extension.'\n") 3845*0Sstevel@tonic-gate unless $tests or -f "test.pl" or @{$self->{DIR}}; 3846*0Sstevel@tonic-gate push(@m, "\n"); 3847*0Sstevel@tonic-gate 3848*0Sstevel@tonic-gate push(@m, "test_dynamic :: pure_all\n"); 3849*0Sstevel@tonic-gate push(@m, $self->test_via_harness('$(FULLPERLRUN)', '$(TEST_FILES)')) 3850*0Sstevel@tonic-gate if $tests; 3851*0Sstevel@tonic-gate push(@m, $self->test_via_script('$(FULLPERLRUN)', '$(TEST_FILE)')) 3852*0Sstevel@tonic-gate if -f "test.pl"; 3853*0Sstevel@tonic-gate push(@m, "\n"); 3854*0Sstevel@tonic-gate 3855*0Sstevel@tonic-gate push(@m, "testdb_dynamic :: pure_all\n"); 3856*0Sstevel@tonic-gate push(@m, $self->test_via_script('$(FULLPERLRUN) $(TESTDB_SW)', 3857*0Sstevel@tonic-gate '$(TEST_FILE)')); 3858*0Sstevel@tonic-gate push(@m, "\n"); 3859*0Sstevel@tonic-gate 3860*0Sstevel@tonic-gate # Occasionally we may face this degenerate target: 3861*0Sstevel@tonic-gate push @m, "test_ : test_dynamic\n\n"; 3862*0Sstevel@tonic-gate 3863*0Sstevel@tonic-gate if ($self->needs_linking()) { 3864*0Sstevel@tonic-gate push(@m, "test_static :: pure_all \$(MAP_TARGET)\n"); 3865*0Sstevel@tonic-gate push(@m, $self->test_via_harness('./$(MAP_TARGET)', '$(TEST_FILES)')) if $tests; 3866*0Sstevel@tonic-gate push(@m, $self->test_via_script('./$(MAP_TARGET)', '$(TEST_FILE)')) if -f "test.pl"; 3867*0Sstevel@tonic-gate push(@m, "\n"); 3868*0Sstevel@tonic-gate push(@m, "testdb_static :: pure_all \$(MAP_TARGET)\n"); 3869*0Sstevel@tonic-gate push(@m, $self->test_via_script('./$(MAP_TARGET) $(TESTDB_SW)', '$(TEST_FILE)')); 3870*0Sstevel@tonic-gate push(@m, "\n"); 3871*0Sstevel@tonic-gate } else { 3872*0Sstevel@tonic-gate push @m, "test_static :: test_dynamic\n"; 3873*0Sstevel@tonic-gate push @m, "testdb_static :: testdb_dynamic\n"; 3874*0Sstevel@tonic-gate } 3875*0Sstevel@tonic-gate join("", @m); 3876*0Sstevel@tonic-gate} 3877*0Sstevel@tonic-gate 3878*0Sstevel@tonic-gate=item test_via_harness (override) 3879*0Sstevel@tonic-gate 3880*0Sstevel@tonic-gateFor some reason which I forget, Unix machines like to have 3881*0Sstevel@tonic-gatePERL_DL_NONLAZY set for tests. 3882*0Sstevel@tonic-gate 3883*0Sstevel@tonic-gate=cut 3884*0Sstevel@tonic-gate 3885*0Sstevel@tonic-gatesub test_via_harness { 3886*0Sstevel@tonic-gate my($self, $perl, $tests) = @_; 3887*0Sstevel@tonic-gate return $self->SUPER::test_via_harness("PERL_DL_NONLAZY=1 $perl", $tests); 3888*0Sstevel@tonic-gate} 3889*0Sstevel@tonic-gate 3890*0Sstevel@tonic-gate=item test_via_script (override) 3891*0Sstevel@tonic-gate 3892*0Sstevel@tonic-gateAgain, the PERL_DL_NONLAZY thing. 3893*0Sstevel@tonic-gate 3894*0Sstevel@tonic-gate=cut 3895*0Sstevel@tonic-gate 3896*0Sstevel@tonic-gatesub test_via_script { 3897*0Sstevel@tonic-gate my($self, $perl, $script) = @_; 3898*0Sstevel@tonic-gate return $self->SUPER::test_via_script("PERL_DL_NONLAZY=1 $perl", $script); 3899*0Sstevel@tonic-gate} 3900*0Sstevel@tonic-gate 3901*0Sstevel@tonic-gate 3902*0Sstevel@tonic-gate=item tools_other (o) 3903*0Sstevel@tonic-gate 3904*0Sstevel@tonic-gate my $make_frag = $MM->tools_other; 3905*0Sstevel@tonic-gate 3906*0Sstevel@tonic-gateReturns a make fragment containing definitions for: 3907*0Sstevel@tonic-gate 3908*0Sstevel@tonic-gateSHELL, CHMOD, CP, MV, NOOP, NOECHO, RM_F, RM_RF, TEST_F, TOUCH, 3909*0Sstevel@tonic-gateDEV_NULL, UMASK_NULL, MKPATH, EQUALIZE_TIMESTAMP, 3910*0Sstevel@tonic-gateWARN_IF_OLD_PACKLIST, UNINST, VERBINST, MOD_INSTALL, DOC_INSTALL and 3911*0Sstevel@tonic-gateUNINSTALL 3912*0Sstevel@tonic-gate 3913*0Sstevel@tonic-gateinit_others() initializes all these values. 3914*0Sstevel@tonic-gate 3915*0Sstevel@tonic-gate=cut 3916*0Sstevel@tonic-gate 3917*0Sstevel@tonic-gatesub tools_other { 3918*0Sstevel@tonic-gate my($self) = shift; 3919*0Sstevel@tonic-gate my @m; 3920*0Sstevel@tonic-gate 3921*0Sstevel@tonic-gate for my $tool (qw{ SHELL CHMOD CP MV NOOP NOECHO RM_F RM_RF TEST_F TOUCH 3922*0Sstevel@tonic-gate UMASK_NULL DEV_NULL MKPATH EQUALIZE_TIMESTAMP 3923*0Sstevel@tonic-gate ECHO ECHO_N 3924*0Sstevel@tonic-gate UNINST VERBINST 3925*0Sstevel@tonic-gate MOD_INSTALL DOC_INSTALL UNINSTALL 3926*0Sstevel@tonic-gate WARN_IF_OLD_PACKLIST 3927*0Sstevel@tonic-gate } ) 3928*0Sstevel@tonic-gate { 3929*0Sstevel@tonic-gate next unless defined $self->{$tool}; 3930*0Sstevel@tonic-gate push @m, "$tool = $self->{$tool}\n"; 3931*0Sstevel@tonic-gate } 3932*0Sstevel@tonic-gate 3933*0Sstevel@tonic-gate return join "", @m; 3934*0Sstevel@tonic-gate} 3935*0Sstevel@tonic-gate 3936*0Sstevel@tonic-gate=item tool_xsubpp (o) 3937*0Sstevel@tonic-gate 3938*0Sstevel@tonic-gateDetermines typemaps, xsubpp version, prototype behaviour. 3939*0Sstevel@tonic-gate 3940*0Sstevel@tonic-gate=cut 3941*0Sstevel@tonic-gate 3942*0Sstevel@tonic-gatesub tool_xsubpp { 3943*0Sstevel@tonic-gate my($self) = shift; 3944*0Sstevel@tonic-gate return "" unless $self->needs_linking; 3945*0Sstevel@tonic-gate 3946*0Sstevel@tonic-gate my $xsdir; 3947*0Sstevel@tonic-gate foreach my $dir (@INC) { 3948*0Sstevel@tonic-gate $xsdir = $self->catdir($dir, 'ExtUtils'); 3949*0Sstevel@tonic-gate if( -r $self->catfile($xsdir, "xsubpp") ) { 3950*0Sstevel@tonic-gate last; 3951*0Sstevel@tonic-gate } 3952*0Sstevel@tonic-gate } 3953*0Sstevel@tonic-gate 3954*0Sstevel@tonic-gate my $tmdir = File::Spec->catdir($self->{PERL_LIB},"ExtUtils"); 3955*0Sstevel@tonic-gate my(@tmdeps) = $self->catfile($tmdir,'typemap'); 3956*0Sstevel@tonic-gate if( $self->{TYPEMAPS} ){ 3957*0Sstevel@tonic-gate my $typemap; 3958*0Sstevel@tonic-gate foreach $typemap (@{$self->{TYPEMAPS}}){ 3959*0Sstevel@tonic-gate if( ! -f $typemap ){ 3960*0Sstevel@tonic-gate warn "Typemap $typemap not found.\n"; 3961*0Sstevel@tonic-gate } 3962*0Sstevel@tonic-gate else{ 3963*0Sstevel@tonic-gate push(@tmdeps, $typemap); 3964*0Sstevel@tonic-gate } 3965*0Sstevel@tonic-gate } 3966*0Sstevel@tonic-gate } 3967*0Sstevel@tonic-gate push(@tmdeps, "typemap") if -f "typemap"; 3968*0Sstevel@tonic-gate my(@tmargs) = map("-typemap $_", @tmdeps); 3969*0Sstevel@tonic-gate if( exists $self->{XSOPT} ){ 3970*0Sstevel@tonic-gate unshift( @tmargs, $self->{XSOPT} ); 3971*0Sstevel@tonic-gate } 3972*0Sstevel@tonic-gate 3973*0Sstevel@tonic-gate 3974*0Sstevel@tonic-gate $self->{XSPROTOARG} = "" unless defined $self->{XSPROTOARG}; 3975*0Sstevel@tonic-gate 3976*0Sstevel@tonic-gate return qq{ 3977*0Sstevel@tonic-gateXSUBPPDIR = $xsdir 3978*0Sstevel@tonic-gateXSUBPP = \$(XSUBPPDIR)/xsubpp 3979*0Sstevel@tonic-gateXSPROTOARG = $self->{XSPROTOARG} 3980*0Sstevel@tonic-gateXSUBPPDEPS = @tmdeps \$(XSUBPP) 3981*0Sstevel@tonic-gateXSUBPPARGS = @tmargs 3982*0Sstevel@tonic-gateXSUBPP_EXTRA_ARGS = 3983*0Sstevel@tonic-gate}; 3984*0Sstevel@tonic-gate}; 3985*0Sstevel@tonic-gate 3986*0Sstevel@tonic-gate 3987*0Sstevel@tonic-gate=item all_target 3988*0Sstevel@tonic-gate 3989*0Sstevel@tonic-gateBuild man pages, too 3990*0Sstevel@tonic-gate 3991*0Sstevel@tonic-gate=cut 3992*0Sstevel@tonic-gate 3993*0Sstevel@tonic-gatesub all_target { 3994*0Sstevel@tonic-gate my $self = shift; 3995*0Sstevel@tonic-gate 3996*0Sstevel@tonic-gate return <<'MAKE_EXT'; 3997*0Sstevel@tonic-gateall :: pure_all manifypods 3998*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 3999*0Sstevel@tonic-gateMAKE_EXT 4000*0Sstevel@tonic-gate} 4001*0Sstevel@tonic-gate 4002*0Sstevel@tonic-gate=item top_targets (o) 4003*0Sstevel@tonic-gate 4004*0Sstevel@tonic-gateDefines the targets all, subdirs, config, and O_FILES 4005*0Sstevel@tonic-gate 4006*0Sstevel@tonic-gate=cut 4007*0Sstevel@tonic-gate 4008*0Sstevel@tonic-gatesub top_targets { 4009*0Sstevel@tonic-gate# --- Target Sections --- 4010*0Sstevel@tonic-gate 4011*0Sstevel@tonic-gate my($self) = shift; 4012*0Sstevel@tonic-gate my(@m); 4013*0Sstevel@tonic-gate 4014*0Sstevel@tonic-gate push @m, $self->all_target, "\n" unless $self->{SKIPHASH}{'all'}; 4015*0Sstevel@tonic-gate 4016*0Sstevel@tonic-gate push @m, ' 4017*0Sstevel@tonic-gatepure_all :: config pm_to_blib subdirs linkext 4018*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 4019*0Sstevel@tonic-gate 4020*0Sstevel@tonic-gatesubdirs :: $(MYEXTLIB) 4021*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 4022*0Sstevel@tonic-gate 4023*0Sstevel@tonic-gateconfig :: $(FIRST_MAKEFILE) $(INST_LIBDIR)$(DIRFILESEP).exists 4024*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 4025*0Sstevel@tonic-gate 4026*0Sstevel@tonic-gateconfig :: $(INST_ARCHAUTODIR)$(DIRFILESEP).exists 4027*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 4028*0Sstevel@tonic-gate 4029*0Sstevel@tonic-gateconfig :: $(INST_AUTODIR)$(DIRFILESEP).exists 4030*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 4031*0Sstevel@tonic-gate'; 4032*0Sstevel@tonic-gate 4033*0Sstevel@tonic-gate push @m, $self->dir_target(qw[$(INST_AUTODIR) $(INST_LIBDIR) $(INST_ARCHAUTODIR)]); 4034*0Sstevel@tonic-gate 4035*0Sstevel@tonic-gate if (%{$self->{MAN1PODS}}) { 4036*0Sstevel@tonic-gate push @m, q[ 4037*0Sstevel@tonic-gateconfig :: $(INST_MAN1DIR)$(DIRFILESEP).exists 4038*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 4039*0Sstevel@tonic-gate 4040*0Sstevel@tonic-gate]; 4041*0Sstevel@tonic-gate push @m, $self->dir_target(qw[$(INST_MAN1DIR)]); 4042*0Sstevel@tonic-gate } 4043*0Sstevel@tonic-gate if (%{$self->{MAN3PODS}}) { 4044*0Sstevel@tonic-gate push @m, q[ 4045*0Sstevel@tonic-gateconfig :: $(INST_MAN3DIR)$(DIRFILESEP).exists 4046*0Sstevel@tonic-gate $(NOECHO) $(NOOP) 4047*0Sstevel@tonic-gate 4048*0Sstevel@tonic-gate]; 4049*0Sstevel@tonic-gate push @m, $self->dir_target(qw[$(INST_MAN3DIR)]); 4050*0Sstevel@tonic-gate } 4051*0Sstevel@tonic-gate 4052*0Sstevel@tonic-gate push @m, ' 4053*0Sstevel@tonic-gate$(O_FILES): $(H_FILES) 4054*0Sstevel@tonic-gate' if @{$self->{O_FILES} || []} && @{$self->{H} || []}; 4055*0Sstevel@tonic-gate 4056*0Sstevel@tonic-gate push @m, q{ 4057*0Sstevel@tonic-gatehelp: 4058*0Sstevel@tonic-gate perldoc ExtUtils::MakeMaker 4059*0Sstevel@tonic-gate}; 4060*0Sstevel@tonic-gate 4061*0Sstevel@tonic-gate join('',@m); 4062*0Sstevel@tonic-gate} 4063*0Sstevel@tonic-gate 4064*0Sstevel@tonic-gate=item writedoc 4065*0Sstevel@tonic-gate 4066*0Sstevel@tonic-gateObsolete, deprecated method. Not used since Version 5.21. 4067*0Sstevel@tonic-gate 4068*0Sstevel@tonic-gate=cut 4069*0Sstevel@tonic-gate 4070*0Sstevel@tonic-gatesub writedoc { 4071*0Sstevel@tonic-gate# --- perllocal.pod section --- 4072*0Sstevel@tonic-gate my($self,$what,$name,@attribs)=@_; 4073*0Sstevel@tonic-gate my $time = localtime; 4074*0Sstevel@tonic-gate print "=head2 $time: $what C<$name>\n\n=over 4\n\n=item *\n\n"; 4075*0Sstevel@tonic-gate print join "\n\n=item *\n\n", map("C<$_>",@attribs); 4076*0Sstevel@tonic-gate print "\n\n=back\n\n"; 4077*0Sstevel@tonic-gate} 4078*0Sstevel@tonic-gate 4079*0Sstevel@tonic-gate=item xs_c (o) 4080*0Sstevel@tonic-gate 4081*0Sstevel@tonic-gateDefines the suffix rules to compile XS files to C. 4082*0Sstevel@tonic-gate 4083*0Sstevel@tonic-gate=cut 4084*0Sstevel@tonic-gate 4085*0Sstevel@tonic-gatesub xs_c { 4086*0Sstevel@tonic-gate my($self) = shift; 4087*0Sstevel@tonic-gate return '' unless $self->needs_linking(); 4088*0Sstevel@tonic-gate ' 4089*0Sstevel@tonic-gate.xs.c: 4090*0Sstevel@tonic-gate $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $(XSUBPP_EXTRA_ARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c 4091*0Sstevel@tonic-gate'; 4092*0Sstevel@tonic-gate} 4093*0Sstevel@tonic-gate 4094*0Sstevel@tonic-gate=item xs_cpp (o) 4095*0Sstevel@tonic-gate 4096*0Sstevel@tonic-gateDefines the suffix rules to compile XS files to C++. 4097*0Sstevel@tonic-gate 4098*0Sstevel@tonic-gate=cut 4099*0Sstevel@tonic-gate 4100*0Sstevel@tonic-gatesub xs_cpp { 4101*0Sstevel@tonic-gate my($self) = shift; 4102*0Sstevel@tonic-gate return '' unless $self->needs_linking(); 4103*0Sstevel@tonic-gate ' 4104*0Sstevel@tonic-gate.xs.cpp: 4105*0Sstevel@tonic-gate $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.cpp 4106*0Sstevel@tonic-gate'; 4107*0Sstevel@tonic-gate} 4108*0Sstevel@tonic-gate 4109*0Sstevel@tonic-gate=item xs_o (o) 4110*0Sstevel@tonic-gate 4111*0Sstevel@tonic-gateDefines suffix rules to go from XS to object files directly. This is 4112*0Sstevel@tonic-gateonly intended for broken make implementations. 4113*0Sstevel@tonic-gate 4114*0Sstevel@tonic-gate=cut 4115*0Sstevel@tonic-gate 4116*0Sstevel@tonic-gatesub xs_o { # many makes are too dumb to use xs_c then c_o 4117*0Sstevel@tonic-gate my($self) = shift; 4118*0Sstevel@tonic-gate return '' unless $self->needs_linking(); 4119*0Sstevel@tonic-gate ' 4120*0Sstevel@tonic-gate.xs$(OBJ_EXT): 4121*0Sstevel@tonic-gate $(PERLRUN) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > $*.xsc && $(MV) $*.xsc $*.c 4122*0Sstevel@tonic-gate $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c 4123*0Sstevel@tonic-gate'; 4124*0Sstevel@tonic-gate} 4125*0Sstevel@tonic-gate 4126*0Sstevel@tonic-gate 4127*0Sstevel@tonic-gate1; 4128*0Sstevel@tonic-gate 4129*0Sstevel@tonic-gate=back 4130*0Sstevel@tonic-gate 4131*0Sstevel@tonic-gate=head1 SEE ALSO 4132*0Sstevel@tonic-gate 4133*0Sstevel@tonic-gateL<ExtUtils::MakeMaker> 4134*0Sstevel@tonic-gate 4135*0Sstevel@tonic-gate=cut 4136*0Sstevel@tonic-gate 4137*0Sstevel@tonic-gate__END__ 4138