1 # Build instructions for podlators.
3 # We need to use ExtUtils::MakeMaker since this module is part of Perl core,
4 # which only supports that build method, and because it is a dependency of
5 # other build systems like Module::Build.
7 # Copyright 1999, 2000, 2001, 2008, 2010, 2012, 2014, 2015, 2016
8 # Russ Allbery <rra@cpan.org>
10 # This program is free software; you may redistribute it and/or modify it
11 # under the same terms as Perl itself.
18 use ExtUtils::MakeMaker;
21 # Generate full paths for scripts distributed in the bin directory. Appends
22 # the .com extension to scripts on VMS, unless they already have the .PL
25 # @scripts - List of script names
27 # Returns: (Array) List of relative paths from top of distribution
28 # (Scalar) Space-separated relative paths from top of distribution
31 my @paths = map { File::Spec->catfile('scripts', $_) } @scripts;
33 @paths = map { m{ [.] PL \z }xms ? $_ : $_ . '.com' } @paths;
35 return wantarray ? @paths : join(q{ }, @paths);
38 # Generate an association between a source file and a destination man page for
39 # non-module man pages. ExtUtils::MakeMaker only really understands how to
40 # generate man pages for modules, so we need to help it for the script man
41 # pages and (particularly) the perlpodstyle man page.
43 # $directory - Directory containing the file
44 # $file - File containing POD in that directory
46 # Returns: The path to the file with POD and the output man page, as a pair
48 my ($directory, $file) = @_;
50 # Build the base name of the file by stripping any *.pod or *.PL suffix.
52 $basename =~ s{ [.] (?: pod | PL ) \z }{}xms;
54 # Determine the output file name for the generated man page.
55 my $outname = $basename . q{.} . $Config{man1ext};
56 my $outpath = File::Spec->catfile(qw(blib man1), $outname);
57 return (File::Spec->catfile($directory, $file), $outpath);
60 # The hash of all the metadata. This will be modified before WriteMakefile to
61 # remove keys not supported by the local version of ExtUtils::MakeMaker.
64 DISTNAME => 'podlators',
65 ABSTRACT => 'Convert POD data to various other formats',
66 AUTHOR => 'Russ Allbery <rra@cpan.org>',
68 EXE_FILES => [scripts('pod2text', 'pod2man')],
69 VERSION_FROM => 'lib/Pod/Man.pm',
70 MIN_PERL_VERSION => '5.006',
72 # Use *.PL files to generate the driver scripts so that we get the correct
73 # invocation of Perl on non-UNIX platforms.
75 scripts('pod2man.PL', 'pod2man'), scripts('pod2text.PL', 'pod2text'),
78 # Override the files that generate section 1 man pages.
80 man1pod('scripts', 'pod2man.PL'),
81 man1pod('scripts', 'pod2text.PL'),
83 # Perl core uses a separate copy in the top-level pod directory.
84 ($ENV{PERL_CORE} ? () : man1pod('pod', 'perlpodstyle.pod')),
87 # Clean some additional files.
88 clean => { FILES => File::Spec->catdir('t', 'tmp') },
89 realclean => { FILES => scalar(scripts('pod2text', 'pod2man')) },
91 # Dependencies on other modules.
94 'Pod::Simple' => 3.06,
97 # Older versions of ExtUtils::MakeMaker don't pick up nested test
98 # directories by default.
99 test => { TESTS => 't/*/*.t' },
101 # For older versions of Perl, we have to force installation into the Perl
102 # module directories since site modules did not take precedence over core
104 INSTALLDIRS => $] lt '5.011' ? 'perl' : 'site',
106 # Additional metadata.
108 'meta-spec' => { version => 2 },
111 mailto => 'bug-podlators@rt.cpan.org',
112 web => 'https://rt.cpan.org/Dist/Display.html?Name=podlators',
114 homepage => 'http://www.eyrie.org/~eagle/software/podlators/',
116 url => 'git://github.com/rra/podlators.git',
117 web => 'https://github.com/rra/podlators',
124 # Remove keys that aren't supported by this version of ExtUtils::MakeMaker.
125 # This hash maps keys to the minimum supported version.
129 MIN_PERL_VERSION => 6.48,
131 for my $key (keys(%supported)) {
132 if ($ExtUtils::MakeMaker::VERSION < $supported{$key}) {
133 delete $metadata{$key};
137 # Generate the actual Makefile. Pick an arbitrary module to pull the version
138 # from, since they should all have the same version.
139 WriteMakefile(%metadata);