1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#!/usr/bin/perl
#
# Hacked version of installman that just prints out dependencies for
# Makefile.bsd-wrapper. When upgrading to a new version of perl,
# look at the runpod2man() calls in installman and duplicate here.
#
use Getopt::Long;
use File::Find;
require Cwd;
umask 022;
$usage =
"Usage: gen_openbsd_mandep --man1ext=cat1 --man3ext=cat3p
Defaults are:
man1ext = cat1
man3ext = cat3p
";
GetOptions( qw( man1ext=s man3ext=s help) ) || die $usage;
die $usage if $opt_help;
# These are written funny to avoid -w typo warnings.
$man1ext = defined($opt_man1ext) ? $opt_man1ext : 'cat1';
$man3ext = defined($opt_man3ext) ? $opt_man3ext : 'cat3p';
print "# Dependecies generated by the ``gen_openbsd_mandep'' script\n";
# Convert the main pod pages.
runpod2man('pod', $man1ext);
# Convert the pods for library modules.
runpod2man('lib', $man3ext);
# Convert the pods embedded in the installed scripts
runpod2man('utils', $man1ext, 'c2ph');
runpod2man('utils', $man1ext, 'h2ph');
runpod2man('utils', $man1ext, 'h2xs');
runpod2man('utils', $man1ext, 'perldoc');
runpod2man('utils', $man1ext, 'perlbug');
runpod2man('utils', $man1ext, 'pl2pm');
runpod2man('utils', $man1ext, 'splain');
runpod2man('x2p', $man1ext, 's2p');
runpod2man('x2p', $man1ext, 'a2p.pod');
runpod2man('pod', $man1ext, 'pod2man');
runpod2man('pod', $man1ext, 'pod2html');
runpod2man('lib/ExtUtils', $man1ext, 'xsubpp');
# Man links
print "
MLINKS= c2ph.1 pstruct.1
";
# Print MANALL decl
$manall_lines[0] =~ s/^/MANALL=/;
foreach (@manall_lines) {
print $_;
}
print "$manall_line\n" if defined($manall_line);
sub runpod2man {
# $script is script name if we are installing a manpage embedded
# in a script, undef otherwise
my($poddir, $manext, $script) = @_;
my($downdir); # can't just use .. when installing xsubpp manpage
$downdir = $poddir;
$downdir =~ s:[^/]+:..:g;
my($builddir) = Cwd::getcwd();
chdir $poddir || die "Unable to cd to $poddir directory!\n$!\n";
# Use 1, not cat1 as section
$manext =~ /^(cat)?(.*)$/;
$pod2man = "\${POD2MAN} --section=$2 --official";
# Make a list of all the .pm and .pod files in the directory.
if ($script) {
@modpods = ($script);
} else {
@modpods = ();
find(\&lsmodpods, '.');
}
foreach $mod (@modpods) {
$manpage = $mod;
my $tmp;
# Skip .pm files that have corresponding .pod files, and Functions.pm.
next if (($tmp = $mod) =~ s/\.pm$/.pod/ && -f $tmp);
next if ($mod eq 'Pod/Functions.pm'); #### Used only by pod itself
# Convert name from File/Basename.pm to File::Basename.3 format,
# if necessary.
$manpage =~ s#\.p(m|od)$##;
if ($^O eq 'os2' || $^O eq 'amigaos' || $^O eq 'uwin') {
$manpage =~ s#/#.#g;
} else {
$manpage =~ s#/#::#g;
}
$manpage .= ".${manext}";
# Print out the dependency
print "$manpage: $poddir/$mod\n\t$pod2man", ' ${.ALLSRC} | ${NROFF} -man > ${.TARGET}', "\n";
# Store for MANALL decl later on
if (length($manall_line) + length($manpage) > 69) {
push(@manall_lines, "$manall_line \\\n");
undef($manall_line);
}
if (defined($manall_line)) {
$manall_line .= " $manpage";
} else {
$manall_line = "\t$manpage";
}
}
chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n";
}
sub lsmodpods {
my $dir = $File::Find::dir;
my $name = $File::Find::name;
if (-f $_) {
$name =~ s#^\./##;
push(@modpods, $name) if ($name =~ /\.p(m|od)$/);
}
}
exit 0;
|