-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');
-
-sub runpod2man {
- # $script is script name if we are installing a manpage embedded
- # in a script, undef otherwise
- my($poddir, $mandir, $manext, $script) = @_;
-
- my($downdir); # can't just use .. when installing xsubpp manpage
-
- $downdir = $poddir;
- $downdir =~ s:[^/]+:..:g;
- my($builddir) = Cwd::getcwd();
+my $has_man1dir = $opts{man1dir} ne '' && -d $opts{man1dir};
+my $fh = open_or_die('utils.lst');
+while (<$fh>) {
+ next if /^#/;
+ chomp;
+ my ($path, $leaf) = m|^(\S*/(\S+))|;
+ # Have we already installed the manpage for this? (eg perldoc, a2p)
+ next if $man1{$leaf};
+ pod2man({$leaf, $path}, $opts{man1dir}, $opts{man1ext});
+ if ($has_man1dir) {
+ if (my ($link) = m|#.*link\s*=\s*\S+/(\S+)|) {
+ my $old = "$opts{man1dir}/$leaf.$opts{man1ext}";
+ my $new = "$opts{man1dir}/$link.$opts{man1ext}";
+ unlink($new);
+ link($old, $new);
+ $old =~ s/^\Q$opts{destdir}\E// if $opts{destdir};
+ $new =~ s/^\Q$opts{destdir}\E// if $opts{destdir};
+ $packlist->{$new} = { from => $old, type => 'link' };
+ }
+ }
+}
+close $fh or my_die("close 'utils.lst': $!");