3 # Wherein we ensure the INST_* and INSTALL* variables are set correctly
4 # according to the values of PREFIX, SITEPREFIX, INSTALLDIRS, etc...
6 # Essentially, this test is a Makefile.PL.
9 if( $ENV{PERL_CORE} ) {
11 @INC = ('../lib', 'lib');
14 unshift @INC, 't/lib';
19 use Test::More tests => 17;
20 use MakeMaker::Test::Utils;
21 use ExtUtils::MakeMaker;
26 $ENV{PERL_CORE} ? chdir '../lib/ExtUtils/t' : chdir 't';
32 my $Makefile = makefile_name;
33 my $Curdir = File::Spec->curdir;
34 my $Updir = File::Spec->updir;
36 ok( chdir 'Big-Fat-Dummy', "chdir'd to Big-Fat-Dummy" ) ||
37 diag("chdir failed: $!");
39 my $stdout = tie *STDOUT, 'TieOut' or die;
40 my $mm = WriteMakefile(
41 NAME => 'Big::Fat::Dummy',
42 VERSION_FROM => 'lib/Big/Fat/Dummy.pm',
44 PERL_CORE => $ENV{PERL_CORE},
46 like( $stdout->read, qr{
47 Writing\ $Makefile\ for\ Big::Fat::Liar\n
48 Big::Fat::Liar's\ vars\n
50 INST_ARCHLIB\ =\ \S+\n
51 Writing\ $Makefile\ for\ Big::Fat::Dummy\n
56 isa_ok( $mm, 'ExtUtils::MakeMaker' );
58 is( $mm->{NAME}, 'Big::Fat::Dummy', 'NAME' );
59 is( $mm->{VERSION}, 0.01, 'VERSION' );
61 my $config_prefix = $^O eq 'VMS' ? VMS::Filespec::unixify($Config{prefix})
63 is( $mm->{PREFIX}, $config_prefix, 'PREFIX' );
65 is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' );
67 my($perl_src, $mm_perl_src);
68 if( $ENV{PERL_CORE} ) {
69 $perl_src = File::Spec->catdir($Updir, $Updir, $Updir, $Updir);
70 $perl_src = File::Spec->canonpath($perl_src);
71 $mm_perl_src = File::Spec->canonpath($mm->{PERL_SRC});
74 $mm_perl_src = $mm->{PERL_SRC};
77 is( $mm_perl_src, $perl_src, 'PERL_SRC' );
81 is( $mm->{PERM_RW}, 644, 'PERM_RW' );
82 is( $mm->{PERM_RWX}, 755, 'PERM_RWX' );
86 is( $mm->{INST_ARCHLIB},
87 $mm->{PERL_CORE} ? $mm->{PERL_ARCHLIB}
88 : File::Spec->catdir($Curdir, 'blib', 'arch'),
90 is( $mm->{INST_BIN}, File::Spec->catdir($Curdir, 'blib', 'bin'),
93 is( keys %{$mm->{CHILDREN}}, 1 );
94 my($child_pack) = keys %{$mm->{CHILDREN}};
95 my $c_mm = $mm->{CHILDREN}{$child_pack};
96 is( $c_mm->{INST_ARCHLIB},
97 $c_mm->{PERL_CORE} ? $c_mm->{PERL_ARCHLIB}
98 : File::Spec->catdir($Updir, 'blib', 'arch'),
99 'CHILD INST_ARCHLIB');
100 is( $c_mm->{INST_BIN}, File::Spec->catdir($Updir, 'blib', 'bin'),
104 my $inst_lib = File::Spec->catdir($Curdir, 'blib', 'lib');
106 $mm->{PERL_CORE} ? $mm->{PERL_LIB} : $inst_lib, 'INST_LIB' );
110 is( $mm->{INSTALLDIRS}, 'site', 'INSTALLDIRS' );