use vars qw($packlist @modpods);
require Cwd;
+if ($Config{d_umask}) {
+ umask(022); # umasks like 077 aren't that useful for installations
+}
+
$ENV{SHELL} = 'sh' if $^O eq 'os2';
my $ver = $Config{version}; # Not used presently.
my $usage =
"Usage: installman --man1dir=/usr/wherever --man1ext=1
--man3dir=/usr/wherever --man3ext=3
+ --batchlimit=40
--notify --verbose --silent --help
Defaults are:
man1dir = $Config{'installman1dir'};
man1ext = $Config{'man1ext'};
man3dir = $Config{'installman3dir'};
man3ext = $Config{'man3ext'};
+ batchlimit is maximum number of pod files per invocation of pod2man
--notify (or -n) just lists commands that would be executed.
--verbose (or -V) report all progress.
--silent (or -S) be silent. Only report errors.\n";
my %opts;
GetOptions( \%opts,
- qw( man1dir=s man1ext=s man3dir=s man3ext=s
+ qw( man1dir=s man1ext=s man3dir=s man3ext=s batchlimit=i
notify n help silent S verbose V))
|| die $usage;
die $usage if $opts{help};
unless defined($opts{man3dir});
$opts{man3ext} = $Config{'man3ext'}
unless defined($opts{man3ext});
+$opts{batchlimit} ||= 40;
$opts{silent} ||= $opts{S};
-$opts{verbose} ||= $opts{V};
-
$opts{notify} ||= $opts{n};
+$opts{verbose} ||= $opts{V} || $opts{notify};
#Sanity checks
$packlist = ExtUtils::Packlist->new("$Config{installarchlib}/.packlist");
+
# Install the main pod pages.
runpod2man('pod', $opts{man1dir}, $opts{man1ext});
runpod2man('lib', $opts{man3dir}, $opts{man3ext});
# Install the pods embedded in the installed scripts
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'c2ph');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'h2ph');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'h2xs');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'perlcc');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'perldoc');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'perlbug');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'pl2pm');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'splain');
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'dprofpp');
-runpod2man('x2p', $opts{man1dir}, $opts{man1ext}, 's2p');
-runpod2man('x2p', $opts{man1dir}, $opts{man1ext}, 'a2p.pod');
-runpod2man('x2p', $opts{man1dir}, $opts{man1ext}, 'find2perl');
-runpod2man('pod', $opts{man1dir}, $opts{man1ext}, 'pod2man');
-runpod2man('pod', $opts{man1dir}, $opts{man1ext}, 'pod2html');
-runpod2man('pod', $opts{man1dir}, $opts{man1ext}, 'pod2text');
-runpod2man('pod', $opts{man1dir}, $opts{man1ext}, 'pod2usage');
-runpod2man('pod', $opts{man1dir}, $opts{man1ext}, 'podchecker');
-runpod2man('pod', $opts{man1dir}, $opts{man1ext}, 'podselect');
-
-# It would probably be better to have this page linked
-# to the c2ph man page. Or, this one could say ".so man1/c2ph.1",
-# but then it would have to pay attention to $opts{man1dir} and $opts{man1ext}.
-runpod2man('utils', $opts{man1dir}, $opts{man1ext}, 'pstruct');
-
-runpod2man('lib/ExtUtils', $opts{man1dir}, $opts{man1ext}, 'xsubpp');
+open UTILS, "utils.lst" or die "Can't open 'utils.lst': $!";
+while (<UTILS>) {
+ next if /^#/;
+ chomp;
+ $_ = $1 if /#.*pod\s*=\s*(\S+)/;
+ my ($where, $what) = m|^(.*?)/(\S+)|;
+ runpod2man($where, $opts{man1dir}, $opts{man1ext}, $what);
+ if (($where, $what) = m|#.*link\s*=\s*(\S+)/(\S+)|) {
+ runpod2man($where, $opts{man1dir}, $opts{man1ext}, $what);
+ }
+}
sub runpod2man {
- # $script is script name if we are installing a manpage embedded
- # in a script, undef otherwise
- my($poddir, $mandir, $manext, $script) = @_;
+ # @script is scripts names if we are installing manpages embedded
+ # in scripts, () otherwise
+ my($poddir, $mandir, $manext, @script) = @_;
my($downdir); # can't just use .. when installing xsubpp manpage
my($builddir) = Cwd::getcwd();
if ($mandir eq ' ' or $mandir eq '') {
- warn "Skipping installation of ",
- ($script ? "$poddir/$script man page" : "$poddir man pages"), ".\n";
+ if (@script) {
+ warn "Skipping installation of $poddir/$_ man page.\n"
+ foreach @script;
+ } else {
+ warn "Skipping installation of $poddir man pages.\n";
+ }
return;
}
# installed by occult means.)
my $pod2man = "$downdir/perl -I $downdir/lib $downdir/pod/pod2man --section=$manext --official";
- mkpath($mandir, 1, 0777) unless $opts{notify}; # In File::Path
+ mkpath($mandir, $opts{verbose}, 0777) unless $opts{notify}; # In File::Path
# Make a list of all the .pm and .pod files in the directory. We will
# always run pod2man from the lib directory and feed it the full pathname
# of the pod. This might be useful for pod2man someday.
- if ($script) {
- @modpods = ($script);
+ if (@script) {
+ @modpods = @script;
}
else {
@modpods = ();
File::Find::find(\&lsmodpods, '.');
}
+ my @to_process;
foreach my $mod (@modpods) {
my $manpage = $mod;
my $tmp;
}
$tmp = "${mandir}/${manpage}.tmp";
$manpage = "${mandir}/${manpage}.${manext}";
- if (&cmd("$pod2man $mod > $tmp") == 0 && !$opts{notify} && -s $tmp) {
- if (rename($tmp, $manpage)) {
- $packlist->{$manpage} = { type => 'file' };
- next;
+ push @to_process, [$mod, $tmp, $manpage];
+ }
+ # Don't do all pods in same command to avoid busting command line limits
+ while (my @this_batch = splice @to_process, 0, $opts{batchlimit}) {
+ my $cmd = join " ", $pod2man, map "$$_[0] $$_[1]", @this_batch;
+ if (&cmd($cmd) == 0 && !$opts{notify}) {
+ foreach (@this_batch) {
+ my (undef, $tmp, $manpage) = @$_;
+ if (-s $tmp) {
+ if (rename($tmp, $manpage)) {
+ $packlist->{$manpage} = { type => 'file' };
+ next;
+ }
+ }
+ unless ($opts{notify}) {
+ unlink($tmp);
+ }
}
}
- unless ($opts{notify}) {
- unlink($tmp);
- }
}
chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n";
print " chdir $builddir\n" if $opts{verbose};