3 # Wherein we ensure the INST_* and INSTALL* variables are set correctly
4 # in a default Makefile.PL run
6 # Essentially, this test is a Makefile.PL.
13 use Test::More tests => 26;
14 use MakeMaker::Test::Utils;
15 use MakeMaker::Test::Setup::BFD;
16 use ExtUtils::MakeMaker;
27 my $Makefile = makefile_name;
28 my $Curdir = File::Spec->curdir;
29 my $Updir = File::Spec->updir;
31 ok( setup_recurs(), 'setup' );
33 ok( chdir File::Spec->updir );
34 ok( teardown_recurs(), 'teardown' );
37 ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) ||
38 diag("chdir failed: $!");
40 my $stdout = tie *STDOUT, 'TieOut' or die;
41 my $mm = WriteMakefile(
43 VERSION_FROM => 'lib/Big/Dummy.pm',
45 PERL_CORE => $ENV{PERL_CORE},
47 like( $stdout->read, qr{
48 Writing\ $Makefile\ for\ Big::Liar\n
51 INST_ARCHLIB\ =\ \S+\n
52 Writing\ $Makefile\ for\ Big::Dummy\n
57 isa_ok( $mm, 'ExtUtils::MakeMaker' );
59 is( $mm->{NAME}, 'Big::Dummy', 'NAME' );
60 is( $mm->{VERSION}, 0.01, 'VERSION' );
62 my $config_prefix = $Config{installprefixexp} || $Config{installprefix} ||
63 $Config{prefixexp} || $Config{prefix};
64 is( $mm->{PERLPREFIX}, $config_prefix, 'PERLPREFIX' );
66 is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' );
68 my($perl_src, $mm_perl_src);
69 if( $ENV{PERL_CORE} ) {
70 $perl_src = File::Spec->catdir($Updir, $Updir, $Updir, $Updir);
71 $perl_src = File::Spec->canonpath($perl_src);
72 $mm_perl_src = File::Spec->canonpath($mm->{PERL_SRC});
75 $mm_perl_src = $mm->{PERL_SRC};
78 is( $mm_perl_src, $perl_src, 'PERL_SRC' );
82 is( $mm->{PERM_RW}, 644, 'PERM_RW' );
83 is( $mm->{PERM_RWX}, 755, 'PERM_RWX' );
87 is( $mm->{INST_ARCHLIB},
88 $mm->{PERL_CORE} ? $mm->{PERL_ARCHLIB}
89 : File::Spec->catdir($Curdir, 'blib', 'arch'),
91 is( $mm->{INST_BIN}, File::Spec->catdir($Curdir, 'blib', 'bin'),
94 is( keys %{$mm->{CHILDREN}}, 1 );
95 my($child_pack) = keys %{$mm->{CHILDREN}};
96 my $c_mm = $mm->{CHILDREN}{$child_pack};
97 is( $c_mm->{INST_ARCHLIB},
98 $c_mm->{PERL_CORE} ? $c_mm->{PERL_ARCHLIB}
99 : File::Spec->catdir($Updir, 'blib', 'arch'),
100 'CHILD INST_ARCHLIB');
101 is( $c_mm->{INST_BIN}, File::Spec->catdir($Updir, 'blib', 'bin'),
105 my $inst_lib = File::Spec->catdir($Curdir, 'blib', 'lib');
107 $mm->{PERL_CORE} ? $mm->{PERL_LIB} : $inst_lib, 'INST_LIB' );
111 is( $mm->{INSTALLDIRS}, 'site', 'INSTALLDIRS' );
115 # Make sure the INSTALL*MAN*DIR variables work. We forgot them
117 $stdout = tie *STDOUT, 'TieOut' or die;
119 NAME => 'Big::Dummy',
120 VERSION_FROM => 'lib/Big/Dummy.pm',
121 PERL_CORE => $ENV{PERL_CORE},
122 INSTALLMAN1DIR => 'none',
123 INSTALLSITEMAN3DIR => 'none',
124 INSTALLVENDORMAN1DIR => 'none',
125 INST_MAN1DIR => 'none',
127 like( $stdout->read, qr{
128 Writing\ $Makefile\ for\ Big::Liar\n
131 INST_ARCHLIB\ =\ \S+\n
132 Writing\ $Makefile\ for\ Big::Dummy\n
137 isa_ok( $mm, 'ExtUtils::MakeMaker' );
139 is ( $mm->{INSTALLMAN1DIR}, 'none' );
140 is ( $mm->{INSTALLSITEMAN3DIR}, 'none' );
141 is ( $mm->{INSTALLVENDORMAN1DIR}, 'none' );
142 is ( $mm->{INST_MAN1DIR}, 'none' );