1*0Sstevel@tonic-gate#!/usr/bin/perl -w 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gate# Wherein we ensure the INST_* and INSTALL* variables are set correctly 4*0Sstevel@tonic-gate# in a default Makefile.PL run 5*0Sstevel@tonic-gate# 6*0Sstevel@tonic-gate# Essentially, this test is a Makefile.PL. 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gateBEGIN { 9*0Sstevel@tonic-gate if( $ENV{PERL_CORE} ) { 10*0Sstevel@tonic-gate chdir 't' if -d 't'; 11*0Sstevel@tonic-gate @INC = ('../lib', 'lib'); 12*0Sstevel@tonic-gate } 13*0Sstevel@tonic-gate else { 14*0Sstevel@tonic-gate unshift @INC, 't/lib'; 15*0Sstevel@tonic-gate } 16*0Sstevel@tonic-gate} 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gateuse strict; 19*0Sstevel@tonic-gateuse Test::More tests => 23; 20*0Sstevel@tonic-gateuse MakeMaker::Test::Utils; 21*0Sstevel@tonic-gateuse ExtUtils::MakeMaker; 22*0Sstevel@tonic-gateuse File::Spec; 23*0Sstevel@tonic-gateuse TieOut; 24*0Sstevel@tonic-gateuse Config; 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gatechdir 't'; 27*0Sstevel@tonic-gate 28*0Sstevel@tonic-gateperl_lib; 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate$| = 1; 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gatemy $Makefile = makefile_name; 33*0Sstevel@tonic-gatemy $Curdir = File::Spec->curdir; 34*0Sstevel@tonic-gatemy $Updir = File::Spec->updir; 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gateok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || 37*0Sstevel@tonic-gate diag("chdir failed: $!"); 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gatemy $stdout = tie *STDOUT, 'TieOut' or die; 40*0Sstevel@tonic-gatemy $mm = WriteMakefile( 41*0Sstevel@tonic-gate NAME => 'Big::Dummy', 42*0Sstevel@tonic-gate VERSION_FROM => 'lib/Big/Dummy.pm', 43*0Sstevel@tonic-gate PREREQ_PM => {}, 44*0Sstevel@tonic-gate PERL_CORE => $ENV{PERL_CORE}, 45*0Sstevel@tonic-gate); 46*0Sstevel@tonic-gatelike( $stdout->read, qr{ 47*0Sstevel@tonic-gate Writing\ $Makefile\ for\ Big::Liar\n 48*0Sstevel@tonic-gate Big::Liar's\ vars\n 49*0Sstevel@tonic-gate INST_LIB\ =\ \S+\n 50*0Sstevel@tonic-gate INST_ARCHLIB\ =\ \S+\n 51*0Sstevel@tonic-gate Writing\ $Makefile\ for\ Big::Dummy\n 52*0Sstevel@tonic-gate}x ); 53*0Sstevel@tonic-gateundef $stdout; 54*0Sstevel@tonic-gateuntie *STDOUT; 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gateisa_ok( $mm, 'ExtUtils::MakeMaker' ); 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gateis( $mm->{NAME}, 'Big::Dummy', 'NAME' ); 59*0Sstevel@tonic-gateis( $mm->{VERSION}, 0.01, 'VERSION' ); 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gatemy $config_prefix = $Config{installprefixexp} || $Config{installprefix} || 62*0Sstevel@tonic-gate $Config{prefixexp} || $Config{prefix}; 63*0Sstevel@tonic-gateis( $mm->{PERLPREFIX}, $config_prefix, 'PERLPREFIX' ); 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gateis( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' ); 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gatemy($perl_src, $mm_perl_src); 68*0Sstevel@tonic-gateif( $ENV{PERL_CORE} ) { 69*0Sstevel@tonic-gate $perl_src = File::Spec->catdir($Updir, $Updir); 70*0Sstevel@tonic-gate $perl_src = File::Spec->canonpath($perl_src); 71*0Sstevel@tonic-gate $mm_perl_src = File::Spec->canonpath($mm->{PERL_SRC}); 72*0Sstevel@tonic-gate} 73*0Sstevel@tonic-gateelse { 74*0Sstevel@tonic-gate $mm_perl_src = $mm->{PERL_SRC}; 75*0Sstevel@tonic-gate} 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gateis( $mm_perl_src, $perl_src, 'PERL_SRC' ); 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate# PERM_* 81*0Sstevel@tonic-gateis( $mm->{PERM_RW}, 644, 'PERM_RW' ); 82*0Sstevel@tonic-gateis( $mm->{PERM_RWX}, 755, 'PERM_RWX' ); 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate# INST_* 86*0Sstevel@tonic-gateis( $mm->{INST_ARCHLIB}, 87*0Sstevel@tonic-gate $mm->{PERL_CORE} ? $mm->{PERL_ARCHLIB} 88*0Sstevel@tonic-gate : File::Spec->catdir($Curdir, 'blib', 'arch'), 89*0Sstevel@tonic-gate 'INST_ARCHLIB'); 90*0Sstevel@tonic-gateis( $mm->{INST_BIN}, File::Spec->catdir($Curdir, 'blib', 'bin'), 91*0Sstevel@tonic-gate 'INST_BIN' ); 92*0Sstevel@tonic-gate 93*0Sstevel@tonic-gateis( keys %{$mm->{CHILDREN}}, 1 ); 94*0Sstevel@tonic-gatemy($child_pack) = keys %{$mm->{CHILDREN}}; 95*0Sstevel@tonic-gatemy $c_mm = $mm->{CHILDREN}{$child_pack}; 96*0Sstevel@tonic-gateis( $c_mm->{INST_ARCHLIB}, 97*0Sstevel@tonic-gate $c_mm->{PERL_CORE} ? $c_mm->{PERL_ARCHLIB} 98*0Sstevel@tonic-gate : File::Spec->catdir($Updir, 'blib', 'arch'), 99*0Sstevel@tonic-gate 'CHILD INST_ARCHLIB'); 100*0Sstevel@tonic-gateis( $c_mm->{INST_BIN}, File::Spec->catdir($Updir, 'blib', 'bin'), 101*0Sstevel@tonic-gate 'CHILD INST_BIN' ); 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gatemy $inst_lib = File::Spec->catdir($Curdir, 'blib', 'lib'); 105*0Sstevel@tonic-gateis( $mm->{INST_LIB}, 106*0Sstevel@tonic-gate $mm->{PERL_CORE} ? $mm->{PERL_LIB} : $inst_lib, 'INST_LIB' ); 107*0Sstevel@tonic-gate 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate# INSTALL* 110*0Sstevel@tonic-gateis( $mm->{INSTALLDIRS}, 'site', 'INSTALLDIRS' ); 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate 113*0Sstevel@tonic-gate 114*0Sstevel@tonic-gate# Make sure the INSTALL*MAN*DIR variables work. We forgot them 115*0Sstevel@tonic-gate# at one point. 116*0Sstevel@tonic-gate$stdout = tie *STDOUT, 'TieOut' or die; 117*0Sstevel@tonic-gate$mm = WriteMakefile( 118*0Sstevel@tonic-gate NAME => 'Big::Dummy', 119*0Sstevel@tonic-gate VERSION_FROM => 'lib/Big/Dummy.pm', 120*0Sstevel@tonic-gate PERL_CORE => $ENV{PERL_CORE}, 121*0Sstevel@tonic-gate INSTALLMAN1DIR => 'none', 122*0Sstevel@tonic-gate INSTALLSITEMAN3DIR => 'none', 123*0Sstevel@tonic-gate INSTALLVENDORMAN1DIR => 'none', 124*0Sstevel@tonic-gate INST_MAN1DIR => 'none', 125*0Sstevel@tonic-gate); 126*0Sstevel@tonic-gatelike( $stdout->read, qr{ 127*0Sstevel@tonic-gate Writing\ $Makefile\ for\ Big::Liar\n 128*0Sstevel@tonic-gate Big::Liar's\ vars\n 129*0Sstevel@tonic-gate INST_LIB\ =\ \S+\n 130*0Sstevel@tonic-gate INST_ARCHLIB\ =\ \S+\n 131*0Sstevel@tonic-gate Writing\ $Makefile\ for\ Big::Dummy\n 132*0Sstevel@tonic-gate}x ); 133*0Sstevel@tonic-gateundef $stdout; 134*0Sstevel@tonic-gateuntie *STDOUT; 135*0Sstevel@tonic-gate 136*0Sstevel@tonic-gateisa_ok( $mm, 'ExtUtils::MakeMaker' ); 137*0Sstevel@tonic-gate 138*0Sstevel@tonic-gateis ( $mm->{INSTALLMAN1DIR}, 'none' ); 139*0Sstevel@tonic-gateis ( $mm->{INSTALLSITEMAN3DIR}, 'none' ); 140*0Sstevel@tonic-gateis ( $mm->{INSTALLVENDORMAN1DIR}, 'none' ); 141*0Sstevel@tonic-gateis ( $mm->{INST_MAN1DIR}, 'none' ); 142