4 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
8 use Module::Build::ConfigData;
10 my $manpage_support = Module::Build::ConfigData->feature('manpage_support');
11 my $HTML_support = Module::Build::ConfigData->feature('HTML_support');
14 my ($have_c_compiler, $C_support_feature) = check_compiler();
15 if (! $C_support_feature) {
16 plan skip_all => 'C_support not enabled';
17 } elsif ( ! $have_c_compiler ) {
18 plan skip_all => 'C_support enabled, but no compiler found';
19 } elsif ( ! eval {require Archive::Tar} ) {
20 plan skip_all => "Archive::Tar not installed to read archives.";
21 } elsif ( ! eval {IO::Zlib->VERSION(1.01)} ) {
22 plan skip_all => "IO::Zlib 1.01 required to read compressed archives.";
23 } elsif ( $^O eq 'VMS' ) {
24 plan skip_all => "Needs porting work on VMS";
29 ensure_blib('Module::Build');
32 my $tmp = MBTest->tmpdir;
36 my $dist = DistGen->new( dir => $tmp, xs => 1 );
37 $dist->add_file( 'hello', <<'---' );
39 print "Hello, World!\n";
54 $dist->change_build_pl
56 module_name => $dist->name,
58 scripts => [ 'hello' ],
64 use File::Spec::Functions qw(catdir);
67 my @installstyle = qw(lib perl5);
68 my $mb = Module::Build->new_from_context(
72 installdirs => 'site',
74 manpage_reset(), html_reset(),
76 ( installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'),
77 installsiteman3dir => catdir($tmp, 'site', 'man', 'man3') ) : () ),
79 ( installsitehtml1dir => catdir($tmp, 'site', 'html'),
80 installsitehtml3dir => catdir($tmp, 'site', 'html') ) : () ),
86 $mb->dispatch('ppd', args => {codebase => '/path/to/codebase-xs'});
88 (my $dist_filename = $dist->name) =~ s/::/-/g;
89 my $ppd = slurp($dist_filename . '.ppd');
91 my $perl_version = Module::Build::PPMMaker->_ppd_version($mb->perl_version);
92 my $varchname = Module::Build::PPMMaker->_varchname($mb->config);
94 # This test is quite a hack since with XML you don't really want to
95 # do a strict string comparison, but absent an XML parser it's the
98 <SOFTPKG NAME="$dist_filename" VERSION="0,01,0,0">
99 <TITLE>@{[$dist->name]}</TITLE>
100 <ABSTRACT>Perl extension for blah blah blah</ABSTRACT>
101 <AUTHOR>A. U. Thor, a.u.thor\@a.galaxy.far.far.away</AUTHOR>
103 <PERLCORE VERSION="$perl_version" />
105 <ARCHITECTURE NAME="$varchname" />
106 <CODEBASE HREF="/path/to/codebase-xs" />
113 $mb->dispatch('ppmdist');
116 my $tar = Archive::Tar->new;
118 my $tarfile = $mb->ppm_name . '.tar.gz';
119 $tar->read( $tarfile, 1 );
121 my $files = { map { $_ => 1 } $tar->list_files };
123 my $fname = 'Simple';
124 $fname = DynaLoader::mod2fname([$fname]) if defined &DynaLoader::mod2fname;
125 exists_ok($files, "blib/arch/auto/Simple/$fname." . $mb->config('dlext'));
126 exists_ok($files, 'blib/lib/Simple.pm');
127 exists_ok($files, 'blib/script/hello');
130 skip( "manpage_support not enabled.", 2 ) unless $manpage_support;
132 exists_ok($files, 'blib/man3/Simple.' . $mb->config('man3ext'));
133 exists_ok($files, 'blib/man1/hello.' . $mb->config('man1ext'));
137 skip( "HTML_support not enabled.", 2 ) unless $HTML_support;
139 exists_ok($files, 'blib/html/site/lib/Simple.html');
140 exists_ok($files, 'blib/html/bin/hello.html');
146 $mb->dispatch('realclean');
151 skip( "HTML_support not enabled.", 3 ) unless $HTML_support;
153 # Make sure html documents are generated for the ppm distro even when
154 # they would not be built during a normal build.
155 $mb = Module::Build->new_from_context(
159 installdirs => 'site',
162 installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'),
163 installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'),
167 $mb->dispatch('ppmdist');
170 $tar = Archive::Tar->new;
171 $tar->read( $tarfile, 1 );
173 $files = {map { $_ => 1 } $tar->list_files};
175 exists_ok($files, 'blib/html/site/lib/Simple.html');
176 exists_ok($files, 'blib/html/bin/hello.html');
180 $mb->dispatch('realclean');
188 ########################################
193 local $Test::Builder::Level = $Test::Builder::Level + 1;
194 ok exists( $files->{$file} ) && $files->{$file}, $file;
197 # A hash of all Config.pm settings related to installing
198 # manpages with values set to an empty string.
201 installman1dir => '',
202 installman3dir => '',
203 installsiteman1dir => '',
204 installsiteman3dir => '',
205 installvendorman1dir => '',
206 installvendorman3dir => '',
210 # A hash of all Config.pm settings related to installing
211 # html documents with values set to an empty string.
214 installhtmldir => '',
215 installhtml1dir => '',
216 installhtml3dir => '',
217 installsitehtml1dir => '',
218 installsitehtml3dir => '',
219 installvendorhtml1dir => '',
220 installvendorhtml3dir => '',