2 BEGIN { @INC = ('lib') }
11 $release = substr($ver,0,3); # Not used presently.
12 $patchlevel = substr($ver,3,2);
13 die "Patchlevel of perl ($patchlevel)",
14 "and patchlevel of config.sh ($Config{'PATCHLEVEL'}) don't match\n"
15 if $patchlevel != $Config{'PATCHLEVEL'};
18 "Usage: installman --man1dir=/usr/wherever --man1ext=1
19 --man3dir=/usr/wherever --man3ext=3
22 man1dir = $Config{'installman1dir'};
23 man1ext = $Config{'man1ext'};
24 man3dir = $Config{'installman3dir'};
25 man3ext = $Config{'man3ext'};
26 --notify (or -n) just lists commands that would be executed.\n";
28 GetOptions( qw( man1dir=s man1ext=s man3dir=s man3ext=s notify help))
31 # These are written funny to avoid -w typo warnings.
32 $man1dir = defined($opt_man1dir) ? $opt_man1dir : $Config{'installman1dir'};
33 $man1ext = defined($opt_man1ext) ? $opt_man1ext : $Config{'man1ext'};
34 $man3dir = defined($opt_man3dir) ? $opt_man3dir : $Config{'installman3dir'};
35 $man3ext = defined($opt_man3ext) ? $opt_man3ext : $Config{'man3ext'};
37 $notify = defined($opt_notify) ? $opt_notify : 0;
41 -x "./perl" || warn "./perl not found! Have you run make?\n";
42 -d $Config{'installprivlib'}
43 || warn "Perl library directory $Config{'installprivlib'} not found.
44 Have you run make install?. (Installing anyway.)\n";
45 -x 't/TEST' || warn "WARNING: You've never run 'make test'!!!",
46 " (Installing anyway.)\n";
48 # Install the main pod pages.
49 runpod2man('pod', $man1dir, $man1ext);
51 # Install the pods for library modules.
52 runpod2man('lib', $man3dir, $man3ext);
55 my($poddir, $mandir, $manext) = @_;
56 my($builddir) = Cwd::getcwd();
58 if ($mandir eq ' ' or $mandir eq '') {
59 print STDERR "Skipping installation of $poddir man pages.\n";
63 chdir $poddir || die "Unable to cd to $poddir directory!\n$!\n";
65 # We insist on using the current version of pod2man in case there
66 # are enhancements or changes from previous installed versions.
67 $pod2man = "../pod/pod2man";
68 -x $pod2man || die "Executable $pod2man not found.\n";
71 # Make a list of all the .pm and .pod files in the directory. We will
72 # always run pod2man from the lib directory and feed it the full pathname
73 # of the pod. This might be useful for pod2man someday.
75 find(\&lsmodpods, '.');
76 foreach $mod (@modpods) {
78 # Convert name from File/Basename.pm to File::Basename.3 format,
80 $manpage =~ s#\.p(m|od)$##;
82 $manpage = "${mandir}/${manpage}.${manext}";
83 # Print $release $patchlevel stuff? or should pod2man do that?
84 &cmd("$pod2man $mod > $manpage");
86 chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n";
90 my $dir = $File::Find::dir;
91 my $name = $File::Find::name;
94 push(@modpods, $name) if ($name =~ /\.p(m|od)$/);
98 print STDERR " Installation complete\n";
103 ###############################################################################
104 # Utility subroutines from installperl
108 print STDERR " $cmd\n";
111 warn "Command failed!!!\n" if $?;
116 local($from,$to) = @_;
118 print STDERR " ln $from $to\n";
119 link($from,$to) || warn "Couldn't link $from to $to: $!\n" unless $notify;
123 local($mode,$name) = @_;
125 printf STDERR " chmod %o %s\n", $mode, $name;
126 chmod($mode,$name) || warn sprintf("Couldn't chmod %o %s: $!\n",$mode,$name)
133 local($shortdir) = $dir;
135 $shortdir =~ s#(.*)/.*#$1#;
138 print STDERR " mkdir $dir\n";
139 mkdir($dir, 0777) || warn "Couldn't create $dir: $!\n" unless $notify;
144 local($p1, $p2) = @_;
145 local($dev1, $ino1, $dev2, $ino2);
148 ($dev1, $ino1) = stat($p1);
149 ($dev2, $ino2) = stat($p2);
150 ($dev1 == $dev2 && $ino1 == $ino2);